| http://www.sim.no/ http://www.coin3d.org/

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

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) by Kongsberg Oil & Gas Technologies.
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 Kongsberg Oil & Gas Technologies
18 * about acquiring a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, 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
93 protected:
94 SoUniformShaderParameter();
95 virtual ~SoUniformShaderParameter();
96
97 SoGLShaderParameter * getGLShaderParameter(const uint32_t cachecontext);
98 void ensureParameter(SoGLShaderObject * shader);
99
100 private:
101 SoUniformShaderParameterP * pimpl;
102 };
103
104 /* **************************************************************************
105 * *** SoShaderParameter1f ***
106 * **************************************************************************/
107
108 class COIN_DLL_API SoShaderParameter1f : public SoUniformShaderParameter {
109 typedef SoUniformShaderParameter inherited;
110 SO_NODE_HEADER(SoShaderParameter1f);
111
112 public:
113 SoSFFloat value;
114 SoShaderParameter1f();
115
116 SoINTERNAL public:
117 static void initClass();
118 virtual void updateParameter(SoGLShaderObject *shaderObject);
119
120 protected:
121 virtual ~SoShaderParameter1f();
122 };
123
124 /* **************************************************************************
125 * *** SoShaderParameter1i ***
126 * **************************************************************************/
127
128 class COIN_DLL_API SoShaderParameter1i : public SoUniformShaderParameter {
129 typedef SoUniformShaderParameter inherited;
130 SO_NODE_HEADER(SoShaderParameter1i);
131
132 public:
133 SoSFInt32 value;
134 SoShaderParameter1i();
135
136 SoINTERNAL public:
137 static void initClass();
138 virtual void updateParameter(SoGLShaderObject *shaderObject);
139
140 protected:
141 virtual ~SoShaderParameter1i();
142 };
143
144 /* **************************************************************************
145 * *** SoShaderParameter2f ***
146 * **************************************************************************/
147
148 class COIN_DLL_API SoShaderParameter2f : public SoUniformShaderParameter {
149 typedef SoUniformShaderParameter inherited;
150 SO_NODE_HEADER(SoShaderParameter2f);
151
152 public:
153 SoSFVec2f value;
154 SoShaderParameter2f();
155
156 SoINTERNAL public:
157 static void initClass();
158 virtual void updateParameter(SoGLShaderObject *shaderObject);
159
160 protected:
161 virtual ~SoShaderParameter2f();
162 };
163
164 /* **************************************************************************
165 * *** SoShaderParameter2i ***
166 * **************************************************************************/
167
168 class COIN_DLL_API SoShaderParameter2i : public SoUniformShaderParameter {
169 typedef SoUniformShaderParameter inherited;
170 SO_NODE_HEADER(SoShaderParameter2i);
171
172 public:
173 SoSFVec2i32 value;
174 SoShaderParameter2i();
175
176 SoINTERNAL public:
177 static void initClass();
178 virtual void updateParameter(SoGLShaderObject *shaderObject);
179
180 protected:
181 virtual ~SoShaderParameter2i();
182 };
183
184 /* **************************************************************************
185 * *** SoShaderParameter3f ***
186 * **************************************************************************/
187
188 class COIN_DLL_API SoShaderParameter3f : public SoUniformShaderParameter {
189 typedef SoUniformShaderParameter inherited;
190 SO_NODE_HEADER(SoShaderParameter3f);
191
192 public:
193 SoSFVec3f value;
194
195 SoShaderParameter3f();
196
197 SoINTERNAL public:
198 static void initClass();
199 virtual void updateParameter(SoGLShaderObject *shaderObject);
200
201 protected:
202 virtual ~SoShaderParameter3f();
203 };
204
205 /* **************************************************************************
206 * *** SoShaderParameter3i ***
207 * **************************************************************************/
208
209 class COIN_DLL_API SoShaderParameter3i : public SoUniformShaderParameter {
210 typedef SoUniformShaderParameter inherited;
211 SO_NODE_HEADER(SoShaderParameter3i);
212
213 public:
214 SoSFVec3i32 value;
215
216 SoShaderParameter3i();
217
218 SoINTERNAL public:
219 static void initClass();
220 virtual void updateParameter(SoGLShaderObject *shaderObject);
221
222 protected:
223 virtual ~SoShaderParameter3i();
224 };
225
226 /* **************************************************************************
227 * *** SoShaderParameter4f ***
228 * **************************************************************************/
229
230 class COIN_DLL_API SoShaderParameter4f : public SoUniformShaderParameter {
231 typedef SoUniformShaderParameter inherited;
232 SO_NODE_HEADER(SoShaderParameter4f);
233
234 public:
235 SoSFVec4f value;
236
237 SoShaderParameter4f();
238
239 SoINTERNAL public:
240 static void initClass();
241 virtual void updateParameter(SoGLShaderObject *shaderObject);
242
243 protected:
244 virtual ~SoShaderParameter4f();
245 };
246
247 /* **************************************************************************
248 * *** SoShaderParameter4i ***
249 * **************************************************************************/
250
251 class COIN_DLL_API SoShaderParameter4i : public SoUniformShaderParameter {
252 typedef SoUniformShaderParameter inherited;
253 SO_NODE_HEADER(SoShaderParameter4i);
254
255 public:
256 SoSFVec4i32 value;
257
258 SoShaderParameter4i();
259
260 SoINTERNAL public:
261 static void initClass();
262 virtual void updateParameter(SoGLShaderObject *shaderObject);
263
264 protected:
265 virtual ~SoShaderParameter4i();
266 };
267
268 /* **************************************************************************
269 * *** SoShaderParameterArray1f ***
270 * **************************************************************************/
271
272 class COIN_DLL_API SoShaderParameterArray1f : public SoUniformShaderParameter {
273 typedef SoUniformShaderParameter inherited;
274 SO_NODE_HEADER(SoShaderParameterArray1f);
275
276 public:
277 SoMFFloat value;
278
279 SoShaderParameterArray1f();
280
281 SoINTERNAL public:
282 static void initClass();
283 virtual void updateParameter(SoGLShaderObject *shaderObject);
284
285 protected:
286 virtual ~SoShaderParameterArray1f();
287 };
288
289 /* **************************************************************************
290 * *** SoShaderParameterArray1i ***
291 * **************************************************************************/
292
293 class COIN_DLL_API SoShaderParameterArray1i : public SoUniformShaderParameter {
294 typedef SoUniformShaderParameter inherited;
295 SO_NODE_HEADER(SoShaderParameterArray1i);
296
297 public:
298 SoMFInt32 value;
299
300 SoShaderParameterArray1i();
301
302 SoINTERNAL public:
303 static void initClass();
304 virtual void updateParameter(SoGLShaderObject *shaderObject);
305
306 protected:
307 virtual ~SoShaderParameterArray1i();
308 };
309
310 /* **************************************************************************
311 * *** SoShaderParameterArray2f ***
312 * **************************************************************************/
313
314 class COIN_DLL_API SoShaderParameterArray2f : public SoUniformShaderParameter {
315 typedef SoUniformShaderParameter inherited;
316 SO_NODE_HEADER(SoShaderParameterArray2f);
317
318 public:
319 SoMFVec2f value;
320
321 SoShaderParameterArray2f();
322
323 SoINTERNAL public:
324 static void initClass();
325 virtual void updateParameter(SoGLShaderObject *shaderObject);
326
327 protected:
328 virtual ~SoShaderParameterArray2f();
329 };
330
331 /* **************************************************************************
332 * *** SoShaderParameterArray2i ***
333 * **************************************************************************/
334 class COIN_DLL_API SoShaderParameterArray2i : public SoUniformShaderParameter {
335 typedef SoUniformShaderParameter inherited;
336 SO_NODE_HEADER(SoShaderParameterArray2i);
337
338 public:
339 SoMFVec2i32 value;
340
341 SoShaderParameterArray2i();
342
343 SoINTERNAL public:
344 static void initClass();
345 virtual void updateParameter(SoGLShaderObject *shaderObject);
346
347 protected:
348 virtual ~SoShaderParameterArray2i();
349 };
350
351 /* **************************************************************************
352 * *** SoShaderParameterArray3f ***
353 * **************************************************************************/
354
355 class COIN_DLL_API SoShaderParameterArray3f : public SoUniformShaderParameter {
356 typedef SoUniformShaderParameter inherited;
357 SO_NODE_HEADER(SoShaderParameterArray3f);
358
359 public:
360 SoMFVec3f value;
361
362 SoShaderParameterArray3f();
363
364 SoINTERNAL public:
365 static void initClass();
366 virtual void updateParameter(SoGLShaderObject *shaderObject);
367
368 protected:
369 virtual ~SoShaderParameterArray3f();
370 };
371
372 /* **************************************************************************
373 * *** SoShaderParameterArray3i ***
374 * **************************************************************************/
375
376 class COIN_DLL_API SoShaderParameterArray3i : public SoUniformShaderParameter {
377 typedef SoUniformShaderParameter inherited;
378 SO_NODE_HEADER(SoShaderParameterArray3i);
379
380 public:
381 SoMFVec3i32 value;
382
383 SoShaderParameterArray3i();
384
385 SoINTERNAL public:
386 static void initClass();
387 virtual void updateParameter(SoGLShaderObject *shaderObject);
388
389 protected:
390 virtual ~SoShaderParameterArray3i();
391 };
392
393 /* **************************************************************************
394 * *** SoShaderParameterArray4f ***
395 * **************************************************************************/
396
397 class COIN_DLL_API SoShaderParameterArray4f : public SoUniformShaderParameter {
398 typedef SoUniformShaderParameter inherited;
399 SO_NODE_HEADER(SoShaderParameterArray4f);
400
401 public:
402 SoMFVec4f value;
403
404 SoShaderParameterArray4f();
405
406 SoINTERNAL public:
407 static void initClass();
408 virtual void updateParameter(SoGLShaderObject *shaderObject);
409
410 protected:
411 virtual ~SoShaderParameterArray4f();
412
413 };
414
415 /* **************************************************************************
416 * *** SoShaderParameterArray4i ***
417 * **************************************************************************/
418
419 class COIN_DLL_API SoShaderParameterArray4i : public SoUniformShaderParameter {
420 typedef SoUniformShaderParameter inherited;
421 SO_NODE_HEADER(SoShaderParameterArray4i);
422
423 public:
424 SoMFVec4i32 value;
425
426 SoShaderParameterArray4i();
427
428 SoINTERNAL public:
429 static void initClass();
430 virtual void updateParameter(SoGLShaderObject *shaderObject);
431
432 protected:
433 virtual ~SoShaderParameterArray4i();
434 };
435
436 /* **************************************************************************
437 * *** SoShaderParameterMatrix ***
438 * **************************************************************************/
439
440 class COIN_DLL_API SoShaderParameterMatrix : public SoUniformShaderParameter {
441 typedef SoUniformShaderParameter inherited;
442 SO_NODE_HEADER(SoShaderParameterMatrix);
443
444 public:
445 SoSFMatrix value;
446
447 SoShaderParameterMatrix();
448
449 SoINTERNAL public:
450 static void initClass();
451 virtual void updateParameter(SoGLShaderObject *shaderObject);
452
453 protected:
454 virtual ~SoShaderParameterMatrix();
455 };
456
457 /* **************************************************************************
458 * *** SoShaderParameterMatrixArray ***
459 * **************************************************************************/
460
461 class COIN_DLL_API SoShaderParameterMatrixArray : public SoUniformShaderParameter {
462 typedef SoUniformShaderParameter inherited;
463 SO_NODE_HEADER(SoShaderParameterMatrixArray);
464
465 public:
466 SoMFMatrix value;
467
468 SoShaderParameterMatrixArray();
469
470 SoINTERNAL public:
471 static void initClass();
472 virtual void updateParameter(SoGLShaderObject *shaderObject);
473
474 protected:
475 virtual ~SoShaderParameterMatrixArray();
476 };
477
478 /* **************************************************************************
479 * *** SoShaderStateMatrixParameter ***
480 * **************************************************************************/
481
482 class COIN_DLL_API SoShaderStateMatrixParameter : public SoUniformShaderParameter {
483 typedef SoUniformShaderParameter inherited;
484 SO_NODE_HEADER(SoShaderStateMatrixParameter);
485
486 public:
487
488 enum MatrixType {
489 MODELVIEW,
490 PROJECTION,
491 TEXTURE,
492 MODELVIEW_PROJECTION
493 };
494
495 enum MatrixTransform{
496 IDENTITY,
497 TRANSPOSE,
498 INVERSE,
499 INVERSE_TRANSPOSE
500 };
501
502 SoSFEnum matrixType;
503 SoSFEnum matrixTransform;
504
505 SoShaderStateMatrixParameter();
506 virtual ~SoShaderStateMatrixParameter();
507
508 static void initClass(void);
509 virtual void updateParameter(SoGLShaderObject *shaderObject);
510 };
511
512 #endif /* ! COIN_SOSHADERPARAMETER_H */

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