Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://coin3d.github.io
https://www.kongsberg.com/en/kogt/
SoShaderParameter.h
1#ifndef COIN_SOSHADERPARAMETER_H
2#define COIN_SOSHADERPARAMETER_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/SoNode.h>
37#include <Inventor/nodes/SoSubNode.h>
38#include <Inventor/fields/SoSFString.h>
39#include <Inventor/fields/SoSFFloat.h>
40#include <Inventor/fields/SoSFInt32.h>
41#include <Inventor/fields/SoSFVec2f.h>
42#include <Inventor/fields/SoSFVec3f.h>
43#include <Inventor/fields/SoSFVec4f.h>
44#include <Inventor/fields/SoMFFloat.h>
45#include <Inventor/fields/SoMFInt32.h>
46#include <Inventor/fields/SoMFVec2f.h>
47#include <Inventor/fields/SoMFVec3f.h>
48#include <Inventor/fields/SoMFVec4f.h>
49#include <Inventor/fields/SoSFMatrix.h>
50#include <Inventor/fields/SoMFMatrix.h>
51#include <Inventor/fields/SoSFNode.h>
52#include <Inventor/fields/SoSFEnum.h>
53#include <Inventor/fields/SoSFImage.h>
54
55#include <Inventor/fields/SoSFVec2i32.h>
56#include <Inventor/fields/SoSFVec3i32.h>
57#include <Inventor/fields/SoSFVec4i32.h>
58#include <Inventor/fields/SoMFVec2i32.h>
59#include <Inventor/fields/SoMFVec3i32.h>
60#include <Inventor/fields/SoMFVec4i32.h>
61
62class SoGLShaderParameter;
63class SoGLShaderObject;
64class SoState;
65
66// *************************************************************************
67
68// FIXME: split to one header file for each class? 20050120 mortene.
69
70/* **************************************************************************
71 * *** SoShaderParameter ***
72 * **************************************************************************/
73
74class COIN_DLL_API SoShaderParameter : public SoNode {
75 typedef SoNode inherited;
77
78public:
81
82 SoINTERNAL public:
83 static void initClass();
84
85protected:
87 virtual ~SoShaderParameter();
88};
89
90/* **************************************************************************
91 * *** SoUniformShaderParameter ***
92 * **************************************************************************/
93class SoUniformShaderParameterP;
94
95class COIN_DLL_API SoUniformShaderParameter : public SoShaderParameter {
96 typedef SoShaderParameter inherited;
97 SO_NODE_ABSTRACT_HEADER(SoUniformShaderParameter);
98
99 SoINTERNAL public:
100 static void initClass(void);
101 virtual void updateParameter(SoGLShaderObject *shaderObject) = 0;
102
103protected:
104 SoUniformShaderParameter();
105 virtual ~SoUniformShaderParameter();
106
107 SoGLShaderParameter * getGLShaderParameter(const uint32_t cachecontext);
108 void ensureParameter(SoGLShaderObject * shader);
109
110private:
111 SoUniformShaderParameterP * pimpl;
112};
113
114/* **************************************************************************
115 * *** SoShaderParameter1f ***
116 * **************************************************************************/
117
118class COIN_DLL_API SoShaderParameter1f : public SoUniformShaderParameter {
119 typedef SoUniformShaderParameter inherited;
120 SO_NODE_HEADER(SoShaderParameter1f);
121
122public:
124 SoShaderParameter1f();
125
126 SoINTERNAL public:
127 static void initClass();
128 virtual void updateParameter(SoGLShaderObject *shaderObject);
129
130protected:
131 virtual ~SoShaderParameter1f();
132};
133
134/* **************************************************************************
135 * *** SoShaderParameter1i ***
136 * **************************************************************************/
137
138class COIN_DLL_API SoShaderParameter1i : public SoUniformShaderParameter {
139 typedef SoUniformShaderParameter inherited;
140 SO_NODE_HEADER(SoShaderParameter1i);
141
142public:
144 SoShaderParameter1i();
145
146 SoINTERNAL public:
147 static void initClass();
148 virtual void updateParameter(SoGLShaderObject *shaderObject);
149
150protected:
151 virtual ~SoShaderParameter1i();
152};
153
154/* **************************************************************************
155 * *** SoShaderParameter2f ***
156 * **************************************************************************/
157
158class COIN_DLL_API SoShaderParameter2f : public SoUniformShaderParameter {
159 typedef SoUniformShaderParameter inherited;
160 SO_NODE_HEADER(SoShaderParameter2f);
161
162public:
164 SoShaderParameter2f();
165
166 SoINTERNAL public:
167 static void initClass();
168 virtual void updateParameter(SoGLShaderObject *shaderObject);
169
170protected:
171 virtual ~SoShaderParameter2f();
172};
173
174/* **************************************************************************
175 * *** SoShaderParameter2i ***
176 * **************************************************************************/
177
178class COIN_DLL_API SoShaderParameter2i : public SoUniformShaderParameter {
179 typedef SoUniformShaderParameter inherited;
180 SO_NODE_HEADER(SoShaderParameter2i);
181
182public:
184 SoShaderParameter2i();
185
186 SoINTERNAL public:
187 static void initClass();
188 virtual void updateParameter(SoGLShaderObject *shaderObject);
189
190protected:
191 virtual ~SoShaderParameter2i();
192};
193
194/* **************************************************************************
195 * *** SoShaderParameter3f ***
196 * **************************************************************************/
197
198class COIN_DLL_API SoShaderParameter3f : public SoUniformShaderParameter {
199 typedef SoUniformShaderParameter inherited;
200 SO_NODE_HEADER(SoShaderParameter3f);
201
202public:
204
205 SoShaderParameter3f();
206
207 SoINTERNAL public:
208 static void initClass();
209 virtual void updateParameter(SoGLShaderObject *shaderObject);
210
211protected:
212 virtual ~SoShaderParameter3f();
213};
214
215/* **************************************************************************
216 * *** SoShaderParameter3i ***
217 * **************************************************************************/
218
219class COIN_DLL_API SoShaderParameter3i : public SoUniformShaderParameter {
220 typedef SoUniformShaderParameter inherited;
221 SO_NODE_HEADER(SoShaderParameter3i);
222
223public:
225
226 SoShaderParameter3i();
227
228 SoINTERNAL public:
229 static void initClass();
230 virtual void updateParameter(SoGLShaderObject *shaderObject);
231
232protected:
233 virtual ~SoShaderParameter3i();
234};
235
236/* **************************************************************************
237 * *** SoShaderParameter4f ***
238 * **************************************************************************/
239
240class COIN_DLL_API SoShaderParameter4f : public SoUniformShaderParameter {
241 typedef SoUniformShaderParameter inherited;
242 SO_NODE_HEADER(SoShaderParameter4f);
243
244public:
246
247 SoShaderParameter4f();
248
249 SoINTERNAL public:
250 static void initClass();
251 virtual void updateParameter(SoGLShaderObject *shaderObject);
252
253protected:
254 virtual ~SoShaderParameter4f();
255};
256
257/* **************************************************************************
258 * *** SoShaderParameter4i ***
259 * **************************************************************************/
260
261class COIN_DLL_API SoShaderParameter4i : public SoUniformShaderParameter {
262 typedef SoUniformShaderParameter inherited;
263 SO_NODE_HEADER(SoShaderParameter4i);
264
265public:
267
268 SoShaderParameter4i();
269
270 SoINTERNAL public:
271 static void initClass();
272 virtual void updateParameter(SoGLShaderObject *shaderObject);
273
274protected:
275 virtual ~SoShaderParameter4i();
276};
277
278/* **************************************************************************
279 * *** SoShaderParameterArray1f ***
280 * **************************************************************************/
281
282class COIN_DLL_API SoShaderParameterArray1f : public SoUniformShaderParameter {
283 typedef SoUniformShaderParameter inherited;
284 SO_NODE_HEADER(SoShaderParameterArray1f);
285
286public:
288
289 SoShaderParameterArray1f();
290
291 SoINTERNAL public:
292 static void initClass();
293 virtual void updateParameter(SoGLShaderObject *shaderObject);
294
295protected:
296 virtual ~SoShaderParameterArray1f();
297};
298
299/* **************************************************************************
300 * *** SoShaderParameterArray1i ***
301 * **************************************************************************/
302
303class COIN_DLL_API SoShaderParameterArray1i : public SoUniformShaderParameter {
304 typedef SoUniformShaderParameter inherited;
305 SO_NODE_HEADER(SoShaderParameterArray1i);
306
307public:
309
310 SoShaderParameterArray1i();
311
312 SoINTERNAL public:
313 static void initClass();
314 virtual void updateParameter(SoGLShaderObject *shaderObject);
315
316protected:
317 virtual ~SoShaderParameterArray1i();
318};
319
320/* **************************************************************************
321 * *** SoShaderParameterArray2f ***
322 * **************************************************************************/
323
324class COIN_DLL_API SoShaderParameterArray2f : public SoUniformShaderParameter {
325 typedef SoUniformShaderParameter inherited;
326 SO_NODE_HEADER(SoShaderParameterArray2f);
327
328public:
330
331 SoShaderParameterArray2f();
332
333 SoINTERNAL public:
334 static void initClass();
335 virtual void updateParameter(SoGLShaderObject *shaderObject);
336
337protected:
338 virtual ~SoShaderParameterArray2f();
339};
340
341/* **************************************************************************
342 * *** SoShaderParameterArray2i ***
343 * **************************************************************************/
344class COIN_DLL_API SoShaderParameterArray2i : public SoUniformShaderParameter {
345 typedef SoUniformShaderParameter inherited;
346 SO_NODE_HEADER(SoShaderParameterArray2i);
347
348public:
350
351 SoShaderParameterArray2i();
352
353 SoINTERNAL public:
354 static void initClass();
355 virtual void updateParameter(SoGLShaderObject *shaderObject);
356
357protected:
358 virtual ~SoShaderParameterArray2i();
359};
360
361/* **************************************************************************
362 * *** SoShaderParameterArray3f ***
363 * **************************************************************************/
364
365class COIN_DLL_API SoShaderParameterArray3f : public SoUniformShaderParameter {
366 typedef SoUniformShaderParameter inherited;
367 SO_NODE_HEADER(SoShaderParameterArray3f);
368
369public:
371
372 SoShaderParameterArray3f();
373
374 SoINTERNAL public:
375 static void initClass();
376 virtual void updateParameter(SoGLShaderObject *shaderObject);
377
378protected:
379 virtual ~SoShaderParameterArray3f();
380};
381
382/* **************************************************************************
383 * *** SoShaderParameterArray3i ***
384 * **************************************************************************/
385
386class COIN_DLL_API SoShaderParameterArray3i : public SoUniformShaderParameter {
387 typedef SoUniformShaderParameter inherited;
388 SO_NODE_HEADER(SoShaderParameterArray3i);
389
390public:
392
393 SoShaderParameterArray3i();
394
395 SoINTERNAL public:
396 static void initClass();
397 virtual void updateParameter(SoGLShaderObject *shaderObject);
398
399protected:
400 virtual ~SoShaderParameterArray3i();
401};
402
403/* **************************************************************************
404 * *** SoShaderParameterArray4f ***
405 * **************************************************************************/
406
407class COIN_DLL_API SoShaderParameterArray4f : public SoUniformShaderParameter {
408 typedef SoUniformShaderParameter inherited;
409 SO_NODE_HEADER(SoShaderParameterArray4f);
410
411public:
413
414 SoShaderParameterArray4f();
415
416 SoINTERNAL public:
417 static void initClass();
418 virtual void updateParameter(SoGLShaderObject *shaderObject);
419
420protected:
421 virtual ~SoShaderParameterArray4f();
422
423};
424
425/* **************************************************************************
426 * *** SoShaderParameterArray4i ***
427 * **************************************************************************/
428
429class COIN_DLL_API SoShaderParameterArray4i : public SoUniformShaderParameter {
430 typedef SoUniformShaderParameter inherited;
431 SO_NODE_HEADER(SoShaderParameterArray4i);
432
433public:
434 SoMFVec4i32 value;
435
436 SoShaderParameterArray4i();
437
438 SoINTERNAL public:
439 static void initClass();
440 virtual void updateParameter(SoGLShaderObject *shaderObject);
441
442protected:
443 virtual ~SoShaderParameterArray4i();
444};
445
446/* **************************************************************************
447 * *** SoShaderParameterMatrix ***
448 * **************************************************************************/
449
450class COIN_DLL_API SoShaderParameterMatrix : public SoUniformShaderParameter {
451 typedef SoUniformShaderParameter inherited;
452 SO_NODE_HEADER(SoShaderParameterMatrix);
453
454public:
456
457 SoShaderParameterMatrix();
458
459 SoINTERNAL public:
460 static void initClass();
461 virtual void updateParameter(SoGLShaderObject *shaderObject);
462
463protected:
464 virtual ~SoShaderParameterMatrix();
465};
466
467/* **************************************************************************
468 * *** SoShaderParameterMatrixArray ***
469 * **************************************************************************/
470
471class COIN_DLL_API SoShaderParameterMatrixArray : public SoUniformShaderParameter {
472 typedef SoUniformShaderParameter inherited;
473 SO_NODE_HEADER(SoShaderParameterMatrixArray);
474
475public:
477
478 SoShaderParameterMatrixArray();
479
480 SoINTERNAL public:
481 static void initClass();
482 virtual void updateParameter(SoGLShaderObject *shaderObject);
483
484protected:
485 virtual ~SoShaderParameterMatrixArray();
486};
487
488/* **************************************************************************
489 * *** SoShaderStateMatrixParameter ***
490 * **************************************************************************/
491
492class COIN_DLL_API SoShaderStateMatrixParameter : public SoUniformShaderParameter {
493 typedef SoUniformShaderParameter inherited;
494 SO_NODE_HEADER(SoShaderStateMatrixParameter);
495
496public:
497
499 MODELVIEW,
500 PROJECTION,
501 TEXTURE,
502 MODELVIEW_PROJECTION
503 };
504
506 IDENTITY,
507 TRANSPOSE,
508 INVERSE,
509 INVERSE_TRANSPOSE
510 };
511
514
515 SoShaderStateMatrixParameter();
516 virtual ~SoShaderStateMatrixParameter();
517
518 static void initClass(void);
519 virtual void updateParameter(SoGLShaderObject *shaderObject);
520 virtual void updateValue(SoState *state);
521
522protected:
523 // Unlike in other parameter classes, here value is not a field because
524 // it is updated dynamically from the state.
525 SbMatrix value;
526};
527
528#endif /* ! COIN_SOSHADERPARAMETER_H */
The SbMatrix class is a 4x4 dimensional representation of a matrix.
Definition SbMatrix.h:47
The SoMFFloat class is a container for floating point values.
Definition SoMFFloat.h:39
The SoMFInt32 class is a container for 32-bit integer values.
Definition SoMFInt32.h:39
The SoMFMatrix class is a container for SbMatrix values.
Definition SoMFMatrix.h:40
The SoMFVec2f class is a container for SbVec2f vectors.
Definition SoMFVec2f.h:40
The SoMFVec2i32 class is a container for SbVec2i32 vectors.
Definition SoMFVec2i32.h:40
The SoMFVec3f class is a container for SbVec3f vectors.
Definition SoMFVec3f.h:40
The SoMFVec3i32 class is a container for SbVec3i32 vectors.
Definition SoMFVec3i32.h:40
The SoMFVec4f class is a container for SbVec4f vectors.
Definition SoMFVec4f.h:40
The SoMFVec4i32 class is a container for SbVec4i32 vectors.
Definition SoMFVec4i32.h:40
SoNode(void)
Definition SoNode.cpp:417
static void initClass(void)
Sets up initialization for data common to all instances of this class, like submitting necessary info...
Definition SoNode.cpp:573
The SoSFEnum class is a container for an enum value.
Definition SoSFEnum.h:40
The SoSFFloat class is a container for a floating point value.
Definition SoSFFloat.h:39
The SoSFInt32 class is a container for a 32-bit integer value.
Definition SoSFInt32.h:39
The SoSFMatrix class is a container for an SbMatrix.
Definition SoSFMatrix.h:40
The SoSFString class is a container for an SbString.
Definition SoSFString.h:40
The SoSFVec2f class is a container for an SbVec2f vector.
Definition SoSFVec2f.h:40
The SoSFVec2i32 class is a container for an SbVec2i32 vector.
Definition SoSFVec2i32.h:40
The SoSFVec3f class is a container for an SbVec3f vector.
Definition SoSFVec3f.h:40
The SoSFVec3i32 class is a container for an SbVec3i32 vector.
Definition SoSFVec3i32.h:40
The SoSFVec4f class is a container for an SbVec4f vector.
Definition SoSFVec4f.h:40
The SoSFVec4i32 class is a container for an SbVec4i32 vector.
Definition SoSFVec4i32.h:40
SoSFFloat value
Definition SoShaderParameter.h:123
virtual void updateParameter(SoGLShaderObject *shaderObject)
Updates the shader parameter in the OpenGL state with the content of the value field.
Definition SoShaderParameter.cpp:520
virtual void updateParameter(SoGLShaderObject *shaderObject)
Updates the shader parameter in the OpenGL state with the content of the value field.
Definition SoShaderParameter.cpp:1066
SoSFInt32 value
Definition SoShaderParameter.h:143
virtual void updateParameter(SoGLShaderObject *shaderObject)
Updates the shader parameter in the OpenGL state with the content of the value field.
Definition SoShaderParameter.cpp:555
SoSFVec2f value
Definition SoShaderParameter.h:163
virtual void updateParameter(SoGLShaderObject *shaderObject)
Updates the shader parameter in the OpenGL state with the content of the value field.
Definition SoShaderParameter.cpp:1102
SoSFVec2i32 value
Definition SoShaderParameter.h:183
SoSFVec3f value
Definition SoShaderParameter.h:203
virtual void updateParameter(SoGLShaderObject *shaderObject)
Updates the shader parameter in the OpenGL state with the content of the value field.
Definition SoShaderParameter.cpp:590
SoSFVec3i32 value
Definition SoShaderParameter.h:224
virtual void updateParameter(SoGLShaderObject *shaderObject)
Updates the shader parameter in the OpenGL state with the content of the value field.
Definition SoShaderParameter.cpp:1138
virtual void updateParameter(SoGLShaderObject *shaderObject)
Updates the shader parameter in the OpenGL state with the content of the value field.
Definition SoShaderParameter.cpp:625
SoSFVec4f value
Definition SoShaderParameter.h:245
SoSFVec4i32 value
Definition SoShaderParameter.h:266
virtual void updateParameter(SoGLShaderObject *shaderObject)
Updates the shader parameter in the OpenGL state with the content of the value field.
Definition SoShaderParameter.cpp:1174
SoMFFloat value
Definition SoShaderParameter.h:287
virtual void updateParameter(SoGLShaderObject *shaderObject)
Updates the shader parameter in the OpenGL state with the content of the value field.
Definition SoShaderParameter.cpp:796
virtual void updateParameter(SoGLShaderObject *shaderObject)
Updates the shader parameter in the OpenGL state with the content of the value field.
Definition SoShaderParameter.cpp:1210
SoMFInt32 value
Definition SoShaderParameter.h:308
SoMFVec2f value
Definition SoShaderParameter.h:329
virtual void updateParameter(SoGLShaderObject *shaderObject)
Updates the shader parameter in the OpenGL state with the content of the value field.
Definition SoShaderParameter.cpp:831
virtual void updateParameter(SoGLShaderObject *shaderObject)
Updates the shader parameter in the OpenGL state with the content of the value field.
Definition SoShaderParameter.cpp:1247
SoMFVec2i32 value
Definition SoShaderParameter.h:349
SoMFVec3f value
Definition SoShaderParameter.h:370
virtual void updateParameter(SoGLShaderObject *shaderObject)
Updates the shader parameter in the OpenGL state with the content of the value field.
Definition SoShaderParameter.cpp:878
SoMFVec3i32 value
Definition SoShaderParameter.h:391
virtual void updateParameter(SoGLShaderObject *shaderObject)
Updates the shader parameter in the OpenGL state with the content of the value field.
Definition SoShaderParameter.cpp:1284
virtual void updateParameter(SoGLShaderObject *shaderObject)
Updates the shader parameter in the OpenGL state with the content of the value field.
Definition SoShaderParameter.cpp:925
SoMFVec4f value
Definition SoShaderParameter.h:412
virtual void updateParameter(SoGLShaderObject *shaderObject)
Updates the shader parameter in the OpenGL state with the content of the value field.
Definition SoShaderParameter.cpp:1321
SoMFMatrix value
Definition SoShaderParameter.h:476
virtual void updateParameter(SoGLShaderObject *shaderObject)
Updates the shader parameter in the OpenGL state with the content of the value field.
Definition SoShaderParameter.cpp:1014
SoSFMatrix value
Definition SoShaderParameter.h:455
virtual void updateParameter(SoGLShaderObject *shaderObject)
Updates the shader parameter in the OpenGL state with the content of the value field.
Definition SoShaderParameter.cpp:977
SoShaderParameter()
Definition SoShaderParameter.cpp:403
SoSFString name
Definition SoShaderParameter.h:79
SoSFInt32 identifier
Definition SoShaderParameter.h:80
SoSFEnum matrixType
Definition SoShaderParameter.h:512
virtual void updateValue(SoState *state)
Definition SoShaderParameter.cpp:739
MatrixTransform
Definition SoShaderParameter.h:505
virtual void updateParameter(SoGLShaderObject *shaderObject)
Updates the shader parameter in the OpenGL state with the content of the value field.
Definition SoShaderParameter.cpp:696
MatrixType
Definition SoShaderParameter.h:498
SoSFEnum matrixTransform
Definition SoShaderParameter.h:513
The SoState class manages the Coin scene graph traversal state data.
Definition SoState.h:44
virtual void updateParameter(SoGLShaderObject *shaderObject)=0
Updates the shader parameter in the OpenGL state with the content of the value field.
#define SO_NODE_ABSTRACT_HEADER(classname)
Definition Coin_macros.dox:61
#define SO_NODE_HEADER(classname)
Definition Coin_macros.dox:50