From 377170212cfd70e3684cf27c5b8f64d58c03c9b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 24 Jan 2013 21:52:27 +0100 Subject: [PATCH] DebugTools: render boxes with proper size. Cube and Square primitives have 2x2(x2) size, thus to render box with size 1x1(x1) we have to set scale to 0.5. --- src/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp b/src/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp index 345f69642..25a69c435 100644 --- a/src/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp +++ b/src/DebugTools/Implementation/AxisAlignedBoxRenderer.cpp @@ -24,9 +24,10 @@ namespace Magnum { namespace DebugTools { namespace Implementation { template void AxisAlignedBoxRenderer::draw(Resource& options, const typename DimensionTraits::MatrixType&, typename SceneGraph::AbstractCamera* camera) { + /* Half scale, because the box is 2x2(x2) */ typename DimensionTraits::MatrixType transformation = DimensionTraits::MatrixType::translation(axisAlignedBox.transformedPosition())* - DimensionTraits::MatrixType::scaling(axisAlignedBox.transformedSize()); + DimensionTraits::MatrixType::scaling(axisAlignedBox.transformedSize()/2); this->shader->setTransformationProjectionMatrix(camera->projectionMatrix()*camera->cameraMatrix()*transformation) ->setColor(options->color()) ->use();