diff --git a/src/graphics/stk_text_billboard.cpp b/src/graphics/stk_text_billboard.cpp index 9884272f0..fcd52497b 100644 --- a/src/graphics/stk_text_billboard.cpp +++ b/src/graphics/stk_text_billboard.cpp @@ -50,16 +50,28 @@ STKTextBillboard::STKTextBillboard(core::stringw text, FontWithFace* font, void STKTextBillboard::updateAbsolutePosition() { + // Make billboard always face the camera + scene::ICameraSceneNode* curr_cam = + irr_driver->getSceneManager()->getActiveCamera(); + if (!curr_cam) return; + core::quaternion q(curr_cam->getViewMatrix()); + q.W = -q.W; + if (Parent) { // Override to not use the parent's rotation - AbsoluteTransformation = getRelativeTransformation(); core::vector3df wc = RelativeTranslation; Parent->getAbsoluteTransformation().transformVect(wc); AbsoluteTransformation.setTranslation(wc); + q.getMatrix(AbsoluteTransformation, wc); } else - AbsoluteTransformation = getRelativeTransformation(); + { + q.getMatrix(AbsoluteTransformation, RelativeTranslation); + } + core::matrix4 m; + m.setScale(RelativeScale); + AbsoluteTransformation *= m; } scene::IMesh* STKTextBillboard::getTextMesh(core::stringw text, FontWithFace* font) @@ -173,22 +185,6 @@ scene::IMesh* STKTextBillboard::getTextMesh(core::stringw text, FontWithFace* fo return Mesh; } -void STKTextBillboard::updateNoGL() -{ - scene::ICameraSceneNode* curr_cam =irr_driver->getSceneManager()->getActiveCamera(); - btMatrix3x3 m; - m.setFromOpenGLSubMatrix(curr_cam->getViewMatrix().pointer()); - btQuaternion q; - m.getRotation(q); - q.setW(-q.getW()); - Vec3 hpr; - hpr.setHPR(q); - this->setRotation(hpr.toIrrHPR()); - updateAbsolutePosition(); - - STKMeshSceneNode::updateNoGL(); -} - void STKTextBillboard::collectChar(video::ITexture* texture, const core::rect& destRect, const core::rect& sourceRect, diff --git a/src/graphics/stk_text_billboard.hpp b/src/graphics/stk_text_billboard.hpp index 89e41f6ae..90cfddbb4 100644 --- a/src/graphics/stk_text_billboard.hpp +++ b/src/graphics/stk_text_billboard.hpp @@ -74,8 +74,6 @@ public: const irr::core::vector3df& position, const irr::core::vector3df& size); - virtual void updateNoGL() OVERRIDE; - virtual scene::ESCENE_NODE_TYPE getType() const OVERRIDE { return scene::ESNT_TEXT;