From: Ash Tyndall Date: Sat, 8 Oct 2011 05:22:49 +0000 (+0800) Subject: (no commit message) X-Git-Url: https://git.ucc.asn.au/?p=atyndall%2Fcits2231.git;a=commitdiff_plain;h=3d89d50018205ce3262ee69d780ed0d5e07ecd78 --- diff --git a/scene.c b/scene.c index 19df5d3..df115d1 100644 --- a/scene.c +++ b/scene.c @@ -167,6 +167,31 @@ void getTexture(int i) { // getTexture(i) loads texture i if it isn't already lo glBindTexture(GL_TEXTURE_2D, 0); // Back to default texture } +// Menu enum +enum menu { + // Main menu + ROTATE_MOVE_CAMERA, + POSITION_SCALE, + ROTATION_TEXTURE_SCALE, + EXIT, + + // Material submenu + MATERIAL_ALL_RGB, + MATERIAL_AMBIENT_RGB, + MATERIAL_DIFFUSE_RGB, + MATERIAL_SPECULAR_RGB, + MATERIAL_ALL_ADSS, + MATERIAL_RED_ADSS, + MATERIAL_GREEN_ADSS, + MATERIAL_BLUE_ADSS, + + // Light submenu + LIGHT_MOVE_LIGHT_1, + LIGHT_RGBALL_LIGHT_1, + LIGHT_MOVE_LIGHT_2, + LIGHT_RGBALL_LIGHT_2 +}; + // Menu arrays const char *textureMenuEntries[NTEXTURE] = { "1 Plain", "2 Rust", "3 Concrete", "4 Carpet", "5 Beach Sand", @@ -197,7 +222,11 @@ const char *materialMenuEntries[8] = { }; void processMainEvents(int id) { - if(id == 99) exit(0); + switch (id) { + case EXIT: + exit(0); + + } } void processObjectEvents(int id) { @@ -220,53 +249,24 @@ void processLightEvents(int id) { } -void makeMenu() { - //int main, object, objectsize, material, texture, gtexture, light; - - glutCreateMenu(processMainEvents); - - - /*int objectSize = sizeof(objectMenuEntries) / sizeof(objectMenuEntries[0]); - int numMenus = objectSize/10 + 1; - int objectSubmenu[numMenus]; - - for( int i = 0; objectSubmenu[i]; i++ ) { - objectSubmenu[i] = 0; - } - // Create the n-(n+10) menus - for ( int i = 0; i < numMenus; i++ ) { - objectSubmenu[i] = glutCreateMenu(processObjectEvents); - - for ( int j = 0; j < (i + 1) * 10; j++ ) { - - if ( objectMenuEntries[j] ) { - glutAddMenuEntry( objectMenuEntries[j], j + 1 ); - } else { - break; - } - - } - - } +void makeMenu() { + glutCreateMenu(processMainEvents); - // Create the overmenu*/ - //int objectMenu = glutCreateMenu(processObjectEvents); - /*for ( int i = 0; objectSubmenu[i]; i++ ) { - char name[10]; - sprintf(name,"%d",(i + 1) * 10); - glutAddSubMenu( name, objectSubmenu[i] ); - }*/ + glutAddMenuEntry("Rotate/Move Camera", ROTATE_MOVE_CAMERA); + //Add object + glutAddMenuEntry("Position/Scale", POSITION_SCALE); + glutAddMenuEntry("Rotation/Texture Scale", ROTATION_TEXTURE_SCALE); + //material + //texture + //ground texture + //lights - //glutAddSubMenu("Objects", objectMenu); - glutAddMenuEntry("Exit", 99); - - + glutAddMenuEntry("Exit", EXIT); glutAttachMenu(GLUT_RIGHT_BUTTON); - }