Fix stk text billboard orientation

This commit is contained in:
vlj 2014-09-24 01:37:31 +02:00
parent 58e1b73752
commit 562fe802f6
2 changed files with 9 additions and 14 deletions

View File

@ -153,21 +153,16 @@ scene::IMesh* STKTextBillboard::getTextMesh(core::stringw text, gui::ScalableFon
return Mesh;
}
void STKTextBillboard::OnRegisterSceneNode()
void STKTextBillboard::updateNoGL()
{
if (IsVisible)
{
SceneManager->registerNodeForRendering(this, scene::ESNRP_SOLID);
scene::ICameraSceneNode* curr_cam = irr_driver->getSceneManager()->getActiveCamera();
core::vector3df cam_pos = curr_cam->getPosition();
core::vector3df text_pos = this->getAbsolutePosition();
float angle = atan2(text_pos.X - cam_pos.X, text_pos.Z - cam_pos.Z);
this->setRotation(core::vector3df(0.0f, angle * 180.0f / M_PI, 0.0f));
updateAbsolutePosition();
scene::ICameraSceneNode* curr_cam = irr_driver->getSceneManager()->getActiveCamera();
core::vector3df cam_pos = curr_cam->getPosition();
core::vector3df text_pos = this->getAbsolutePosition();
float angle = atan2(text_pos.X - cam_pos.X, text_pos.Z - cam_pos.Z);
this->setRotation(core::vector3df(0.0f, angle * 180.0f / M_PI, 0.0f));
updateAbsolutePosition();
}
ISceneNode::OnRegisterSceneNode();
STKMeshSceneNode::updateNoGL();
}
void STKTextBillboard::collectChar(video::ITexture* texture,

View File

@ -56,7 +56,7 @@ public:
const irr::core::vector3df& position,
const irr::core::vector3df& size);
virtual void OnRegisterSceneNode() OVERRIDE;
virtual void updateNoGL() OVERRIDE;
virtual void collectChar(irr::video::ITexture* texture,
const irr::core::rect<irr::s32>& destRect,