Skip to content

Commit

Permalink
Main: DefaultDebugDrawer - add setBoneAxesSize()
Browse files Browse the repository at this point in the history
Allows to set size of axes for debug bone drawing.
  • Loading branch information
chillywillysoft authored and paroj committed May 21, 2023
1 parent caddfcf commit f156e86
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions OgreMain/include/OgreDefaultDebugDrawer.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class _OgreExport DefaultDebugDrawer : public DebugDrawer
ManualObject mAxes;
int mDrawType;
bool mStatic;
float mBoneAxesSize;
void preFindVisibleObjects(SceneManager* source, SceneManager::IlluminationRenderStage irs, Viewport* v) override;
void postFindVisibleObjects(SceneManager* source, SceneManager::IlluminationRenderStage irs, Viewport* v) override;
void beginLines();
Expand All @@ -38,6 +39,8 @@ class _OgreExport DefaultDebugDrawer : public DebugDrawer
void drawWireBox(const AxisAlignedBox& aabb, const ColourValue& colour = ColourValue::White);
/// draw coordinate axes
void drawAxes(const Affine3& pose, float size = 1.0f);
/// Specifes the size of the axes drawn by drawBone()
void setBoneAxesSize(float size);
};

} /* namespace Ogre */
Expand Down
8 changes: 6 additions & 2 deletions OgreMain/src/OgreDefaultDebugDrawer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace Ogre
{

DefaultDebugDrawer::DefaultDebugDrawer() : mLines(""), mAxes(""), mDrawType(0), mStatic(false) {}
DefaultDebugDrawer::DefaultDebugDrawer() : mLines(""), mAxes(""), mDrawType(0), mStatic(false), mBoneAxesSize(1.0f) {}

void DefaultDebugDrawer::preFindVisibleObjects(SceneManager* source,
SceneManager::IlluminationRenderStage irs, Viewport* v)
Expand Down Expand Up @@ -141,9 +141,13 @@ void DefaultDebugDrawer::drawAxes(const Affine3& pose, float size)
mAxes.triangle(base + 4, base + 5, base + 6);
}
}
void DefaultDebugDrawer::setBoneAxesSize(float size)
{
mBoneAxesSize = size;
}
void DefaultDebugDrawer::drawBone(const Node* node, const Affine3 & transform)
{
drawAxes(transform * node->_getFullTransform());
drawAxes(transform * node->_getFullTransform(), mBoneAxesSize);
}
void DefaultDebugDrawer::drawSceneNode(const SceneNode* node)
{
Expand Down

0 comments on commit f156e86

Please sign in to comment.