SmallChange  1.0.0
A collection of extensions to Coin3D
Loading...
Searching...
No Matches
SmTextureText2Collector.h
1#ifndef SMTEXTURETEXT2COLLECTOR_H
2#define SMTEXTURETEXT2COLLECTOR_H
3
4/**************************************************************************/
5
6#include <vector>
7#include <Inventor/elements/SoSubElement.h>
8#include <Inventor/elements/SoElement.h>
9#include <Inventor/SbColor4f.h>
10
11#include <SmallChange/nodes/SmTextureFont.h>
12#include <SmallChange/nodes/SmTextureText2.h>
13
15 typedef SoElement inherited;
16
17 SO_ELEMENT_HEADER(SmTextureText2CollectorElement);
18public:
19 static void initClass(void);
20protected:
22
23public:
24
25 typedef struct {
26 SbString text;
27 const SmTextureFont::FontImage * font;
28 SbVec3f worldpos;
29 float maxdist;
30 SbColor4f color;
31 SmTextureText2::Justification justification;
32 SmTextureText2::VerticalJustification vjustification;
33 } TextItem;
34
35
36 virtual void init(SoState * state);
37 static void startCollecting(SoState * state, const bool storeitems = true);
38
39 static void add(SoState * state,
40 const SbString & text,
41 const SmTextureFont::FontImage * font,
42 const SbVec3f & worldpos,
43 const float maxdist,
44 const SbColor4f & color,
45 SmTextureText2::Justification j,
46 SmTextureText2::VerticalJustification vj);
47
48 static const std::vector <TextItem> & finishCollecting(SoState * state);
49 static bool isCollecting(SoState * state);
50
51 virtual SbBool matches(const SoElement * elt) const;
52 virtual SoElement * copyMatchInfo(void) const;
53
54private:
55 bool collecting;
56 bool storeitems;
57 std::vector <TextItem> items;
58};
59
60/**************************************************************************/
61
62#include <Inventor/nodes/SoSubNode.h>
63#include <Inventor/nodes/SoSeparator.h>
64#include <Inventor/fields/SoSFBool.h>
65
66#include <SmallChange/basic.h>
67
69 typedef SoSeparator inherited;
70
71 SO_NODE_HEADER(SmTextureText2Collector);
72
73 public:
74 SoSFBool depthMask;
75
76 static void initClass(void);
78
79 virtual void GLRenderBelowPath(SoGLRenderAction * action);
80 virtual void GLRenderInPath(SoGLRenderAction * action);
81
82 protected:
84
85 virtual void renderText(SoGLRenderAction * action,
86 const std::vector<SmTextureText2CollectorElement::TextItem> &);
87};
88
89/**************************************************************************/
90
91#endif // SMTEXTURETEXT2COLLECTOR_H
Definition misc/SbList.h:69
Definition SmTextureFont.h:54
Definition SmTextureText2Collector.h:14
The SmTextureText2Collector node is a group node which optimizes SmTextureText2 rendering.
Definition SmTextureText2Collector.h:68
Definition SmTextureText2Collector.h:25