Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Goers <mega@osirion.org>2012-01-14 11:08:12 +0000
committerEvan Goers <mega@osirion.org>2012-01-14 11:08:12 +0000
commitc508960e040e49a7c3c2d91b234bc46ac9a1f8b3 (patch)
tree63a0ff53dd496a92d0a6877cd00cb64456f92bc6 /src/render/state.cc
parent4354cdabdb618dba09155d0fcdff1e9af44bf50c (diff)
Enabled separate specular.
Diffstat (limited to 'src/render/state.cc')
-rw-r--r--src/render/state.cc28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/render/state.cc b/src/render/state.cc
index a6a65ba..09e1a59 100644
--- a/src/render/state.cc
+++ b/src/render/state.cc
@@ -138,15 +138,11 @@ void State::clear()
// lighting model
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
+ glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
// color tracking
glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
- // material settings
- GLfloat specular_reflectance[] = { 1.0f, 1.0f, 1.0f, 1.0f };
- glMaterialfv(GL_FRONT, GL_SPECULAR, specular_reflectance);
- glMateriali(GL_FRONT, GL_SHININESS, 8); // shininess 1-128
-
// alpha blending function
gl::blendfunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -213,6 +209,10 @@ void State::use_material(const model::Material * material) {
math::Color color;
reset();
+
+ // material settings
+ glMateriali(GL_FRONT, GL_SHININESS, 8);
+ GLfloat specular_reflectance[3];
if (!material) {
color.assign(1.0f, 0.0f, 1.0f);
@@ -267,7 +267,6 @@ void State::use_material(const model::Material * material) {
gl::enable(GL_TEXTURE_2D);
if (material->flags() & model::Material::Environment) {
-
gl::texgeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
gl::texgeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
@@ -278,7 +277,6 @@ void State::use_material(const model::Material * material) {
} else {
// envmapped without texture: use the skybox as envmap
if (material->flags() & model::Material::Environment) {
-
if (core::localplayer()->zone()->sky().size()) {
gl::enable(GL_TEXTURE_CUBE_MAP);
@@ -292,9 +290,23 @@ void State::use_material(const model::Material * material) {
} else {
color.assign(0.0f, 0.0f, 0.0f);
}
+ specular_reflectance[0] = 1.0f;
+ specular_reflectance[1] = 1.0f;
+ specular_reflectance[2] = 1.0f;
+
+ glMateriali(GL_FRONT, GL_SHININESS, 4);
+ glMaterialfv(GL_FRONT, GL_SPECULAR, specular_reflectance);
+
+ gl::color(color);
+ return;
}
}
-
+
+ specular_reflectance[0] = color.r;
+ specular_reflectance[1] = color.g;
+ specular_reflectance[2] = color.b;
+
+ glMaterialfv(GL_FRONT, GL_SPECULAR, specular_reflectance);
gl::color(color);
}