~baltix/+junk/irrlicht-test

« back to all changes in this revision

Viewing changes to source/Irrlicht/CTextSceneNode.h

  • Committer: Mantas Kriaučiūnas
  • Date: 2011-07-18 13:06:25 UTC
  • Revision ID: mantas@akl.lt-20110718130625-c5pvifp61e7kj1ol
Included whole irrlicht SVN libraries to work around launchpad recipe issue with quilt, see https://answers.launchpad.net/launchpad/+question/165193

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (C) 2002-2011 Nikolaus Gebhardt
 
2
// This file is part of the "Irrlicht Engine".
 
3
// For conditions of distribution and use, see copyright notice in irrlicht.h
 
4
 
 
5
#ifndef __C_TEXT_SCENE_NODE_H_INCLUDED__
 
6
#define __C_TEXT_SCENE_NODE_H_INCLUDED__
 
7
 
 
8
#include "ITextSceneNode.h"
 
9
#include "IBillboardTextSceneNode.h"
 
10
#include "IGUIFont.h"
 
11
#include "IGUIFontBitmap.h"
 
12
#include "ISceneCollisionManager.h"
 
13
#include "SMesh.h"
 
14
 
 
15
namespace irr
 
16
{
 
17
namespace scene
 
18
{
 
19
 
 
20
 
 
21
        class CTextSceneNode : public ITextSceneNode
 
22
        {
 
23
        public:
 
24
 
 
25
                //! constructor
 
26
                CTextSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
 
27
                        gui::IGUIFont* font, scene::ISceneCollisionManager* coll,
 
28
                        const core::vector3df& position = core::vector3df(0,0,0), const wchar_t* text=0,
 
29
                        video::SColor color=video::SColor(100,0,0,0));
 
30
 
 
31
                //! destructor
 
32
                virtual ~CTextSceneNode();
 
33
 
 
34
                virtual void OnRegisterSceneNode();
 
35
 
 
36
                //! renders the node.
 
37
                virtual void render();
 
38
 
 
39
                //! returns the axis aligned bounding box of this node
 
40
                virtual const core::aabbox3d<f32>& getBoundingBox() const;
 
41
 
 
42
                //! sets the text string
 
43
                virtual void setText(const wchar_t* text);
 
44
 
 
45
                //! sets the color of the text
 
46
                virtual void setTextColor(video::SColor color);
 
47
 
 
48
                //! Returns type of the scene node
 
49
                virtual ESCENE_NODE_TYPE getType() const { return ESNT_TEXT; }
 
50
 
 
51
        private:
 
52
 
 
53
                core::stringw Text;
 
54
                video::SColor Color;
 
55
                gui::IGUIFont* Font;
 
56
                scene::ISceneCollisionManager* Coll;
 
57
                core::aabbox3d<f32> Box;
 
58
        };
 
59
 
 
60
        class CBillboardTextSceneNode : public IBillboardTextSceneNode
 
61
        {
 
62
        public:
 
63
 
 
64
                CBillboardTextSceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id,
 
65
                        gui::IGUIFont* font,const wchar_t* text,
 
66
                        const core::vector3df& position, const core::dimension2d<f32>& size,
 
67
                        video::SColor colorTop, video::SColor shade_bottom);
 
68
 
 
69
                //! destructor
 
70
                virtual ~CBillboardTextSceneNode();
 
71
 
 
72
                //! sets the vertex positions etc
 
73
                virtual void OnAnimate(u32 timeMs);
 
74
 
 
75
                //! registers the node into the transparent pass
 
76
                virtual void OnRegisterSceneNode();
 
77
 
 
78
                //! renders the node.
 
79
                virtual void render();
 
80
 
 
81
                //! returns the axis aligned bounding box of this node
 
82
                virtual const core::aabbox3d<f32>& getBoundingBox() const;
 
83
 
 
84
                //! sets the text string
 
85
                virtual void setText(const wchar_t* text);
 
86
 
 
87
                //! sets the color of the text
 
88
                virtual void setTextColor(video::SColor color);
 
89
 
 
90
                //! sets the size of the billboard
 
91
                virtual void setSize(const core::dimension2d<f32>& size);
 
92
 
 
93
                //! gets the size of the billboard
 
94
                virtual const core::dimension2d<f32>& getSize() const;
 
95
 
 
96
                virtual video::SMaterial& getMaterial(u32 i);
 
97
 
 
98
                //! returns amount of materials used by this scene node.
 
99
                virtual u32 getMaterialCount() const;
 
100
 
 
101
                //! Returns type of the scene node
 
102
                virtual ESCENE_NODE_TYPE getType() const { return ESNT_TEXT; }
 
103
 
 
104
                //! Set the color of all vertices of the billboard
 
105
                //! \param overallColor: the color to set
 
106
                virtual void setColor(const video::SColor & overallColor);
 
107
 
 
108
                //! Set the color of the top and bottom vertices of the billboard
 
109
                //! \param topColor: the color to set the top vertices
 
110
                //! \param bottomColor: the color to set the bottom vertices
 
111
                virtual void setColor(const video::SColor & topColor, const video::SColor & bottomColor);
 
112
 
 
113
                //! Gets the color of the top and bottom vertices of the billboard
 
114
                //! \param topColor: stores the color of the top vertices
 
115
                //! \param bottomColor: stores the color of the bottom vertices
 
116
                virtual void getColor(video::SColor & topColor, video::SColor & bottomColor) const;
 
117
 
 
118
        private:
 
119
 
 
120
                core::stringw Text;
 
121
                video::SColor Color;
 
122
                gui::IGUIFontBitmap* Font;
 
123
 
 
124
                core::dimension2d<f32> Size;
 
125
                core::aabbox3d<f32> BBox;
 
126
                video::SMaterial Material;
 
127
 
 
128
                video::SColor ColorTop;
 
129
                video::SColor ColorBottom;
 
130
                struct SSymbolInfo
 
131
                {
 
132
                        u32 bufNo;
 
133
                        f32 Width;
 
134
                        f32 Kerning;
 
135
                        u32 firstInd;
 
136
                        u32 firstVert;
 
137
                };
 
138
 
 
139
                core::array < SSymbolInfo > Symbol;
 
140
 
 
141
                SMesh *Mesh;
 
142
        };
 
143
 
 
144
} // end namespace scene
 
145
} // end namespace irr
 
146
 
 
147
#endif
 
148