SmallChange
1.0.0
A collection of extensions to Coin3D
Loading...
Searching...
No Matches
SmTextureText2.h
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>
47
#include <SmallChange/nodes/SmTextureFont.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
56
SO_NODE_HEADER(
SmTextureText2
);
57
58
public
:
59
static
void
initClass(
void
);
60
SmTextureText2
(
void
);
61
62
enum
Justification {
63
LEFT = 1,
64
RIGHT,
65
CENTER
66
};
67
68
enum
VerticalJustification {
69
BOTTOM = 1,
70
TOP,
71
VCENTER
72
};
73
74
SoMFString string;
75
SoSFEnum justification;
76
SoSFEnum verticalJustification;
77
SoMFVec3f position;
78
SoSFFloat maxRange;
79
SoSFVec3f offset;
80
SoMFFloat rotation;
81
82
SoMFInt32 stringIndex;
83
SoSFBool pickOnPixel;
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
SbList
Definition
misc/SbList.h:69
SbVec3f
SmTextureFontBundle
Definition
SmTextureFont.h:151
SmTextureText2
The SmTextureText2 node is used for fast text rendering.
Definition
SmTextureText2.h:53
SoAction
SoShape
lib
SmallChange
nodes
SmTextureText2.h
Generated on Tue Sep 10 2024 20:35:47 for SmallChange by
1.10.0