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>2014-09-21 03:30:48 +0000
committerEvan Goers <mega@osirion.org>2014-09-21 03:30:48 +0000
commit7550a2e19516d7924bcd89356f3f1b0402180e2f (patch)
tree9554b0e74737d431640521c47aba68c2e26c98a6 /src/render
parent62a0cbd0f2f9b59d078d3feecf1296c7066163a8 (diff)
Added shininess setting for shaders.
Diffstat (limited to 'src/render')
-rw-r--r--src/render/gl.cc5
-rw-r--r--src/render/gl.h3
-rw-r--r--src/render/state.cc8
3 files changed, 11 insertions, 5 deletions
diff --git a/src/render/gl.cc b/src/render/gl.cc
index 932fe34..7b05da7 100644
--- a/src/render/gl.cc
+++ b/src/render/gl.cc
@@ -270,6 +270,11 @@ void specular(Color const & specular)
glMaterialfv(GL_FRONT, GL_SPECULAR, specular.ptr());
}
+void shininess(Color const & shine)
+{
+ glMaterialfv(GL_FRONT, GL_SHININESS, shine.ptr());
+}
+
void matrixmode(GLenum mode)
{
glMatrixMode(mode);
diff --git a/src/render/gl.h b/src/render/gl.h
index c5da4db..cf9e89d 100644
--- a/src/render/gl.h
+++ b/src/render/gl.h
@@ -257,6 +257,9 @@ void color(const float r, const float g, const float b, const float a = 1.0f);
/// specify the specular reflectivity color
void specular(math::Color const & specular);
+/// specify the shininess
+void shininess(math::Color const & shine);
+
/// Push the current transformation matrix to the stack
void push();
diff --git a/src/render/state.cc b/src/render/state.cc
index 6f791b3..8ada29c 100644
--- a/src/render/state.cc
+++ b/src/render/state.cc
@@ -234,7 +234,8 @@ void State::use_material_layer(const model::Material * material, const model::La
}
math::Color color(layer->color());
- math::Color specular(layer->color());
+ math::Color specular(layer->specular());
+ math::Color shine(layer->shininess());
// apply color generation rules
switch (layer->rgbgen()) {
@@ -283,6 +284,7 @@ void State::use_material_layer(const model::Material * material, const model::La
gl::color(color);
gl::specular(specular);
+ gl::shininess(shine);
// lighted or fullbright
if (state_power && layer->fullbright()) {
@@ -328,7 +330,6 @@ void State::use_material_layer(const model::Material * material, const model::La
} else {
color.assign(0.0f, 0.0f, 0.0f);
}
- gl::material(GL_FRONT, GL_SHININESS, 4);
}
@@ -361,9 +362,6 @@ void State::reset()
gl::disable(GL_TEXTURE_CUBE_MAP);
gl::disable(GL_TEXTURE_2D);
- // default specular shininess setting
- gl::material(GL_FRONT, GL_SHININESS, 8);
-
gl::color(math::Color(1.0f));
gl::specular(math::Color(0.0f));
}