From 4ca453e2272beed121b957244408a61b0b0d8b9b Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 15 Aug 2009 08:18:13 +0000 Subject: don't render entites behind the camera --- src/render/draw.cc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/render/draw.cc') diff --git a/src/render/draw.cc b/src/render/draw.cc index 0b6fba2..e9e655c 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -97,7 +97,7 @@ void pass_prepare(float seconds) core::EntityGlobe *globe = static_cast(entity); // add the globe to the globes list - if (globe->visible()) { + if (globe->visible() && !ext_render(globe)->behind()) { globes_list[ext_render(globe)->distance()] = globe; } @@ -495,7 +495,7 @@ void draw_pass_default() for (core::Zone::Content::iterator it = zone->content().begin(); it != zone->content().end(); ++it) { core::Entity *entity = (*it); - if (!entity->serverside() && !entity->model() && (entity->type() != core::Entity::Globe)) { + if (!entity->model() && (entity->type() != core::Entity::Globe) && !entity->serverside() && !ext_render(entity)->behind()) { gl::push(); gl::translate(entity->location()); @@ -854,7 +854,7 @@ void draw_pass_model_fragments() for (core::Zone::Content::iterator it = zone->content().begin(); it != zone->content().end(); it++) { core::Entity *entity = (*it); - if (entity->model() && ext_render(entity)->visible()) { + if (entity->model() && ext_render(entity)->visible() && !ext_render(entity)->behind()) { gl::push(); gl::translate(entity->location()); gl::multmatrix(entity->axis()); @@ -1209,7 +1209,6 @@ void draw(float seconds) gl::enable(GL_CULL_FACE); // enable culling gl::enable(GL_COLOR_MATERIAL); // enable color tracking - gl::enable(GL_LIGHTING); // enable lighting if (r_normalize && r_normalize->value()) { // enable full normalization gl::enable(GL_NORMALIZE); @@ -1217,6 +1216,8 @@ void draw(float seconds) // enable rescaling of normals gl::enable(GL_RESCALE_NORMAL); } + + gl::enable(GL_LIGHTING); // enable lighting draw_pass_globes(); // draw globes @@ -1224,6 +1225,8 @@ void draw(float seconds) draw_pass_model_fragments(); + gl::disable(GL_LIGHTING); // disable lighting + if (r_normalize && r_normalize->value()) { // disable full normalization gl::disable(GL_NORMALIZE); @@ -1231,7 +1234,6 @@ void draw(float seconds) // disable resaling of normals gl::disable(GL_RESCALE_NORMAL); } - gl::disable(GL_LIGHTING); // disable lighting gl::enable(GL_BLEND); gl::depthmask(GL_FALSE); // disable depth buffer writing @@ -1284,6 +1286,7 @@ void draw(float seconds) // GL_BLEND must be enabled for the GUI } +// draw HUD target world space geometry, like dock indicators void draw_target(core::Entity *entity) { model::Model *model = entity->model(); @@ -1294,7 +1297,7 @@ void draw_target(core::Entity *entity) return; float d = math::distance(core::localcontrol()->location(), entity->location()) - entity->radius() - core::localcontrol()->radius(); - if (d > 100.0f) + if (d > core::range::fxdistance) return; gl::enable(GL_DEPTH_TEST); -- cgit v1.2.3