Coin  4.0.3
Coin3D core library
Loading...
Searching...
No Matches
SoGLMultiTextureCoordinateElement.h
1#ifndef COIN_SOGLMULTITEXTURECOORDINATEELEMENT_H
2#define COIN_SOGLMULTITEXTURECOORDINATEELEMENT_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/SoMultiTextureCoordinateElement.h>
37
38class SoGLMultiTextureCoordinateElementP;
39typedef void SoTexCoordTexgenCB(void * data);
40
43
44 SO_ELEMENT_HEADER(SoGLMultiTextureCoordinateElement);
45public:
46 static void initClass(void);
47protected:
49
50public:
51 virtual void init(SoState * state);
52 virtual void push(SoState * state);
53 virtual void pop(SoState * state,
54 const SoElement * prevTopElement);
55
56 static void setTexGen(SoState * const state, SoNode * const node,
57 const int unit,
58 SoTexCoordTexgenCB * const texgenFunc,
59 void * const texgenData = NULL,
60 SoTextureCoordinateFunctionCB * const func = NULL,
61 void * const funcData = NULL);
62
63 virtual CoordType getType(const int unit = 0) const;
64
65 static const SoGLMultiTextureCoordinateElement * getInstance(SoState * const state);
66
67 void send(const int unit, const int index) const;
68 void send(const int unit, const int index, const SbVec3f &c, const SbVec3f &n) const;
69
70 class GLUnitData {
71 public:
72 GLUnitData() : texgenCB(NULL), texgenData(NULL) {}
73 GLUnitData(const GLUnitData & org) : texgenCB(org.texgenCB), texgenData(org.texgenData) {}
74 SoTexCoordTexgenCB * texgenCB;
75 void * texgenData;
76 };
77
78 void initRender(const SbBool * enabled, const int maxenabled) const;
79
80 // Coin-3 support
81 void send(const int index) const {
82 for (int i = 0; i <= this->multimax; i++) {
83 if (this->multienabled[i]) {
84 this->send(i, index);
85 }
86 }
87 }
88 void send(const int index, const SbVec3f &c, const SbVec3f &n) const {
89 for (int i = 0; i <= this->multimax; i++) {
90 if (this->multienabled[i]) {
91 this->send(i, index, c, n);
92 }
93 }
94 }
95 void initMulti(SoState * state) const;
96 static void setTexGen(SoState * const state, SoNode * const node,
97 SoTexCoordTexgenCB * const texgenFunc,
98 void * const texgenData = NULL,
99 SoTextureCoordinateFunctionCB * const func = NULL,
100 void * const funcData = NULL) {
101 setTexGen(state, node, 0, texgenFunc, texgenData, func, funcData);
102 }
103
104protected:
105 virtual void setElt(const int unit,
106 SoTexCoordTexgenCB *func,
107 void *data = NULL);
108
109private:
110 void doCallback(const int unit) const;
111 SoGLMultiTextureCoordinateElementP * pimpl;
112 mutable const SbBool * multienabled;
113 mutable int multimax;
114};
115
116#endif // !COIN_SOGLMULTITEXTURECOORDINATEELEMENT_H
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition SbVec3f.h:51
SoElement is the abstract base class for all elements.
Definition SoElement.h:43
virtual void pop(SoState *state, const SoElement *prevTopElement)
Definition SoElement.cpp:585
Definition SoGLMultiTextureCoordinateElement.h:70
The SoGLMultiTextureCoordinateElement class stores the current gltexture coordinates for several unit...
Definition SoGLMultiTextureCoordinateElement.h:41
The SoMultiTextureCoordinateElement class is yet to be documented.
Definition SoMultiTextureCoordinateElement.h:48
static CoordType getType(SoState *const state, const int unit=0)
Definition SoMultiTextureCoordinateElement.cpp:409
static const SoMultiTextureCoordinateElement * getInstance(SoState *const state)
FIXME: write doc.
Definition SoMultiTextureCoordinateElement.cpp:271
virtual void init(SoState *state)
FIXME: write doc.
Definition SoMultiTextureCoordinateElement.cpp:431
virtual void push(SoState *state)
Definition SoMultiTextureCoordinateElement.cpp:507
static void initClass(void)
Definition SoMultiTextureCoordinateElement.cpp:101
The SoNode class is the base class for nodes used in scene graphs.
Definition SoNode.h:56
The SoState class manages the Coin scene graph traversal state data.
Definition SoState.h:44