Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://bitbucket.org/Coin3D/
http://www.kongsberg.com/kogt/
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SmTextureText2.h
Go to the documentation of this file.
1 #ifndef SM_TEXTURE_TEXT2_H
2 #define SM_TEXTURE_TEXT2_H
3 
4 /**************************************************************************\
5  * Copyright (c) Kongsberg Oil & Gas Technologies AS
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are
10  * met:
11  *
12  * Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in the
17  * documentation and/or other materials provided with the distribution.
18  *
19  * Neither the name of the copyright holder nor the names of its
20  * contributors may be used to endorse or promote products derived from
21  * this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 \**************************************************************************/
35 
36 #include <Inventor/nodes/SoSubNode.h>
37 #include <Inventor/nodes/SoShape.h>
38 #include <Inventor/fields/SoMFVec3f.h>
39 #include <Inventor/fields/SoSFFloat.h>
40 #include <Inventor/fields/SoMFFloat.h>
41 #include <Inventor/fields/SoMFInt32.h>
42 #include <Inventor/fields/SoMFString.h>
43 #include <Inventor/fields/SoSFVec3f.h>
44 #include <Inventor/fields/SoSFEnum.h>
45 #include <Inventor/fields/SoSFBool.h>
46 #include <SmallChange/basic.h>
48 
49 class SbViewVolume;
50 class SbViewportRegion;
51 class SbMatrix;
52 
53 class SMALLCHANGE_DLL_API SmTextureText2 : public SoShape {
54  typedef SoShape inherited;
55 
57 
58 public:
59  static void initClass(void);
60  SmTextureText2(void);
61 
63  LEFT = 1,
65  CENTER
66  };
67 
69  BOTTOM = 1,
70  TOP,
71  VCENTER
72  };
73 
81 
84 
85 
86  virtual void GLRender(SoGLRenderAction * action);
87  virtual void rayPick(SoRayPickAction * action);
88  virtual void getPrimitiveCount(SoGetPrimitiveCountAction * action);
89  virtual void buildStringQuad(SoAction * action, int idx, SbVec3f & p0, SbVec3f & p1, SbVec3f & p2, SbVec3f & p3);
90 
91 protected:
92  virtual ~SmTextureText2();
93 
94  virtual void generatePrimitives(SoAction * action);
95  virtual void computeBBox(SoAction * action, SbBox3f & box, SbVec3f & center);
96 
97  virtual int getStrings(SoState * state, const SbString * & strings) const;
98  virtual int getPositions(SoState * state, const SbVec3f * & positions) const;
99  virtual int getRotations(SoState * state, const float * & rotations) const;
100  virtual int getStringIndices(SoState * state, const int32_t * & indices) const;
101 
102 private:
103  void renderString(const SmTextureFontBundle & bundle,
104  const SbString * s,
105  const int numstring,
106  const SbVec3f & pos,
107  const SbViewVolume & vv,
108  const SbViewportRegion & vp,
109  const SbMatrix & projmatrix,
110  const SbMatrix & modelmatrix,
111  const SbMatrix & invmodelmatrix,
112  const float rotation);
113 
114  static void render_text(unsigned char * dst,
115  const int idx,
116  const unsigned char value,
117  const unsigned char alpha);
118 
119 };
120 
121 #endif
SoMFInt32 stringIndex
Definition: SmTextureText2.h:82
Definition: SmTextureText2.h:64
SoSFVec3f offset
Definition: SmTextureText2.h:79
VerticalJustification
Definition: SmTextureText2.h:68
SoSFFloat maxRange
Definition: SmTextureText2.h:78
#define SO_NODE_HEADER(classname)
virtual void GLRender(SoGLRenderAction *action)
SoMFFloat rotation
Definition: SmTextureText2.h:80
SoSFEnum justification
Definition: SmTextureText2.h:75
static void render_text(unsigned char *dst, const int idx, const unsigned char value, const unsigned char alpha)
Definition: SmTextureFont.cpp:510
virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action)
static void initClass(void)
virtual void generatePrimitives(SoAction *action)=0
virtual void computeBBox(SoAction *action, SbBox3f &box, SbVec3f &center)=0
SoMFVec3f position
Definition: SmTextureText2.h:77
The SmTextureText2 node is used for fast text rendering.
Definition: SmTextureText2.h:53
SoMFString string
Definition: SmTextureText2.h:74
SoSFEnum verticalJustification
Definition: SmTextureText2.h:76
SoSFBool pickOnPixel
Definition: SmTextureText2.h:83
Justification
Definition: SmTextureText2.h:62
Definition: SmTextureFont.h:151
virtual void rayPick(SoRayPickAction *action)