From 80ad7e99b738f367eb045768d054cf74347ee1b4 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Mon, 24 Mar 2008 11:08:22 +0000 Subject: merged vertex and evertex arrays --- src/render/draw.cc | 45 +++++++++++++++++---------------------------- 1 file changed, 17 insertions(+), 28 deletions(-) (limited to 'src/render') diff --git a/src/render/draw.cc b/src/render/draw.cc index e904888..590cddd 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -146,12 +146,7 @@ void draw_model_evertex(core::Entity *entity) size_t count = entity->model()->evertex_count(); render::gl::color(entity->color()); - glVertexPointer(3, GL_FLOAT, 0, core::VertexArray::evertex); - glNormalPointer(GL_FLOAT, 0, core::VertexArray::evertex_normal); - - glEnableClientState(GL_VERTEX_ARRAY); - glEnableClientState(GL_NORMAL_ARRAY); - + if (r_drawwireframe && r_drawwireframe->value()) { glDrawArrays(gl::LineLoop, index, count); } else { @@ -316,14 +311,6 @@ void draw_pass_default() /* Draw model vertices*/ void draw_pass_model_vertex() { - glVertexPointer(3, GL_FLOAT, 0, core::VertexArray::vertex); - glNormalPointer(GL_FLOAT, 0, core::VertexArray::vertex_normal); - glColorPointer(3, GL_FLOAT, 0, core::VertexArray::vertex_color); - - glEnableClientState(GL_VERTEX_ARRAY); - glEnableClientState(GL_NORMAL_ARRAY); - glEnableClientState(GL_COLOR_ARRAY); - std::map::iterator it; for (it=core::Entity::registry.begin(); it != core::Entity::registry.end(); it++) { @@ -339,21 +326,11 @@ void draw_pass_model_vertex() gl::pop(); } } - - glDisableClientState(GL_VERTEX_ARRAY); - glDisableClientState(GL_NORMAL_ARRAY); - glDisableClientState(GL_COLOR_ARRAY); } /* Draw entites with model evertices */ void draw_pass_model_evertex() { - glVertexPointer(3, GL_FLOAT, 0, core::VertexArray::evertex); - glNormalPointer(GL_FLOAT, 0, core::VertexArray::evertex_normal); - - glEnableClientState(GL_VERTEX_ARRAY); - glEnableClientState(GL_NORMAL_ARRAY); - std::map::iterator it; for (it=core::Entity::registry.begin(); it != core::Entity::registry.end(); it++) { @@ -369,9 +346,6 @@ void draw_pass_model_evertex() gl::pop(); } } - - glDisableClientState(GL_VERTEX_ARRAY); - glDisableClientState(GL_NORMAL_ARRAY); } /* Draw model lights, engines */ @@ -476,9 +450,24 @@ void draw(math::Vector3f const &eye, math::Vector3f const &target, float seconds gl::disable(GL_BLEND); // disbable alpha blending for world polys draw_pass_default(); // draw entities without model + + glVertexPointer(3, GL_FLOAT, 0, core::VertexArray::vertex); + glNormalPointer(GL_FLOAT, 0, core::VertexArray::vertex_normal); + glColorPointer(3, GL_FLOAT, 0, core::VertexArray::vertex_color); + + glEnableClientState(GL_VERTEX_ARRAY); + glEnableClientState(GL_NORMAL_ARRAY); + glEnableClientState(GL_COLOR_ARRAY); + draw_pass_model_vertex(); // draw entities with model + + glDisableClientState(GL_COLOR_ARRAY); + draw_pass_model_evertex(); // draw entities with model, vertices with entity color - + + glDisableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_NORMAL_ARRAY); + gl::disable(GL_LIGHTING); gl::enable(GL_BLEND); -- cgit v1.2.3