diff --git a/include/IBillboardSceneNode.h b/include/IBillboardSceneNode.h index ab105549..9930dca2 100644 --- a/include/IBillboardSceneNode.h +++ b/include/IBillboardSceneNode.h @@ -17,7 +17,7 @@ namespace scene which always looks to the camera. It is usually used for explosions, fire, lensflares, particles and things like that. */ -class IBillboardSceneNode : virtual public ISceneNode +class IBillboardSceneNode : public ISceneNode { public: diff --git a/include/IBillboardTextSceneNode.h b/include/IBillboardTextSceneNode.h new file mode 100644 index 00000000..09c71667 --- /dev/null +++ b/include/IBillboardTextSceneNode.h @@ -0,0 +1,62 @@ +// Copyright (C) 2002-2008 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#ifndef __I_BILLBOARD_TEXT_SCENE_NODE_H_INCLUDED__ +#define __I_BILLBOARD_TEXT_SCENE_NODE_H_INCLUDED__ + +#include "IBillboardSceneNode.h" + +namespace irr +{ +namespace scene +{ + +//! A billboard text scene node. +/** Acts like a billboard which displays the currently set text. + Due to the exclusion of RTTI in Irrlicht we have to avoid multiple + inheritance. Hence, changes to the ITextSceneNode interface have + to be copied here manually. +*/ +class IBillboardTextSceneNode : public IBillboardSceneNode +{ +public: + + //! Constructor + IBillboardTextSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id, + const core::vector3df& position = core::vector3df(0,0,0)) + : IBillboardSceneNode(parent, mgr, id, position) {} + + //! Sets the size of the billboard. + virtual void setSize(const core::dimension2d& size) = 0; + + //! Returns the size of the billboard. + virtual const core::dimension2d& getSize() const = 0; + + //! Set the color of all vertices of the billboard + /** \param overallColor: the color to set */ + virtual void setColor(const video::SColor & overallColor) = 0; + + //! Set the color of the top and bottom vertices of the billboard + /** \param topColor: the color to set the top vertices + \param bottomColor: the color to set the bottom vertices */ + virtual void setColor(const video::SColor & topColor, const video::SColor & bottomColor) = 0; + + //! Gets the color of the top and bottom vertices of the billboard + /** \param topColor: stores the color of the top vertices + \param bottomColor: stores the color of the bottom vertices */ + virtual void getColor(video::SColor & topColor, video::SColor & bottomColor) const = 0; + + //! sets the text string + virtual void setText(const wchar_t* text) = 0; + + //! sets the color of the text + virtual void setTextColor(video::SColor color) = 0; +}; + +} // end namespace scene +} // end namespace irr + + +#endif + diff --git a/include/ISceneManager.h b/include/ISceneManager.h index 3808b0d6..5fe723cf 100644 --- a/include/ISceneManager.h +++ b/include/ISceneManager.h @@ -108,6 +108,7 @@ namespace scene class IMetaTriangleSelector; class IMeshManipulator; class ITextSceneNode; + class IBillboardTextSceneNode; class IVolumeLightSceneNode; class ISceneNodeFactory; class ISceneNodeAnimatorFactory; @@ -824,7 +825,7 @@ namespace scene s32 id=-1) = 0; //! Adds a text scene node, which uses billboards - virtual ITextSceneNode* addBillboardTextSceneNode( gui::IGUIFont* font, const wchar_t* text, + virtual IBillboardTextSceneNode* addBillboardTextSceneNode( gui::IGUIFont* font, const wchar_t* text, ISceneNode* parent = 0, const core::dimension2d& size = core::dimension2d(10.0f, 10.0f), const core::vector3df& position = core::vector3df(0,0,0), s32 id=-1, diff --git a/include/ITextSceneNode.h b/include/ITextSceneNode.h index c0fd03a2..770693f3 100644 --- a/include/ITextSceneNode.h +++ b/include/ITextSceneNode.h @@ -13,7 +13,7 @@ namespace scene { //! A scene node for displaying 2d text at a position in three dimensional space -class ITextSceneNode : virtual public ISceneNode +class ITextSceneNode : public ISceneNode { public: diff --git a/source/Irrlicht/CBillboardSceneNode.cpp b/source/Irrlicht/CBillboardSceneNode.cpp index 64b09396..e7d1b76b 100644 --- a/source/Irrlicht/CBillboardSceneNode.cpp +++ b/source/Irrlicht/CBillboardSceneNode.cpp @@ -17,7 +17,7 @@ namespace scene CBillboardSceneNode::CBillboardSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id, const core::vector3df& position, const core::dimension2d& size, video::SColor shade_top, video::SColor shade_down) - : ISceneNode(parent, mgr, id, position), IBillboardSceneNode(parent, mgr, id, position) + : IBillboardSceneNode(parent, mgr, id, position) { #ifdef _DEBUG setDebugName("CBillboardSceneNode"); diff --git a/source/Irrlicht/CSceneManager.cpp b/source/Irrlicht/CSceneManager.cpp index 04e9a318..348d53e0 100644 --- a/source/Irrlicht/CSceneManager.cpp +++ b/source/Irrlicht/CSceneManager.cpp @@ -425,7 +425,7 @@ ITextSceneNode* CSceneManager::addTextSceneNode(gui::IGUIFont* font, //! Adds a text scene node, which uses billboards -ITextSceneNode* CSceneManager::addBillboardTextSceneNode(gui::IGUIFont* font, +IBillboardTextSceneNode* CSceneManager::addBillboardTextSceneNode(gui::IGUIFont* font, const wchar_t* text, ISceneNode* parent, const core::dimension2d& size, const core::vector3df& position, s32 id, @@ -437,7 +437,7 @@ ITextSceneNode* CSceneManager::addBillboardTextSceneNode(gui::IGUIFont* font, if (!parent) parent = this; - ITextSceneNode* node = new CBillboardTextSceneNode(parent, this, id, font, text, position, size, + IBillboardTextSceneNode* node = new CBillboardTextSceneNode(parent, this, id, font, text, position, size, shade_top, shade_down); node->drop(); diff --git a/source/Irrlicht/CSceneManager.h b/source/Irrlicht/CSceneManager.h index 9073824b..46086b42 100644 --- a/source/Irrlicht/CSceneManager.h +++ b/source/Irrlicht/CSceneManager.h @@ -178,7 +178,7 @@ namespace scene s32 id=-1); //! Adds a text scene node, which uses billboards - virtual ITextSceneNode* addBillboardTextSceneNode(gui::IGUIFont* font, const wchar_t* text, + virtual IBillboardTextSceneNode* addBillboardTextSceneNode(gui::IGUIFont* font, const wchar_t* text, ISceneNode* parent = 0, const core::dimension2d& size = core::dimension2d(10.0f, 10.0f), const core::vector3df& position = core::vector3df(0,0,0), s32 id=-1, diff --git a/source/Irrlicht/CTextSceneNode.cpp b/source/Irrlicht/CTextSceneNode.cpp index a6cda5aa..aa7e2d79 100644 --- a/source/Irrlicht/CTextSceneNode.cpp +++ b/source/Irrlicht/CTextSceneNode.cpp @@ -22,7 +22,7 @@ CTextSceneNode::CTextSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id, gui::IGUIFont* font, scene::ISceneCollisionManager* coll, const core::vector3df& position, const wchar_t* text, video::SColor color) - : ISceneNode(parent, mgr, id, position), ITextSceneNode(parent, mgr, id, position), Text(text), Color(color), + : ITextSceneNode(parent, mgr, id, position), Text(text), Color(color), Font(font), Coll(coll) { @@ -93,7 +93,7 @@ CBillboardTextSceneNode::CBillboardTextSceneNode(ISceneNode* parent, ISceneManag gui::IGUIFont* font,const wchar_t* text, const core::vector3df& position, const core::dimension2d& size, video::SColor shade_top,video::SColor shade_bottom ) -: ISceneNode(parent, mgr, id, position), ITextSceneNode(parent, mgr, id, position), IBillboardSceneNode(parent, mgr, id, position), +: IBillboardTextSceneNode(parent, mgr, id, position), Font(0), Shade_top(shade_top), Shade_bottom(shade_bottom), Mesh(0) { #ifdef _DEBUG diff --git a/source/Irrlicht/CTextSceneNode.h b/source/Irrlicht/CTextSceneNode.h index 57cffae3..fe5b2b78 100644 --- a/source/Irrlicht/CTextSceneNode.h +++ b/source/Irrlicht/CTextSceneNode.h @@ -6,7 +6,7 @@ #define __C_TEXT_SCENE_NODE_H_INCLUDED__ #include "ITextSceneNode.h" -#include "IBillboardSceneNode.h" +#include "IBillboardTextSceneNode.h" #include "IGUIFont.h" #include "IGUIFontBitmap.h" #include "ISceneCollisionManager.h" @@ -57,7 +57,7 @@ namespace scene core::aabbox3d Box; }; - class CBillboardTextSceneNode : virtual public ITextSceneNode, virtual public IBillboardSceneNode + class CBillboardTextSceneNode : public IBillboardTextSceneNode { public: