From 81787e9004377016236865e95b95707ed6cf1d0b Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 2 Mar 2008 12:23:48 +0000 Subject: initial (buggy) support for .map models --- src/client/draw.cc | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'src/client') diff --git a/src/client/draw.cc b/src/client/draw.cc index 11d4aa7..76c55b3 100644 --- a/src/client/draw.cc +++ b/src/client/draw.cc @@ -8,6 +8,7 @@ #include "render/render.h" #include "render/sphere.h" #include "render/box.h" +#include "render/model.h" #include "client/client.h" #include "client/camera.h" #include "client/draw.h" @@ -55,23 +56,32 @@ void draw_entity_diamond(core::Entity *entity) // draw an entity of entity_type core::Entity::Default void draw_entity_default(core::Entity *entity) { + render::Model *model = 0; + if (entity->modelname().size()) + model = render::Model::get(entity->modelname()); + render::gl::push(); render::gl::translate(entity->location()); - - switch(entity->shape()) { - case core::Entity::Sphere: - draw_entity_sphere(entity); - break; - case core::Entity::Diamond: - draw_entity_diamond(entity); - break; + if (model) { + render::gl::color(entity->color()); + model->draw(); + } else { + switch(entity->shape()) { + case core::Entity::Sphere: + draw_entity_sphere(entity); + break; + + case core::Entity::Diamond: + draw_entity_diamond(entity); + break; - case core::Entity::Cube: + case core::Entity::Cube: default: draw_entity_cube(entity); break; + } } render::gl::pop(); -- cgit v1.2.3