Visualization Library 2.1.0

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Shader.hpp
Go to the documentation of this file.
1 /**************************************************************************************/
2 /* */
3 /* Visualization Library */
4 /* http://visualizationlibrary.org */
5 /* */
6 /* Copyright (c) 2005-2020, Michele Bosi */
7 /* All rights reserved. */
8 /* */
9 /* Redistribution and use in source and binary forms, with or without modification, */
10 /* are permitted provided that the following conditions are met: */
11 /* */
12 /* - Redistributions of source code must retain the above copyright notice, this */
13 /* list of conditions and the following disclaimer. */
14 /* */
15 /* - Redistributions in binary form must reproduce the above copyright notice, this */
16 /* list of conditions and the following disclaimer in the documentation and/or */
17 /* other materials provided with the distribution. */
18 /* */
19 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND */
20 /* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED */
21 /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
22 /* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR */
23 /* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
24 /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
25 /* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
26 /* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
27 /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
28 /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
29 /* */
30 /**************************************************************************************/
31 
32 #ifndef Shader_INCLUDE_ONCE
33 #define Shader_INCLUDE_ONCE
34 
36 #include <vlCore/Vector4.hpp>
37 #include <vlCore/Matrix4.hpp>
40 #include <vlGraphics/EnableSet.hpp>
42 #include <vlGraphics/Texture.hpp>
43 #include <vlGraphics/Scissor.hpp>
44 #include <vlGraphics/Light.hpp>
45 #include <vlGraphics/ClipPlane.hpp>
46 #include <vector>
47 
48 namespace vl
49 {
50  class Light;
51  class ClipPlane;
52  class Shader;
53  //------------------------------------------------------------------------------
54  // VertexAttrib
55  //------------------------------------------------------------------------------
59  // todo: would be nice to support double, int and uint types as well.
61  {
63 
64  public:
65  VertexAttrib(): mValue( fvec4(0,0,0,0) )
66  {
67  VL_DEBUG_SET_OBJECT_NAME()
68  }
69 
70  virtual ERenderState type() const { return RS_VertexAttrib; }
71 
72  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
73 
74  void setValue(const fvec4& value) { mValue = value; }
75 
76  const fvec4& value() const { return mValue; }
77 
78  virtual ref<RenderState> clone() const
79  {
81  *rs = *this;
82  return rs;
83  }
84 
85  protected:
87  };
88  //------------------------------------------------------------------------------
89  // Color
90  //------------------------------------------------------------------------------
95  {
97 
98  public:
99  Color(): mColor( fvec4(1,1,1,1) )
100  {
101  VL_DEBUG_SET_OBJECT_NAME()
102  }
103 
104  virtual ERenderState type() const { return RS_Color; }
105 
106  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
107 
108  void setValue(const fvec4& color) { mColor = color; }
109 
110  const fvec4& value() const { return mColor; }
111 
112  virtual ref<RenderState> clone() const
113  {
114  ref<Color> rs = new Color;
115  *rs = *this;
116  return rs;
117  }
118 
119  protected:
121  };
122  //------------------------------------------------------------------------------
123  // SecondaryColor
124  //------------------------------------------------------------------------------
129  {
131 
132  public:
133  SecondaryColor(): mSecondaryColor( fvec3(1,1,1) )
134  {
135  VL_DEBUG_SET_OBJECT_NAME()
136  }
137 
138  virtual ERenderState type() const { return RS_SecondaryColor; }
139 
140  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
141 
142  void setValue(const fvec3& color) { mSecondaryColor = color; }
143 
144  const fvec3& value() const { return mSecondaryColor; }
145 
146  virtual ref<RenderState> clone() const
147  {
149  *rs = *this;
150  return rs;
151  }
152 
153  protected:
155  };
156  //------------------------------------------------------------------------------
157  // Normal
158  //------------------------------------------------------------------------------
163  {
165 
166  public:
167  Normal(): mNormal( fvec3(0,1,0) )
168  {
169  VL_DEBUG_SET_OBJECT_NAME()
170  }
171 
172  virtual ERenderState type() const { return RS_Normal; }
173 
174  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
175 
176  void setValue(const fvec3& color) { mNormal = color; }
177 
178  const fvec3& value() const { return mNormal; }
179 
180  virtual ref<RenderState> clone() const
181  {
182  ref<Normal> rs = new Normal;
183  *rs = *this;
184  return rs;
185  }
186 
187  protected:
189  };
190  //------------------------------------------------------------------------------
191  // PixelTransfer
192  //------------------------------------------------------------------------------
197  {
199 
200  public:
202  {
203  VL_DEBUG_SET_OBJECT_NAME()
204  mMapColor = false;
205  mMapStencil = false;
206  mIndexShift = 0;
207  mIndexOffset = 0;
208  mRedScale = 1;
209  mGreenScale = 1;
210  mBlueScale = 1;
211  mAlphaScale = 1;
212  mDepthScale = 1;
213  mRedBias = 0;
214  mGreenBias = 0;
215  mBlueBias = 0;
216  mAlphaBias = 0;
217  mDepthBias = 0;
218  mPostColorMatrixRedScale = 1;
219  mPostColorMatrixGreenScale = 1;
220  mPostColorMatrixBlueScale = 1;
221  mPostColorMatrixAlphaScale = 1;
222  mPostColorMatrixRedBias = 0;
223  mPostColorMatrixGreenBias = 0;
224  mPostColorMatrixBlueBias = 0;
225  mPostColorMatrixAlphaBias = 0;
226  mPostConvolutionRedScale = 1;
227  mPostConvolutionGreenScale = 1;
228  mPostConvolutionBlueScale = 1;
229  mPostConvolutionAlphaScale = 1;
230  mPostConvolutionRedBias = 0;
231  mPostConvolutionGreenBias = 0;
232  mPostConvolutionBlueBias = 0;
233  mPostConvolutionAlphaBias = 0;
234  }
235 
236  virtual ERenderState type() const { return RS_PixelTransfer; }
237 
238  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
239 
240  bool mapColor() const { return mMapColor; }
241  bool mapStencil() const { return mMapStencil; }
242  int indexShift() const { return mIndexShift; }
243  int indexOffset() const { return mIndexOffset; }
244  float redScale() const { return mRedScale; }
245  float greenScale() const { return mGreenScale; }
246  float blueScale() const { return mBlueScale; }
247  float alphaScale() const { return mAlphaScale; }
248  float depthScale() const { return mDepthScale; }
249  float redBias() const { return mRedBias; }
250  float greenBias() const { return mGreenBias; }
251  float blueBias() const { return mBlueBias; }
252  float alphaBias() const { return mAlphaBias; }
253  float depthBias() const { return mDepthBias; }
254  float postColorMatrixRedScale() const { return mPostColorMatrixRedScale; }
255  float postColorMatrixGreenScale() const { return mPostColorMatrixGreenScale; }
256  float postColorMatrixBlueScale() const { return mPostColorMatrixBlueScale; }
257  float postColorMatrixAlphaScale() const { return mPostColorMatrixAlphaScale; }
258  float postColorMatrixRedBias() const { return mPostColorMatrixRedBias; }
259  float postColorMatrixGreenBias() const { return mPostColorMatrixGreenBias; }
260  float postColorMatrixBlueBias() const { return mPostColorMatrixBlueBias; }
261  float postColorMatrixAlphaBias() const { return mPostColorMatrixAlphaBias; }
262  float postConvolutionRedScale() const { return mPostConvolutionRedScale; }
263  float postConvolutionGreenScale() const { return mPostConvolutionGreenScale; }
264  float postConvolutionBlueScale() const { return mPostConvolutionBlueScale; }
265  float postConvolutionAlphaScale() const { return mPostConvolutionAlphaScale; }
266  float postConvolutionRedBias() const { return mPostConvolutionRedBias; }
267  float postConvolutionGreenBias() const { return mPostConvolutionGreenBias; }
268  float postConvolutionBlueBias() const { return mPostConvolutionBlueBias; }
269  float postConvolutionAlphaBias() const { return mPostConvolutionAlphaBias; }
270 
271  void setMapColor(bool map_color) { mMapColor = map_color; }
272  void setMapStencil(bool map_stencil) { mMapStencil = map_stencil; }
273  void setIndexShift(int index_shift) { mIndexShift = index_shift; }
274  void setIndexOffset(int index_offset) { mIndexOffset = index_offset; }
275  void setRedScale(float red_scale) { mRedScale = red_scale; }
276  void setGreenScale(float green_scale) { mGreenScale = green_scale; }
277  void setBlueScale(float blue_scale) { mBlueScale = blue_scale; }
278  void setAlphaScale(float alpha_scale) { mAlphaScale = alpha_scale; }
279  void setDepthScale(float depth_scale) { mDepthScale = depth_scale; }
280  void setRedBias(float red_bias) { mRedBias = red_bias; }
281  void setGreenBias(float green_bias) { mGreenBias = green_bias; }
282  void setBlueBias(float blue_bias) { mBlueBias = blue_bias; }
283  void setAlphaBias(float alpha_bias) { mAlphaBias = alpha_bias; }
284  void setDepthBias(float depth_bias) { mDepthBias = depth_bias; }
285  void setPostColorMatrixRedScale(float scale) { mPostColorMatrixRedScale = scale; }
286  void setPostColorMatrixGreenScale(float scale) { mPostColorMatrixGreenScale = scale; }
287  void setPostColorMatrixBlueScale(float scale) { mPostColorMatrixBlueScale = scale; }
288  void setPostColorMatrixAlphaScale(float scale) { mPostColorMatrixAlphaScale = scale; }
289  void setPostColorMatrixRedBias(float bias) { mPostColorMatrixRedBias = bias; }
290  void setPostColorMatrixGreenBias(float bias) { mPostColorMatrixGreenBias = bias; }
291  void setPostColorMatrixBlueBias(float bias) { mPostColorMatrixBlueBias = bias; }
292  void setPostColorMatrixAlphaBias(float bias) { mPostColorMatrixAlphaBias = bias; }
293  void setPostConvolutionRedScale(float scale) { mPostConvolutionRedScale = scale; }
294  void setPostConvolutionGreenScale(float scale) { mPostConvolutionGreenScale = scale; }
295  void setPostConvolutionBlueScale(float scale) { mPostConvolutionBlueScale = scale; }
296  void setPostConvolutionAlphaScale(float scale) { mPostConvolutionAlphaScale = scale; }
297  void setPostConvolutionRedBias(float bias) { mPostConvolutionRedBias = bias; }
298  void setPostConvolutionGreenBias(float bias) { mPostConvolutionGreenBias = bias; }
299  void setPostConvolutionBlueBias(float bias) { mPostConvolutionBlueBias = bias; }
300  void setPostConvolutionAlphaBias(float bias) { mPostConvolutionAlphaBias = bias; }
301 
302  virtual ref<RenderState> clone() const
303  {
305  *rs = *this;
306  return rs;
307  }
308 
309  protected:
310  bool mMapColor;
314  float mRedScale;
315  float mGreenScale;
316  float mBlueScale;
317  float mAlphaScale;
318  float mDepthScale;
319  float mRedBias;
320  float mGreenBias;
321  float mBlueBias;
322  float mAlphaBias;
323  float mDepthBias;
340  };
341  //------------------------------------------------------------------------------
342  // Hint
343  //------------------------------------------------------------------------------
347  {
349 
350  public:
351  Hint(): mPerspectiveCorrectionHint(HM_DONT_CARE), mPointSmoothHint(HM_DONT_CARE), mLineSmoothHint(HM_DONT_CARE),
352  mPolygonSmoothHint(HM_DONT_CARE), mFogHint(HM_DONT_CARE), mGenerateMipmapHint(HM_DONT_CARE)
353  {
354  VL_DEBUG_SET_OBJECT_NAME()
355  }
356 
357  virtual ERenderState type() const { return RS_Hint; }
358 
359  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
360 
361  void setPerspectiveCorrectionHint(EHintMode mode) { mPerspectiveCorrectionHint = mode; }
362  void setPolygonSmoohtHint(EHintMode mode) { mPolygonSmoothHint = mode; }
363  void setLineSmoothHint(EHintMode mode) { mLineSmoothHint = mode; }
364  void setPointSmoothHint(EHintMode mode) { mPointSmoothHint = mode; }
365  void setFogHint(EHintMode mode) { mFogHint = mode; }
366  void setGenerateMipmapHint(EHintMode mode) { mGenerateMipmapHint = mode; }
367 
368  EHintMode perspectiveCorrectionHint() const { return mPerspectiveCorrectionHint; }
369  EHintMode polygonSmoohtHint() const { return mPolygonSmoothHint; }
370  EHintMode lineSmoothHint() const { return mLineSmoothHint; }
371  EHintMode pointSmoothHint() const { return mPointSmoothHint; }
372  EHintMode fogHint() const { return mFogHint; }
373  EHintMode generateMipmapHint() const { return mGenerateMipmapHint; }
374 
375  virtual ref<RenderState> clone() const
376  {
377  ref<Hint> rs = new Hint;
378  *rs = *this;
379  return rs;
380  }
381 
382  protected:
389  };
390  //------------------------------------------------------------------------------
391  // CullFace
392  //------------------------------------------------------------------------------
396  {
398 
399  public:
400  CullFace(EPolygonFace cullface=PF_BACK): mFaceMode(cullface)
401  {
402  VL_DEBUG_SET_OBJECT_NAME()
403  }
404 
405  virtual ERenderState type() const { return RS_CullFace; }
406 
407  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
408 
409  void set(EPolygonFace facemode) { mFaceMode = facemode; }
410 
411  EPolygonFace faceMode() const { return mFaceMode; }
412 
413  virtual ref<RenderState> clone() const
414  {
415  ref<CullFace> rs = new CullFace;
416  *rs = *this;
417  return rs;
418  }
419 
420  protected:
422  };
423  //------------------------------------------------------------------------------
424  // FrontFace
425  //------------------------------------------------------------------------------
429  {
431 
432  public:
433  FrontFace(EFrontFace frontface=FF_CCW): mFrontFace(frontface)
434  {
435  VL_DEBUG_SET_OBJECT_NAME()
436  }
437 
438  virtual ERenderState type() const { return RS_FrontFace; }
439 
440  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
441 
442  void set(EFrontFace frontface) { mFrontFace = frontface; }
443 
444  EFrontFace frontFace() const { return mFrontFace; }
445 
446  virtual ref<RenderState> clone() const
447  {
448  ref<FrontFace> rs = new FrontFace;
449  *rs = *this;
450  return rs;
451  }
452 
453  protected:
455  };
456  //------------------------------------------------------------------------------
457  // DepthFunc
458  //------------------------------------------------------------------------------
462  {
464 
465  public:
466  DepthFunc(EFunction depthfunc=FU_LESS): mDepthFunc(depthfunc)
467  {
468  VL_DEBUG_SET_OBJECT_NAME()
469  }
470 
471  virtual ERenderState type() const { return RS_DepthFunc; }
472 
473  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
474 
475  void set(EFunction depthfunc) { mDepthFunc = depthfunc; }
476 
477  EFunction depthFunc() const { return mDepthFunc; }
478 
479  virtual ref<RenderState> clone() const
480  {
481  ref<DepthFunc> rs = new DepthFunc;
482  *rs = *this;
483  return rs;
484  }
485 
486  protected:
488  };
489  //------------------------------------------------------------------------------
490  // DepthMask
491  //------------------------------------------------------------------------------
495  {
497 
498  public:
499  DepthMask(bool depthmask=true): mDepthMask(depthmask)
500  {
501  VL_DEBUG_SET_OBJECT_NAME()
502  }
503 
504  virtual ERenderState type() const { return RS_DepthMask; }
505 
506  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
507 
508  void set(bool depthmask) { mDepthMask = depthmask; }
509 
510  bool depthMask() const { return mDepthMask; }
511 
512  virtual ref<RenderState> clone() const
513  {
514  ref<DepthMask> rs = new DepthMask;
515  *rs = *this;
516  return rs;
517  }
518 
519  protected:
521  };
522  //------------------------------------------------------------------------------
523  // PolygonMode
524  //------------------------------------------------------------------------------
528  {
530 
531  public:
532  PolygonMode(EPolygonMode frontface=PM_FILL, EPolygonMode backface=PM_FILL): mFrontFace(frontface), mBackFace(backface)
533  {
534  VL_DEBUG_SET_OBJECT_NAME()
535  }
536 
537  virtual ERenderState type() const { return RS_PolygonMode; }
538 
539  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
540 
541  void set(EPolygonMode frontface, EPolygonMode backface) { mFrontFace = frontface; mBackFace = backface; }
542 
543  void setFrontFace(EPolygonMode frontface) { mFrontFace = frontface; }
544 
545  void setBackFace(EPolygonMode backface) { mBackFace = backface; }
546 
547  EPolygonMode frontFace() const { return mFrontFace; }
548 
549  EPolygonMode backFace() const { return mBackFace; }
550 
551  virtual ref<RenderState> clone() const
552  {
553  ref<PolygonMode> rs = new PolygonMode;
554  *rs = *this;
555  return rs;
556  }
557 
558  protected:
561  };
562  //------------------------------------------------------------------------------
563  // ShadeModel
564  //------------------------------------------------------------------------------
568  {
570 
571  public:
572  ShadeModel(EShadeModel shademodel=SM_SMOOTH): mShadeModel(shademodel)
573  {
574  VL_DEBUG_SET_OBJECT_NAME()
575  }
576 
577  virtual ERenderState type() const { return RS_ShadeModel; }
578 
579  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
580 
581  void set(EShadeModel shademodel) { mShadeModel = shademodel; }
582 
583  EShadeModel shadeModel() const { return mShadeModel; }
584 
585  virtual ref<RenderState> clone() const
586  {
587  ref<ShadeModel> rs = new ShadeModel;
588  *rs = *this;
589  return rs;
590  }
591 
592  protected:
594  };
595  //------------------------------------------------------------------------------
596  // BlendFunc
597  //------------------------------------------------------------------------------
601  {
603 
604  public:
606  mSrcRGB(src_rgb), mDstRGB(dst_rgb), mSrcAlpha(src_alpha), mDstAlpha(dst_alpha)
607  {
608  VL_DEBUG_SET_OBJECT_NAME()
609  }
610 
611  virtual ERenderState type() const { return RS_BlendFunc; }
612 
613  // if glBlendFuncSeparate is not supported uses RGB factor for both RGB and Alpha
614 
615  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
616 
617  void set(EBlendFactor src_rgb, EBlendFactor dst_rgb, EBlendFactor src_alpha, EBlendFactor dst_alpha) { mSrcRGB = src_rgb; mSrcAlpha = src_alpha; mDstRGB = dst_rgb; mDstAlpha = dst_alpha; }
618 
619  void set(EBlendFactor src_rgba, EBlendFactor dst_rgba) { mSrcRGB = src_rgba; mSrcAlpha = src_rgba; mDstRGB = dst_rgba; mDstAlpha = dst_rgba; }
620 
621  void setSrcRGB(EBlendFactor factor) { mSrcRGB = factor; }
622 
623  void setDstRGB(EBlendFactor factor) { mDstRGB = factor; }
624 
625  void setSrcAlpha(EBlendFactor factor) { mSrcAlpha = factor; }
626 
627  void setDstAlpha(EBlendFactor factor) { mDstAlpha = factor; }
628 
629  EBlendFactor srcRGB() const { return mSrcRGB; }
630 
631  EBlendFactor dstRGB() const { return mDstRGB; }
632 
633  EBlendFactor srcAlpha() const { return mSrcAlpha; }
634 
635  EBlendFactor dstAlpha() const { return mDstAlpha; }
636 
637  virtual ref<RenderState> clone() const
638  {
639  ref<BlendFunc> rs = new BlendFunc;
640  *rs = *this;
641  return rs;
642  }
643 
644  protected:
649  };
650  //------------------------------------------------------------------------------
651  // BlendEquation
652  //------------------------------------------------------------------------------
658  {
660 
661  public:
662  BlendEquation(EBlendEquation mode_rgb=BE_FUNC_ADD, EBlendEquation mode_alpha=BE_FUNC_ADD): mModeRGB(mode_rgb), mModeAlpha(mode_alpha)
663  {
664  VL_DEBUG_SET_OBJECT_NAME()
665  }
666 
667  virtual ERenderState type() const { return RS_BlendEquation; }
668 
669  // if glBlendEquationSeparate is not supported uses RGB mode for both RGB and Alpha
670 
671  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
672 
673  void set(EBlendEquation mode_rgba) { mModeRGB = mode_rgba; mModeAlpha = mode_rgba; }
674 
675  void set(EBlendEquation mode_rgb, EBlendEquation mode_alpha) { mModeRGB = mode_rgb; mModeAlpha = mode_alpha; }
676 
677  EBlendEquation modeRGB() const { return mModeRGB; }
678 
679  EBlendEquation modeAlpha() const { return mModeAlpha; }
680 
681  virtual ref<RenderState> clone() const
682  {
684  *rs = *this;
685  return rs;
686  }
687 
688  protected:
691  };
692  //------------------------------------------------------------------------------
693  // SampleCoverage
694  //------------------------------------------------------------------------------
698  {
700 
701  public:
702  SampleCoverage(GLclampf value=1.0f, bool invert=false): mValue(value), mInvert(invert)
703  {
704  VL_DEBUG_SET_OBJECT_NAME()
705  }
706 
707  virtual ERenderState type() const { return RS_SampleCoverage; }
708 
709  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
710 
711  void set(GLclampf value, bool invert) { mValue = value; mInvert = invert; }
712 
713  void setValue(GLclampf value) { mValue = value; }
714 
715  void setInvert(bool invert) { mInvert = invert; }
716 
717  GLclampf value() const { return mValue; }
718 
719  bool invert() const { return mInvert; }
720 
721  virtual ref<RenderState> clone() const
722  {
724  *rs = *this;
725  return rs;
726  }
727 
728  protected:
729  GLclampf mValue;
730  bool mInvert;
731  };
732  //------------------------------------------------------------------------------
733  // AlphaFunc
734  //------------------------------------------------------------------------------
738  {
740 
741  public:
742  AlphaFunc(EFunction alphafunc=FU_ALWAYS, float refvalue=0): mRefValue(refvalue), mAlphaFunc(alphafunc)
743  {
744  VL_DEBUG_SET_OBJECT_NAME()
745  }
746 
747  virtual ERenderState type() const { return RS_AlphaFunc; }
748 
749  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
750 
751  void set(EFunction alphafunc, float ref_value) { mAlphaFunc = alphafunc; mRefValue = ref_value; }
752 
753  EFunction alphaFunc() const { return mAlphaFunc; }
754 
755  float refValue() const { return mRefValue; }
756 
757  virtual ref<RenderState> clone() const
758  {
759  ref<AlphaFunc> rs = new AlphaFunc;
760  *rs = *this;
761  return rs;
762  }
763 
764  protected:
765  float mRefValue;
767  };
768  //------------------------------------------------------------------------------
769  // Material
770  //------------------------------------------------------------------------------
775  {
777 
778  public:
779  Material();
780  virtual ERenderState type() const { return RS_Material; }
781  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
782 
783  void multiplyTransparency(float alpha);
784  float getMinimumAlpha() const;
785 
786  void setTransparency(float alpha);
787  void setFrontTransparency(float alpha);
788  void setBackTransparency(float alpha);
789  void setFrontFlatColor(const fvec4& color);
790  void setBackFlatColor(const fvec4& color);
791  void setFlatColor(const fvec4& color);
792 
793  void setAmbient(const fvec4& color) { mFrontAmbient = mBackAmbient = color; }
794  void setDiffuse(const fvec4& color) { mFrontDiffuse = mBackDiffuse = color; }
795  void setSpecular(const fvec4& color) { mFrontSpecular = mBackSpecular = color; }
796  void setEmission(const fvec4& color) { mFrontEmission = mBackEmission = color; }
797  void setShininess(float shininess) { mFrontShininess = mBackShininess = shininess; }
798 
799  void setFrontAmbient(const fvec4& color) { mFrontAmbient = color; }
800  void setFrontDiffuse(const fvec4& color) { mFrontDiffuse = color; }
801  void setFrontSpecular(const fvec4& color) { mFrontSpecular = color; }
802  void setFrontEmission(const fvec4& color) { mFrontEmission = color; }
803  void setFrontShininess(float shininess) { mFrontShininess=shininess; }
804 
805  const fvec4& frontAmbient() const { return mFrontAmbient; }
806  const fvec4& frontDiffuse() const { return mFrontDiffuse; }
807  const fvec4& frontSpecular() const { return mFrontSpecular; }
808  const fvec4& frontEmission() const { return mFrontEmission; }
809  float frontShininess() const { return mFrontShininess; }
810 
811  void setBackAmbient(const fvec4& color) { mBackAmbient = color; }
812  void setBackDiffuse(const fvec4& color) { mBackDiffuse = color; }
813  void setBackSpecular(const fvec4& color) { mBackSpecular = color; }
814  void setBackEmission(const fvec4& color) { mBackEmission = color; }
815  void setBackShininess(float shininess) { mBackShininess=shininess; }
816 
817  const fvec4& backAmbient() const { return mBackAmbient; }
818  const fvec4& backDiffuse() const { return mBackDiffuse; }
819  const fvec4& backSpecular() const { return mBackSpecular; }
820  const fvec4& backEmission() const { return mBackEmission; }
821  float backShininess() const { return mBackShininess; }
822 
823  // color material
824 
825  void setColorMaterial(EPolygonFace face, EColorMaterial color) { mColorMaterialFace = face; mColorMaterial = color; }
826  EPolygonFace colorMaterialFace() const { return mColorMaterialFace; }
827  EColorMaterial colorMaterial() const { return mColorMaterial; }
828  void setColorMaterialEnabled(bool enabled) { mColorMaterialEnabled = enabled; }
829  bool colorMaterialEnabled() const { return mColorMaterialEnabled; }
830 
831  virtual ref<RenderState> clone() const
832  {
833  ref<Material> rs = new Material;
834  *rs = *this;
835  return rs;
836  }
837 
838  protected:
849  // color material
853  };
854  //------------------------------------------------------------------------------
855  // LightModel
856  //------------------------------------------------------------------------------
860  {
862 
863  public:
864  LightModel(): mAmbientColor(0.2f,0.2f,0.2f,1.0f), mColorControl(CC_SINGLE_COLOR), mLocalViewer(false), mTwoSide(false)
865  {
866  VL_DEBUG_SET_OBJECT_NAME()
867  }
868 
869  virtual ERenderState type() const { return RS_LightModel; }
870 
871  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
872 
873  void setLocalViewer(bool localviewer) { mLocalViewer = localviewer; }
874 
875  void setTwoSide(bool twoside) { mTwoSide = twoside; }
876 
877  void setColorControl(EColorControl colorcontrol) { mColorControl = colorcontrol; }
878 
879  void setAmbientColor(const fvec4& ambientcolor) { mAmbientColor = ambientcolor; }
880 
881  bool localViewer() const { return mLocalViewer; }
882 
883  bool twoSide() const { return mTwoSide; }
884 
885  EColorControl colorControl() const { return mColorControl; }
886 
887  const fvec4& ambientColor() const { return mAmbientColor; }
888 
889  virtual ref<RenderState> clone() const
890  {
891  ref<LightModel> rs = new LightModel;
892  *rs = *this;
893  return rs;
894  }
895 
896  protected:
900  bool mTwoSide;
901  };
902  //------------------------------------------------------------------------------
903  // Fog
904  //------------------------------------------------------------------------------
908  {
910 
911  public:
912  Fog(EFogMode mode=FM_LINEAR, const fvec4& color=fvec4(0,0,0,0), float density=1, float start=0, float end=1):
913  mColor(color), mMode(mode), mDensity(density), mStart(start), mEnd(end)
914  {
915  VL_DEBUG_SET_OBJECT_NAME()
916  }
917 
918  virtual ERenderState type() const { return RS_Fog; }
919 
920  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
921 
922  void set(EFogMode mode, const fvec4& color, float density, float start, float end) { mColor = color; mMode = mode; mDensity = density; mStart = start; mEnd = end; }
923 
924  void setColor(const fvec4& color) { mColor = color; }
925 
926  void setMode(EFogMode mode) { mMode = mode; }
927 
928  void setDensity(float density) { mDensity = density; }
929 
930  void setStart(float start) { mStart = start; }
931 
932  void setEnd(float end) { mEnd = end; }
933 
934  const fvec4& color() const { return mColor; }
935 
936  EFogMode mode() const { return mMode; }
937 
938  float density() const { return mDensity; }
939 
940  float start() const { return mStart; }
941 
942  float end() const { return mEnd; }
943 
944  virtual ref<RenderState> clone() const
945  {
946  ref<Fog> rs = new Fog;
947  *rs = *this;
948  return rs;
949  }
950 
951  protected:
954  float mDensity;
955  float mStart;
956  float mEnd;
957  };
958  //------------------------------------------------------------------------------
959  // PolygonOffset
960  //------------------------------------------------------------------------------
964  {
966 
967  public:
968  PolygonOffset(): mFactor(0.0f), mUnits(0.0f)
969  {
970  VL_DEBUG_SET_OBJECT_NAME()
971  }
972 
973  virtual ERenderState type() const { return RS_PolygonOffset; }
974 
975  PolygonOffset(float factor, float units): mFactor(factor), mUnits(units) {}
976 
977  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
978 
979  void set(float factor, float units) { mFactor = factor; mUnits = units; }
980 
981  void setFactor(float factor) { mFactor = factor; }
982 
983  void setUnits(float units) { mUnits = units; }
984 
985  float factor() const { return mFactor; }
986 
987  float units() const { return mUnits; }
988 
989  virtual ref<RenderState> clone() const
990  {
992  *rs = *this;
993  return rs;
994  }
995 
996  protected:
997  float mFactor;
998  float mUnits;
999  };
1000  //------------------------------------------------------------------------------
1001  // LogicOp
1002  //------------------------------------------------------------------------------
1006  {
1008 
1009  public:
1010  LogicOp(ELogicOp logicop=LO_COPY): mLogicOp(logicop)
1011  {
1012  VL_DEBUG_SET_OBJECT_NAME()
1013  }
1014 
1015  virtual ERenderState type() const { return RS_LogicOp; }
1016 
1017  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
1018 
1019  void set(ELogicOp logicop) { mLogicOp = logicop; }
1020 
1021  ELogicOp logicOp() const { return mLogicOp; }
1022 
1023  virtual ref<RenderState> clone() const
1024  {
1025  ref<LogicOp> rs = new LogicOp;
1026  *rs = *this;
1027  return rs;
1028  }
1029 
1030  protected:
1032  };
1033  //------------------------------------------------------------------------------
1034  // DepthRange
1035  //------------------------------------------------------------------------------
1039  {
1041 
1042  public:
1043  DepthRange(): mZNear(0), mZFar(1.0f)
1044  {
1045  VL_DEBUG_SET_OBJECT_NAME()
1046  }
1047 
1048  DepthRange(float znear, float zfar): mZNear(znear), mZFar(zfar)
1049  {
1050  VL_DEBUG_SET_OBJECT_NAME()
1051  }
1052 
1053  virtual ERenderState type() const { return RS_DepthRange; }
1054 
1055  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
1056 
1057  void set(float znear, float zfar) { mZNear = znear; mZFar = zfar; }
1058 
1059  void setZNear(float znear) { mZNear = znear; }
1060 
1061  void setZFar(float zfar) { mZFar = zfar; }
1062 
1063  float zNear() const { return mZNear; }
1064 
1065  float zFar() const { return mZFar; }
1066 
1067  virtual ref<RenderState> clone() const
1068  {
1069  ref<DepthRange> rs = new DepthRange;
1070  *rs = *this;
1071  return rs;
1072  }
1073 
1074  protected:
1075  float mZNear;
1076  float mZFar;
1077  };
1078  //------------------------------------------------------------------------------
1079  // LineWidth
1080  //------------------------------------------------------------------------------
1084  {
1086 
1087  public:
1088  LineWidth(float linewidth=1.0f): mLineWidth(linewidth)
1089  {
1090  VL_DEBUG_SET_OBJECT_NAME()
1091  }
1092 
1093  virtual ERenderState type() const { return RS_LineWidth; }
1094 
1095  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
1096 
1097  void set(float linewidth) { mLineWidth = linewidth; }
1098 
1099  float lineWidth() const { return mLineWidth; }
1100 
1101  virtual ref<RenderState> clone() const
1102  {
1103  ref<LineWidth> rs = new LineWidth;
1104  *rs = *this;
1105  return rs;
1106  }
1107 
1108  protected:
1109  float mLineWidth;
1110  };
1111  //------------------------------------------------------------------------------
1112  // PointSize
1113  //------------------------------------------------------------------------------
1117  {
1119 
1120  public:
1121  PointSize(float pointsize=1.0f): mPointSize(pointsize)
1122  {
1123  VL_DEBUG_SET_OBJECT_NAME()
1124  }
1125 
1126  virtual ERenderState type() const { return RS_PointSize; }
1127 
1128  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
1129 
1130  void set(float pointsize) { mPointSize = pointsize; }
1131 
1132  float pointSize() const { return mPointSize; }
1133 
1134  virtual ref<RenderState> clone() const
1135  {
1136  ref<PointSize> rs = new PointSize;
1137  *rs = *this;
1138  return rs;
1139  }
1140 
1141  protected:
1142  float mPointSize;
1143  };
1144  //------------------------------------------------------------------------------
1145  // PolygonStipple
1146  //------------------------------------------------------------------------------
1150  {
1152 
1153  public:
1154  PolygonStipple();
1155 
1156  PolygonStipple(const unsigned char* mask);
1157 
1158  virtual ERenderState type() const { return RS_PolygonStipple; }
1159 
1160  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
1161 
1162  void set(const unsigned char* mask);
1163 
1164  const unsigned char* mask() const { return mMask; }
1165 
1166  virtual ref<RenderState> clone() const
1167  {
1169  *rs = *this;
1170  return rs;
1171  }
1172 
1173  protected:
1174  unsigned char mMask[32*32/8];
1175  };
1176  //------------------------------------------------------------------------------
1177  // LineStipple
1178  //------------------------------------------------------------------------------
1182  {
1184 
1185  public:
1186  LineStipple(int factor=1, GLushort pattern=~(GLushort)0): mFactor(factor), mPattern(pattern)
1187  {
1188  VL_DEBUG_SET_OBJECT_NAME()
1189  }
1190 
1191  virtual ERenderState type() const { return RS_LineStipple; }
1192 
1193  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
1194 
1195  void set(int factor, GLushort pattern) { mFactor = factor; mPattern = pattern; }
1196 
1197  void setFactor(int factor) { mFactor = factor; }
1198 
1199  void setPattern(GLushort pattern) { mPattern = pattern; }
1200 
1201  int factor() const { return mFactor; }
1202 
1203  GLushort pattern() const { return mPattern; }
1204 
1205  virtual ref<RenderState> clone() const
1206  {
1207  ref<LineStipple> rs = new LineStipple;
1208  *rs = *this;
1209  return rs;
1210  }
1211 
1212  protected:
1213  int mFactor;
1214  GLushort mPattern;
1215  };
1216  //------------------------------------------------------------------------------
1217  // PointParameter
1218  //------------------------------------------------------------------------------
1222  {
1224 
1225  public:
1226  PointParameter(float sizemin=0, float sizemax=1024.0f, float fadethresholdsize=1.0f, fvec3 distanceattenuation=fvec3(1,0,0)):
1227  mDistanceAttenuation(distanceattenuation), mSizeMin(sizemin), mSizeMax(sizemax), mFadeThresholdSize(fadethresholdsize),
1228  mPointSpriteCoordOrigin(PPCO_UPPER_LEFT)
1229  {
1230  VL_DEBUG_SET_OBJECT_NAME()
1231  }
1232  virtual ERenderState type() const { return RS_PointParameter; }
1233 
1234  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
1235 
1236  void set(float sizemin, float sizemax, float fadethresholdsize, fvec3 distanceattenuation) { mDistanceAttenuation = distanceattenuation; mSizeMin = sizemin; mSizeMax = sizemax; mFadeThresholdSize = fadethresholdsize; }
1237 
1238  void setDistanceAttenuation(fvec3 attenuation) { mDistanceAttenuation = attenuation; }
1239 
1240  void setSizeMin(float sizemin) { mSizeMin = sizemin; }
1241 
1242  void setSizeMax(float sizemax) { mSizeMax = sizemax; }
1243 
1244  void setFadeThresholdSize(float threshold) { mFadeThresholdSize = threshold; }
1245 
1246  fvec3 distanceAttenuation() const { return mDistanceAttenuation; }
1247 
1248  float sizeMin() const { return mSizeMin; }
1249 
1250  float sizeMax() const { return mSizeMax; }
1251 
1252  float fadeThresholdSize() const { return mFadeThresholdSize; }
1253 
1254  EPointSpriteCoordOrigin pointSpriteCoordOrigin() const { return mPointSpriteCoordOrigin; }
1255 
1256  void setPointSpriteCoordOrigin(EPointSpriteCoordOrigin orig) { mPointSpriteCoordOrigin = orig; }
1257 
1258  virtual ref<RenderState> clone() const
1259  {
1261  *rs = *this;
1262  return rs;
1263  }
1264 
1265  protected:
1267  float mSizeMin;
1268  float mSizeMax;
1271  };
1272  //------------------------------------------------------------------------------
1273  // StencilFunc
1274  //------------------------------------------------------------------------------
1280  {
1282 
1283  public:
1284  StencilFunc(EFunction function=FU_ALWAYS, int refvalue=0, unsigned int mask=~(unsigned int)0):
1285  mFunction_Front(function), mFunction_Back(function),
1286  mRefValue_Front(refvalue), mRefValue_Back(refvalue),
1287  mMask_Front(mask), mMask_Back(mask)
1288  {
1289  VL_DEBUG_SET_OBJECT_NAME()
1290  }
1291 
1292  virtual ERenderState type() const { return RS_StencilFunc; }
1293 
1294  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
1295 
1296  void set(EPolygonFace face, EFunction function, int refvalue, unsigned int mask)
1297  {
1298  if (face == PF_FRONT || face == PF_FRONT_AND_BACK)
1299  {
1300  mFunction_Front = function;
1301  mRefValue_Front = refvalue;
1302  mMask_Front = mask;
1303  }
1304  if (face == PF_BACK || face == PF_FRONT_AND_BACK)
1305  {
1306  mFunction_Back = function;
1307  mRefValue_Back = refvalue;
1308  mMask_Back = mask;
1309  }
1310  }
1311 
1312  EFunction function_Front() const { return mFunction_Front; }
1313 
1314  int refValue_Front() const { return mRefValue_Front; }
1315 
1316  unsigned int mask_Front() const { return mMask_Front; }
1317 
1318  EFunction function_Back() const { return mFunction_Back; }
1319 
1320  int refValue_Back() const { return mRefValue_Back; }
1321 
1322  unsigned int mask_Back() const { return mMask_Back; }
1323 
1324  virtual ref<RenderState> clone() const
1325  {
1326  ref<StencilFunc> rs = new StencilFunc;
1327  *rs = *this;
1328  return rs;
1329  }
1330 
1331  protected:
1332  EFunction mFunction_Front;
1333  EFunction mFunction_Back;
1336  unsigned int mMask_Front;
1337  unsigned int mMask_Back;
1338  };
1339  //------------------------------------------------------------------------------
1340  // StencilOp
1341  //------------------------------------------------------------------------------
1347  {
1349 
1350  public:
1352  mSFail_Front(sfail), mSFail_Back(sfail),
1353  mDpFail_Front(dpfail), mDpFail_Back(dpfail),
1354  mDpPass_Front(dppass), mDpPass_Back(dppass)
1355  {
1356  VL_DEBUG_SET_OBJECT_NAME()
1357  }
1358 
1359  virtual ERenderState type() const { return RS_StencilOp; }
1360 
1361  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
1362 
1363  void set(EPolygonFace face, EStencilOp sfail, EStencilOp dpfail, EStencilOp dppass)
1364  {
1365  if (face == PF_FRONT || face == PF_FRONT_AND_BACK)
1366  {
1367  mSFail_Front = sfail;
1368  mDpFail_Front = dpfail;
1369  mDpPass_Front = dppass;
1370  }
1371  if (face == PF_BACK || face == PF_FRONT_AND_BACK)
1372  {
1373  mSFail_Back = sfail;
1374  mDpFail_Back = dpfail;
1375  mDpPass_Back = dppass;
1376  }
1377  }
1378 
1379  EStencilOp sFail_Front() const { return mSFail_Front; }
1380 
1381  EStencilOp dpFail_Front() const { return mDpFail_Front; }
1382 
1383  EStencilOp dpPass_Front() const { return mDpPass_Front; }
1384 
1385  EStencilOp sFail_Back() const { return mSFail_Front; }
1386 
1387  EStencilOp dpFail_Back() const { return mDpFail_Front; }
1388 
1389  EStencilOp dpPass_Back() const { return mDpPass_Front; }
1390 
1391  virtual ref<RenderState> clone() const
1392  {
1393  ref<StencilOp> rs = new StencilOp;
1394  *rs = *this;
1395  return rs;
1396  }
1397 
1398  protected:
1405  };
1406  //------------------------------------------------------------------------------
1407  // StencilMask
1408  //------------------------------------------------------------------------------
1414  {
1416 
1417  public:
1418  StencilMask(unsigned int mask=~(unsigned int)0): mMask_Front(mask), mMask_Back(mask)
1419  {
1420  VL_DEBUG_SET_OBJECT_NAME()
1421  }
1422 
1423  virtual ERenderState type() const { return RS_StencilMask; }
1424 
1425  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
1426 
1427  void set(EPolygonFace face, unsigned int mask)
1428  {
1429  if (face == PF_FRONT || face == PF_FRONT_AND_BACK)
1430  mMask_Front = mask;
1431  if (face == PF_BACK || face == PF_FRONT_AND_BACK)
1432  mMask_Back = mask;
1433  }
1434 
1435  unsigned int mask_Front() const { return mMask_Front; }
1436 
1437  unsigned int mask_Back() const { return mMask_Back; }
1438 
1439  virtual ref<RenderState> clone() const
1440  {
1441  ref<StencilMask> rs = new StencilMask;
1442  *rs = *this;
1443  return rs;
1444  }
1445 
1446  protected:
1447  unsigned int mMask_Front;
1448  unsigned int mMask_Back;
1449  };
1450  //------------------------------------------------------------------------------
1451  // BlendColor
1452  //------------------------------------------------------------------------------
1456  {
1458 
1459  public:
1460  BlendColor(const fvec4& blendcolor=fvec4(0,0,0,0)): mBlendColor(blendcolor)
1461  {
1462  VL_DEBUG_SET_OBJECT_NAME()
1463  }
1464 
1465  virtual ERenderState type() const { return RS_BlendColor; }
1466 
1467  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
1468 
1469  void set(const fvec4& blendcolor) { mBlendColor = blendcolor; }
1470 
1471  const fvec4& blendColor() const { return mBlendColor; }
1472 
1473  virtual ref<RenderState> clone() const
1474  {
1475  ref<BlendColor> rs = new BlendColor;
1476  *rs = *this;
1477  return rs;
1478  }
1479 
1480  protected:
1482  };
1483  //------------------------------------------------------------------------------
1484  // ColorMask
1485  //------------------------------------------------------------------------------
1489  {
1491 
1492  public:
1493  ColorMask(bool red=true, bool green=true, bool blue=true, bool alpha=true): mRed(red), mGreen(green), mBlue(blue), mAlpha(alpha)
1494  {
1495  VL_DEBUG_SET_OBJECT_NAME()
1496  }
1497 
1498  virtual ERenderState type() const { return RS_ColorMask; }
1499 
1500  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
1501 
1502  void set(bool red, bool green, bool blue, bool alpha) { mRed = red; mGreen = green; mBlue = blue; mAlpha = alpha; }
1503 
1504  void setRed(bool red) { mRed = red; }
1505 
1506  void setGreen(bool green) { mGreen = green; }
1507 
1508  void setBlue(bool blue) { mBlue = blue; }
1509 
1510  void setAlpha(bool alpha) { mAlpha = alpha; }
1511 
1512  bool red() const { return mRed; }
1513 
1514  bool green() const { return mGreen; }
1515 
1516  bool blue() const { return mBlue; }
1517 
1518  bool alpha() const { return mAlpha; }
1519 
1520  virtual ref<RenderState> clone() const
1521  {
1522  ref<ColorMask> rs = new ColorMask;
1523  *rs = *this;
1524  return rs;
1525  }
1526 
1527  protected:
1528  bool mRed;
1529  bool mGreen;
1530  bool mBlue;
1531  bool mAlpha;
1532  };
1533  //------------------------------------------------------------------------------
1534  // TextureMatrix
1535  //------------------------------------------------------------------------------
1540  {
1542 
1543  public:
1544  TextureMatrix() { mUseCameraRotationInverse = false; }
1545 
1546  virtual ERenderState type() const { return RS_TextureMatrix; }
1547 
1548  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
1549 
1550  const fmat4& matrix() const { return mMatrix; }
1551 
1552  const TextureMatrix& setMatrix(const fmat4& matrix)
1553  {
1554  mMatrix = matrix;
1555  return *this;
1556  }
1557 
1564  void setUseCameraRotationInverse(bool use) { mUseCameraRotationInverse = use; }
1565 
1566  bool useCameraRotationInverse() const { return mUseCameraRotationInverse; }
1567 
1568  virtual ref<RenderState> clone() const
1569  {
1571  *rs = *this;
1572  return rs;
1573  }
1574 
1575  protected:
1578  };
1579  //------------------------------------------------------------------------------
1580  // TexEnv
1581  //------------------------------------------------------------------------------
1590  {
1592 
1593  public:
1594  TexEnv();
1595  virtual ERenderState type() const { return RS_TexEnv; }
1596  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
1597 
1598  void setMode(ETexEnvMode mode) { mMode = mode; }
1599  ETexEnvMode mode() const { return mMode; }
1600  void setCombineRGB(ETexEnvMode combineRGB) { mCombineRGB = combineRGB; }
1601  ETexEnvMode combineRGB() const { return mCombineRGB; }
1602  void setCombineAlpha(ETexEnvMode combineAlpha) { mCombineAlpha = combineAlpha; }
1603  ETexEnvMode combineAlpha() const { return mCombineAlpha; }
1604  void setColor(const fvec4& color) { mColor = color; }
1605  const fvec4& color() const { return mColor; }
1606  void setRGBScale(float rgbscale) { mRGBScale = rgbscale; }
1607  float rgbScale() const { return mRGBScale; }
1608  void setAlphaScale(float alphascale) { mAlphaScale = alphascale; }
1609  float alphaScale() const { return mAlphaScale; }
1610 
1611  void setSource0RGB(ETexEnvSource source) { mSource0RGB = source; }
1612  void setSource1RGB(ETexEnvSource source) { mSource1RGB = source; }
1613  void setSource2RGB(ETexEnvSource source) { mSource2RGB = source; }
1614  ETexEnvSource source0RGB() const { return mSource0RGB; }
1615  ETexEnvSource source1RGB() const { return mSource1RGB; }
1616  ETexEnvSource source2RGB() const { return mSource2RGB; }
1617  void setSource0Alpha(ETexEnvSource source) { mSource0Alpha = source; }
1618  void setSource1Alpha(ETexEnvSource source) { mSource1Alpha = source; }
1619  void setSource2Alpha(ETexEnvSource source) { mSource2Alpha = source; }
1620  ETexEnvSource source0Alpha() const { return mSource0Alpha; }
1621  ETexEnvSource source1Alpha() const { return mSource1Alpha; }
1622  ETexEnvSource source2Alpha() const { return mSource2Alpha; }
1623 
1624  void setOperand0RGB(ETexEnvOperand operand) { mOperand0RGB = operand; }
1625  void setOperand1RGB(ETexEnvOperand operand) { mOperand1RGB = operand; }
1626  void setOperand2RGB(ETexEnvOperand operand) { mOperand2RGB = operand; }
1627  ETexEnvOperand operand0RGB() const { return mOperand0RGB; }
1628  ETexEnvOperand operand1RGB() const { return mOperand1RGB; }
1629  ETexEnvOperand operand2RGB() const { return mOperand2RGB; }
1630  void setOperand0Alpha(ETexEnvOperand operand) { mOperand0Alpha = operand; }
1631  void setOperand1Alpha(ETexEnvOperand operand) { mOperand1Alpha = operand; }
1632  void setOperand2Alpha(ETexEnvOperand operand) { mOperand2Alpha = operand; }
1633  ETexEnvOperand operand0Alpha() const { return mOperand0Alpha; }
1634  ETexEnvOperand operand1Alpha() const { return mOperand1Alpha; }
1635  ETexEnvOperand operand2Alpha() const { return mOperand2Alpha; }
1636 
1637  void setPointSpriteCoordReplace(bool replace) { mPointSpriteCoordReplace = replace; }
1638  bool pointSpriteCoordReplace() const { return mPointSpriteCoordReplace; }
1639 
1640  void setLodBias(float lodbias) { mLodBias = lodbias; }
1641  float lodBias() const { return mLodBias; }
1642 
1643  virtual ref<RenderState> clone() const
1644  {
1645  ref<TexEnv> rs = new TexEnv;
1646  *rs = *this;
1647  return rs;
1648  }
1649 
1650  public:
1652  float mRGBScale;
1669  float mLodBias;
1671  };
1672  //------------------------------------------------------------------------------
1673  // TexGen
1674  //------------------------------------------------------------------------------
1683  {
1685 
1686  public:
1687  TexGen();
1688 
1689  virtual ERenderState type() const { return RS_TexGen; }
1690  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
1691 
1692  void setEyePlaneS(const fvec4& plane) { mEyePlaneS = plane; }
1693  void setObjectPlaneS(const fvec4& plane) { mObjectPlaneS = plane; }
1694  void setGenModeS(ETexGenMode mode) { mGenModeS = mode; }
1695  const fvec4& eyePlaneS() const { return mEyePlaneS; }
1696  const fvec4& objectPlaneS() const { return mObjectPlaneS; }
1697  ETexGenMode genModeS() const { return mGenModeS; }
1698 
1699  void setEyePlaneT(const fvec4& plane) { mEyePlaneT = plane; }
1700  void setObjectPlaneT(const fvec4& plane) { mObjectPlaneT = plane; }
1701  void setGenModeT(ETexGenMode mode) { mGenModeT = mode; }
1702  const fvec4& eyePlaneT() const { return mEyePlaneT; }
1703  const fvec4& objectPlaneT() const { return mObjectPlaneT; }
1704  ETexGenMode genModeT() const { return mGenModeT; }
1705 
1706  void setEyePlaneR(const fvec4& plane) { mEyePlaneR = plane; }
1707  void setObjectPlaneR(const fvec4& plane) { mObjectPlaneR = plane; }
1708  void setGenModeR(ETexGenMode mode) { mGenModeR = mode; }
1709  const fvec4& eyePlaneR() const { return mEyePlaneR; }
1710  const fvec4& objectPlaneR() const { return mObjectPlaneR; }
1711  ETexGenMode genModeR() const { return mGenModeR; }
1712 
1713  void setEyePlaneQ(const fvec4& plane) { mEyePlaneQ = plane; }
1714  void setObjectPlaneQ(const fvec4& plane) { mObjectPlaneQ = plane; }
1715  void setGenModeQ(ETexGenMode mode) { mGenModeQ = mode; }
1716  const fvec4& eyePlaneQ() const { return mEyePlaneQ; }
1717  const fvec4& objectPlaneQ() const { return mObjectPlaneQ; }
1718  ETexGenMode genModeQ() const { return mGenModeQ; }
1719 
1720  virtual ref<RenderState> clone() const
1721  {
1722  ref<TexGen> rs = new TexGen;
1723  *rs = *this;
1724  return rs;
1725  }
1726 
1727  public:
1740  };
1741  //------------------------------------------------------------------------------
1742  // TextureImageUnit
1743  //------------------------------------------------------------------------------
1748  {
1750 
1751  public:
1753  {
1754  VL_DEBUG_SET_OBJECT_NAME()
1755  }
1756 
1757  virtual ERenderState type() const { return RS_TextureImageUnit; }
1758  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
1759 
1761  static void reset(int index, OpenGLContext* ctx) { TextureImageUnit().apply( index, NULL, ctx ); }
1762 
1765  void setTexture(Texture* texture) { mTexture = texture; }
1766 
1768  Texture* texture() { return mTexture.get(); }
1769 
1771  const Texture* texture() const { return mTexture.get(); }
1772 
1773  bool hasTexture() const;
1774 
1775  virtual ref<RenderState> clone() const
1776  {
1778  *rs = *this;
1779  return rs;
1780  }
1781 
1782  protected:
1784  };
1785  //------------------------------------------------------------------------------
1786  // ShaderAnimator
1787  //------------------------------------------------------------------------------
1793  {
1795 
1796  public:
1797  ShaderAnimator(): mEnabled(true) {}
1798 
1804  virtual void updateShader(Shader* shader, Camera* camera, real cur_time) = 0;
1805 
1807  void setEnabled(bool enable) { mEnabled = enable; }
1808 
1810  bool isEnabled() const { return mEnabled; }
1811 
1812  protected:
1813  bool mEnabled;
1814  };
1815  //------------------------------------------------------------------------------
1816  // Shader
1817  //------------------------------------------------------------------------------
1831  {
1833 
1834  // use deepCopy() and shallowCopy() instead
1835  Shader(const Shader& other): Object(other) { }
1836  Shader& operator=(const Shader&) { return *this; }
1837 
1838  public:
1840  Shader();
1841 
1843  virtual ~Shader();
1844 
1847  {
1848  ref<Shader> sh = new Shader;
1849  sh->shallowCopyFrom(*this);
1850  return sh;
1851  }
1852 
1855  Shader& shallowCopyFrom(const Shader& other)
1856  {
1857  super::operator=(other);
1858 
1859  // we don't copy the update time
1860  // mLastUpdateTime = other.mLastUpdateTime;
1861 
1862  if (other.mRenderStateSet.get())
1863  {
1864  if (mRenderStateSet.get() == NULL)
1865  mRenderStateSet = new RenderStateSet;
1866  mRenderStateSet->shallowCopyFrom( *other.mRenderStateSet );
1867  }
1868  else
1869  mRenderStateSet = NULL;
1870 
1871  if (other.mEnableSet.get())
1872  {
1873  if (mEnableSet.get() == NULL)
1874  mEnableSet = new EnableSet;
1875  *mEnableSet = *other.mEnableSet;
1876  }
1877  else
1878  mEnableSet = NULL;
1879 
1880  if (other.mUniformSet.get())
1881  {
1882  if (mUniformSet.get() == NULL)
1883  mUniformSet = new UniformSet;
1884  mUniformSet->shallowCopyFrom( *other.mUniformSet );
1885  }
1886  else
1887  mUniformSet = NULL;
1888 
1889  mScissor = other.mScissor;
1890 
1891  mShaderAnimator = other.mShaderAnimator;
1892 
1893  #ifdef VL_USER_DATA_SHADER
1894  mShaderUserData = other.mShaderUserData;
1895  #endif
1896 
1897  return *this;
1898  }
1899 
1902  {
1903  ref<Shader> sh = new Shader;
1904  sh->deepCopyFrom(*this);
1905  return sh;
1906  }
1907 
1909  Shader& deepCopyFrom(const Shader& other)
1910  {
1911  super::operator=(other);
1912 
1913  // we don't copy the update time
1914  // mLastUpdateTime = other.mLastUpdateTime;
1915 
1916  if (other.mRenderStateSet.get())
1917  {
1918  if (mRenderStateSet.get() == NULL)
1919  mRenderStateSet = new RenderStateSet;
1920  mRenderStateSet->deepCopyFrom( *other.mRenderStateSet.get() );
1921  }
1922  else
1923  mRenderStateSet = NULL;
1924 
1925  if (other.mEnableSet.get())
1926  {
1927  if (mEnableSet.get() == NULL)
1928  mEnableSet = new EnableSet;
1929  *mEnableSet = *other.mEnableSet; // this is just a vector of ints
1930  }
1931  else
1932  mEnableSet = NULL;
1933 
1934  if (other.mUniformSet.get())
1935  {
1936  if (mUniformSet.get() == NULL)
1937  mUniformSet = new UniformSet;
1938  mUniformSet->deepCopyFrom( *other.mUniformSet.get() );
1939  }
1940  else
1941  mUniformSet = NULL;
1942 
1943  mScissor = new Scissor(*other.mScissor);
1944 
1945  // note: this is shallow copied
1946  mShaderAnimator = other.mShaderAnimator;
1947 
1948  #ifdef VL_USER_DATA_SHADER
1949  mShaderUserData = other.mShaderUserData;
1950  #endif
1951 
1952  return *this;
1953  }
1954 
1956  void reset()
1957  {
1958  disableAll();
1959  eraseAllRenderStates();
1960  eraseAllUniforms();
1961  }
1962 
1963  // state getters
1964 
1966  GLSLProgram* gocGLSLProgram();
1967 
1969  const GLSLProgram* getGLSLProgram() const;
1970 
1972  GLSLProgram* getGLSLProgram();
1973 
1974  PixelTransfer* gocPixelTransfer();
1975  const PixelTransfer* getPixelTransfer() const { if (!getRenderStateSet()) return NULL; else return static_cast<const PixelTransfer*>( getRenderStateSet()->renderState( RS_PixelTransfer ) ); }
1976  PixelTransfer* getPixelTransfer() { if (!getRenderStateSet()) return NULL; else return static_cast<PixelTransfer*>( getRenderStateSet()->renderState( RS_PixelTransfer ) ); }
1977 
1978  Hint* gocHint();
1979  const Hint* getHint() const { if (!getRenderStateSet()) return NULL; else return static_cast<const Hint*>( getRenderStateSet()->renderState( RS_Hint ) ); }
1980  Hint* getHint() { if (!getRenderStateSet()) return NULL; else return static_cast<Hint*>( getRenderStateSet()->renderState( RS_Hint ) ); }
1981 
1982  CullFace* gocCullFace();
1983  const CullFace* getCullFace() const { if (!getRenderStateSet()) return NULL; else return static_cast<const CullFace*>( getRenderStateSet()->renderState( RS_CullFace ) ); }
1984  CullFace* getCullFace() { if (!getRenderStateSet()) return NULL; else return static_cast<CullFace*>( getRenderStateSet()->renderState( RS_CullFace ) ); }
1985 
1986  FrontFace* gocFrontFace();
1987  const FrontFace* getFrontFace() const { if (!getRenderStateSet()) return NULL; else return static_cast<const FrontFace*>( getRenderStateSet()->renderState( RS_FrontFace ) ); }
1988  FrontFace* getFrontFace() { if (!getRenderStateSet()) return NULL; else return static_cast<FrontFace*>( getRenderStateSet()->renderState( RS_FrontFace ) ); }
1989 
1990  DepthFunc* gocDepthFunc();
1991  const DepthFunc* getDepthFunc() const { if (!getRenderStateSet()) return NULL; else return static_cast<const DepthFunc*>( getRenderStateSet()->renderState( RS_DepthFunc ) ); }
1992  DepthFunc* getDepthFunc() { if (!getRenderStateSet()) return NULL; else return static_cast<DepthFunc*>( getRenderStateSet()->renderState( RS_DepthFunc ) ); }
1993 
1994  DepthMask* gocDepthMask();
1995  const DepthMask* getDepthMask() const { if (!getRenderStateSet()) return NULL; else return static_cast<const DepthMask*>( getRenderStateSet()->renderState( RS_DepthMask ) ); }
1996  DepthMask* getDepthMask() { if (!getRenderStateSet()) return NULL; else return static_cast<DepthMask*>( getRenderStateSet()->renderState( RS_DepthMask ) ); }
1997 
1998  Color* gocColor();
1999  const Color* getColor() const { if (!getRenderStateSet()) return NULL; else return static_cast<const Color*>( getRenderStateSet()->renderState( RS_Color ) ); }
2000  Color* getColor() { if (!getRenderStateSet()) return NULL; else return static_cast<Color*>( getRenderStateSet()->renderState( RS_Color ) ); }
2001 
2002  SecondaryColor* gocSecondaryColor();
2003  const SecondaryColor* getSecondaryColor() const { if (!getRenderStateSet()) return NULL; else return static_cast<const SecondaryColor*>( getRenderStateSet()->renderState( RS_SecondaryColor ) ); }
2004  SecondaryColor* getSecondaryColor() { if (!getRenderStateSet()) return NULL; else return static_cast<SecondaryColor*>( getRenderStateSet()->renderState( RS_SecondaryColor ) ); }
2005 
2006  Normal* gocNormal();
2007  const Normal* getNormal() const { if (!getRenderStateSet()) return NULL; else return static_cast<const Normal*>( getRenderStateSet()->renderState( RS_Normal ) ); }
2008  Normal* getNormal() { if (!getRenderStateSet()) return NULL; else return static_cast<Normal*>( getRenderStateSet()->renderState( RS_Normal ) ); }
2009 
2010  ColorMask* gocColorMask();
2011  const ColorMask* getColorMask() const { if (!getRenderStateSet()) return NULL; else return static_cast<const ColorMask*>( getRenderStateSet()->renderState( RS_ColorMask ) ); }
2012  ColorMask* getColorMask() { if (!getRenderStateSet()) return NULL; else return static_cast<ColorMask*>( getRenderStateSet()->renderState( RS_ColorMask ) ); }
2013 
2014  PolygonMode* gocPolygonMode();
2015  const PolygonMode* getPolygonMode() const { if (!getRenderStateSet()) return NULL; else return static_cast<const PolygonMode*>( getRenderStateSet()->renderState( RS_PolygonMode ) ); }
2016  PolygonMode* getPolygonMode() { if (!getRenderStateSet()) return NULL; else return static_cast<PolygonMode*>( getRenderStateSet()->renderState( RS_PolygonMode ) ); }
2017 
2018  ShadeModel* gocShadeModel();
2019  const ShadeModel* getShadeModel() const { if (!getRenderStateSet()) return NULL; else return static_cast<const ShadeModel*>( getRenderStateSet()->renderState( RS_ShadeModel ) ); }
2020  ShadeModel* getShadeModel() { if (!getRenderStateSet()) return NULL; else return static_cast<ShadeModel*>( getRenderStateSet()->renderState( RS_ShadeModel ) ); }
2021 
2022  BlendEquation* gocBlendEquation();
2023  const BlendEquation* getBlendEquation() const { if (!getRenderStateSet()) return NULL; else return static_cast<const BlendEquation*>( getRenderStateSet()->renderState( RS_BlendEquation ) ); }
2024  BlendEquation* getBlendEquation() { if (!getRenderStateSet()) return NULL; else return static_cast<BlendEquation*>( getRenderStateSet()->renderState( RS_BlendEquation ) ); }
2025 
2026  AlphaFunc* gocAlphaFunc();
2027  const AlphaFunc* getAlphaFunc() const { if (!getRenderStateSet()) return NULL; else return static_cast<const AlphaFunc*>( getRenderStateSet()->renderState( RS_AlphaFunc ) ); }
2028  AlphaFunc* getAlphaFunc() { if (!getRenderStateSet()) return NULL; else return static_cast<AlphaFunc*>( getRenderStateSet()->renderState( RS_AlphaFunc ) ); }
2029 
2030  Material* gocMaterial();
2031  const Material* getMaterial() const { if (!getRenderStateSet()) return NULL; else return static_cast<const Material*>( getRenderStateSet()->renderState( RS_Material ) ); }
2032  Material* getMaterial() { if (!getRenderStateSet()) return NULL; else return static_cast<Material*>( getRenderStateSet()->renderState( RS_Material ) ); }
2033 
2034  LightModel* gocLightModel();
2035  const LightModel* getLightModel() const { if (!getRenderStateSet()) return NULL; else return static_cast<const LightModel*>( getRenderStateSet()->renderState( RS_LightModel ) ); }
2036  LightModel* getLightModel() { if (!getRenderStateSet()) return NULL; else return static_cast<LightModel*>( getRenderStateSet()->renderState( RS_LightModel ) ); }
2037 
2038  Fog* gocFog();
2039  const Fog* getFog() const { if (!getRenderStateSet()) return NULL; else return static_cast<const Fog*>( getRenderStateSet()->renderState( RS_Fog ) ); }
2040  Fog* getFog() { if (!getRenderStateSet()) return NULL; else return static_cast<Fog*>( getRenderStateSet()->renderState( RS_Fog ) ); }
2041 
2042  PolygonOffset* gocPolygonOffset();
2043  const PolygonOffset* getPolygonOffset() const { if (!getRenderStateSet()) return NULL; else return static_cast<const PolygonOffset*>( getRenderStateSet()->renderState( RS_PolygonOffset ) ); }
2044  PolygonOffset* getPolygonOffset() { if (!getRenderStateSet()) return NULL; else return static_cast<PolygonOffset*>( getRenderStateSet()->renderState( RS_PolygonOffset ) ); }
2045 
2046  LogicOp* gocLogicOp();
2047  const LogicOp* getLogicOp() const { if (!getRenderStateSet()) return NULL; else return static_cast<const LogicOp*>( getRenderStateSet()->renderState( RS_LogicOp ) ); }
2048  LogicOp* getLogicOp() { if (!getRenderStateSet()) return NULL; else return static_cast<LogicOp*>( getRenderStateSet()->renderState( RS_LogicOp ) ); }
2049 
2050  DepthRange* gocDepthRange();
2051  const DepthRange* getDepthRange() const { if (!getRenderStateSet()) return NULL; else return static_cast<const DepthRange*>( getRenderStateSet()->renderState( RS_DepthRange ) ); }
2052  DepthRange* getDepthRange() { if (!getRenderStateSet()) return NULL; else return static_cast<DepthRange*>( getRenderStateSet()->renderState( RS_DepthRange ) ); }
2053 
2054  LineWidth* gocLineWidth();
2055  const LineWidth* getLineWidth() const { if (!getRenderStateSet()) return NULL; else return static_cast<const LineWidth*>( getRenderStateSet()->renderState( RS_LineWidth ) ); }
2056  LineWidth* getLineWidth() { if (!getRenderStateSet()) return NULL; else return static_cast<LineWidth*>( getRenderStateSet()->renderState( RS_LineWidth ) ); }
2057 
2058  PointSize* gocPointSize();
2059  const PointSize* getPointSize() const { if (!getRenderStateSet()) return NULL; else return static_cast<const PointSize*>( getRenderStateSet()->renderState( RS_PointSize ) ); }
2060  PointSize* getPointSize() { if (!getRenderStateSet()) return NULL; else return static_cast<PointSize*>( getRenderStateSet()->renderState( RS_PointSize ) ); }
2061 
2062  LineStipple* gocLineStipple();
2063  const LineStipple* getLineStipple() const { if (!getRenderStateSet()) return NULL; else return static_cast<const LineStipple*>( getRenderStateSet()->renderState( RS_LineStipple ) ); }
2064  LineStipple* getLineStipple() { if (!getRenderStateSet()) return NULL; else return static_cast<LineStipple*>( getRenderStateSet()->renderState( RS_LineStipple ) ); }
2065 
2066  PolygonStipple* gocPolygonStipple();
2067  const PolygonStipple* getPolygonStipple() const { if (!getRenderStateSet()) return NULL; else return static_cast<const PolygonStipple*>( getRenderStateSet()->renderState( RS_PolygonStipple ) ); }
2068  PolygonStipple* getPolygonStipple() { if (!getRenderStateSet()) return NULL; else return static_cast<PolygonStipple*>( getRenderStateSet()->renderState( RS_PolygonStipple ) ); }
2069 
2070  PointParameter* gocPointParameter();
2071  const PointParameter* getPointParameter() const { if (!getRenderStateSet()) return NULL; else return static_cast<const PointParameter*>( getRenderStateSet()->renderState( RS_PointParameter ) ); }
2072  PointParameter* getPointParameter() { if (!getRenderStateSet()) return NULL; else return static_cast<PointParameter*>( getRenderStateSet()->renderState( RS_PointParameter ) ); }
2073 
2074  StencilFunc* gocStencilFunc();
2075  const StencilFunc* getStencilFunc() const { if (!getRenderStateSet()) return NULL; else return static_cast<const StencilFunc*>( getRenderStateSet()->renderState( RS_StencilFunc ) ); }
2076  StencilFunc* getStencilFunc() { if (!getRenderStateSet()) return NULL; else return static_cast<StencilFunc*>( getRenderStateSet()->renderState( RS_StencilFunc ) ); }
2077 
2078  StencilOp* gocStencilOp();
2079  const StencilOp* getStencilOp() const { if (!getRenderStateSet()) return NULL; else return static_cast<const StencilOp*>( getRenderStateSet()->renderState( RS_StencilOp ) ); }
2080  StencilOp* getStencilOp() { if (!getRenderStateSet()) return NULL; else return static_cast<StencilOp*>( getRenderStateSet()->renderState( RS_StencilOp ) ); }
2081 
2082  StencilMask* gocStencilMask();
2083  const StencilMask* getStencilMask() const { if (!getRenderStateSet()) return NULL; else return static_cast<const StencilMask*>( getRenderStateSet()->renderState( RS_StencilMask ) ); }
2084  StencilMask* getStencilMask() { if (!getRenderStateSet()) return NULL; else return static_cast<StencilMask*>( getRenderStateSet()->renderState( RS_StencilMask ) ); }
2085 
2086  BlendColor* gocBlendColor();
2087  const BlendColor* getBlendColor() const { if (!getRenderStateSet()) return NULL; else return static_cast<const BlendColor*>( getRenderStateSet()->renderState( RS_BlendColor ) ); }
2088  BlendColor* getBlendColor() { if (!getRenderStateSet()) return NULL; else return static_cast<BlendColor*>( getRenderStateSet()->renderState( RS_BlendColor ) ); }
2089 
2090  BlendFunc* gocBlendFunc();
2091  const BlendFunc* getBlendFunc() const { if (!getRenderStateSet()) return NULL; else return static_cast<const BlendFunc*>( getRenderStateSet()->renderState( RS_BlendFunc ) ); }
2092  BlendFunc* getBlendFunc() { if (!getRenderStateSet()) return NULL; else return static_cast<BlendFunc*>( getRenderStateSet()->renderState( RS_BlendFunc ) ); }
2093 
2094  SampleCoverage* gocSampleCoverage();
2095  const SampleCoverage* getSampleCoverage() const { if (!getRenderStateSet()) return NULL; else return static_cast<const SampleCoverage*>( getRenderStateSet()->renderState( RS_SampleCoverage ) ); }
2096  SampleCoverage* getSampleCoverage() { if (!getRenderStateSet()) return NULL; else return static_cast<SampleCoverage*>( getRenderStateSet()->renderState( RS_SampleCoverage ) ); }
2097 
2098  // indexed render states
2099 
2100  // vertex attrib
2101 
2102  VertexAttrib* gocVertexAttrib(int attr_index);
2103 
2104  const VertexAttrib* getVertexAttrib(int attr_index) const;
2105 
2106  VertexAttrib* getVertexAttrib(int attr_index);
2107 
2108  // lights
2109 
2110  Light* gocLight(int light_index);
2111 
2112  const Light* getLight(int light_index) const;
2113 
2114  Light* getLight(int light_index);
2115 
2116  // clip planes
2117 
2118  ClipPlane* gocClipPlane(int plane_index);
2119 
2120  const ClipPlane* getClipPlane(int plane_index) const;
2121 
2122  ClipPlane* getClipPlane(int plane_index);
2123 
2124  // texture unit
2125 
2126  TextureImageUnit* gocTextureImageUnit(int unit_index);
2127 
2128  const TextureImageUnit* getTextureImageUnit(int unit_index) const { return static_cast<const TextureImageUnit*>( getRenderStateSet()->renderState( RS_TextureImageUnit, unit_index ) ); }
2129 
2130  TextureImageUnit* getTextureImageUnit(int unit_index) { return static_cast<TextureImageUnit*>( getRenderStateSet()->renderState( RS_TextureImageUnit, unit_index ) ); }
2131 
2132  // tex env
2133 
2134  TexEnv* gocTexEnv(int unit_index);
2135 
2136  const TexEnv* getTexEnv(int unit_index) const { return static_cast<const TexEnv*>( getRenderStateSet()->renderState( RS_TexEnv, unit_index ) ); }
2137 
2138  TexEnv* getTexEnv(int unit_index) { return static_cast<TexEnv*>( getRenderStateSet()->renderState( RS_TexEnv, unit_index ) ); }
2139 
2140  // tex gen
2141 
2142  TexGen* gocTexGen(int unit_index);
2143 
2144  const TexGen* getTexGen(int unit_index) const { return static_cast<const TexGen*>( getRenderStateSet()->renderState( RS_TexGen, unit_index ) ); }
2145 
2146  TexGen* getTexGen(int unit_index) { return static_cast<TexGen*>( getRenderStateSet()->renderState( RS_TexGen, unit_index ) ); }
2147 
2148  // texture matrix
2149 
2150  TextureMatrix* gocTextureMatrix(int unit_index);
2151 
2152  const TextureMatrix* getTextureMatrix(int unit_index) const { return static_cast<const TextureMatrix*>( getRenderStateSet()->renderState( RS_TextureMatrix, unit_index ) ); }
2153 
2154  TextureMatrix* getTextureMatrix(int unit_index) { return static_cast<TextureMatrix*>( getRenderStateSet()->renderState( RS_TextureMatrix, unit_index ) ); }
2155 
2156  // enable methods
2157 
2158  void enable(EEnable capability) { gocEnableSet()->enable(capability); }
2159 
2160  void disable(EEnable capability) { gocEnableSet()->disable(capability); }
2161 
2162  const std::vector<EEnable>& enables() const { return getEnableSet()->enables(); }
2163 
2164  int isEnabled(EEnable capability) const { if (!getEnableSet()) return false; return getEnableSet()->isEnabled(capability); }
2165 
2166  void disableAll() { if (getEnableSet()) getEnableSet()->disableAll(); }
2167 
2168  bool isBlendingEnabled() const { if (!getEnableSet()) return false; return getEnableSet()->isBlendingEnabled(); }
2169 
2170  // render states methods
2171 
2172  void setRenderState(RenderStateNonIndexed* renderstate) { gocRenderStateSet()->setRenderState(renderstate, -1); }
2173 
2174  void setRenderState(RenderState* renderstate, int index) { gocRenderStateSet()->setRenderState(renderstate, index); }
2175 
2176  const RenderState* renderState( ERenderState type, int index=0 ) const { if (!getRenderStateSet()) return NULL; return getRenderStateSet()->renderState(type, index); }
2177 
2178  RenderState* renderState( ERenderState type, int index=0 ) { return gocRenderStateSet()->renderState(type, index); }
2179 
2180  size_t renderStatesCount() const { return getRenderStateSet()->renderStatesCount(); }
2181 
2182  const RenderStateSlot* renderStates() const { return getRenderStateSet()->renderStates(); }
2183 
2184  RenderStateSlot* renderStates() { return getRenderStateSet()->renderStates(); }
2185 
2187  void eraseRenderState(ERenderState type, int index=-1) { gocRenderStateSet()->eraseRenderState(type, index); }
2188 
2189  void eraseRenderState(RenderState* rs, int index) { if (rs) gocRenderStateSet()->eraseRenderState(rs->type(), index); }
2190 
2191  void eraseAllRenderStates() { if(getRenderStateSet()) getRenderStateSet()->eraseAllRenderStates(); }
2192 
2194  const GLSLProgram* glslProgram() const { if (!getRenderStateSet()) return NULL; return getRenderStateSet()->glslProgram(); }
2195 
2197  GLSLProgram* glslProgram() { return gocRenderStateSet()->glslProgram(); }
2198 
2199  // uniforms methods
2200 
2202  void setUniform(Uniform* uniform) { VL_CHECK(uniform); gocUniformSet()->setUniform(uniform); }
2203 
2205  const std::vector< ref<Uniform> >& uniforms() const { return getUniformSet()->uniforms(); }
2206 
2208  void eraseUniform(const char* name) { gocUniformSet()->eraseUniform(name); }
2209 
2211  void eraseUniform(const Uniform* uniform) { gocUniformSet()->eraseUniform(uniform); }
2212 
2214  void eraseAllUniforms() { if (getUniformSet()) getUniformSet()->eraseAllUniforms(); }
2215 
2217  Uniform* gocUniform(const char* name) { return gocUniformSet()->gocUniform(name); }
2218 
2220  Uniform* getUniform(const char* name) { return getUniformSet()->getUniform(name); }
2221 
2223  const Uniform* getUniform(const char* name) const { return getUniformSet()->getUniform(name); }
2224 
2225  // sets
2226 
2227  EnableSet* gocEnableSet() { if (!mEnableSet) mEnableSet = new EnableSet; return mEnableSet.get(); }
2228 
2229  EnableSet* getEnableSet() { return mEnableSet.get(); }
2230 
2231  const EnableSet* getEnableSet() const { return mEnableSet.get(); }
2232 
2233  RenderStateSet* gocRenderStateSet() { if (!mRenderStateSet) mRenderStateSet = new RenderStateSet; return mRenderStateSet.get(); }
2234 
2235  RenderStateSet* getRenderStateSet() { return mRenderStateSet.get(); }
2236 
2237  const RenderStateSet* getRenderStateSet() const { return mRenderStateSet.get(); }
2238 
2249  UniformSet* gocUniformSet() { if (!mUniformSet) mUniformSet = new UniformSet; return mUniformSet.get(); }
2250 
2261  UniformSet* getUniformSet() { return mUniformSet.get(); }
2262 
2273  const UniformSet* getUniformSet() const { return mUniformSet.get(); }
2274 
2275  void setEnableSet(EnableSet* es) { mEnableSet = es; }
2276 
2277  void setRenderStateSet(RenderStateSet* rss) { mRenderStateSet = rss; }
2278 
2289  void setUniformSet(UniformSet* us) { mUniformSet = us; }
2290 
2300  void setScissor(Scissor* scissor) { mScissor = scissor; }
2301 
2309  const Scissor* scissor() const { return mScissor.get(); }
2310 
2318  Scissor* scissor() { return mScissor.get(); }
2319 
2321  void setShaderAnimator(ShaderAnimator* animator) { mShaderAnimator = animator; }
2322 
2324  ShaderAnimator* shaderAnimator() { return mShaderAnimator.get(); }
2325 
2327  const ShaderAnimator* shaderAnimator() const { return mShaderAnimator.get(); }
2328 
2330  real lastUpdateTime() const { return mLastUpdateTime; }
2331 
2333  void setLastUpdateTime(real time) { mLastUpdateTime = time; }
2334 
2335 #ifdef VL_USER_DATA_SHADER
2336  public:
2337  const Object* shaderUserData() const { return mShaderUserData.get(); }
2338  Object* shaderUserData() { return mShaderUserData.get(); }
2339  void setShaderUserData(Object* user_data) { mShaderUserData = user_data; }
2340 
2341  private:
2342  ref<Object> mShaderUserData;
2343 #endif
2344 
2345  protected:
2352  };
2353 }
2354 
2355 #endif
EStencilOp sFail_Back() const
Definition: Shader.hpp:1385
const Hint * getHint() const
Definition: Shader.hpp:1979
void setFogHint(EHintMode mode)
Definition: Shader.hpp:365
EStencilOp dpFail_Front() const
Definition: Shader.hpp:1381
void setFrontSpecular(const fvec4 &color)
Definition: Shader.hpp:801
EPolygonFace mFaceMode
Definition: Shader.hpp:421
const fvec4 & objectPlaneQ() const
Definition: Shader.hpp:1717
UniformSet * gocUniformSet()
Returns the UniformSet installed (creating it if no UniformSet has been installed) ...
Definition: Shader.hpp:2249
void setOperand1Alpha(ETexEnvOperand operand)
Definition: Shader.hpp:1631
void setBackFace(EPolygonMode backface)
Definition: Shader.hpp:545
BlendColor * getBlendColor()
Definition: Shader.hpp:2088
BlendEquation * getBlendEquation()
Definition: Shader.hpp:2024
ETexGenMode genModeR() const
Definition: Shader.hpp:1711
virtual ERenderState type() const
Definition: Shader.hpp:236
Wraps an OpenGL Shading Language uniform to be associated to a GLSLProgram (see vl::GLSLProgram docum...
Definition: Uniform.hpp:59
void setPointSpriteCoordReplace(bool replace)
Definition: Shader.hpp:1637
int factor() const
Definition: Shader.hpp:1201
GLclampf value() const
Definition: Shader.hpp:717
virtual ref< RenderState > clone() const
Definition: Shader.hpp:1258
void setCombineRGB(ETexEnvMode combineRGB)
Definition: Shader.hpp:1600
void setLastUpdateTime(real time)
Used internally.
Definition: Shader.hpp:2333
void setRGBScale(float rgbscale)
Definition: Shader.hpp:1606
bool pointSpriteCoordReplace() const
Definition: Shader.hpp:1638
ETexEnvOperand mOperand2RGB
Definition: Shader.hpp:1665
fvec4 mObjectPlaneS
Definition: Shader.hpp:1729
virtual ref< RenderState > clone() const
Definition: Shader.hpp:1568
virtual ref< RenderState > clone() const
Definition: Shader.hpp:1101
float mPostConvolutionAlphaScale
Definition: Shader.hpp:335
ETexEnvMode mode() const
Definition: Shader.hpp:1599
virtual ERenderState type() const
Definition: Shader.hpp:1757
ELogicOp logicOp() const
Definition: Shader.hpp:1021
void setDensity(float density)
Definition: Shader.hpp:928
float depthScale() const
Definition: Shader.hpp:248
RenderState wrapping the OpenGL function glPointParameter(), see also http://www.opengl.org/sdk/docs/man/xhtml/glPointParameter.xml for more information.
Definition: Shader.hpp:1221
EStencilOp mSFail_Back
Definition: Shader.hpp:1400
void setSource1Alpha(ETexEnvSource source)
Definition: Shader.hpp:1618
float lineWidth() const
Definition: Shader.hpp:1099
virtual ref< RenderState > clone() const
Definition: Shader.hpp:1166
RenderState wrapping the OpenGL function glStencilOp() and glStencilOpSeparate(), see also http://www...
Definition: Shader.hpp:1346
void setDepthBias(float depth_bias)
Definition: Shader.hpp:284
ShadeModel * getShadeModel()
Definition: Shader.hpp:2020
float mPostColorMatrixAlphaScale
Definition: Shader.hpp:327
virtual ERenderState type() const
Definition: Shader.hpp:1498
int isEnabled(EEnable capability) const
Definition: Shader.hpp:2164
void setPointSmoothHint(EHintMode mode)
Definition: Shader.hpp:364
void setLodBias(float lodbias)
Definition: Shader.hpp:1640
Vector3< float > fvec3
A 3 components vector with float precision.
Definition: Vector3.hpp:253
virtual ERenderState type() const
Definition: Shader.hpp:1595
ETexEnvOperand operand2RGB() const
Definition: Shader.hpp:1629
unsigned int mMask_Front
Definition: Shader.hpp:1336
const DepthRange * getDepthRange() const
Definition: Shader.hpp:2051
float zFar() const
Definition: Shader.hpp:1065
void setPostColorMatrixGreenScale(float scale)
Definition: Shader.hpp:286
void setAlphaBias(float alpha_bias)
Definition: Shader.hpp:283
Fog * getFog()
Definition: Shader.hpp:2040
bool useCameraRotationInverse() const
Definition: Shader.hpp:1566
void setFadeThresholdSize(float threshold)
Definition: Shader.hpp:1244
EBlendFactor dstRGB() const
Definition: Shader.hpp:631
void setIndexOffset(int index_offset)
Definition: Shader.hpp:274
float mStart
Definition: Shader.hpp:955
const RenderState * renderState(ERenderState type, int index=0) const
Definition: Shader.hpp:2176
ref< RenderStateSet > mRenderStateSet
Definition: Shader.hpp:2346
void setLineSmoothHint(EHintMode mode)
Definition: Shader.hpp:363
RenderStateSet * gocRenderStateSet()
Definition: Shader.hpp:2233
virtual ref< RenderState > clone() const
Definition: Shader.hpp:889
const StencilFunc * getStencilFunc() const
Definition: Shader.hpp:2075
bool localViewer() const
Definition: Shader.hpp:881
const fvec4 & value() const
Definition: Shader.hpp:76
LineStipple * getLineStipple()
Definition: Shader.hpp:2064
float refValue() const
Definition: Shader.hpp:755
ERenderState
fvec4 mFrontSpecular
Definition: Shader.hpp:841
fvec4 mBlendColor
Definition: Shader.hpp:1481
RenderState wrapping the OpenGL function glDepthFunc(), see also http://www.opengl.org/sdk/docs/man/xhtml/glDepthFunc.xml for more information.
Definition: Shader.hpp:461
const PolygonOffset * getPolygonOffset() const
Definition: Shader.hpp:2043
EShadeModel shadeModel() const
Definition: Shader.hpp:583
float blueBias() const
Definition: Shader.hpp:251
RenderState wrapping the OpenGL function glHint(), see also http://www.opengl.org/sdk/docs/man/xhtml/...
Definition: Shader.hpp:346
EPolygonFace
ETexEnvSource mSource2Alpha
Definition: Shader.hpp:1662
Vector4< float > fvec4
A 4 components vector with float precision.
Definition: Vector4.hpp:280
ETexEnvMode
float mDensity
Definition: Shader.hpp:954
void setPostColorMatrixRedScale(float scale)
Definition: Shader.hpp:285
EPolygonMode backFace() const
Definition: Shader.hpp:549
UniformSet & shallowCopyFrom(const UniformSet &other)
Definition: UniformSet.hpp:62
void setBackDiffuse(const fvec4 &color)
Definition: Shader.hpp:812
void eraseAllUniforms()
Equivalent to gocUniformSet()->eraseAllUniforms(...)
Definition: Shader.hpp:2214
EShadeModel
bool mDepthMask
Definition: Shader.hpp:520
EBlendFactor srcAlpha() const
Definition: Shader.hpp:633
void setPerspectiveCorrectionHint(EHintMode mode)
Definition: Shader.hpp:361
SecondaryColor * getSecondaryColor()
Definition: Shader.hpp:2004
float frontShininess() const
Definition: Shader.hpp:809
StencilOp * getStencilOp()
Definition: Shader.hpp:2080
RenderState wrapping the OpenGL function glPolygonOffset(), see also http://www.opengl.org/sdk/docs/man/xhtml/glPolygonOffset.xml for more information.
Definition: Shader.hpp:963
ETexEnvOperand mOperand1RGB
Definition: Shader.hpp:1664
RenderState wrapping the OpenGL function glPolygonMode(), see also http://www.opengl.org/sdk/docs/man/xhtml/glPolygonMode.xml for more information.
Definition: Shader.hpp:527
Hint * getHint()
Definition: Shader.hpp:1980
const fvec4 & backDiffuse() const
Definition: Shader.hpp:818
float postColorMatrixBlueScale() const
Definition: Shader.hpp:256
float postConvolutionAlphaBias() const
Definition: Shader.hpp:269
ref< Shader > deepCopy() const
Returns the deep copy of a Shader.
Definition: Shader.hpp:1901
void setGreen(bool green)
Definition: Shader.hpp:1506
EColorMaterial colorMaterial() const
Definition: Shader.hpp:827
FrontFace * getFrontFace()
Definition: Shader.hpp:1988
RenderState wrapping the OpenGL function glNormal(), see also http://www.opengl.org/sdk/docs/man/xhtm...
Definition: Shader.hpp:162
void setPointSpriteCoordOrigin(EPointSpriteCoordOrigin orig)
Definition: Shader.hpp:1256
GLushort pattern() const
Definition: Shader.hpp:1203
void setSource0RGB(ETexEnvSource source)
Definition: Shader.hpp:1611
ETexGenMode
Texture generation modes, see also http://www.opengl.org/sdk/docs/man/xhtml/glTexGen.xml for more information.
void setFrontAmbient(const fvec4 &color)
Definition: Shader.hpp:799
LightModel * getLightModel()
Definition: Shader.hpp:2036
virtual ERenderState type() const
Definition: Shader.hpp:1465
void setPostConvolutionAlphaBias(float bias)
Definition: Shader.hpp:300
EnableSet * getEnableSet()
Definition: Shader.hpp:2229
RenderState wrapping the OpenGL function glLogicOp(), see also http://www.opengl.org/sdk/docs/man/xht...
Definition: Shader.hpp:1005
void setOperand1RGB(ETexEnvOperand operand)
Definition: Shader.hpp:1625
RenderState wrapping the OpenGL function glLightModel(), see also http://www.opengl.org/sdk/docs/man/xhtml/glLightModel.xml for more information.
Definition: Shader.hpp:859
ETexEnvSource source1RGB() const
Definition: Shader.hpp:1615
float mPostColorMatrixBlueScale
Definition: Shader.hpp:326
float mAlphaScale
Definition: Shader.hpp:1653
virtual ref< RenderState > clone() const
Definition: Shader.hpp:479
const fvec4 & objectPlaneS() const
Definition: Shader.hpp:1696
DepthRange * getDepthRange()
Definition: Shader.hpp:2052
ShaderAnimator * shaderAnimator()
Returns the ShaderAnimator used to update/animate a Shader (see vl::ShaderAnimator documentation)...
Definition: Shader.hpp:2324
void setEyePlaneR(const fvec4 &plane)
Definition: Shader.hpp:1706
float fadeThresholdSize() const
Definition: Shader.hpp:1252
RenderState wrapping the OpenGL function glBlendFunc(), see also http://www.opengl.org/sdk/docs/man/xhtml/glBlendFunc.xml for more information.
Definition: Shader.hpp:600
RenderStateSlot * renderStates()
Definition: Shader.hpp:2184
void setRenderStateSet(RenderStateSet *rss)
Definition: Shader.hpp:2277
fvec4 mColor
Definition: Shader.hpp:952
const Texture * texture() const
The texture sampler by a texture unit.
Definition: Shader.hpp:1771
EColorControl
float postColorMatrixRedBias() const
Definition: Shader.hpp:258
float mPostColorMatrixBlueBias
Definition: Shader.hpp:330
ETexEnvSource mSource2RGB
Definition: Shader.hpp:1659
float mPostConvolutionGreenBias
Definition: Shader.hpp:337
virtual ref< RenderState > clone() const
Definition: Shader.hpp:831
const ShaderAnimator * shaderAnimator() const
Returns the ShaderAnimator used to update/animate a Shader (see vl::ShaderAnimator documentation)...
Definition: Shader.hpp:2327
PolygonOffset(float factor, float units)
Definition: Shader.hpp:975
Represents an OpenGL context, possibly a widget or a pbuffer, which can also respond to keyboard...
EPointSpriteCoordOrigin
RenderState wrapping the OpenGL function glPolygonStipple(), see also http://www.opengl.org/sdk/docs/man/xhtml/glPolygonStipple.xml for more information.
Definition: Shader.hpp:1149
void setAlpha(bool alpha)
Definition: Shader.hpp:1510
Shader & deepCopyFrom(const Shader &other)
Performs a deep copy from the given Shader.
Definition: Shader.hpp:1909
void setPostConvolutionBlueBias(float bias)
Definition: Shader.hpp:299
void setShininess(float shininess)
Definition: Shader.hpp:797
void setMapColor(bool map_color)
Definition: Shader.hpp:271
void setGenModeS(ETexGenMode mode)
Definition: Shader.hpp:1694
ETexEnvSource source2RGB() const
Definition: Shader.hpp:1616
fvec4 mFrontDiffuse
Definition: Shader.hpp:840
float postConvolutionRedBias() const
Definition: Shader.hpp:266
RenderState wrapping the OpenGL function glFrontFace(), see also http://www.opengl.org/sdk/docs/man/xhtml/glFrontFace.xml for more information.
Definition: Shader.hpp:428
Base class for those render states which have more than one binding points like lights, clipping planes and texture unit states.
Definition: RenderState.hpp:70
DepthMask * getDepthMask()
Definition: Shader.hpp:1996
LogicOp(ELogicOp logicop=LO_COPY)
Definition: Shader.hpp:1010
RenderState wrapping the OpenGL function glShadeModel(), see also http://www.opengl.org/sdk/docs/man/xhtml/glShadeModel.xml for more information.
Definition: Shader.hpp:567
float postConvolutionBlueBias() const
Definition: Shader.hpp:268
void setFrontShininess(float shininess)
Definition: Shader.hpp:803
void setPolygonSmoohtHint(EHintMode mode)
Definition: Shader.hpp:362
void setObjectPlaneS(const fvec4 &plane)
Definition: Shader.hpp:1693
const Fog * getFog() const
Definition: Shader.hpp:2039
float greenScale() const
Definition: Shader.hpp:245
float postConvolutionAlphaScale() const
Definition: Shader.hpp:265
fvec4 mBackDiffuse
Definition: Shader.hpp:844
const AlphaFunc * getAlphaFunc() const
Definition: Shader.hpp:2027
void disableAll()
Definition: Shader.hpp:2166
EnableSet * gocEnableSet()
Definition: Shader.hpp:2227
virtual ref< RenderState > clone() const
Definition: Shader.hpp:637
const std::vector< ref< Uniform > > & uniforms() const
Equivalent to gocUniformSet()->uniforms(...)
Definition: Shader.hpp:2205
bool mLocalViewer
Definition: Shader.hpp:899
const fvec4 & eyePlaneS() const
Definition: Shader.hpp:1695
virtual ref< RenderState > clone() const
Definition: Shader.hpp:146
float mLodBias
Definition: Shader.hpp:1669
void setZNear(float znear)
Definition: Shader.hpp:1059
void setSpecular(const fvec4 &color)
Definition: Shader.hpp:795
const DepthFunc * getDepthFunc() const
Definition: Shader.hpp:1991
void setRenderState(RenderState *renderstate, int index)
Definition: Shader.hpp:2174
Wraps a GLSL program to which you can bind vertex, fragment and geometry shaders. ...
Definition: GLSL.hpp:233
void setObjectPlaneQ(const fvec4 &plane)
Definition: Shader.hpp:1714
virtual ERenderState type() const
Definition: Shader.hpp:667
ETexGenMode genModeS() const
Definition: Shader.hpp:1697
EStencilOp mDpFail_Front
Definition: Shader.hpp:1401
StencilMask(unsigned int mask=~(unsigned int) 0)
Definition: Shader.hpp:1418
void setUseCameraRotationInverse(bool use)
Set this to true when you want your cubemap to appear in world space rather than eye space...
Definition: Shader.hpp:1564
virtual ERenderState type() const
Definition: Shader.hpp:438
Wraps an OpenGL texture object representing and managing all the supported texture types...
Definition: Texture.hpp:178
void setValue(const fvec3 &color)
Definition: Shader.hpp:176
PointSize * getPointSize()
Definition: Shader.hpp:2060
virtual ERenderState type() const
Definition: Shader.hpp:611
PixelTransfer * getPixelTransfer()
Definition: Shader.hpp:1976
fvec4 mEyePlaneS
Definition: Shader.hpp:1728
virtual ERenderState type() const
Definition: Shader.hpp:1191
const TexEnv * getTexEnv(int unit_index) const
Definition: Shader.hpp:2136
float postColorMatrixGreenBias() const
Definition: Shader.hpp:259
void setSource2RGB(ETexEnvSource source)
Definition: Shader.hpp:1613
RenderState wrapping the OpenGL function glDepthMask(), see also http://www.opengl.org/sdk/docs/man/xhtml/glDepthMask.xml for more information.
Definition: Shader.hpp:494
EBlendFactor srcRGB() const
Definition: Shader.hpp:629
virtual ERenderState type() const
Definition: Shader.hpp:405
EFrontFace frontFace() const
Definition: Shader.hpp:444
void setRedBias(float red_bias)
Definition: Shader.hpp:280
virtual ERenderState type() const
Definition: Shader.hpp:707
EFogMode mode() const
Definition: Shader.hpp:936
float sizeMin() const
Definition: Shader.hpp:1248
float postConvolutionRedScale() const
Definition: Shader.hpp:262
const fvec4 & color() const
Definition: Shader.hpp:1605
const Color * getColor() const
Definition: Shader.hpp:1999
virtual ref< RenderState > clone() const
Definition: Shader.hpp:585
ETexEnvOperand mOperand0Alpha
Definition: Shader.hpp:1666
fvec4 mFrontEmission
Definition: Shader.hpp:842
float greenBias() const
Definition: Shader.hpp:250
BlendEquation(EBlendEquation mode_rgb=BE_FUNC_ADD, EBlendEquation mode_alpha=BE_FUNC_ADD)
Definition: Shader.hpp:662
ETexGenMode mGenModeS
Definition: Shader.hpp:1736
virtual ERenderState type() const
Definition: Shader.hpp:1689
void setGenModeT(ETexGenMode mode)
Definition: Shader.hpp:1701
void setBackSpecular(const fvec4 &color)
Definition: Shader.hpp:813
fvec3 distanceAttenuation() const
Definition: Shader.hpp:1246
float alphaBias() const
Definition: Shader.hpp:252
const ShadeModel * getShadeModel() const
Definition: Shader.hpp:2019
ETexEnvSource mSource1Alpha
Definition: Shader.hpp:1661
ColorMask(bool red=true, bool green=true, bool blue=true, bool alpha=true)
Definition: Shader.hpp:1493
float postConvolutionBlueScale() const
Definition: Shader.hpp:264
const PointParameter * getPointParameter() const
Definition: Shader.hpp:2071
void setBackEmission(const fvec4 &color)
Definition: Shader.hpp:814
virtual ref< RenderState > clone() const
Definition: Shader.hpp:1775
float mEnd
Definition: Shader.hpp:956
const EnableSet * getEnableSet() const
Definition: Shader.hpp:2231
RenderStateSet & shallowCopyFrom(const RenderStateSet &other)
StencilOp(EStencilOp sfail=SO_KEEP, EStencilOp dpfail=SO_KEEP, EStencilOp dppass=SO_KEEP)
Definition: Shader.hpp:1351
void setPostConvolutionAlphaScale(float scale)
Definition: Shader.hpp:296
ETexEnvSource source2Alpha() const
Definition: Shader.hpp:1622
LogicOp * getLogicOp()
Definition: Shader.hpp:2048
const fvec4 & objectPlaneR() const
Definition: Shader.hpp:1710
void setOperand2RGB(ETexEnvOperand operand)
Definition: Shader.hpp:1626
virtual ref< RenderState > clone() const
Definition: Shader.hpp:551
virtual ref< RenderState > clone() const
Definition: Shader.hpp:1720
RenderState * renderState(ERenderState type, int index=0)
Definition: Shader.hpp:2178
EHintMode mPolygonSmoothHint
Definition: Shader.hpp:386
void setPostColorMatrixRedBias(float bias)
Definition: Shader.hpp:289
Uniform * gocUniform(const char *name)
Equivalent to gocUniformSet()->gocUniform(...)
Definition: Shader.hpp:2217
RenderState wrapping the OpenGL function glPixelTransfer(), see also http://www.opengl.org/sdk/docs/man/xhtml/glPixelTransfer.xml for more information.
Definition: Shader.hpp:196
EHintMode perspectiveCorrectionHint() const
Definition: Shader.hpp:368
void setColor(const fvec4 &color)
Definition: Shader.hpp:924
#define VL_INSTRUMENT_CLASS(ClassName, BaseClass)
Definition: TypeInfo.hpp:122
bool isEnabled() const
Whether the ShaderAnimator is enabled or not.
Definition: Shader.hpp:1810
void setShaderAnimator(ShaderAnimator *animator)
Installs the ShaderAnimator used to update/animate a Shader (see vl::ShaderAnimator documentation)...
Definition: Shader.hpp:2321
EColorMaterial mColorMaterial
Definition: Shader.hpp:851
void eraseRenderState(RenderState *rs, int index)
Definition: Shader.hpp:2189
fvec3 mDistanceAttenuation
Definition: Shader.hpp:1266
size_t renderStatesCount() const
Definition: Shader.hpp:2180
void setIndexShift(int index_shift)
Definition: Shader.hpp:273
virtual ERenderState type() const
Definition: Shader.hpp:138
void disable(EEnable capability)
Definition: Shader.hpp:2160
EStencilOp
BlendFunc(EBlendFactor src_rgb=BF_SRC_ALPHA, EBlendFactor dst_rgb=BF_ONE_MINUS_SRC_ALPHA, EBlendFactor src_alpha=BF_SRC_ALPHA, EBlendFactor dst_alpha=BF_ONE_MINUS_SRC_ALPHA)
Definition: Shader.hpp:605
virtual ERenderState type() const
Definition: Shader.hpp:537
ref< Texture > mTexture
Definition: Shader.hpp:1783
float redScale() const
Definition: Shader.hpp:244
const fvec4 & backAmbient() const
Definition: Shader.hpp:817
float mFrontShininess
Definition: Shader.hpp:848
virtual ref< RenderState > clone() const
Definition: Shader.hpp:1391
EFunction function_Front() const
Definition: Shader.hpp:1312
float mFadeThresholdSize
Definition: Shader.hpp:1269
unsigned int mMask_Back
Definition: Shader.hpp:1337
void setBlue(bool blue)
Definition: Shader.hpp:1508
virtual ref< RenderState > clone() const
Definition: Shader.hpp:757
virtual ERenderState type() const
Definition: Shader.hpp:1126
float postColorMatrixGreenScale() const
Definition: Shader.hpp:255
EBlendFactor mDstAlpha
Definition: Shader.hpp:648
bool depthMask() const
Definition: Shader.hpp:510
virtual ERenderState type() const
Definition: Shader.hpp:1232
void getUniform(double *value) const
Definition: Uniform.hpp:230
void setPostConvolutionRedScale(float scale)
Definition: Shader.hpp:293
bool mPointSpriteCoordReplace
Definition: Shader.hpp:1670
RenderState wrapping the OpenGL function glColor(), see also http://www.opengl.org/sdk/docs/man/xhtml...
Definition: Shader.hpp:94
The TextureMatrix class uses a 4x4 matrix to transform the texture coordinates of a texture unit...
Definition: Shader.hpp:1539
const LightModel * getLightModel() const
Definition: Shader.hpp:2035
DepthFunc(EFunction depthfunc=FU_LESS)
Definition: Shader.hpp:466
const fvec4 & eyePlaneT() const
Definition: Shader.hpp:1702
RenderState wrapping the OpenGL function glDepthRange(), see also http://www.opengl.org/sdk/docs/man/xhtml/glDepthRange.xml for more information.
Definition: Shader.hpp:1038
float postColorMatrixAlphaScale() const
Definition: Shader.hpp:257
float rgbScale() const
Definition: Shader.hpp:1607
void setPostColorMatrixGreenBias(float bias)
Definition: Shader.hpp:290
Material * getMaterial()
Definition: Shader.hpp:2032
unsigned int mMask_Front
Definition: Shader.hpp:1447
void setPostColorMatrixBlueBias(float bias)
Definition: Shader.hpp:291
virtual ERenderState type() const
Definition: Shader.hpp:869
const fvec4 & backSpecular() const
Definition: Shader.hpp:819
Visualization Library main namespace.
virtual ref< RenderState > clone() const
Definition: Shader.hpp:944
Color * getColor()
Definition: Shader.hpp:2000
bool mUseCameraRotationInverse
Definition: Shader.hpp:1577
const fvec4 & ambientColor() const
Definition: Shader.hpp:887
void setSrcAlpha(EBlendFactor factor)
Definition: Shader.hpp:625
const fvec4 & frontAmbient() const
Definition: Shader.hpp:805
EStencilOp mDpPass_Back
Definition: Shader.hpp:1404
EHintMode mPerspectiveCorrectionHint
Definition: Shader.hpp:383
EBlendFactor mDstRGB
Definition: Shader.hpp:646
EStencilOp dpPass_Front() const
Definition: Shader.hpp:1383
void setDepthScale(float depth_scale)
Definition: Shader.hpp:279
ETexGenMode mGenModeR
Definition: Shader.hpp:1738
The TextureImageUnit class associates a Texture object to an OpenGL texture unit. ...
Definition: Shader.hpp:1747
float mPostConvolutionRedBias
Definition: Shader.hpp:336
virtual ERenderState type() const
Definition: Shader.hpp:172
Shader & shallowCopyFrom(const Shader &other)
Performs a shallow copy from the given Shader.
Definition: Shader.hpp:1855
int indexShift() const
Definition: Shader.hpp:242
ETexEnvMode combineAlpha() const
Definition: Shader.hpp:1603
virtual ERenderState type() const
Definition: Shader.hpp:104
ETexEnvOperand operand0RGB() const
Definition: Shader.hpp:1627
RenderState wrapping the OpenGL function glTexEnv(), see also http://www.opengl.org/sdk/docs/man/xhtm...
Definition: Shader.hpp:1589
virtual ERenderState type() const
Definition: Shader.hpp:1423
ShadeModel(EShadeModel shademodel=SM_SMOOTH)
Definition: Shader.hpp:572
float end() const
Definition: Shader.hpp:942
const BlendFunc * getBlendFunc() const
Definition: Shader.hpp:2091
DepthFunc * getDepthFunc()
Definition: Shader.hpp:1992
const LogicOp * getLogicOp() const
Definition: Shader.hpp:2047
RenderState wrapping the OpenGL function glBlendColor(), see also http://www.opengl.org/sdk/docs/man/xhtml/glBlendColor.xml for more information.
Definition: Shader.hpp:1455
EFunction function_Back() const
Definition: Shader.hpp:1318
Texture * texture()
The texture sampler by a texture unit.
Definition: Shader.hpp:1768
const fvec4 & frontDiffuse() const
Definition: Shader.hpp:806
StencilFunc(EFunction function=FU_ALWAYS, int refvalue=0, unsigned int mask=~(unsigned int) 0)
Definition: Shader.hpp:1284
virtual ref< RenderState > clone() const
Definition: Shader.hpp:1324
fvec4 mColor
Definition: Shader.hpp:120
EStencilOp mSFail_Front
Definition: Shader.hpp:1399
EPolygonMode frontFace() const
Definition: Shader.hpp:547
void setGenModeQ(ETexGenMode mode)
Definition: Shader.hpp:1715
Base class for most of the OpenGL render state wrapper classes.
Definition: RenderState.hpp:50
void setDiffuse(const fvec4 &color)
Definition: Shader.hpp:794
EHintMode polygonSmoohtHint() const
Definition: Shader.hpp:369
void setRenderState(RenderStateNonIndexed *renderstate)
Definition: Shader.hpp:2172
fvec4 mBackSpecular
Definition: Shader.hpp:845
const Normal * getNormal() const
Definition: Shader.hpp:2007
RenderState wrapping the OpenGL function glLineStipple(), see also http://www.opengl.org/sdk/docs/man/xhtml/glLineStipple.xml for more information.
Definition: Shader.hpp:1181
float density() const
Definition: Shader.hpp:938
TexEnv * getTexEnv(int unit_index)
Definition: Shader.hpp:2138
Fog(EFogMode mode=FM_LINEAR, const fvec4 &color=fvec4(0, 0, 0, 0), float density=1, float start=0, float end=1)
Definition: Shader.hpp:912
GLSLProgram * glslProgram()
Returns the GLSLProgram associated to a Shader (if any)
Definition: Shader.hpp:2197
void setFrontEmission(const fvec4 &color)
Definition: Shader.hpp:802
TextureImageUnit * getTextureImageUnit(int unit_index)
Definition: Shader.hpp:2130
void setBackShininess(float shininess)
Definition: Shader.hpp:815
ref< ShaderAnimator > mShaderAnimator
Definition: Shader.hpp:2350
ETexEnvOperand mOperand2Alpha
Definition: Shader.hpp:1668
virtual ERenderState type() const
Definition: Shader.hpp:70
void setSizeMax(float sizemax)
Definition: Shader.hpp:1242
EPolygonFace mColorMaterialFace
Definition: Shader.hpp:850
EFogMode mMode
Definition: Shader.hpp:953
Wraps the OpenGL function glClipPlane().
Definition: ClipPlane.hpp:49
EColorMaterial
void setValue(const fvec3 &color)
Definition: Shader.hpp:142
void setEmission(const fvec4 &color)
Definition: Shader.hpp:796
bool mColorMaterialEnabled
Definition: Shader.hpp:852
RenderState wrapping the OpenGL function glColorMask(), see also http://www.opengl.org/sdk/docs/man/xhtml/glColorMask.xml for more information.
Definition: Shader.hpp:1488
EHintMode mGenerateMipmapHint
Definition: Shader.hpp:388
virtual ref< RenderState > clone() const
Definition: Shader.hpp:302
virtual ref< RenderState > clone() const
Definition: Shader.hpp:413
void setAmbientColor(const fvec4 &ambientcolor)
Definition: Shader.hpp:879
EFunction mAlphaFunc
Definition: Shader.hpp:766
ETexEnvSource mSource0RGB
Definition: Shader.hpp:1657
void setOperand0Alpha(ETexEnvOperand operand)
Definition: Shader.hpp:1630
EPointSpriteCoordOrigin pointSpriteCoordOrigin() const
Definition: Shader.hpp:1254
RenderState wrapping the OpenGL function glVertexAttrib(), see also http://www.opengl.org/sdk/docs/man3/xhtml/glVertexAttrib.xml for more information.
Definition: Shader.hpp:60
ETexEnvOperand mOperand0RGB
Definition: Shader.hpp:1663
RenderStateSet & deepCopyFrom(const RenderStateSet &other)
ETexGenMode genModeQ() const
Definition: Shader.hpp:1718
fvec4 mFrontAmbient
Definition: Shader.hpp:839
virtual ref< RenderState > clone() const
Definition: Shader.hpp:681
virtual ERenderState type() const
Definition: Shader.hpp:357
StencilFunc * getStencilFunc()
Definition: Shader.hpp:2076
The base class for all the reference counted objects.
Definition: Object.hpp:158
void setGreenBias(float green_bias)
Definition: Shader.hpp:281
Base class for those render states which have only one binding point (the vast majority).
Definition: RenderState.hpp:84
void setZFar(float zfar)
Definition: Shader.hpp:1061
const DepthMask * getDepthMask() const
Definition: Shader.hpp:1995
PointParameter * getPointParameter()
Definition: Shader.hpp:2072
void setCombineAlpha(ETexEnvMode combineAlpha)
Definition: Shader.hpp:1602
ETexEnvMode mMode
Definition: Shader.hpp:1654
fvec4 mBackEmission
Definition: Shader.hpp:846
float mBackShininess
Definition: Shader.hpp:847
const PixelTransfer * getPixelTransfer() const
Definition: Shader.hpp:1975
const Material * getMaterial() const
Definition: Shader.hpp:2031
virtual ref< RenderState > clone() const
Definition: Shader.hpp:78
bool mapColor() const
Definition: Shader.hpp:240
ColorMask * getColorMask()
Definition: Shader.hpp:2012
const fvec4 & objectPlaneT() const
Definition: Shader.hpp:1703
DepthRange(float znear, float zfar)
Definition: Shader.hpp:1048
void setGenerateMipmapHint(EHintMode mode)
Definition: Shader.hpp:366
ETexGenMode mGenModeQ
Definition: Shader.hpp:1739
const TextureMatrix * getTextureMatrix(int unit_index) const
Definition: Shader.hpp:2152
void setValue(const fvec4 &value)
Definition: Shader.hpp:74
ETexEnvMode combineRGB() const
Definition: Shader.hpp:1601
ETexEnvOperand mOperand1Alpha
Definition: Shader.hpp:1667
void eraseUniform(const char *name)
Equivalent to gocUniformSet()->eraseUniform(...)
Definition: Shader.hpp:2208
float pointSize() const
Definition: Shader.hpp:1132
virtual ERenderState type() const
Definition: Shader.hpp:577
void setMapStencil(bool map_stencil)
Definition: Shader.hpp:272
Normal * getNormal()
Definition: Shader.hpp:2008
EFrontFace mFrontFace
Definition: Shader.hpp:454
EHintMode mPointSmoothHint
Definition: Shader.hpp:384
const StencilMask * getStencilMask() const
Definition: Shader.hpp:2083
bool mapStencil() const
Definition: Shader.hpp:241
EBlendFactor
virtual void apply(int index, const Camera *, OpenGLContext *ctx) const
The parameter cameara is NULL if we are disabling the state, non-NULL if we are enabling it...
Definition: Shader.cpp:1111
float postColorMatrixAlphaBias() const
Definition: Shader.hpp:261
const fvec4 & eyePlaneR() const
Definition: Shader.hpp:1709
float mPostConvolutionRedScale
Definition: Shader.hpp:332
unsigned int mask_Front() const
Definition: Shader.hpp:1435
bool invert() const
Definition: Shader.hpp:719
void setEyePlaneS(const fvec4 &plane)
Definition: Shader.hpp:1692
float postColorMatrixRedScale() const
Definition: Shader.hpp:254
void setSrcRGB(EBlendFactor factor)
Definition: Shader.hpp:621
EStencilOp mDpFail_Back
Definition: Shader.hpp:1402
PolygonStipple * getPolygonStipple()
Definition: Shader.hpp:2068
const TextureImageUnit * getTextureImageUnit(int unit_index) const
Definition: Shader.hpp:2128
ETexEnvOperand operand1Alpha() const
Definition: Shader.hpp:1634
void setBackAmbient(const fvec4 &color)
Definition: Shader.hpp:811
RenderState wrapping the OpenGL function glTexGen(), see also http://www.opengl.org/sdk/docs/man/xhtm...
Definition: Shader.hpp:1682
EFunction depthFunc() const
Definition: Shader.hpp:477
fvec3 mSecondaryColor
Definition: Shader.hpp:154
const Uniform * getUniform(const char *name) const
Equivalent to gocUniformSet()->getUniform(...)
Definition: Shader.hpp:2223
EHintMode pointSmoothHint() const
Definition: Shader.hpp:371
virtual ref< RenderState > clone() const
Definition: Shader.hpp:1473
virtual ref< RenderState > clone() const
Definition: Shader.hpp:989
LineWidth(float linewidth=1.0f)
Definition: Shader.hpp:1088
SampleCoverage(GLclampf value=1.0f, bool invert=false)
Definition: Shader.hpp:702
virtual ref< RenderState > clone() const
Definition: Shader.hpp:1520
Uniform * getUniform(const char *name)
Equivalent to gocUniformSet()->getUniform(...)
Definition: Shader.hpp:2220
virtual ERenderState type() const
Definition: Shader.hpp:471
virtual ERenderState type() const
Definition: Shader.hpp:1292
RenderState wrapping the OpenGL function glLineWidth(), see also http://www.opengl.org/sdk/docs/man/xhtml/glLineWidth.xml for more information.
Definition: Shader.hpp:1083
fvec4 mEyePlaneQ
Definition: Shader.hpp:1734
void setBlueScale(float blue_scale)
Definition: Shader.hpp:277
Callback object used to update/animate a Shader during the rendering.
Definition: Shader.hpp:1792
SampleCoverage * getSampleCoverage()
Definition: Shader.hpp:2096
float postConvolutionGreenScale() const
Definition: Shader.hpp:263
EBlendEquation
ETexGenMode mGenModeT
Definition: Shader.hpp:1737
int refValue_Back() const
Definition: Shader.hpp:1320
fvec4 mObjectPlaneR
Definition: Shader.hpp:1733
EBlendEquation mModeRGB
Definition: Shader.hpp:689
float postConvolutionGreenBias() const
Definition: Shader.hpp:267
TextureMatrix * getTextureMatrix(int unit_index)
Definition: Shader.hpp:2154
ETexGenMode genModeT() const
Definition: Shader.hpp:1704
void setDistanceAttenuation(fvec3 attenuation)
Definition: Shader.hpp:1238
GLclampf mValue
Definition: Shader.hpp:729
const PolygonMode * getPolygonMode() const
Definition: Shader.hpp:2015
EPolygonMode mFrontFace
Definition: Shader.hpp:559
void eraseAllRenderStates()
Definition: Shader.hpp:2191
ETexEnvOperand operand2Alpha() const
Definition: Shader.hpp:1635
fvec3 mNormal
Definition: Shader.hpp:188
float zNear() const
Definition: Shader.hpp:1063
void setDstAlpha(EBlendFactor factor)
Definition: Shader.hpp:627
virtual ERenderState type() const
Definition: Shader.hpp:504
EBlendFactor mSrcRGB
Definition: Shader.hpp:645
DepthMask(bool depthmask=true)
Definition: Shader.hpp:499
void setGenModeR(ETexGenMode mode)
Definition: Shader.hpp:1708
Wraps the OpenGL functions glStencilFunc() and glStencilFuncSeparate(), see also http://www.opengl.org/sdk/docs/man/xhtml/glStencilFunc.xml and http://www.opengl.org/sdk/docs/man/xhtml/glStencilFuncSeparate.xml for more information.
Definition: Shader.hpp:1279
BlendFunc * getBlendFunc()
Definition: Shader.hpp:2092
void setLocalViewer(bool localviewer)
Definition: Shader.hpp:873
void setAmbient(const fvec4 &color)
Definition: Shader.hpp:793
#define NULL
Definition: OpenGLDefs.hpp:81
real mLastUpdateTime
Definition: Shader.hpp:2351
void setEnabled(bool enable)
Whether the ShaderAnimator is enabled or not.
Definition: Shader.hpp:1807
float mPostConvolutionBlueScale
Definition: Shader.hpp:334
void setObjectPlaneT(const fvec4 &plane)
Definition: Shader.hpp:1700
Manages most of the OpenGL rendering states responsible of the final aspect of the rendered objects...
Definition: Shader.hpp:1830
LineStipple(int factor=1, GLushort pattern=~(GLushort) 0)
Definition: Shader.hpp:1186
ETexEnvOperand operand0Alpha() const
Definition: Shader.hpp:1633
ETexEnvOperand operand1RGB() const
Definition: Shader.hpp:1628
A set of RenderState objects managed by a Shader.
RenderState wrapping the OpenGL function glBlendEquation()/glBlendEquationSeparate(), see also http://www.opengl.org/sdk/docs/man/xhtml/glBlendEquation.xml and http://www.opengl.org/sdk/docs/man/xhtml/glBlendEquationSeparate.xml for more information.
Definition: Shader.hpp:657
const Scissor * scissor() const
Returns the Scissor to be used when rendering an Actor.
Definition: Shader.hpp:2309
const fmat4 & matrix() const
Definition: Shader.hpp:1550
const fvec4 & color() const
Definition: Shader.hpp:934
float mRefValue
Definition: Shader.hpp:765
virtual ref< RenderState > clone() const
Definition: Shader.hpp:512
EBlendEquation modeRGB() const
Definition: Shader.hpp:677
AlphaFunc * getAlphaFunc()
Definition: Shader.hpp:2028
ELogicOp mLogicOp
Definition: Shader.hpp:1031
const BlendEquation * getBlendEquation() const
Definition: Shader.hpp:2023
ETexEnvSource mSource0Alpha
Definition: Shader.hpp:1660
PointParameter(float sizemin=0, float sizemax=1024.0f, float fadethresholdsize=1.0f, fvec3 distanceattenuation=fvec3(1, 0, 0))
Definition: Shader.hpp:1226
EFunction mFunction_Front
Definition: Shader.hpp:1332
RenderState wrapping the OpenGL function glMaterial() and glColorMaterial(), see also http://www...
Definition: Shader.hpp:774
fvec4 mEyePlaneT
Definition: Shader.hpp:1730
void setSource1RGB(ETexEnvSource source)
Definition: Shader.hpp:1612
void setUniformSet(UniformSet *us)
Installs a new UniformSet.
Definition: Shader.hpp:2289
PolygonOffset * getPolygonOffset()
Definition: Shader.hpp:2044
const fvec4 & frontSpecular() const
Definition: Shader.hpp:807
virtual ERenderState type() const
Definition: Shader.hpp:973
EFunction alphaFunc() const
Definition: Shader.hpp:753
const unsigned char * mask() const
Definition: Shader.hpp:1164
unsigned int mask_Front() const
Definition: Shader.hpp:1316
void setFrontFace(EPolygonMode frontface)
Definition: Shader.hpp:543
void setRed(bool red)
Definition: Shader.hpp:1504
static void reset(int index, OpenGLContext *ctx)
Reset texture sampler to it&#39;s default disabled state.
Definition: Shader.hpp:1761
virtual ERenderState type() const
Definition: Shader.hpp:1359
void setDstRGB(EBlendFactor factor)
Definition: Shader.hpp:623
TexGen * getTexGen(int unit_index)
Definition: Shader.hpp:2146
int indexOffset() const
Definition: Shader.hpp:243
CullFace(EPolygonFace cullface=PF_BACK)
Definition: Shader.hpp:400
float mPostConvolutionAlphaBias
Definition: Shader.hpp:339
void setSource2Alpha(ETexEnvSource source)
Definition: Shader.hpp:1619
EHintMode mFogHint
Definition: Shader.hpp:387
void setValue(GLclampf value)
Definition: Shader.hpp:713
EEnable
Constant that enable/disable a specific OpenGL feature, see also Shader, Shader::enable(), Shader::disable(), Shader::isEnabled()
RenderState wrapping the OpenGL function glPointSize(), see also http://www.opengl.org/sdk/docs/man/xhtml/glPointSize.xml for more information.
Definition: Shader.hpp:1116
virtual ERenderState type() const
Definition: Shader.hpp:780
void setEyePlaneT(const fvec4 &plane)
Definition: Shader.hpp:1699
#define VL_INSTRUMENT_ABSTRACT_CLASS(ClassName, BaseClass)
Definition: TypeInfo.hpp:145
bool red() const
Definition: Shader.hpp:1512
const StencilOp * getStencilOp() const
Definition: Shader.hpp:2079
EColorControl colorControl() const
Definition: Shader.hpp:885
const LineStipple * getLineStipple() const
Definition: Shader.hpp:2063
void setColorMaterial(EPolygonFace face, EColorMaterial color)
Definition: Shader.hpp:825
float depthBias() const
Definition: Shader.hpp:253
const RenderStateSet * getRenderStateSet() const
Definition: Shader.hpp:2237
const SampleCoverage * getSampleCoverage() const
Definition: Shader.hpp:2095
const LineWidth * getLineWidth() const
Definition: Shader.hpp:2055
UniformSet * getUniformSet()
Returns the UniformSet installed.
Definition: Shader.hpp:2261
PolygonMode * getPolygonMode()
Definition: Shader.hpp:2016
const CullFace * getCullFace() const
Definition: Shader.hpp:1983
virtual ref< RenderState > clone() const
Definition: Shader.hpp:112
void setFrontDiffuse(const fvec4 &color)
Definition: Shader.hpp:800
EFunction mDepthFunc
Definition: Shader.hpp:487
EBlendEquation mModeAlpha
Definition: Shader.hpp:690
EBlendFactor mSrcAlpha
Definition: Shader.hpp:647
float mPostColorMatrixGreenScale
Definition: Shader.hpp:325
EStencilOp dpFail_Back() const
Definition: Shader.hpp:1387
void setColorMaterialEnabled(bool enabled)
Definition: Shader.hpp:828
PolygonMode(EPolygonMode frontface=PM_FILL, EPolygonMode backface=PM_FILL)
Definition: Shader.hpp:532
void setFactor(float factor)
Definition: Shader.hpp:981
virtual ref< RenderState > clone() const
Definition: Shader.hpp:1205
ref< EnableSet > mEnableSet
Definition: Shader.hpp:2347
virtual ref< RenderState > clone() const
Definition: Shader.hpp:1067
void setPostConvolutionGreenBias(float bias)
Definition: Shader.hpp:298
virtual ERenderState type() const
Definition: Shader.hpp:918
RenderStateSet * getRenderStateSet()
Definition: Shader.hpp:2235
unsigned int mask_Back() const
Definition: Shader.hpp:1322
float mPostColorMatrixRedBias
Definition: Shader.hpp:328
const PointSize * getPointSize() const
Definition: Shader.hpp:2059
void setOperand0RGB(ETexEnvOperand operand)
Definition: Shader.hpp:1624
void setOperand2Alpha(ETexEnvOperand operand)
Definition: Shader.hpp:1632
AlphaFunc(EFunction alphafunc=FU_ALWAYS, float refvalue=0)
Definition: Shader.hpp:742
virtual ERenderState type() const
Definition: Shader.hpp:1158
void setValue(const fvec4 &color)
Definition: Shader.hpp:108
const FrontFace * getFrontFace() const
Definition: Shader.hpp:1987
void setPostColorMatrixBlueScale(float scale)
Definition: Shader.hpp:287
void setEyePlaneQ(const fvec4 &plane)
Definition: Shader.hpp:1713
virtual ERenderState type() const
Definition: Shader.hpp:1053
EShadeModel mShadeModel
Definition: Shader.hpp:593
void setAlphaScale(float alpha_scale)
Definition: Shader.hpp:278
void setUnits(float units)
Definition: Shader.hpp:983
const TextureMatrix & setMatrix(const fmat4 &matrix)
Definition: Shader.hpp:1552
void setColor(const fvec4 &color)
Definition: Shader.hpp:1604
RenderState wrapping the OpenGL function glAlphaFunc(), see also http://www.opengl.org/sdk/docs/man/xhtml/glAlphaFunc.xml for more information.
Definition: Shader.hpp:737
const ColorMask * getColorMask() const
Definition: Shader.hpp:2011
StencilMask * getStencilMask()
Definition: Shader.hpp:2084
virtual ERenderState type() const
Definition: Shader.hpp:747
void setScissor(Scissor *scissor)
Sets the Scissor to be used when rendering an Actor.
Definition: Shader.hpp:2300
EPolygonMode mBackFace
Definition: Shader.hpp:560
ETexEnvMode mCombineAlpha
Definition: Shader.hpp:1656
void setFactor(int factor)
Definition: Shader.hpp:1197
float mRGBScale
Definition: Shader.hpp:1652
float factor() const
Definition: Shader.hpp:985
EFrontFace
fvec4 mEyePlaneR
Definition: Shader.hpp:1732
float mPostColorMatrixGreenBias
Definition: Shader.hpp:329
void setRedScale(float red_scale)
Definition: Shader.hpp:275
float mPostColorMatrixRedScale
Definition: Shader.hpp:324
void setAlphaScale(float alphascale)
Definition: Shader.hpp:1608
unsigned int mMask_Back
Definition: Shader.hpp:1448
virtual ref< RenderState > clone() const
Definition: Shader.hpp:375
EColorControl mColorControl
Definition: Shader.hpp:898
EStencilOp dpPass_Back() const
Definition: Shader.hpp:1389
const fvec4 & value() const
Definition: Shader.hpp:110
Wraps the OpenGL function glLight().
Definition: Light.hpp:51
float sizeMax() const
Definition: Shader.hpp:1250
virtual ref< RenderState > clone() const
Definition: Shader.hpp:1439
A set of Uniform objects managed by a Shader.
Definition: UniformSet.hpp:50
void setTexture(Texture *texture)
The texture sampler by a texture unit.
Definition: Shader.hpp:1765
bool green() const
Definition: Shader.hpp:1514
const fvec4 & eyePlaneQ() const
Definition: Shader.hpp:1716
virtual ref< RenderState > clone() const
Definition: Shader.hpp:721
void setPostConvolutionGreenScale(float scale)
Definition: Shader.hpp:294
float mPostColorMatrixAlphaBias
Definition: Shader.hpp:331
void eraseUniform(const Uniform *uniform)
Equivalent to gocUniformSet()->eraseUniform(...)
Definition: Shader.hpp:2211
float postColorMatrixBlueBias() const
Definition: Shader.hpp:260
virtual ref< RenderState > clone() const
Definition: Shader.hpp:180
The ref<> class is used to reference-count an Object.
Definition: Object.hpp:55
EFunction mFunction_Back
Definition: Shader.hpp:1333
ETexEnvSource mSource1RGB
Definition: Shader.hpp:1658
float lodBias() const
Definition: Shader.hpp:1641
void setPostColorMatrixAlphaScale(float scale)
Definition: Shader.hpp:288
const std::vector< EEnable > & enables() const
Definition: Shader.hpp:2162
float start() const
Definition: Shader.hpp:940
virtual ERenderState type() const
Definition: RenderState.hpp:59
LineWidth * getLineWidth()
Definition: Shader.hpp:2056
const PolygonStipple * getPolygonStipple() const
Definition: Shader.hpp:2067
const BlendColor * getBlendColor() const
Definition: Shader.hpp:2087
Represents a virtual camera defining, among other things, the point of view from which scenes can be ...
Definition: Camera.hpp:49
The Scissor class wraps the OpenGL function glScissor(), see http://www.opengl.org/sdk/docs/man/xhtml...
Definition: Scissor.hpp:47
Scissor * scissor()
Returns the Scissor to be used when rendering an Actor.
Definition: Shader.hpp:2318
EPolygonFace faceMode() const
Definition: Shader.hpp:411
UniformSet & deepCopyFrom(const UniformSet &other)
Definition: UniformSet.cpp:37
unsigned int mask_Back() const
Definition: Shader.hpp:1437
void setBlueBias(float blue_bias)
Definition: Shader.hpp:282
EBlendFactor dstAlpha() const
Definition: Shader.hpp:635
const GLSLProgram * glslProgram() const
Returns the GLSLProgram associated to a Shader (if any)
Definition: Shader.hpp:2194
bool twoSide() const
Definition: Shader.hpp:883
ETexEnvSource source0RGB() const
Definition: Shader.hpp:1614
fvec4 mObjectPlaneT
Definition: Shader.hpp:1731
fvec4 mObjectPlaneQ
Definition: Shader.hpp:1735
void setSource0Alpha(ETexEnvSource source)
Definition: Shader.hpp:1617
void setGreenScale(float green_scale)
Definition: Shader.hpp:276
virtual ref< RenderState > clone() const
Definition: Shader.hpp:1134
ref< UniformSet > mUniformSet
Definition: Shader.hpp:2348
const fvec4 & backEmission() const
Definition: Shader.hpp:820
float alphaScale() const
Definition: Shader.hpp:247
RenderState wrapping the OpenGL function glStencilMask() and glStencilMaskSeparate(), see also http://www.opengl.org/sdk/docs/man/xhtml/glStencilMask.xml and http://www.opengl.org/sdk/docs/man/xhtml/glStencilMaskSeparate.xml for more information.
Definition: Shader.hpp:1413
float mPostConvolutionGreenScale
Definition: Shader.hpp:333
const SecondaryColor * getSecondaryColor() const
Definition: Shader.hpp:2003
virtual ERenderState type() const
Definition: Shader.hpp:1093
ETexEnvSource source1Alpha() const
Definition: Shader.hpp:1621
const fvec4 & frontEmission() const
Definition: Shader.hpp:808
EHintMode mLineSmoothHint
Definition: Shader.hpp:385
virtual ERenderState type() const
Definition: Shader.hpp:1015
EHintMode lineSmoothHint() const
Definition: Shader.hpp:370
const fvec4 & blendColor() const
Definition: Shader.hpp:1471
void setUniform(Uniform *uniform)
Equivalent to gocUniformSet()->setUniform(...)
Definition: Shader.hpp:2202
real lastUpdateTime() const
Last time this Actor was animated/updated using a shaderAnimator().
Definition: Shader.hpp:2330
ETexEnvSource
EPointSpriteCoordOrigin mPointSpriteCoordOrigin
Definition: Shader.hpp:1270
ref< Scissor > mScissor
Definition: Shader.hpp:2349
ETexEnvMode mCombineRGB
Definition: Shader.hpp:1655
void setTwoSide(bool twoside)
Definition: Shader.hpp:875
float mLineWidth
Definition: Shader.hpp:1109
void reset()
Disables everything, erases all the render states, erases all the uniforms.
Definition: Shader.hpp:1956
EPolygonMode
ETexEnvOperand
PointSize(float pointsize=1.0f)
Definition: Shader.hpp:1121
float alphaScale() const
Definition: Shader.hpp:1609
void setStart(float start)
Definition: Shader.hpp:930
void setPostConvolutionRedBias(float bias)
Definition: Shader.hpp:297
CullFace * getCullFace()
Definition: Shader.hpp:1984
#define VL_CHECK(expr)
Definition: checks.hpp:73
bool alpha() const
Definition: Shader.hpp:1518
const fvec3 & value() const
Definition: Shader.hpp:144
FrontFace(EFrontFace frontface=FF_CCW)
Definition: Shader.hpp:433
virtual ref< RenderState > clone() const
Definition: Shader.hpp:1023
void setColorControl(EColorControl colorcontrol)
Definition: Shader.hpp:877
void enable(EEnable capability)
Definition: Shader.hpp:2158
float blueScale() const
Definition: Shader.hpp:246
fvec4 mColor
Definition: Shader.hpp:1651
bool isBlendingEnabled() const
Definition: Shader.hpp:2168
const UniformSet * getUniformSet() const
Returns the UniformSet installed.
Definition: Shader.hpp:2273
void setPostColorMatrixAlphaBias(float bias)
Definition: Shader.hpp:292
const RenderStateSlot * renderStates() const
Definition: Shader.hpp:2182
float mPointSize
Definition: Shader.hpp:1142
virtual ref< RenderState > clone() const
Definition: Shader.hpp:1643
bool blue() const
Definition: Shader.hpp:1516
void setSizeMin(float sizemin)
Definition: Shader.hpp:1240
float redBias() const
Definition: Shader.hpp:249
EStencilOp sFail_Front() const
Definition: Shader.hpp:1379
fvec4 mBackAmbient
Definition: Shader.hpp:843
EHintMode generateMipmapHint() const
Definition: Shader.hpp:373
void setPattern(GLushort pattern)
Definition: Shader.hpp:1199
float backShininess() const
Definition: Shader.hpp:821
EHintMode fogHint() const
Definition: Shader.hpp:372
void setMode(EFogMode mode)
Definition: Shader.hpp:926
ETexEnvSource source0Alpha() const
Definition: Shader.hpp:1620
virtual ref< RenderState > clone() const
Definition: Shader.hpp:446
BlendColor(const fvec4 &blendcolor=fvec4(0, 0, 0, 0))
Definition: Shader.hpp:1460
GLushort mPattern
Definition: Shader.hpp:1214
void setEnd(float end)
Definition: Shader.hpp:932
RenderState wrapping the OpenGL function glFog(), see also http://www.opengl.org/sdk/docs/man/xhtml/g...
Definition: Shader.hpp:907
fvec4 mAmbientColor
Definition: Shader.hpp:897
float units() const
Definition: Shader.hpp:987
void setInvert(bool invert)
Definition: Shader.hpp:715
virtual ERenderState type() const
Definition: Shader.hpp:1546
EBlendEquation modeAlpha() const
Definition: Shader.hpp:679
const fvec3 & value() const
Definition: Shader.hpp:178
bool colorMaterialEnabled() const
Definition: Shader.hpp:829
float mPostConvolutionBlueBias
Definition: Shader.hpp:338
RenderState wrapping the OpenGL function glSecondaryColor(), see also http://www.opengl.org/sdk/docs/man/xhtml/glSecondaryColor.xml for more information.
Definition: Shader.hpp:128
void setEnableSet(EnableSet *es)
Definition: Shader.hpp:2275
EStencilOp mDpPass_Front
Definition: Shader.hpp:1403
void setMode(ETexEnvMode mode)
Definition: Shader.hpp:1598
A set of enables managed by Shader.
Definition: EnableSet.hpp:47
EPolygonFace colorMaterialFace() const
Definition: Shader.hpp:826
int refValue_Front() const
Definition: Shader.hpp:1314
void eraseRenderState(ERenderState type, int index=-1)
If index == -1 all the renderstates of the given type are removed regardless of their binding index...
Definition: Shader.hpp:2187
const TexGen * getTexGen(int unit_index) const
Definition: Shader.hpp:2144
RenderState wrapping the OpenGL function glSampleCoverage(), see also http://www.opengl.org/sdk/docs/man/xhtml/glSampleCoverage.xml for more information.
Definition: Shader.hpp:697
RenderState wrapping the OpenGL function glCullFace(), see also http://www.opengl.org/sdk/docs/man/xhtml/glCullFace.xml for more information.
Definition: Shader.hpp:395
ref< Shader > shallowCopy() const
Returns the shallow copy of a Shader.
Definition: Shader.hpp:1846
void setPostConvolutionBlueScale(float scale)
Definition: Shader.hpp:295
void setObjectPlaneR(const fvec4 &plane)
Definition: Shader.hpp:1707