X-Git-Url: https://git.ucc.asn.au/?p=atyndall%2Fcits2231.git;a=blobdiff_plain;f=scene.c;h=6be6503f6ed5105da1583c8e0a72878276938e3f;hp=705c2d1277c4b7d045a46c9c40a9879590e97523;hb=3907265dfa666c2490c4d7299a9610e5c506ccb1;hpb=b43c5e3029d160c9e82f410dfbabbb32068fc57d diff --git a/scene.c b/scene.c index 705c2d1..6be6503 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,1); glLightfv(GL_LIGHT1, GL_AMBIENT, ambient1); glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuse1); @@ -408,15 +415,16 @@ void init() { glLightfv(GL_LIGHT1, GL_SPOT_DIRECTION, direction1); glLightf(GL_LIGHT1, GL_SPOT_CUTOFF, 90.0); + glLightf(GL_LIGHT1, GL_SPOT_EXPONENT,1); 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);