Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-03-05 18:21:39 +0000
committerStijn Buys <ingar@osirion.org>2008-03-05 18:21:39 +0000
commit4f6b27b58bfae9ce860a005edf890d8f1136a85f (patch)
treea3b4f7b108173d8cba0df0c66768d0a9ebf61047 /src/render/model.cc
parentc326c5d31e710cd22f4d5047252da2bfc77da1f1 (diff)
OpenGL lighting
Diffstat (limited to 'src/render/model.cc')
-rw-r--r--src/render/model.cc17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/render/model.cc b/src/render/model.cc
index 70b5f18..848bc49 100644
--- a/src/render/model.cc
+++ b/src/render/model.cc
@@ -414,9 +414,7 @@ void Model::make_face(math::Plane3f *face, std::vector<math::Plane3f *> & planes
color = 0;
}
- Vector3f n = face->normal();
- n.normalize();
- Face *mf = new Face(n, color);
+ Face *mf = new Face(face->normal()*-1, color);
if (color) delete color;
for (std::vector<Vector3f *>::iterator it = vl.begin(); it != vl.end(); it++) {
@@ -459,16 +457,16 @@ void Model::draw(core::Entity const * entity, math::Vector3f const & eye)
for (std::list<Face *>::iterator fit = model_face.begin(); fit != model_face.end(); fit++) {
// poor man's lighting
// set the face color depending on the viewing direction
- float d = fabsf(math::dotproduct(n, (*fit)->normal()));
+ //float d = fabsf(math::dotproduct(n, (*fit)->normal()));
- if (d > 1)
- d = 1;
- d = 0.5f + d/2;
+ //if (d > 1)
+ // d = 1;
+ //d = 0.5f + d/2;
if ((*fit)->color()) {
- render::gl::color(*(*fit)->color() * d);
+ render::gl::color(*(*fit)->color());
} else {
- render::gl::color(entity->color() * d);
+ render::gl::color(entity->color());
}
(*fit)->draw();
}
@@ -482,7 +480,6 @@ void Model::draw(core::EntityControlable const * entity, math::Vector3f const &
// draw engines
// all engines are assumed to point to the rear
if (model_engine.size() && entity->thrust()) {
-
gl::color(1.0f,0 ,0);
gl::begin(gl::Lines);