Coin  4.0.3
Coin3D core library
Loading...
Searching...
No Matches
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
64class SoState;
65
66// *************************************************************************
67
68// FIXME: split to one header file for each class? 20050120 mortene.
69
70/* **************************************************************************
71 * *** SoShaderParameter ***
72 * **************************************************************************/
73
75 typedef SoNode inherited;
76 SO_NODE_ABSTRACT_HEADER(SoShaderParameter);
77
78public:
81
82 SoINTERNAL public:
83 static void initClass();
84
85protected:
87 virtual ~SoShaderParameter();
88};
89
90/* **************************************************************************
91 * *** SoUniformShaderParameter ***
92 * **************************************************************************/
93class SoUniformShaderParameterP;
94
97 SO_NODE_ABSTRACT_HEADER(SoUniformShaderParameter);
98
99 SoINTERNAL public:
100 static void initClass(void);
101 virtual void updateParameter(SoGLShaderObject *shaderObject) = 0;
102
103protected:
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
120 SO_NODE_HEADER(SoShaderParameter1f);
121
122public:
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
140 SO_NODE_HEADER(SoShaderParameter1i);
141
142public:
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
160 SO_NODE_HEADER(SoShaderParameter2f);
161
162public:
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
180 SO_NODE_HEADER(SoShaderParameter2i);
181
182public:
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
200 SO_NODE_HEADER(SoShaderParameter3f);
201
202public:
204
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
221 SO_NODE_HEADER(SoShaderParameter3i);
222
223public:
225
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
242 SO_NODE_HEADER(SoShaderParameter4f);
243
244public:
246
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
263 SO_NODE_HEADER(SoShaderParameter4i);
264
265public:
267
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
284 SO_NODE_HEADER(SoShaderParameterArray1f);
285
286public:
288
290
291 SoINTERNAL public:
292 static void initClass();
293 virtual void updateParameter(SoGLShaderObject *shaderObject);
294
295protected:
297};
298
299/* **************************************************************************
300 * *** SoShaderParameterArray1i ***
301 * **************************************************************************/
302
305 SO_NODE_HEADER(SoShaderParameterArray1i);
306
307public:
309
311
312 SoINTERNAL public:
313 static void initClass();
314 virtual void updateParameter(SoGLShaderObject *shaderObject);
315
316protected:
318};
319
320/* **************************************************************************
321 * *** SoShaderParameterArray2f ***
322 * **************************************************************************/
323
326 SO_NODE_HEADER(SoShaderParameterArray2f);
327
328public:
330
332
333 SoINTERNAL public:
334 static void initClass();
335 virtual void updateParameter(SoGLShaderObject *shaderObject);
336
337protected:
339};
340
341/* **************************************************************************
342 * *** SoShaderParameterArray2i ***
343 * **************************************************************************/
346 SO_NODE_HEADER(SoShaderParameterArray2i);
347
348public:
350
352
353 SoINTERNAL public:
354 static void initClass();
355 virtual void updateParameter(SoGLShaderObject *shaderObject);
356
357protected:
359};
360
361/* **************************************************************************
362 * *** SoShaderParameterArray3f ***
363 * **************************************************************************/
364
367 SO_NODE_HEADER(SoShaderParameterArray3f);
368
369public:
371
373
374 SoINTERNAL public:
375 static void initClass();
376 virtual void updateParameter(SoGLShaderObject *shaderObject);
377
378protected:
380};
381
382/* **************************************************************************
383 * *** SoShaderParameterArray3i ***
384 * **************************************************************************/
385
388 SO_NODE_HEADER(SoShaderParameterArray3i);
389
390public:
392
394
395 SoINTERNAL public:
396 static void initClass();
397 virtual void updateParameter(SoGLShaderObject *shaderObject);
398
399protected:
401};
402
403/* **************************************************************************
404 * *** SoShaderParameterArray4f ***
405 * **************************************************************************/
406
409 SO_NODE_HEADER(SoShaderParameterArray4f);
410
411public:
413
415
416 SoINTERNAL public:
417 static void initClass();
418 virtual void updateParameter(SoGLShaderObject *shaderObject);
419
420protected:
422
423};
424
425/* **************************************************************************
426 * *** SoShaderParameterArray4i ***
427 * **************************************************************************/
428
431 SO_NODE_HEADER(SoShaderParameterArray4i);
432
433public:
434 SoMFVec4i32 value;
435
437
438 SoINTERNAL public:
439 static void initClass();
440 virtual void updateParameter(SoGLShaderObject *shaderObject);
441
442protected:
444};
445
446/* **************************************************************************
447 * *** SoShaderParameterMatrix ***
448 * **************************************************************************/
449
452 SO_NODE_HEADER(SoShaderParameterMatrix);
453
454public:
456
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
473 SO_NODE_HEADER(SoShaderParameterMatrixArray);
474
475public:
477
479
480 SoINTERNAL public:
481 static void initClass();
482 virtual void updateParameter(SoGLShaderObject *shaderObject);
483
484protected:
486};
487
488/* **************************************************************************
489 * *** SoShaderStateMatrixParameter ***
490 * **************************************************************************/
491
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
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 SbList class is a template container class for lists.
Definition SbList.h:70
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
The SoNode class is the base class for nodes used in scene graphs.
Definition SoNode.h:56
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
The SoShaderParameter1f class is used to define a floating point value as shader parameter.
Definition SoShaderParameter.h:118
SoSFFloat value
Definition SoShaderParameter.h:123
The SoShaderParameter1i class is used to define an integer value as shader parameter.
Definition SoShaderParameter.h:138
SoSFInt32 value
Definition SoShaderParameter.h:143
The SoShaderParameter2f class is used to define a two-dimensional floating point value as shader para...
Definition SoShaderParameter.h:158
SoSFVec2f value
Definition SoShaderParameter.h:163
The SoShaderParameter2i class is used to define a two-dimensional integer value as shader parameter.
Definition SoShaderParameter.h:178
SoSFVec2i32 value
Definition SoShaderParameter.h:183
The SoShaderParameter3f class is used to define a three-dimensional floating point value as shader pa...
Definition SoShaderParameter.h:198
SoSFVec3f value
Definition SoShaderParameter.h:203
The SoShaderParameter3i class is used to define a three-dimensional integer value as shader parameter...
Definition SoShaderParameter.h:219
SoSFVec3i32 value
Definition SoShaderParameter.h:224
The SoShaderParameter4f class is used to define a four-dimensional floating point value as shader par...
Definition SoShaderParameter.h:240
SoSFVec4f value
Definition SoShaderParameter.h:245
The SoShaderParameter4i class is used to define a four-dimensional integer value as shader parameter.
Definition SoShaderParameter.h:261
SoSFVec4i32 value
Definition SoShaderParameter.h:266
The SoShaderParameterArray1f class is used to define a floating point array as shader parameter.
Definition SoShaderParameter.h:282
SoMFFloat value
Definition SoShaderParameter.h:287
The SoShaderParameterArray1i class is used to define an integer array as shader parameter.
Definition SoShaderParameter.h:303
SoMFInt32 value
Definition SoShaderParameter.h:308
The SoShaderParameterArray2f class is used to define a two-dimensional floating point array as shader...
Definition SoShaderParameter.h:324
SoMFVec2f value
Definition SoShaderParameter.h:329
The SoShaderParameterArray2i class is used to define a two-dimensional integer array as shader parame...
Definition SoShaderParameter.h:344
SoMFVec2i32 value
Definition SoShaderParameter.h:349
The SoShaderParameterArray3f class is used to define a three-dimensional floating point array as shad...
Definition SoShaderParameter.h:365
SoMFVec3f value
Definition SoShaderParameter.h:370
The SoShaderParameterArray3i class is used to define a three-dimensional integer array as shader para...
Definition SoShaderParameter.h:386
SoMFVec3i32 value
Definition SoShaderParameter.h:391
The SoShaderParameterArray4f class is used to define a four-dimensional floating point array as shade...
Definition SoShaderParameter.h:407
SoMFVec4f value
Definition SoShaderParameter.h:412
The SoShaderParameterArray4i class is used to define a four-dimensional integer array as shader param...
Definition SoShaderParameter.h:429
The SoShaderParameterMatrixArray class is used to define a matrix array as shader parameter.
Definition SoShaderParameter.h:471
SoMFMatrix value
Definition SoShaderParameter.h:476
The SoShaderParameterMatrix class is used to define a matrix as shader parameter.
Definition SoShaderParameter.h:450
SoSFMatrix value
Definition SoShaderParameter.h:455
The SoShaderParameter class is the base class for all shader parameter classes.
Definition SoShaderParameter.h:74
SoSFString name
Definition SoShaderParameter.h:79
SoSFInt32 identifier
Definition SoShaderParameter.h:80
The SoShaderStateMatrixParameter class is used to define a matrix as shader parameter whose content i...
Definition SoShaderParameter.h:492
SoSFEnum matrixType
Definition SoShaderParameter.h:512
MatrixTransform
Definition SoShaderParameter.h:505
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
The SoUniformShaderParameter class is the base class for all uniform shader variables.
Definition SoShaderParameter.h:95
virtual void updateParameter(SoGLShaderObject *shaderObject)=0
Updates the shader parameter in the OpenGL state with the content of the value field.