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

Copyright © by Kongsberg Oil & Gas Technologies. All rights reserved.

Generated for Coin by Doxygen