Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/render')
-rw-r--r--src/render/draw.cc3
-rw-r--r--src/render/state.cc28
2 files changed, 23 insertions, 8 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc
index 04c839b..f60ba1a 100644
--- a/src/render/draw.cc
+++ b/src/render/draw.cc
@@ -258,6 +258,9 @@ void draw_globe(const core::EntityGlobe* globe)
math::Vector3f location(globe->location());
float radius = globe->radius();
+ GLfloat globe_specular[] = { 0.25f, 0.25f, 0.25f, 1.0f };
+ glMaterialfv(GL_FRONT, GL_SPECULAR, globe_specular);
+
if (globe->flag_is_set(core::Entity::Bright)) {
// bright globe, render fullbright
gl::disable(GL_LIGHTING);
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);
}