From 982562fa19bb87a3dab352e562f386f61c171b7b Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 17 Feb 2008 18:59:52 +0000 Subject: major rewrite of Cvar, Func and Entity --- src/client/draw.cc | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'src/client/draw.cc') diff --git a/src/client/draw.cc b/src/client/draw.cc index 021cf3a..72a67c2 100644 --- a/src/client/draw.cc +++ b/src/client/draw.cc @@ -4,7 +4,7 @@ the terms and conditions of the GNU General Public License version 2 */ -#include "core/player.h" +#include "core/core.h" #include "render/render.h" #include "render/sphere.h" #include "render/box.h" @@ -20,16 +20,16 @@ render::Box cube(math::Vector3f(0.5f, 0.5f, 0.5f), math::Vector3f(-0.5f, -0.5f, void draw_entity_sphere(core::Entity *entity) { - render::gl::color(entity->core_color); - sphere.radius = entity->core_radius; + render::gl::color(entity->color()); + sphere.radius = entity->radius(); sphere.draw(); } void draw_entity_cube(core::Entity *entity) { - cube.topcolor = entity->core_color; - cube.bottomcolor = entity->core_color * 0.7f; - cube.radius = entity->core_radius; + cube.topcolor = entity->color(); + cube.bottomcolor = entity->color(); + cube.radius = entity->radius(); cube.draw(); } @@ -37,11 +37,11 @@ void draw_entity_cube(core::Entity *entity) void draw_entity_diamond(core::Entity *entity) { using namespace render; - float r = entity->core_radius; + float r = entity->radius(); gl::begin(gl::Lines); gl::color(1.0f, 0.0f, 0.0f); gl::vertex(r,0.0f,0.0f); - gl::color(entity->core_color); + gl::color(entity->color()); gl::vertex(-r,0.0f,0.0f); gl::vertex(0.0f,0.0f,r/2); @@ -52,22 +52,22 @@ void draw_entity_diamond(core::Entity *entity) gl::end(); } -// draw an entity of core_type core::entity::Default +// draw an entity of entity_type core::Entity::Default void draw_entity_default(core::Entity *entity) { render::gl::push(); - render::gl::translate(entity->location); + render::gl::translate(entity->location()); - switch(entity->core_shape) { - case core::entity::Sphere: + switch(entity->shape()) { + case core::Entity::Sphere: draw_entity_sphere(entity); break; - case core::entity::Diamond: + case core::Entity::Diamond: draw_entity_diamond(entity); break; - case core::entity::Cube: + case core::Entity::Cube: default: draw_entity_cube(entity); @@ -96,9 +96,9 @@ void draw_ship(core::EntityControlable *entity) using namespace render; gl::push(); - gl::translate(entity->location); + gl::translate(entity->location()); gl::scale(0.2f, 0.2f, 0.2f); - gl::rotate(entity->direction, 0.0f, 1.0f, 0.0f ); + gl::rotate(entity->direction(), 0.0f, 1.0f, 0.0f ); Vector3f tl(0.25, 0.125, 0.125); Vector3f br(-0.25, -0.125, -0.125); @@ -127,14 +127,14 @@ void draw_ship(core::EntityControlable *entity) cockpit.bottomcolor = engine1.bottomcolor; cockpit.draw(); - if(entity->target_thrust > 0 ) { + if(entity->thrust() > 0 ) { gl::color(1.0f,0 ,0 ); gl::begin(gl::Lines); gl::vertex(-0.5f, 0, 0.185); - gl::vertex(-0.5f-0.25f*entity->target_thrust, 0, 0.185); + gl::vertex(-0.5f-0.25f*entity->thrust(), 0, 0.185); gl::vertex(-0.5f, 0, -0.185f); - gl::vertex(-0.5f-0.25f*entity->target_thrust, 0, -0.185f); + gl::vertex(-0.5f-0.25f*entity->thrust(), 0, -0.185f); gl::end(); } @@ -207,14 +207,14 @@ void draw_world(float seconds) // draw entities using namespace render; - std::vector::iterator it; - for (it=core::entity::registry.begin(); it != core::entity::registry.end(); it++) { - switch ( (*it)->core_type()) { - case core::entity::Default: - draw_entity_default((*it)); + std::map::iterator it; + for (it=core::Entity::registry.begin(); it != core::Entity::registry.end(); it++) { + switch ((*it).second->type()) { + case core::Entity::Default: + draw_entity_default((*it).second); break; - case core::entity::Controlable: - draw_ship(static_cast(*it)); + case core::Entity::Controlable: + draw_ship(static_cast ((*it).second)); default: break; } -- cgit v1.2.3