\r
if ( buttonSelected == GLUT_LEFT_BUTTON ) {\r
// w: left/right, h: near/far\r
\r
if ( buttonSelected == GLUT_LEFT_BUTTON ) {\r
// w: left/right, h: near/far\r
-\r
- // **NOTE: Currently a work in progress\r
- printf("cam angle: %f\n", rotate*camRotateFactor);\r
- sceneObjs[curObject].x += diffx * sin(rotate*camRotateFactor);\r
- sceneObjs[curObject].z += diffx * cos(rotate*camRotateFactor);\r
+ float angler = 2 * M_PI * ( (rotate*camRotateFactor)/360.0 );\r
+ sceneObjs[curObject].x += diffx * cos(angler) * leftrightFactor + diffy * cos(M_PI/2 + angler) * nearfarFactor;\r
+ sceneObjs[curObject].z += diffx * sin(angler) * leftrightFactor + diffy * sin(M_PI/2 + angler) * nearfarFactor;\r
if ( buttonSelected == GLUT_LEFT_BUTTON ) {\r
// w: rotate on y\r
sceneObjs[curObject].rotation.y += diffx * rotateFactor;\r
if ( buttonSelected == GLUT_LEFT_BUTTON ) {\r
// w: rotate on y\r
sceneObjs[curObject].rotation.y += diffx * rotateFactor;\r
} else if ( buttonSelected == GLUT_MIDDLE_BUTTON ) {\r
// w: rotate on x\r
sceneObjs[curObject].rotation.x += diffx * rotateFactor;\r
} else if ( buttonSelected == GLUT_MIDDLE_BUTTON ) {\r
// w: rotate on x\r
sceneObjs[curObject].rotation.x += diffx * rotateFactor;\r
// h: texture scale\r
float max = (float)height/texscaleFactor;\r
float scaling = (diffy + max) / max;\r
sceneObjs[curObject].texture.scale *= scaling;\r
// h: texture scale\r
float max = (float)height/texscaleFactor;\r
float scaling = (diffy + max) / max;\r
sceneObjs[curObject].texture.scale *= scaling;\r
// Apply independant rotation vectors\r
glRotatef(so.rotation.x, 1.0, 0.0, 0.0);\r
glRotatef(so.rotation.y, 0.0, 1.0, 0.0);\r
// Apply independant rotation vectors\r
glRotatef(so.rotation.x, 1.0, 0.0, 0.0);\r
glRotatef(so.rotation.y, 0.0, 1.0, 0.0);\r
// Apply scaling vector\r
glScalef(so.scale[0], so.scale[1], so.scale[2]);\r
\r
// Apply scaling vector\r
glScalef(so.scale[0], so.scale[1], so.scale[2]);\r
\r
- glutInitWindowSize(500, 500);\r
- glutCreateWindow("Scene Editor");\r
+ glutInitWindowSize(width, height);\r
+ glutCreateWindow("Scene Editor - Ashley Tyndall (20915779), Jenna de la Harpe (20367932)");\r
\r
glShadeModel(GL_SMOOTH); // Enables Smooth Shading\r
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background\r
\r
glShadeModel(GL_SMOOTH); // Enables Smooth Shading\r
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background\r