(no commit message)
authorAsh Tyndall <[email protected]>
Sat, 8 Oct 2011 05:36:48 +0000 (13:36 +0800)
committerAsh Tyndall <[email protected]>
Sat, 8 Oct 2011 05:36:48 +0000 (13:36 +0800)
scene.c

diff --git a/scene.c b/scene.c
index 18cb9fb..2a5ab65 100644 (file)
--- a/scene.c
+++ b/scene.c
@@ -249,14 +249,7 @@ void processLightEvents(int id) {
 \r
 \r
 void makeMenu() {\r
-  int mainMenu = glutCreateMenu(processMainEvents);\r
-\r
-  glutAddMenuEntry("Rotate/Move Camera", ROTATE_MOVE_CAMERA);\r
-  //Add object\r
-  glutAddMenuEntry("Position/Scale", POSITION_SCALE);\r
-  glutAddMenuEntry("Rotation/Texture Scale", ROTATION_TEXTURE_SCALE);\r
-  //material\r
-  \r
+  // Construct material menu\r
   int materialMenu = glutCreateMenu(processMaterialEvents);\r
   glutAddMenuEntry("All R/G/B", MATERIAL_ALL_RGB);\r
   glutAddMenuEntry("Ambient R/G/B", MATERIAL_AMBIENT_RGB);\r
@@ -267,6 +260,41 @@ void makeMenu() {
   glutAddMenuEntry("Green Amb/Diff/Spec/Shine", MATERIAL_GREEN_ADSS);\r
   glutAddMenuEntry("Blue Amb/Diff/Spec/Shine", MATERIAL_BLUE_ADSS);\r
 \r
+  // Construct light menu\r
+  int lightMenu = glutCreateMenu(processLightEvents);\r
+  glutAddMenuEntry("Move Light 1", LIGHT_MOVE_LIGHT_1);\r
+  glutAddMenuEntry("R/G/B/All Light 1", LIGHT_RGBALL_LIGHT_1);\r
+  glutAddMenuEntry("Move Light 2", LIGHT_MOVE_LIGHT_2);\r
+  glutAddMenuEntry("R/G/B/All Light 2", LIGHT_RGBALL_LIGHT_2);\r
+\r
+  // Construct add object submenus\r
+  int addObjectSubmenu[6];\r
+\r
+  for( int i = 0; i < 6; i++ ) {\r
+    addObjectSubmenu[i] = glutCreateMenu(processObjectEvents);\r
+    for ( int j = i; j < (i+9); j++ ) {\r
+      glutAddMenuEntry( objectMenuEntries[j], j );\r
+    }\r
+  }\r
+\r
+  // Construct add object menu\r
+  int addObjectMenu = glutCreateMenu(processObjectEvents);\r
+  for ( int i = 0; addObjectSubmenu[i]; i++ ) {\r
+    char * name = { (char)i };\r
+    glutAddSubMenu( name, addObjectSubmenu[i] );\r
+  }\r
+\r
+\r
+  int mainMenu = glutCreateMenu(processMainEvents);\r
+\r
+  glutAddMenuEntry("Rotate/Move Camera", ROTATE_MOVE_CAMERA);\r
+  //Add object\r
+  glutAddMenuEntry("Position/Scale", POSITION_SCALE);\r
+  glutAddMenuEntry("Rotation/Texture Scale", ROTATION_TEXTURE_SCALE);\r
+  //material\r
+  \r
+  \r
+\r
   glutSetMenu(mainMenu);\r
   glutAddSubMenu("Material", materialMenu);\r
   \r
@@ -280,22 +308,6 @@ void makeMenu() {
   glutAttachMenu(GLUT_RIGHT_BUTTON);\r
 }\r
 \r
-    \r
-/*void createGLUTMenus() {\r
-\r
-       int menu,submenu;\r
-\r
-       submenu = glutCreateMenu(processMenuEvents);\r
-       glutAddMenuEntry("Red",RED);\r
-       glutAddMenuEntry("Blue",BLUE);\r
-       glutAddMenuEntry("Green",GREEN);\r
-\r
-       menu = glutCreateMenu(processMenuEvents);\r
-       glutAddMenuEntry("White",WHITE);\r
-       glutAddSubMenu("RGB Menu",submenu);\r
-       glutAttachMenu(GLUT_RIGHT_BUTTON);\r
-*/\r
-\r
 void display() {\r
    // You probably want to change both of the following.\r
    glClear(GL_COLOR_BUFFER_BIT);\r

UCC git Repository :: git.ucc.asn.au