Coin Logo http://www.sim.no
http://www.coin3d.org

SoShaderParameter.h
1 #ifndef COIN_SOSHADERPARAMETER_H
2 #define COIN_SOSHADERPARAMETER_H
3 
4 /**************************************************************************\
5  *
6  * This file is part of the Coin 3D visualization library.
7  * Copyright (C) 1998-2007 by Systems in Motion. All rights reserved.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * ("GPL") version 2 as published by the Free Software Foundation.
12  * See the file LICENSE.GPL at the root directory of this source
13  * distribution for additional information about the GNU GPL.
14  *
15  * For using Coin with software that can not be combined with the GNU
16  * GPL, and for taking advantage of the additional benefits of our
17  * support services, please contact Systems in Motion about acquiring
18  * a Coin Professional Edition License.
19  *
20  * See http://www.coin3d.org/ for more information.
21  *
22  * Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
23  * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24  *
25 \**************************************************************************/
26 
27 #include <Inventor/nodes/SoNode.h>
28 #include <Inventor/nodes/SoSubNode.h>
29 #include <Inventor/fields/SoSFString.h>
30 #include <Inventor/fields/SoSFFloat.h>
31 #include <Inventor/fields/SoSFInt32.h>
32 #include <Inventor/fields/SoSFVec2f.h>
33 #include <Inventor/fields/SoSFVec3f.h>
34 #include <Inventor/fields/SoSFVec4f.h>
35 #include <Inventor/fields/SoMFFloat.h>
36 #include <Inventor/fields/SoMFInt32.h>
37 #include <Inventor/fields/SoMFVec2f.h>
38 #include <Inventor/fields/SoMFVec3f.h>
39 #include <Inventor/fields/SoMFVec4f.h>
40 #include <Inventor/fields/SoSFMatrix.h>
41 #include <Inventor/fields/SoMFMatrix.h>
42 #include <Inventor/fields/SoSFNode.h>
43 #include <Inventor/fields/SoSFEnum.h>
44 #include <Inventor/fields/SoSFImage.h>
45 
46 #include <Inventor/fields/SoSFVec2i32.h>
47 #include <Inventor/fields/SoSFVec3i32.h>
48 #include <Inventor/fields/SoSFVec4i32.h>
49 #include <Inventor/fields/SoMFVec2i32.h>
50 #include <Inventor/fields/SoMFVec3i32.h>
51 #include <Inventor/fields/SoMFVec4i32.h>
52 
53 class SoGLShaderParameter;
54 class SoGLShaderObject;
55 
56 // *************************************************************************
57 
58 // FIXME: split to one header file for each class? 20050120 mortene.
59 
60 /* **************************************************************************
61  * *** SoShaderParameter ***
62  * **************************************************************************/
63 
64 class COIN_DLL_API SoShaderParameter : public SoNode {
65  typedef SoNode inherited;
66  SO_NODE_ABSTRACT_HEADER(SoShaderParameter);
67 
68 public:
69  SoSFString name;
70  SoSFInt32 identifier;
71 
72  SoINTERNAL public:
73  static void initClass();
74 
75 protected:
76  SoShaderParameter();
77  virtual ~SoShaderParameter();
78 };
79 
80 /* **************************************************************************
81  * *** SoUniformShaderParameter ***
82  * **************************************************************************/
83 class SoUniformShaderParameterP;
84 
85 class COIN_DLL_API SoUniformShaderParameter : public SoShaderParameter {
86  typedef SoShaderParameter inherited;
87  SO_NODE_ABSTRACT_HEADER(SoUniformShaderParameter);
88 
89  SoINTERNAL public:
90  static void initClass(void);
91  virtual void updateParameter(SoGLShaderObject *shaderObject) = 0;
92  SbBool isRegularBehavior() const { return isRegularBehaviorFlag; }
93 
94 protected:
95  SoUniformShaderParameter();
96  virtual ~SoUniformShaderParameter();
97 
98  SbBool isRegularBehaviorFlag;
99 
100  SoGLShaderParameter * getGLShaderParameter(const uint32_t cachecontext);
101  void ensureParameter(SoGLShaderObject * shader);
102 
103 private:
104  SoUniformShaderParameterP * pimpl;
105 };
106 
107 /* **************************************************************************
108  * *** SoShaderParameter1f ***
109  * **************************************************************************/
110 
111 class COIN_DLL_API SoShaderParameter1f : public SoUniformShaderParameter {
112  typedef SoUniformShaderParameter inherited;
113  SO_NODE_HEADER(SoShaderParameter1f);
114 
115 public:
116  SoSFFloat value;
117  SoShaderParameter1f();
118 
119  SoINTERNAL public:
120  static void initClass();
121  virtual void updateParameter(SoGLShaderObject *shaderObject);
122 
123 protected:
124  virtual ~SoShaderParameter1f();
125 };
126 
127 /* **************************************************************************
128  * *** SoShaderParameter1i ***
129  * **************************************************************************/
130 
131 class COIN_DLL_API SoShaderParameter1i : public SoUniformShaderParameter {
132  typedef SoUniformShaderParameter inherited;
133  SO_NODE_HEADER(SoShaderParameter1i);
134 
135 public:
136  SoSFInt32 value;
137  SoShaderParameter1i();
138 
139  SoINTERNAL public:
140  static void initClass();
141  virtual void updateParameter(SoGLShaderObject *shaderObject);
142 
143 protected:
144  virtual ~SoShaderParameter1i();
145 };
146 
147 /* **************************************************************************
148  * *** SoShaderParameter2f ***
149  * **************************************************************************/
150 
151 class COIN_DLL_API SoShaderParameter2f : public SoUniformShaderParameter {
152  typedef SoUniformShaderParameter inherited;
153  SO_NODE_HEADER(SoShaderParameter2f);
154 
155 public:
156  SoSFVec2f value;
157  SoShaderParameter2f();
158 
159  SoINTERNAL public:
160  static void initClass();
161  virtual void updateParameter(SoGLShaderObject *shaderObject);
162 
163 protected:
164  virtual ~SoShaderParameter2f();
165 };
166 
167 /* **************************************************************************
168  * *** SoShaderParameter2i ***
169  * **************************************************************************/
170 
171 class COIN_DLL_API SoShaderParameter2i : public SoUniformShaderParameter {
172  typedef SoUniformShaderParameter inherited;
173  SO_NODE_HEADER(SoShaderParameter2i);
174 
175 public:
176  SoSFVec2i32 value;
177  SoShaderParameter2i();
178 
179  SoINTERNAL public:
180  static void initClass();
181  virtual void updateParameter(SoGLShaderObject *shaderObject);
182 
183 protected:
184  virtual ~SoShaderParameter2i();
185 };
186 
187 /* **************************************************************************
188  * *** SoShaderParameter3f ***
189  * **************************************************************************/
190 
191 class COIN_DLL_API SoShaderParameter3f : public SoUniformShaderParameter {
192  typedef SoUniformShaderParameter inherited;
193  SO_NODE_HEADER(SoShaderParameter3f);
194 
195 public:
196  SoSFVec3f value;
197 
198  SoShaderParameter3f();
199 
200  SoINTERNAL public:
201  static void initClass();
202  virtual void updateParameter(SoGLShaderObject *shaderObject);
203 
204 protected:
205  virtual ~SoShaderParameter3f();
206 };
207 
208 /* **************************************************************************
209  * *** SoShaderParameter3i ***
210  * **************************************************************************/
211 
212 class COIN_DLL_API SoShaderParameter3i : public SoUniformShaderParameter {
213  typedef SoUniformShaderParameter inherited;
214  SO_NODE_HEADER(SoShaderParameter3i);
215 
216 public:
217  SoSFVec3i32 value;
218 
219  SoShaderParameter3i();
220 
221  SoINTERNAL public:
222  static void initClass();
223  virtual void updateParameter(SoGLShaderObject *shaderObject);
224 
225 protected:
226  virtual ~SoShaderParameter3i();
227 };
228 
229 /* **************************************************************************
230  * *** SoShaderParameter4f ***
231  * **************************************************************************/
232 
233 class COIN_DLL_API SoShaderParameter4f : public SoUniformShaderParameter {
234  typedef SoUniformShaderParameter inherited;
235  SO_NODE_HEADER(SoShaderParameter4f);
236 
237 public:
238  SoSFVec4f value;
239 
240  SoShaderParameter4f();
241 
242  SoINTERNAL public:
243  static void initClass();
244  virtual void updateParameter(SoGLShaderObject *shaderObject);
245 
246 protected:
247  virtual ~SoShaderParameter4f();
248 };
249 
250 /* **************************************************************************
251  * *** SoShaderParameter4i ***
252  * **************************************************************************/
253 
254 class COIN_DLL_API SoShaderParameter4i : public SoUniformShaderParameter {
255  typedef SoUniformShaderParameter inherited;
256  SO_NODE_HEADER(SoShaderParameter4i);
257 
258 public:
259  SoSFVec4i32 value;
260 
261  SoShaderParameter4i();
262 
263  SoINTERNAL public:
264  static void initClass();
265  virtual void updateParameter(SoGLShaderObject *shaderObject);
266 
267 protected:
268  virtual ~SoShaderParameter4i();
269 };
270 
271 /* **************************************************************************
272  * *** SoShaderParameterArray1f ***
273  * **************************************************************************/
274 
275 class COIN_DLL_API SoShaderParameterArray1f : public SoUniformShaderParameter {
276  typedef SoUniformShaderParameter inherited;
277  SO_NODE_HEADER(SoShaderParameterArray1f);
278 
279 public:
280  SoMFFloat value;
281 
282  SoShaderParameterArray1f();
283 
284  SoINTERNAL public:
285  static void initClass();
286  virtual void updateParameter(SoGLShaderObject *shaderObject);
287 
288 protected:
289  virtual ~SoShaderParameterArray1f();
290 };
291 
292 /* **************************************************************************
293  * *** SoShaderParameterArray1i ***
294  * **************************************************************************/
295 
296 class COIN_DLL_API SoShaderParameterArray1i : public SoUniformShaderParameter {
297  typedef SoUniformShaderParameter inherited;
298  SO_NODE_HEADER(SoShaderParameterArray1i);
299 
300 public:
301  SoMFInt32 value;
302 
303  SoShaderParameterArray1i();
304 
305  SoINTERNAL public:
306  static void initClass();
307  virtual void updateParameter(SoGLShaderObject *shaderObject);
308 
309 protected:
310  virtual ~SoShaderParameterArray1i();
311 };
312 
313 /* **************************************************************************
314  * *** SoShaderParameterArray2f ***
315  * **************************************************************************/
316 
317 class COIN_DLL_API SoShaderParameterArray2f : public SoUniformShaderParameter {
318  typedef SoUniformShaderParameter inherited;
319  SO_NODE_HEADER(SoShaderParameterArray2f);
320 
321 public:
322  SoMFVec2f value;
323 
324  SoShaderParameterArray2f();
325 
326  SoINTERNAL public:
327  static void initClass();
328  virtual void updateParameter(SoGLShaderObject *shaderObject);
329 
330 protected:
331  virtual ~SoShaderParameterArray2f();
332 };
333 
334 /* **************************************************************************
335  * *** SoShaderParameterArray2i ***
336  * **************************************************************************/
337 class COIN_DLL_API SoShaderParameterArray2i : public SoUniformShaderParameter {
338  typedef SoUniformShaderParameter inherited;
339  SO_NODE_HEADER(SoShaderParameterArray2i);
340 
341 public:
342  SoMFVec2i32 value;
343 
344  SoShaderParameterArray2i();
345 
346  SoINTERNAL public:
347  static void initClass();
348  virtual void updateParameter(SoGLShaderObject *shaderObject);
349 
350 protected:
351  virtual ~SoShaderParameterArray2i();
352 };
353 
354 /* **************************************************************************
355  * *** SoShaderParameterArray3f ***
356  * **************************************************************************/
357 
358 class COIN_DLL_API SoShaderParameterArray3f : public SoUniformShaderParameter {
359  typedef SoUniformShaderParameter inherited;
360  SO_NODE_HEADER(SoShaderParameterArray3f);
361 
362 public:
363  SoMFVec3f value;
364 
365  SoShaderParameterArray3f();
366 
367  SoINTERNAL public:
368  static void initClass();
369  virtual void updateParameter(SoGLShaderObject *shaderObject);
370 
371 protected:
372  virtual ~SoShaderParameterArray3f();
373 };
374 
375 /* **************************************************************************
376  * *** SoShaderParameterArray3i ***
377  * **************************************************************************/
378 
379 class COIN_DLL_API SoShaderParameterArray3i : public SoUniformShaderParameter {
380  typedef SoUniformShaderParameter inherited;
381  SO_NODE_HEADER(SoShaderParameterArray3i);
382 
383 public:
384  SoMFVec3i32 value;
385 
386  SoShaderParameterArray3i();
387 
388  SoINTERNAL public:
389  static void initClass();
390  virtual void updateParameter(SoGLShaderObject *shaderObject);
391 
392 protected:
393  virtual ~SoShaderParameterArray3i();
394 };
395 
396 /* **************************************************************************
397  * *** SoShaderParameterArray4f ***
398  * **************************************************************************/
399 
400 class COIN_DLL_API SoShaderParameterArray4f : public SoUniformShaderParameter {
401  typedef SoUniformShaderParameter inherited;
402  SO_NODE_HEADER(SoShaderParameterArray4f);
403 
404 public:
405  SoMFVec4f value;
406 
407  SoShaderParameterArray4f();
408 
409  SoINTERNAL public:
410  static void initClass();
411  virtual void updateParameter(SoGLShaderObject *shaderObject);
412 
413 protected:
414  virtual ~SoShaderParameterArray4f();
415 
416 };
417 
418 /* **************************************************************************
419  * *** SoShaderParameterArray4i ***
420  * **************************************************************************/
421 
422 class COIN_DLL_API SoShaderParameterArray4i : public SoUniformShaderParameter {
423  typedef SoUniformShaderParameter inherited;
424  SO_NODE_HEADER(SoShaderParameterArray4i);
425 
426 public:
427  SoMFVec4i32 value;
428 
429  SoShaderParameterArray4i();
430 
431  SoINTERNAL public:
432  static void initClass();
433  virtual void updateParameter(SoGLShaderObject *shaderObject);
434 
435 protected:
436  virtual ~SoShaderParameterArray4i();
437 };
438 
439 /* **************************************************************************
440  * *** SoShaderParameterMatrix ***
441  * **************************************************************************/
442 
443 class COIN_DLL_API SoShaderParameterMatrix : public SoUniformShaderParameter {
444  typedef SoUniformShaderParameter inherited;
445  SO_NODE_HEADER(SoShaderParameterMatrix);
446 
447 public:
448  SoSFMatrix value;
449 
450  SoShaderParameterMatrix();
451 
452  SoINTERNAL public:
453  static void initClass();
454  virtual void updateParameter(SoGLShaderObject *shaderObject);
455 
456 protected:
457  virtual ~SoShaderParameterMatrix();
458 };
459 
460 /* **************************************************************************
461  * *** SoShaderParameterMatrixArray ***
462  * **************************************************************************/
463 
464 class COIN_DLL_API SoShaderParameterMatrixArray : public SoUniformShaderParameter {
465  typedef SoUniformShaderParameter inherited;
466  SO_NODE_HEADER(SoShaderParameterMatrixArray);
467 
468 public:
469  SoMFMatrix value;
470 
471  SoShaderParameterMatrixArray();
472 
473  SoINTERNAL public:
474  static void initClass();
475  virtual void updateParameter(SoGLShaderObject *shaderObject);
476 
477 protected:
478  virtual ~SoShaderParameterMatrixArray();
479 };
480 
481 /* **************************************************************************
482  * *** SoShaderStateMatrixParameter ***
483  * **************************************************************************/
484 
485 class COIN_DLL_API SoShaderStateMatrixParameter : public SoUniformShaderParameter {
486  typedef SoUniformShaderParameter inherited;
487  SO_NODE_HEADER(SoShaderStateMatrixParameter);
488 
489 public:
490 
491  enum MatrixType {
492  MODELVIEW,
493  PROJECTION,
494  TEXTURE,
495  MODELVIEW_PROJECTION
496  };
497 
498  enum MatrixTransform{
499  IDENTITY,
500  TRANSPOSE,
501  INVERSE,
502  INVERSE_TRANSPOSE
503  };
504 
505  SoSFEnum matrixType;
506  SoSFEnum matrixTransform;
507 
508  SoShaderStateMatrixParameter();
509  virtual ~SoShaderStateMatrixParameter();
510 
511  static void initClass(void);
512  virtual void updateParameter(SoGLShaderObject *shaderObject);
513 };
514 
515 #endif /* ! COIN_SOSHADERPARAMETER_H */
The SoMFFloat class is a container for floating point values.This field is used where nodes...
Definition: SoMFFloat.h:30
The SoMFVec2i32 class is a container for SbVec2i32 vectors.This field is used where nodes...
Definition: SoMFVec2i32.h:31
The SoMFVec3i32 class is a container for SbVec3i32 vectors.This field is used where nodes...
Definition: SoMFVec3i32.h:31
The SoMFVec4i32 class is a container for SbVec4i32 vectors.This field is used where nodes...
Definition: SoMFVec4i32.h:31
The SoSFVec4f class is a container for an SbVec4f vector.This field is used where nodes...
Definition: SoSFVec4f.h:31
The SoSFVec2i32 class is a container for an SbVec2i32 vector.This field is used where nodes...
Definition: SoSFVec2i32.h:31
The SoSFVec3i32 class is a container for an SbVec3i32 vector.This field is used where nodes...
Definition: SoSFVec3i32.h:31
The SoMFInt32 class is a container for 32-bit integer values.This field is used where nodes...
Definition: SoMFInt32.h:30
The SoSFVec4i32 class is a container for an SbVec4i32 vector.This field is used where nodes...
Definition: SoSFVec4i32.h:31
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:31
The SoSFVec2f class is a container for an SbVec2f vector.This field is used where nodes...
Definition: SoSFVec2f.h:31
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:31
The SoNode class is the base class for nodes used in scene graphs.Coin is a retained mode 3D visualiz...
Definition: SoNode.h:47
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:31
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:31
The SoSFInt32 class is a container for a 32-bit integer value.This field is used where nodes...
Definition: SoSFInt32.h:30
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:31
The SoSFFloat class is a container for a floating point value.This field is used where nodes...
Definition: SoSFFloat.h:30
The SoSFVec3f class is a container for an SbVec3f vector.This field is used where nodes...
Definition: SoSFVec3f.h:31
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:31
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:31

Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.

Generated on Fri Jul 20 2018 for Coin by Doxygen. 1.8.14