X-Git-Url: https://git.ucc.asn.au/?p=atyndall%2Fcits2231.git;a=blobdiff_plain;f=scene.c;h=f3c4d2c8e0388c9e9dd562310be07de9ad104b6c;hp=7afde9cd41ca880037b945980ede82e8eef951d6;hb=55097a45c4add91cd839f9d86d2255f2de5a9ab0;hpb=f8f4c489085c83bc31276148991166165085b557 diff --git a/scene.c b/scene.c index 7afde9c..f3c4d2c 100644 --- a/scene.c +++ b/scene.c @@ -137,9 +137,10 @@ int floorSize = 100; /* Light 0 parameters */ GLfloat diffuse0[] = {1.0, 1.0, 1.0, 1.0}; -GLfloat ambient0[] = {1.0, 1.0, 1.0, 1.0}; +GLfloat ambient0[] = {0.0, 0.0, 0.0, 1.0}; GLfloat specular0[] = {1.0, 1.0, 1.0, 1.0}; -GLfloat light0_pos[] ={ 1.0, 2.0, 3,0, 1.0}; +GLfloat emission0[] = {0.0, 0.0, 0.0, 1.0}; +GLfloat light0_pos[] ={ 1.0, 1.0, 0,0, 1.0}; /** @@ -607,6 +608,25 @@ void drawFloor() { drawSquare(0, -floorSize, -floorSize, floorSize, floorSize); } +/** + * Draw x, z axis on floor + */ +void drawLine() { + // **NOTE: fix function + glDisable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glColor4ub( 0.0, 0.0, 0.0, 0.5 ); + + glBegin(GL_LINES); + glVertex3i( 10.0, 0.1, 10.0); + glVertex3i( -10.0, 0.1, -10.0); + glEnd(); + + glDisable(GL_BLEND); + glEnable(GL_TEXTURE_2D); +} + /** * Display function */ @@ -619,6 +639,7 @@ void display() { 0.0, 1.0, 0.0 /* up is in postivie Y direction */ ); + // **NOTE: Currently this rotation function is all that moves the camera off // the flat surface. Need to integrate function into gluLookAt glRotatef(30.0, 1.0, 0.0, 0.0); @@ -639,6 +660,8 @@ void display() { drawFloor(); + drawLine(); + // Draw teapot for a test object glPushMatrix(); glTranslatef(0.0, 1.0, 0.0); // **NOTE: Teapot does not rest on surface @@ -678,6 +701,11 @@ void init() { glLightfv(GL_LIGHT0, GL_AMBIENT, ambient0); glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse0); glLightfv(GL_LIGHT0, GL_SPECULAR, specular0); + glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE ); + glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, specular0); + glMaterialfv( GL_FRONT_AND_BACK, GL_EMISSION, emission0); + glEnable(GL_COLOR_MATERIAL); + glEnable(GL_LIGHTING); glMatrixMode(GL_MODELVIEW);