Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/render/draw.cc')
-rw-r--r--src/render/draw.cc76
1 files changed, 73 insertions, 3 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc
index 448b2ce..1091d8c 100644
--- a/src/render/draw.cc
+++ b/src/render/draw.cc
@@ -91,7 +91,7 @@ void draw_entity_sphere(core::Entity *entity)
void draw_entity_cube(core::Entity *entity)
{
- float radius = entity->radius()/2;
+ float radius = entity->radius();
gl::scale(radius, radius, radius);
gl::color(entity->color());
@@ -139,6 +139,72 @@ void draw_entity_cube(core::Entity *entity)
gl::end();
}
+void draw_entity_diamond(core::Entity *entity)
+{
+ float radius = entity->radius()/2;
+
+ gl::color(entity->color());
+
+ gl::begin(gl::TriangleFan );
+ gl::normal(0, 0 , 1);
+ gl::vertex(0, 0, radius);
+
+ gl::normal(1, 0 ,0);
+ gl::vertex(radius, 0.0f, 0.0f);
+ gl::normal(0, 1, 0);
+ gl::vertex(0.0f, radius, 0.0f);
+ gl::normal(-1, 0 ,0);
+ gl::vertex(-radius, 0.0f, 0.0f);
+ gl::normal(0, -1, 0);
+ gl::vertex(0.0f, -radius, 0.0f);
+ gl::normal(1, 0 ,0);
+ gl::vertex(radius, 0.0f, 0.0f);
+
+ gl::end();
+
+ gl::begin(gl::TriangleFan);
+ gl::normal(0, 0 , -1);
+ gl::vertex(0, 0, -radius);
+
+ gl::normal(1, 0, 0);
+ gl::vertex(radius, 0.0f, 0.0f);
+
+ gl::normal(0, -1, 0);
+ gl::vertex(0.0f, -radius, 0.0f);
+
+ gl::normal(-1, 0 ,0);
+ gl::vertex(-radius, 0.0f, 0.0f);
+
+ gl::normal(0, 1, 0);
+ gl::vertex(0.0f, radius, 0.0f);
+
+ gl::normal(1, 0 ,0);
+ gl::vertex(radius, 0.0f, 0.0f);
+
+ gl::end();
+
+ gl::begin(gl::Lines);
+
+ gl::vertex(radius, 0, 0);
+ gl::vertex(2* radius, 0, 0);
+
+ gl::vertex(0, radius, 0);
+ gl::vertex(0, 2* radius, 0);
+
+ gl::vertex(0, 0, radius);
+ gl::vertex(0, 0, 2 * radius);
+
+ gl::vertex(-radius, 0, 0);
+ gl::vertex(-2 * radius, 0, 0);
+
+ gl::vertex(0, -radius, 0);
+ gl::vertex(0, -2 * radius, 0);
+
+ gl::vertex(0, 0, -radius);
+ gl::vertex(0, 0, -2 * radius);
+
+ gl::end();
+}
void draw_entity_axis(core::Entity *entity)
{
@@ -225,6 +291,7 @@ void pass_prepare(float seconds)
if (!entity->model()) {
entity->entity_modelname.clear();
+ entity->entity_radius = 0.25;
} else {
// set entity radius to model radius
entity->entity_radius = entity->entity_model->radius();
@@ -343,13 +410,16 @@ void draw_pass_default()
gl::disable(GL_LIGHTING);
}
- switch(entity->shape()) {
+ switch(entity->shape()) {
+
case core::Entity::Sphere:
draw_entity_sphere(entity);
break;
case core::Entity::Diamond:
-
+ draw_entity_diamond(entity);
+ break;
+
case core::Entity::Axis:
draw_entity_axis(entity);
break;