Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-03-02 22:55:30 +0000
committerStijn Buys <ingar@osirion.org>2008-03-02 22:55:30 +0000
commite379b1bfeb231716e07f0e4ae9ef024be9bfd08f (patch)
tree6258754959e820a9a94726a4b1a119c301581111 /src/client
parent6e08b92bd4f3e32fdf550f0a3e950e3101a1b06f (diff)
added target_engine support
Diffstat (limited to 'src/client')
-rw-r--r--src/client/draw.cc94
1 files changed, 56 insertions, 38 deletions
diff --git a/src/client/draw.cc b/src/client/draw.cc
index cdf80c2..91032a8 100644
--- a/src/client/draw.cc
+++ b/src/client/draw.cc
@@ -53,39 +53,6 @@ void draw_entity_diamond(core::Entity *entity)
gl::end();
}
-// 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());
-
- 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:
-
- default:
- draw_entity_cube(entity);
- break;
- }
- }
-
- render::gl::pop();
-}
math::Vector3f v0(1.0f, -1.0f, -1.0f);
@@ -105,10 +72,7 @@ void draw_ship(core::EntityControlable *entity)
using math::Color;
using namespace render;
- gl::push();
- gl::translate(entity->location());
gl::scale(0.2f, 0.2f, 0.2f);
- gl::rotate(entity->direction(), 0.0f, 0.0f, 1.0f );
Vector3f tl(0.25, 0.125, 0.125);
Vector3f br(-0.25, -0.125, -0.125);
@@ -169,8 +133,62 @@ void draw_ship(core::EntityControlable *entity)
gl::vertex(v6);
gl::vertex(v7);
gl::end();
+}
+
+
+// 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());
- gl::pop();
+ render::gl::push();
+ render::gl::translate(entity->location());
+ render::gl::rotate(entity->direction(), 0.0f, 0.0f, 1.0f );
+
+ if (model) {
+ model->draw(entity);
+ } 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:
+
+ default:
+ draw_entity_cube(entity);
+ break;
+ }
+ }
+
+ render::gl::pop();
+}
+
+// draw an entity of entity_type core::Entity::Controlable
+void draw_entity_controlable(core::EntityControlable *entity)
+{
+ render::Model *model = 0;
+ if (entity->modelname().size())
+ model = render::Model::get(entity->modelname());
+
+ render::gl::push();
+ render::gl::translate(entity->location());
+ render::gl::rotate(entity->direction(), 0.0f, 0.0f, 1.0f );
+
+ if (model) {
+ model->draw(entity);
+ } else {
+ draw_ship(entity);
+ }
+
+ render::gl::pop();
+
}
void draw_spacegrid()
@@ -224,7 +242,7 @@ void draw_world(float seconds)
draw_entity_default((*it).second);
break;
case core::Entity::Controlable:
- draw_ship(static_cast<core::EntityControlable *> ((*it).second));
+ draw_entity_controlable(static_cast<core::EntityControlable *> ((*it).second));
break;
default:
break;