Merge pull request #831 from ey6es/master

Disable specular highlights for ground and voxels.
This commit is contained in:
Andrzej Kapolka 2013-08-08 11:03:30 -07:00
commit 4279d508b7

View file

@ -2929,6 +2929,9 @@ void Application::displayOculus(Camera& whichCamera) {
glPopMatrix();
}
const GLfloat WHITE_SPECULAR_COLOR[] = { 1.0f, 1.0f, 1.0f, 1.0f };
const GLfloat NO_SPECULAR_COLOR[] = { 0.0f, 0.0f, 0.0f, 1.0f };
void Application::setupWorldLight(Camera& whichCamera) {
// Setup 3D lights (after the camera transform, so that they are positioned in world space)
@ -2943,10 +2946,9 @@ void Application::setupWorldLight(Camera& whichCamera) {
glLightfv(GL_LIGHT0, GL_AMBIENT, ambient_color);
GLfloat diffuse_color[] = { 0.8, 0.7, 0.7 };
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse_color);
GLfloat specular_color[] = { 1.0, 1.0, 1.0, 1.0};
glLightfv(GL_LIGHT0, GL_SPECULAR, specular_color);
glMaterialfv(GL_FRONT, GL_SPECULAR, specular_color);
glLightfv(GL_LIGHT0, GL_SPECULAR, WHITE_SPECULAR_COLOR);
glMaterialfv(GL_FRONT, GL_SPECULAR, WHITE_SPECULAR_COLOR);
glMateriali(GL_FRONT, GL_SHININESS, 96);
}
@ -3024,6 +3026,9 @@ void Application::displaySide(Camera& whichCamera) {
glutSolidSphere(sphereRadius, 15, 15);
glPopMatrix();
// disable specular lighting for ground and voxels
glMaterialfv(GL_FRONT, GL_SPECULAR, NO_SPECULAR_COLOR);
//draw a grid ground plane....
if (_renderGroundPlaneOn->isChecked()) {
// draw grass plane with fog
@ -3052,6 +3057,9 @@ void Application::displaySide(Camera& whichCamera) {
_voxels.render(_renderVoxelTextures->isChecked());
}
// restore default, white specular
glMaterialfv(GL_FRONT, GL_SPECULAR, WHITE_SPECULAR_COLOR);
// indicate what we'll be adding/removing in mouse mode, if anything
if (_mouseVoxel.s != 0) {
glDisable(GL_LIGHTING);