diff options
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/draw.cc | 14 | ||||
-rw-r--r-- | src/render/render.h | 2 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc index e9e655c..1884125 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -201,7 +201,7 @@ void draw_sphere(math::Color const & color, float radius) } } -void draw_globe(core::EntityGlobe *globe) +void draw_globe(const core::EntityGlobe* globe) { /* Globes have to be rendered distance sorted, closest last. @@ -226,8 +226,8 @@ void draw_globe(core::EntityGlobe *globe) if (ext_render(globe)->distance() > (FARPLANE - globe->radius())) { // globe is behind the far plane, make a fake size calculation - location = Camera::eye() + (location - Camera::eye()) * (FARPLANE / ext_render(globe)->distance()); - radius *= FARPLANE / ext_render(globe)->distance(); + location = Camera::eye() + (location - Camera::eye()) * ((FARPLANE - globe->radius()) / ext_render(globe)->distance()); + radius *= (FARPLANE - globe->radius()) / (ext_render(globe)->distance()); gl::depthmask(GL_FALSE); @@ -336,12 +336,12 @@ void draw_pass_globes() /* ---- Default entities ------------------------------------------ */ -void draw_entity_sphere(core::Entity *entity) +void draw_entity_sphere(const core::Entity* entity) { draw_sphere(entity->color(), entity->radius()); } -void draw_entity_cube(core::Entity *entity) +void draw_entity_cube(const core::Entity* entity) { float radius = entity->radius(); @@ -392,7 +392,7 @@ void draw_entity_cube(core::Entity *entity) gl::end(); } -void draw_entity_diamond(core::Entity *entity) +void draw_entity_diamond(const core::Entity* entity) { float radius = entity->radius()/2; @@ -472,7 +472,7 @@ void draw_entity_diamond(core::Entity *entity) } } -void draw_entity_axis(core::Entity *entity) +void draw_entity_axis(const core::Entity* entity) { float r = entity->radius(); diff --git a/src/render/render.h b/src/render/render.h index 0073f57..c397c78 100644 --- a/src/render/render.h +++ b/src/render/render.h @@ -57,7 +57,7 @@ namespace render { /// use GL_NORMALIZE instead of GL_RESCALE_NORMAL extern core::Cvar *r_normalize; - inline RenderExt *ext_render(core::Entity *entity) { return static_cast<RenderExt *>(entity->extension((size_t)core::Extension::Render)); } + inline RenderExt *ext_render(const core::Entity *entity) { return static_cast<RenderExt *>(entity->extension((size_t)core::Extension::Render)); } } |