Coin
4.0.10
Coin3D core library
Loading...
Searching...
No Matches
SoMultiTextureMatrixElement.h
1
#ifndef COIN_SOMULTITEXTUREMATRIXELEMENT_H
2
#define COIN_SOMULTITEXTUREMATRIXELEMENT_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/elements/SoAccumulatedElement.h>
37
#include <Inventor/SbMatrix.h>
38
39
class
SoMultiTextureMatrixElementP;
40
41
class
COIN_DLL_API
SoMultiTextureMatrixElement
:
public
SoAccumulatedElement
{
42
typedef
SoAccumulatedElement
inherited
;
43
44
SO_ELEMENT_HEADER(
SoMultiTextureMatrixElement
);
45
public
:
46
static
void
initClass
(
void
);
47
protected
:
48
virtual
~SoMultiTextureMatrixElement
();
49
50
public
:
51
void
init
(
SoState
* state)
override
;
52
void
push
(
SoState
* state)
override
;
53
static
void
set(
SoState
*
const
state,
SoNode
*
const
node,
54
const
int
unit,
55
const
SbMatrix
& matrix);
56
static
void
mult(
SoState
*
const
state,
SoNode
*
const
node,
57
const
int
unit,
58
const
SbMatrix
& matrix);
59
static
const
SbMatrix
& get(
SoState
*
const
state,
const
int
unit = 0);
60
61
class
UnitData
{
62
public
:
63
UnitData
() : textureMatrix(
SbMatrix::identity
()) {}
64
UnitData
(
const
UnitData
& org) : textureMatrix(org.textureMatrix) {}
65
UnitData
& operator=(
const
UnitData
& org) =
default
;
66
SbMatrix
textureMatrix;
67
};
68
69
protected
:
70
int
getNumUnits()
const
;
71
UnitData
& getUnitData(
const
int
unit);
72
const
UnitData
& getUnitData(
const
int
unit)
const
;
73
74
virtual
void
multElt(
const
int
unit,
const
SbMatrix
& matrix);
75
virtual
void
setElt(
const
int
unit,
const
SbMatrix
& matrix);
76
virtual
const
SbMatrix
& getElt(
const
int
unit)
const
;
77
78
private
:
79
SoMultiTextureMatrixElementP * pimpl;
80
81
public
:
// Coin-3 support
82
static
void
makeIdentity(
SoState
*
const
state,
SoNode
*
const
node,
const
int
unit = 0) {
83
set(state, node, unit,
SbMatrix::identity
());
84
}
85
static
void
set(
SoState
*
const
state,
SoNode
*
const
node,
86
const
SbMatrix
& matrix) {
87
set(state, node, 0, matrix);
88
}
89
static
void
mult(
SoState
*
const
state,
SoNode
*
const
node,
90
const
SbMatrix
& matrix) {
91
mult(state, node, 0, matrix);
92
}
93
static
void
translateBy(
SoState
*
const
state,
SoNode
*
const
node,
94
const
SbVec3f
& translation) {
95
SbMatrix
m;
96
m.
setTranslate
(translation);
97
mult(state, node, 0, m);
98
}
99
static
void
rotateBy(
SoState
*
const
state,
SoNode
*
const
node,
100
const
SbRotation
& rotation) {
101
SbMatrix
m;
102
m.
setRotate
(rotation);
103
mult(state, node, 0, m);
104
}
105
static
void
scaleBy(
SoState
*
const
state,
SoNode
*
const
node,
106
const
SbVec3f
& scaleFactor) {
107
SbMatrix
m;
108
m.
setScale
(scaleFactor);
109
mult(state, node, 0, m);
110
}
111
};
112
113
#endif
// !COIN_SOTEXTUREMATRIXELEMENT_H
SbMatrix
The SbMatrix class is a 4x4 dimensional representation of a matrix.
Definition
SbMatrix.h:47
SbMatrix::setTranslate
void setTranslate(const SbVec3f &t)
Definition
SbMatrix.cpp:890
SbMatrix::setScale
void setScale(const float s)
Definition
SbMatrix.cpp:860
SbMatrix::setRotate
void setRotate(const SbRotation &q)
Definition
SbMatrix.cpp:372
SbMatrix::identity
static SbMatrix identity(void)
Definition
SbMatrix.cpp:848
SbRotation
The SbRotation class represents a rotation in 3D space.
Definition
SbRotation.h:44
SbVec3f
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition
SbVec3f.h:51
SoAccumulatedElement
The SoAccumulatedElement class is an abstract class for storing accumulated state.
Definition
SoAccumulatedElement.h:39
SoAccumulatedElement::push
void push(SoState *state) override
Definition
SoAccumulatedElement.cpp:92
SoAccumulatedElement::init
void init(SoState *state) override
Definition
SoAccumulatedElement.cpp:84
SoAccumulatedElement::initClass
static void initClass(void)
Definition
SoAccumulatedElement.cpp:69
SoMultiTextureMatrixElement::UnitData
Definition
SoMultiTextureMatrixElement.h:61
SoMultiTextureMatrixElement
The SoMultiTextureMatrixElement class is used to manage the texture matrix stack for texture units > ...
Definition
SoMultiTextureMatrixElement.h:41
SoNode
The SoNode class is the base class for nodes used in scene graphs.
Definition
SoNode.h:56
SoState
The SoState class manages the Coin scene graph traversal state data.
Definition
SoState.h:44
include
Inventor
elements
SoMultiTextureMatrixElement.h
Generated on Thu Oct 8 2026 15:21:37 for Coin by
1.10.0