X-Git-Url: https://git.ucc.asn.au/?p=atyndall%2Fcits2231.git;a=blobdiff_plain;f=scene.c;h=c4ceaa2a4627e7fe86be1cbe3967e7d1ba930fe8;hp=08e78d81501d20aafe064a67d2a45f2e54bd71e4;hb=ada64c83de7bda9dff5b36c37f83b77fcb56171d;hpb=80aa0d67bd33a06666cf2cdfddc17186c9d08adc diff --git a/scene.c b/scene.c index 08e78d8..c4ceaa2 100644 --- a/scene.c +++ b/scene.c @@ -339,12 +339,18 @@ void display() { lightPosition0[2] = 12*sin(lightAngle0); lightPosition0[3] = 0.0; + direction0[0] = lightPosition0[0]; + direction0[2] = lightPosition0[2]; + /* Reposition the light source 1. */ lightPosition1[0] = 12*cos(lightAngle1); lightPosition1[1] = lightHeight1; lightPosition1[2] = 12*sin(lightAngle1); lightPosition1[3] = 0.0; + direction1[0] = lightPosition1[0]; + direction1[2] = lightPosition1[2]; + glPushMatrix(); /* Perform scene rotations based on user mouse/keyboard input. */ @@ -401,6 +407,7 @@ void init() { glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, direction0); glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, 90.0); + glLightf(GL_LIGHT0, GL_SPOT_EXPONENT,120); glLightfv(GL_LIGHT1, GL_AMBIENT, ambient1); glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuse1); @@ -408,18 +415,19 @@ void init() { glLightfv(GL_LIGHT1, GL_SPOT_DIRECTION, direction1); glLightf(GL_LIGHT1, GL_SPOT_CUTOFF, 90.0); + glLightf(GL_LIGHT1, GL_SPOT_EXPONENT,120); glLightModelfv(GL_LIGHT_MODEL_AMBIENT, glightmodel); glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR); - glMaterialfv(GL_FRONT, GL_AMBIENT, ambient); - glMaterialfv(GL_FRONT, GL_DIFFUSE, diffuse); - glMaterialfv(GL_FRONT, GL_SPECULAR, specular); - glMaterialfv(GL_FRONT, GL_EMISSION, emission); - glMaterialf(GL_FRONT, GL_SHININESS, shine); + //glMaterialfv(GL_FRONT, GL_AMBIENT, ambient); + //glMaterialfv(GL_FRONT, GL_DIFFUSE, diffuse); + //glMaterialfv(GL_FRONT, GL_SPECULAR, specular); + //glMaterialfv(GL_FRONT, GL_EMISSION, emission); + //glMaterialf(GL_FRONT, GL_SHININESS, shine); glEnable(GL_LIGHT0); - //glEnable(GL_LIGHT1); + glEnable(GL_LIGHT1); glEnable(GL_LIGHTING); }