From 4f6b27b58bfae9ce860a005edf890d8f1136a85f Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 5 Mar 2008 18:21:39 +0000 Subject: OpenGL lighting --- src/render/model.cc | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/render/model.cc') 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 & 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::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::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); -- cgit v1.2.3