diff options
Diffstat (limited to 'src/render/draw.cc')
-rw-r--r-- | src/render/draw.cc | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/render/draw.cc b/src/render/draw.cc index 1884125..e9123cd 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -837,6 +837,7 @@ void draw_model_bbox(model::Model *model) gl::vertex(model->model_maxbbox.x, model->model_minbbox.y, model->model_minbbox.z); gl::end(); + // body gl::begin(gl::Lines); gl::vertex(model->model_maxbbox.x, model->model_maxbbox.y, model->model_maxbbox.z); gl::vertex(model->model_maxbbox.x, model->model_maxbbox.y, model->model_minbbox.z); @@ -846,6 +847,43 @@ void draw_model_bbox(model::Model *model) gl::vertex(model->model_minbbox.x, model->model_minbbox.y, model->model_minbbox.z); gl::vertex(model->model_maxbbox.x, model->model_minbbox.y, model->model_maxbbox.z); gl::vertex(model->model_maxbbox.x, model->model_minbbox.y, model->model_minbbox.z); + + gl::end(); +} + + +// draw entity axis +void draw_model_axis(const core::Entity *entity) +{ + // axis + const float r = entity->radius() * 1.5f; + + gl::begin(gl::Lines); + + gl::color(entity->color()); + + gl::vertex(-r, 0.0f, 0.0f); + gl::vertex(r, 0.0f, 0.0f); + + gl::vertex(0.0f, -r, 0.0f); + gl::vertex(0.0f, r, 0.0f); + + gl::vertex(0.0f, 0.0f, -r); + gl::vertex(0.0f, 0.0f, r); + + const math::Axis worldaxis(entity->axis().transpose()); + + gl::color(1.0f, 0.0f, 0.0f); + + gl::vertex(worldaxis.forward() * -1 * r); + gl::vertex(worldaxis.forward() * r); + + gl::vertex(worldaxis.left() * -1 * r); + gl::vertex(worldaxis.left() * r); + + gl::vertex(worldaxis.up() * -1 * r); + gl::vertex(worldaxis.up() * r); + gl::end(); } @@ -866,6 +904,9 @@ void draw_pass_model_fragments() draw_model_bbox(entity->model()); } + if (r_axis->value()) { + draw_model_axis(entity); + } gl::pop(); } } |