2011-10-19 01:10:15 +02:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <glut.h>
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "display.h"
|
|
|
|
#include "input.h"
|
|
|
|
|
2011-10-20 20:28:00 +02:00
|
|
|
float ledOnMaterial[] = {0.0, 0.0, 1.0, 1.0};
|
2011-10-23 21:43:54 +02:00
|
|
|
float ledOffMaterial[] = {0.1, 0.1, 0.1, 0.0};
|
|
|
|
|
2011-10-20 20:28:00 +02:00
|
|
|
float wireMaterial[] = {0.7, 0.7, 0.7, 1.0};
|
|
|
|
float innerWireMaterial[] = {0.2, 0.2, 0.2, 0.3};
|
|
|
|
|
2011-10-23 21:43:54 +02:00
|
|
|
float backgroundColor[] = {0.3, 0.3, 0.3, 0.4};
|
|
|
|
float light0Pos[] = {70, 70, 70, 0.0};
|
2011-10-19 01:10:15 +02:00
|
|
|
|
|
|
|
float lookX = 0.0, lookZ = 0.0;
|
2011-10-20 20:28:00 +02:00
|
|
|
float eyePos = 0.0, eyeAngle = 45.0;
|
|
|
|
|
|
|
|
GLUquadricObj *quadric;
|
|
|
|
|
|
|
|
extern void moveCameraPosition(float direction);
|
2011-10-19 01:10:15 +02:00
|
|
|
|
|
|
|
int main(int argc, char* argv[]) {
|
|
|
|
glutInit(&argc, argv);
|
|
|
|
|
|
|
|
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
|
|
|
glutInitWindowSize(WINDOW_WIDTH, WINDOW_HEIGHT);
|
|
|
|
glutCreateWindow("CTHN LEDCube Editor");
|
|
|
|
|
|
|
|
glutDisplayFunc(display);
|
|
|
|
glutKeyboardFunc(keyboard);
|
|
|
|
glutSpecialFunc(keyboard_special);
|
2011-10-30 23:55:53 +01:00
|
|
|
glutMouseFunc(mouse);
|
2011-10-19 01:10:15 +02:00
|
|
|
|
|
|
|
glClearColor(0.0, 0.0, 0.0, 1.0);
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
|
2011-10-23 21:43:54 +02:00
|
|
|
// Lighting
|
2011-10-19 01:10:15 +02:00
|
|
|
glEnable(GL_LIGHTING);
|
2011-10-20 20:28:00 +02:00
|
|
|
glEnable(GL_DEPTH_TEST);
|
|
|
|
|
2011-10-23 21:43:54 +02:00
|
|
|
glEnable(GL_LIGHT0);
|
|
|
|
glLightfv(GL_LIGHT0, GL_POSITION, light0Pos);
|
|
|
|
glLightfv(GL_LIGHT0, GL_AMBIENT, backgroundColor);
|
|
|
|
|
2011-10-19 01:10:15 +02:00
|
|
|
glMatrixMode(GL_MODELVIEW);
|
2011-10-20 20:28:00 +02:00
|
|
|
moveCameraPosition(0); // Init the Position
|
|
|
|
|
|
|
|
|
|
|
|
quadric = gluNewQuadric();
|
|
|
|
gluQuadricNormals(quadric, GLU_SMOOTH);
|
|
|
|
gluQuadricDrawStyle(quadric, GLU_FILL);
|
|
|
|
|
2011-10-19 01:10:15 +02:00
|
|
|
glutMainLoop();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|