Visualization Library 2.0.0-b3

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-2011, 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  // TextureSampler
1743  //------------------------------------------------------------------------------
1748  {
1750 
1751  public:
1753  {
1754  VL_DEBUG_SET_OBJECT_NAME()
1755  }
1756 
1757  virtual ERenderState type() const { return RS_TextureSampler; }
1758  virtual void apply(int index, const Camera*, OpenGLContext* ctx) const;
1759 
1761  static void reset(int index, OpenGLContext* ctx) { TextureSampler().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 
1775  void setTexParameter(TexParameter* tex_param) { mTexParameter = tex_param; }
1776 
1778  TexParameter* getTexParameter() { return mTexParameter.get(); }
1779 
1781  const TexParameter* getTexParameter() const { return mTexParameter.get(); }
1782 
1783  bool hasTexture() const;
1784 
1785  virtual ref<RenderState> clone() const
1786  {
1788  *rs = *this;
1789  return rs;
1790  }
1791 
1792  protected:
1795  };
1796  //------------------------------------------------------------------------------
1797  // ShaderAnimator
1798  //------------------------------------------------------------------------------
1804  {
1806 
1807  public:
1808  ShaderAnimator(): mEnabled(true) {}
1809 
1815  virtual void updateShader(Shader* shader, Camera* camera, real cur_time) = 0;
1816 
1818  void setEnabled(bool enable) { mEnabled = enable; }
1819 
1821  bool isEnabled() const { return mEnabled; }
1822 
1823  protected:
1824  bool mEnabled;
1825  };
1826  //------------------------------------------------------------------------------
1827  // Shader
1828  //------------------------------------------------------------------------------
1842  {
1844 
1845  // use deepCopy() and shallowCopy() instead
1846  Shader(const Shader& other): Object(other) { }
1847  Shader& operator=(const Shader&) { return *this; }
1848 
1849  public:
1851  Shader();
1852 
1854  virtual ~Shader();
1855 
1858  {
1859  ref<Shader> sh = new Shader;
1860  sh->shallowCopyFrom(*this);
1861  return sh;
1862  }
1863 
1866  Shader& shallowCopyFrom(const Shader& other)
1867  {
1868  super::operator=(other);
1869 
1870  // we don't copy the update time
1871  // mLastUpdateTime = other.mLastUpdateTime;
1872 
1873  if (other.mRenderStateSet.get())
1874  {
1875  if (mRenderStateSet.get() == NULL)
1876  mRenderStateSet = new RenderStateSet;
1877  mRenderStateSet->shallowCopyFrom( *other.mRenderStateSet );
1878  }
1879  else
1880  mRenderStateSet = NULL;
1881 
1882  if (other.mEnableSet.get())
1883  {
1884  if (mEnableSet.get() == NULL)
1885  mEnableSet = new EnableSet;
1886  *mEnableSet = *other.mEnableSet;
1887  }
1888  else
1889  mEnableSet = NULL;
1890 
1891  if (other.mUniformSet.get())
1892  {
1893  if (mUniformSet.get() == NULL)
1894  mUniformSet = new UniformSet;
1895  mUniformSet->shallowCopyFrom( *other.mUniformSet );
1896  }
1897  else
1898  mUniformSet = NULL;
1899 
1900  mScissor = other.mScissor;
1901 
1902  mShaderAnimator = other.mShaderAnimator;
1903 
1904  #ifdef VL_USER_DATA_SHADER
1905  mShaderUserData = other.mShaderUserData;
1906  #endif
1907 
1908  return *this;
1909  }
1910 
1913  {
1914  ref<Shader> sh = new Shader;
1915  sh->deepCopyFrom(*this);
1916  return sh;
1917  }
1918 
1920  Shader& deepCopyFrom(const Shader& other)
1921  {
1922  super::operator=(other);
1923 
1924  // we don't copy the update time
1925  // mLastUpdateTime = other.mLastUpdateTime;
1926 
1927  if (other.mRenderStateSet.get())
1928  {
1929  if (mRenderStateSet.get() == NULL)
1930  mRenderStateSet = new RenderStateSet;
1931  mRenderStateSet->deepCopyFrom( *other.mRenderStateSet.get() );
1932  }
1933  else
1934  mRenderStateSet = NULL;
1935 
1936  if (other.mEnableSet.get())
1937  {
1938  if (mEnableSet.get() == NULL)
1939  mEnableSet = new EnableSet;
1940  *mEnableSet = *other.mEnableSet; // this is just a vector of ints
1941  }
1942  else
1943  mEnableSet = NULL;
1944 
1945  if (other.mUniformSet.get())
1946  {
1947  if (mUniformSet.get() == NULL)
1948  mUniformSet = new UniformSet;
1949  mUniformSet->deepCopyFrom( *other.mUniformSet.get() );
1950  }
1951  else
1952  mUniformSet = NULL;
1953 
1954  mScissor = new Scissor(*other.mScissor);
1955 
1956  // note: this is shallow copied
1957  mShaderAnimator = other.mShaderAnimator;
1958 
1959  #ifdef VL_USER_DATA_SHADER
1960  mShaderUserData = other.mShaderUserData;
1961  #endif
1962 
1963  return *this;
1964  }
1965 
1967  void reset()
1968  {
1969  disableAll();
1970  eraseAllRenderStates();
1971  eraseAllUniforms();
1972  }
1973 
1974  // state getters
1975 
1977  GLSLProgram* gocGLSLProgram();
1978 
1980  const GLSLProgram* getGLSLProgram() const;
1981 
1983  GLSLProgram* getGLSLProgram();
1984 
1985  PixelTransfer* gocPixelTransfer();
1986  const PixelTransfer* getPixelTransfer() const { if (!getRenderStateSet()) return NULL; else return static_cast<const PixelTransfer*>( getRenderStateSet()->renderState( RS_PixelTransfer ) ); }
1987  PixelTransfer* getPixelTransfer() { if (!getRenderStateSet()) return NULL; else return static_cast<PixelTransfer*>( getRenderStateSet()->renderState( RS_PixelTransfer ) ); }
1988 
1989  Hint* gocHint();
1990  const Hint* getHint() const { if (!getRenderStateSet()) return NULL; else return static_cast<const Hint*>( getRenderStateSet()->renderState( RS_Hint ) ); }
1991  Hint* getHint() { if (!getRenderStateSet()) return NULL; else return static_cast<Hint*>( getRenderStateSet()->renderState( RS_Hint ) ); }
1992 
1993  CullFace* gocCullFace();
1994  const CullFace* getCullFace() const { if (!getRenderStateSet()) return NULL; else return static_cast<const CullFace*>( getRenderStateSet()->renderState( RS_CullFace ) ); }
1995  CullFace* getCullFace() { if (!getRenderStateSet()) return NULL; else return static_cast<CullFace*>( getRenderStateSet()->renderState( RS_CullFace ) ); }
1996 
1997  FrontFace* gocFrontFace();
1998  const FrontFace* getFrontFace() const { if (!getRenderStateSet()) return NULL; else return static_cast<const FrontFace*>( getRenderStateSet()->renderState( RS_FrontFace ) ); }
1999  FrontFace* getFrontFace() { if (!getRenderStateSet()) return NULL; else return static_cast<FrontFace*>( getRenderStateSet()->renderState( RS_FrontFace ) ); }
2000 
2001  DepthFunc* gocDepthFunc();
2002  const DepthFunc* getDepthFunc() const { if (!getRenderStateSet()) return NULL; else return static_cast<const DepthFunc*>( getRenderStateSet()->renderState( RS_DepthFunc ) ); }
2003  DepthFunc* getDepthFunc() { if (!getRenderStateSet()) return NULL; else return static_cast<DepthFunc*>( getRenderStateSet()->renderState( RS_DepthFunc ) ); }
2004 
2005  DepthMask* gocDepthMask();
2006  const DepthMask* getDepthMask() const { if (!getRenderStateSet()) return NULL; else return static_cast<const DepthMask*>( getRenderStateSet()->renderState( RS_DepthMask ) ); }
2007  DepthMask* getDepthMask() { if (!getRenderStateSet()) return NULL; else return static_cast<DepthMask*>( getRenderStateSet()->renderState( RS_DepthMask ) ); }
2008 
2009  Color* gocColor();
2010  const Color* getColor() const { if (!getRenderStateSet()) return NULL; else return static_cast<const Color*>( getRenderStateSet()->renderState( RS_Color ) ); }
2011  Color* getColor() { if (!getRenderStateSet()) return NULL; else return static_cast<Color*>( getRenderStateSet()->renderState( RS_Color ) ); }
2012 
2013  SecondaryColor* gocSecondaryColor();
2014  const SecondaryColor* getSecondaryColor() const { if (!getRenderStateSet()) return NULL; else return static_cast<const SecondaryColor*>( getRenderStateSet()->renderState( RS_SecondaryColor ) ); }
2015  SecondaryColor* getSecondaryColor() { if (!getRenderStateSet()) return NULL; else return static_cast<SecondaryColor*>( getRenderStateSet()->renderState( RS_SecondaryColor ) ); }
2016 
2017  Normal* gocNormal();
2018  const Normal* getNormal() const { if (!getRenderStateSet()) return NULL; else return static_cast<const Normal*>( getRenderStateSet()->renderState( RS_Normal ) ); }
2019  Normal* getNormal() { if (!getRenderStateSet()) return NULL; else return static_cast<Normal*>( getRenderStateSet()->renderState( RS_Normal ) ); }
2020 
2021  ColorMask* gocColorMask();
2022  const ColorMask* getColorMask() const { if (!getRenderStateSet()) return NULL; else return static_cast<const ColorMask*>( getRenderStateSet()->renderState( RS_ColorMask ) ); }
2023  ColorMask* getColorMask() { if (!getRenderStateSet()) return NULL; else return static_cast<ColorMask*>( getRenderStateSet()->renderState( RS_ColorMask ) ); }
2024 
2025  PolygonMode* gocPolygonMode();
2026  const PolygonMode* getPolygonMode() const { if (!getRenderStateSet()) return NULL; else return static_cast<const PolygonMode*>( getRenderStateSet()->renderState( RS_PolygonMode ) ); }
2027  PolygonMode* getPolygonMode() { if (!getRenderStateSet()) return NULL; else return static_cast<PolygonMode*>( getRenderStateSet()->renderState( RS_PolygonMode ) ); }
2028 
2029  ShadeModel* gocShadeModel();
2030  const ShadeModel* getShadeModel() const { if (!getRenderStateSet()) return NULL; else return static_cast<const ShadeModel*>( getRenderStateSet()->renderState( RS_ShadeModel ) ); }
2031  ShadeModel* getShadeModel() { if (!getRenderStateSet()) return NULL; else return static_cast<ShadeModel*>( getRenderStateSet()->renderState( RS_ShadeModel ) ); }
2032 
2033  BlendEquation* gocBlendEquation();
2034  const BlendEquation* getBlendEquation() const { if (!getRenderStateSet()) return NULL; else return static_cast<const BlendEquation*>( getRenderStateSet()->renderState( RS_BlendEquation ) ); }
2035  BlendEquation* getBlendEquation() { if (!getRenderStateSet()) return NULL; else return static_cast<BlendEquation*>( getRenderStateSet()->renderState( RS_BlendEquation ) ); }
2036 
2037  AlphaFunc* gocAlphaFunc();
2038  const AlphaFunc* getAlphaFunc() const { if (!getRenderStateSet()) return NULL; else return static_cast<const AlphaFunc*>( getRenderStateSet()->renderState( RS_AlphaFunc ) ); }
2039  AlphaFunc* getAlphaFunc() { if (!getRenderStateSet()) return NULL; else return static_cast<AlphaFunc*>( getRenderStateSet()->renderState( RS_AlphaFunc ) ); }
2040 
2041  Material* gocMaterial();
2042  const Material* getMaterial() const { if (!getRenderStateSet()) return NULL; else return static_cast<const Material*>( getRenderStateSet()->renderState( RS_Material ) ); }
2043  Material* getMaterial() { if (!getRenderStateSet()) return NULL; else return static_cast<Material*>( getRenderStateSet()->renderState( RS_Material ) ); }
2044 
2045  LightModel* gocLightModel();
2046  const LightModel* getLightModel() const { if (!getRenderStateSet()) return NULL; else return static_cast<const LightModel*>( getRenderStateSet()->renderState( RS_LightModel ) ); }
2047  LightModel* getLightModel() { if (!getRenderStateSet()) return NULL; else return static_cast<LightModel*>( getRenderStateSet()->renderState( RS_LightModel ) ); }
2048 
2049  Fog* gocFog();
2050  const Fog* getFog() const { if (!getRenderStateSet()) return NULL; else return static_cast<const Fog*>( getRenderStateSet()->renderState( RS_Fog ) ); }
2051  Fog* getFog() { if (!getRenderStateSet()) return NULL; else return static_cast<Fog*>( getRenderStateSet()->renderState( RS_Fog ) ); }
2052 
2053  PolygonOffset* gocPolygonOffset();
2054  const PolygonOffset* getPolygonOffset() const { if (!getRenderStateSet()) return NULL; else return static_cast<const PolygonOffset*>( getRenderStateSet()->renderState( RS_PolygonOffset ) ); }
2055  PolygonOffset* getPolygonOffset() { if (!getRenderStateSet()) return NULL; else return static_cast<PolygonOffset*>( getRenderStateSet()->renderState( RS_PolygonOffset ) ); }
2056 
2057  LogicOp* gocLogicOp();
2058  const LogicOp* getLogicOp() const { if (!getRenderStateSet()) return NULL; else return static_cast<const LogicOp*>( getRenderStateSet()->renderState( RS_LogicOp ) ); }
2059  LogicOp* getLogicOp() { if (!getRenderStateSet()) return NULL; else return static_cast<LogicOp*>( getRenderStateSet()->renderState( RS_LogicOp ) ); }
2060 
2061  DepthRange* gocDepthRange();
2062  const DepthRange* getDepthRange() const { if (!getRenderStateSet()) return NULL; else return static_cast<const DepthRange*>( getRenderStateSet()->renderState( RS_DepthRange ) ); }
2063  DepthRange* getDepthRange() { if (!getRenderStateSet()) return NULL; else return static_cast<DepthRange*>( getRenderStateSet()->renderState( RS_DepthRange ) ); }
2064 
2065  LineWidth* gocLineWidth();
2066  const LineWidth* getLineWidth() const { if (!getRenderStateSet()) return NULL; else return static_cast<const LineWidth*>( getRenderStateSet()->renderState( RS_LineWidth ) ); }
2067  LineWidth* getLineWidth() { if (!getRenderStateSet()) return NULL; else return static_cast<LineWidth*>( getRenderStateSet()->renderState( RS_LineWidth ) ); }
2068 
2069  PointSize* gocPointSize();
2070  const PointSize* getPointSize() const { if (!getRenderStateSet()) return NULL; else return static_cast<const PointSize*>( getRenderStateSet()->renderState( RS_PointSize ) ); }
2071  PointSize* getPointSize() { if (!getRenderStateSet()) return NULL; else return static_cast<PointSize*>( getRenderStateSet()->renderState( RS_PointSize ) ); }
2072 
2073  LineStipple* gocLineStipple();
2074  const LineStipple* getLineStipple() const { if (!getRenderStateSet()) return NULL; else return static_cast<const LineStipple*>( getRenderStateSet()->renderState( RS_LineStipple ) ); }
2075  LineStipple* getLineStipple() { if (!getRenderStateSet()) return NULL; else return static_cast<LineStipple*>( getRenderStateSet()->renderState( RS_LineStipple ) ); }
2076 
2077  PolygonStipple* gocPolygonStipple();
2078  const PolygonStipple* getPolygonStipple() const { if (!getRenderStateSet()) return NULL; else return static_cast<const PolygonStipple*>( getRenderStateSet()->renderState( RS_PolygonStipple ) ); }
2079  PolygonStipple* getPolygonStipple() { if (!getRenderStateSet()) return NULL; else return static_cast<PolygonStipple*>( getRenderStateSet()->renderState( RS_PolygonStipple ) ); }
2080 
2081  PointParameter* gocPointParameter();
2082  const PointParameter* getPointParameter() const { if (!getRenderStateSet()) return NULL; else return static_cast<const PointParameter*>( getRenderStateSet()->renderState( RS_PointParameter ) ); }
2083  PointParameter* getPointParameter() { if (!getRenderStateSet()) return NULL; else return static_cast<PointParameter*>( getRenderStateSet()->renderState( RS_PointParameter ) ); }
2084 
2085  StencilFunc* gocStencilFunc();
2086  const StencilFunc* getStencilFunc() const { if (!getRenderStateSet()) return NULL; else return static_cast<const StencilFunc*>( getRenderStateSet()->renderState( RS_StencilFunc ) ); }
2087  StencilFunc* getStencilFunc() { if (!getRenderStateSet()) return NULL; else return static_cast<StencilFunc*>( getRenderStateSet()->renderState( RS_StencilFunc ) ); }
2088 
2089  StencilOp* gocStencilOp();
2090  const StencilOp* getStencilOp() const { if (!getRenderStateSet()) return NULL; else return static_cast<const StencilOp*>( getRenderStateSet()->renderState( RS_StencilOp ) ); }
2091  StencilOp* getStencilOp() { if (!getRenderStateSet()) return NULL; else return static_cast<StencilOp*>( getRenderStateSet()->renderState( RS_StencilOp ) ); }
2092 
2093  StencilMask* gocStencilMask();
2094  const StencilMask* getStencilMask() const { if (!getRenderStateSet()) return NULL; else return static_cast<const StencilMask*>( getRenderStateSet()->renderState( RS_StencilMask ) ); }
2095  StencilMask* getStencilMask() { if (!getRenderStateSet()) return NULL; else return static_cast<StencilMask*>( getRenderStateSet()->renderState( RS_StencilMask ) ); }
2096 
2097  BlendColor* gocBlendColor();
2098  const BlendColor* getBlendColor() const { if (!getRenderStateSet()) return NULL; else return static_cast<const BlendColor*>( getRenderStateSet()->renderState( RS_BlendColor ) ); }
2099  BlendColor* getBlendColor() { if (!getRenderStateSet()) return NULL; else return static_cast<BlendColor*>( getRenderStateSet()->renderState( RS_BlendColor ) ); }
2100 
2101  BlendFunc* gocBlendFunc();
2102  const BlendFunc* getBlendFunc() const { if (!getRenderStateSet()) return NULL; else return static_cast<const BlendFunc*>( getRenderStateSet()->renderState( RS_BlendFunc ) ); }
2103  BlendFunc* getBlendFunc() { if (!getRenderStateSet()) return NULL; else return static_cast<BlendFunc*>( getRenderStateSet()->renderState( RS_BlendFunc ) ); }
2104 
2105  SampleCoverage* gocSampleCoverage();
2106  const SampleCoverage* getSampleCoverage() const { if (!getRenderStateSet()) return NULL; else return static_cast<const SampleCoverage*>( getRenderStateSet()->renderState( RS_SampleCoverage ) ); }
2107  SampleCoverage* getSampleCoverage() { if (!getRenderStateSet()) return NULL; else return static_cast<SampleCoverage*>( getRenderStateSet()->renderState( RS_SampleCoverage ) ); }
2108 
2109  // indexed render states
2110 
2111  // vertex attrib
2112 
2113  VertexAttrib* gocVertexAttrib(int attr_index);
2114 
2115  const VertexAttrib* getVertexAttrib(int attr_index) const;
2116 
2117  VertexAttrib* getVertexAttrib(int attr_index);
2118 
2119  // lights
2120 
2121  Light* gocLight(int light_index);
2122 
2123  const Light* getLight(int light_index) const;
2124 
2125  Light* getLight(int light_index);
2126 
2127  // clip planes
2128 
2129  ClipPlane* gocClipPlane(int plane_index);
2130 
2131  const ClipPlane* getClipPlane(int plane_index) const;
2132 
2133  ClipPlane* getClipPlane(int plane_index);
2134 
2135  // texture unit
2136 
2137  TextureSampler* gocTextureSampler(int unit_index);
2138 
2139  const TextureSampler* getTextureSampler(int unit_index) const { return static_cast<const TextureSampler*>( getRenderStateSet()->renderState( RS_TextureSampler, unit_index ) ); }
2140 
2141  TextureSampler* getTextureSampler(int unit_index) { return static_cast<TextureSampler*>( getRenderStateSet()->renderState( RS_TextureSampler, unit_index ) ); }
2142 
2143  // tex env
2144 
2145  TexEnv* gocTexEnv(int unit_index);
2146 
2147  const TexEnv* getTexEnv(int unit_index) const { return static_cast<const TexEnv*>( getRenderStateSet()->renderState( RS_TexEnv, unit_index ) ); }
2148 
2149  TexEnv* getTexEnv(int unit_index) { return static_cast<TexEnv*>( getRenderStateSet()->renderState( RS_TexEnv, unit_index ) ); }
2150 
2151  // tex gen
2152 
2153  TexGen* gocTexGen(int unit_index);
2154 
2155  const TexGen* getTexGen(int unit_index) const { return static_cast<const TexGen*>( getRenderStateSet()->renderState( RS_TexGen, unit_index ) ); }
2156 
2157  TexGen* getTexGen(int unit_index) { return static_cast<TexGen*>( getRenderStateSet()->renderState( RS_TexGen, unit_index ) ); }
2158 
2159  // texture matrix
2160 
2161  TextureMatrix* gocTextureMatrix(int unit_index);
2162 
2163  const TextureMatrix* getTextureMatrix(int unit_index) const { return static_cast<const TextureMatrix*>( getRenderStateSet()->renderState( RS_TextureMatrix, unit_index ) ); }
2164 
2165  TextureMatrix* getTextureMatrix(int unit_index) { return static_cast<TextureMatrix*>( getRenderStateSet()->renderState( RS_TextureMatrix, unit_index ) ); }
2166 
2167  // enable methods
2168 
2169  void enable(EEnable capability) { gocEnableSet()->enable(capability); }
2170 
2171  void disable(EEnable capability) { gocEnableSet()->disable(capability); }
2172 
2173  const std::vector<EEnable>& enables() const { return getEnableSet()->enables(); }
2174 
2175  int isEnabled(EEnable capability) const { if (!getEnableSet()) return false; return getEnableSet()->isEnabled(capability); }
2176 
2177  void disableAll() { if (getEnableSet()) getEnableSet()->disableAll(); }
2178 
2179  bool isBlendingEnabled() const { if (!getEnableSet()) return false; return getEnableSet()->isBlendingEnabled(); }
2180 
2181  // render states methods
2182 
2183  void setRenderState(RenderStateNonIndexed* renderstate) { gocRenderStateSet()->setRenderState(renderstate, -1); }
2184 
2185  void setRenderState(RenderState* renderstate, int index) { gocRenderStateSet()->setRenderState(renderstate, index); }
2186 
2187  const RenderState* renderState( ERenderState type, int index=0 ) const { if (!getRenderStateSet()) return NULL; return getRenderStateSet()->renderState(type, index); }
2188 
2189  RenderState* renderState( ERenderState type, int index=0 ) { return gocRenderStateSet()->renderState(type, index); }
2190 
2191  size_t renderStatesCount() const { return getRenderStateSet()->renderStatesCount(); }
2192 
2193  const RenderStateSlot* renderStates() const { return getRenderStateSet()->renderStates(); }
2194 
2195  RenderStateSlot* renderStates() { return getRenderStateSet()->renderStates(); }
2196 
2198  void eraseRenderState(ERenderState type, int index=-1) { gocRenderStateSet()->eraseRenderState(type, index); }
2199 
2200  void eraseRenderState(RenderState* rs, int index) { if (rs) gocRenderStateSet()->eraseRenderState(rs->type(), index); }
2201 
2202  void eraseAllRenderStates() { if(getRenderStateSet()) getRenderStateSet()->eraseAllRenderStates(); }
2203 
2205  const GLSLProgram* glslProgram() const { if (!getRenderStateSet()) return NULL; return getRenderStateSet()->glslProgram(); }
2206 
2208  GLSLProgram* glslProgram() { return gocRenderStateSet()->glslProgram(); }
2209 
2210  // uniforms methods
2211 
2213  void setUniform(Uniform* uniform) { VL_CHECK(uniform); gocUniformSet()->setUniform(uniform); }
2214 
2216  const std::vector< ref<Uniform> >& uniforms() const { return getUniformSet()->uniforms(); }
2217 
2219  void eraseUniform(const char* name) { gocUniformSet()->eraseUniform(name); }
2220 
2222  void eraseUniform(const Uniform* uniform) { gocUniformSet()->eraseUniform(uniform); }
2223 
2225  void eraseAllUniforms() { if (getUniformSet()) getUniformSet()->eraseAllUniforms(); }
2226 
2228  Uniform* gocUniform(const char* name) { return gocUniformSet()->gocUniform(name); }
2229 
2231  Uniform* getUniform(const char* name) { return getUniformSet()->getUniform(name); }
2232 
2234  const Uniform* getUniform(const char* name) const { return getUniformSet()->getUniform(name); }
2235 
2236  // sets
2237 
2238  EnableSet* gocEnableSet() { if (!mEnableSet) mEnableSet = new EnableSet; return mEnableSet.get(); }
2239 
2240  EnableSet* getEnableSet() { return mEnableSet.get(); }
2241 
2242  const EnableSet* getEnableSet() const { return mEnableSet.get(); }
2243 
2244  RenderStateSet* gocRenderStateSet() { if (!mRenderStateSet) mRenderStateSet = new RenderStateSet; return mRenderStateSet.get(); }
2245 
2246  RenderStateSet* getRenderStateSet() { return mRenderStateSet.get(); }
2247 
2248  const RenderStateSet* getRenderStateSet() const { return mRenderStateSet.get(); }
2249 
2260  UniformSet* gocUniformSet() { if (!mUniformSet) mUniformSet = new UniformSet; return mUniformSet.get(); }
2261 
2272  UniformSet* getUniformSet() { return mUniformSet.get(); }
2273 
2284  const UniformSet* getUniformSet() const { return mUniformSet.get(); }
2285 
2286  void setEnableSet(EnableSet* es) { mEnableSet = es; }
2287 
2288  void setRenderStateSet(RenderStateSet* rss) { mRenderStateSet = rss; }
2289 
2300  void setUniformSet(UniformSet* us) { mUniformSet = us; }
2301 
2311  void setScissor(Scissor* scissor) { mScissor = scissor; }
2312 
2320  const Scissor* scissor() const { return mScissor.get(); }
2321 
2329  Scissor* scissor() { return mScissor.get(); }
2330 
2332  void setShaderAnimator(ShaderAnimator* animator) { mShaderAnimator = animator; }
2333 
2335  ShaderAnimator* shaderAnimator() { return mShaderAnimator.get(); }
2336 
2338  const ShaderAnimator* shaderAnimator() const { return mShaderAnimator.get(); }
2339 
2341  real lastUpdateTime() const { return mLastUpdateTime; }
2342 
2344  void setLastUpdateTime(real time) { mLastUpdateTime = time; }
2345 
2346 #ifdef VL_USER_DATA_SHADER
2347  public:
2348  const Object* shaderUserData() const { return mShaderUserData.get(); }
2349  Object* shaderUserData() { return mShaderUserData.get(); }
2350  void setShaderUserData(Object* user_data) { mShaderUserData = user_data; }
2351 
2352  private:
2353  ref<Object> mShaderUserData;
2354 #endif
2355 
2356  protected:
2363  };
2364 }
2365 
2366 #endif
EStencilOp sFail_Back() const
Definition: Shader.hpp:1385
const Hint * getHint() const
Definition: Shader.hpp:1990
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:2260
void setOperand1Alpha(ETexEnvOperand operand)
Definition: Shader.hpp:1631
void setBackFace(EPolygonMode backface)
Definition: Shader.hpp:545
BlendColor * getBlendColor()
Definition: Shader.hpp:2099
BlendEquation * getBlendEquation()
Definition: Shader.hpp:2035
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:2344
void setRGBScale(float rgbscale)
Definition: Shader.hpp:1606
bool pointSpriteCoordReplace() const
Definition: Shader.hpp:1638
void setTexture(Texture *texture)
The texture sampler by a texture unit.
Definition: Shader.hpp:1765
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
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:2031
float mPostColorMatrixAlphaScale
Definition: Shader.hpp:327
virtual ERenderState type() const
Definition: Shader.hpp:1498
int isEnabled(EEnable capability) const
Definition: Shader.hpp:2175
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:252
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:2062
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:2051
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:2187
ref< RenderStateSet > mRenderStateSet
Definition: Shader.hpp:2357
Wraps the OpenGL function glTexParameter(), see also http://www.opengl.org/sdk/docs/man/xhtml/glTexPa...
Definition: Texture.hpp:62
void setLineSmoothHint(EHintMode mode)
Definition: Shader.hpp:363
RenderStateSet * gocRenderStateSet()
Definition: Shader.hpp:2244
virtual ref< RenderState > clone() const
Definition: Shader.hpp:889
const StencilFunc * getStencilFunc() const
Definition: Shader.hpp:2086
bool localViewer() const
Definition: Shader.hpp:881
const fvec4 & value() const
Definition: Shader.hpp:76
LineStipple * getLineStipple()
Definition: Shader.hpp:2075
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:2054
EShadeModel shadeModel() const
Definition: Shader.hpp:583
static void reset(int index, OpenGLContext *ctx)
Reset texture sampler to it&#39;s default disabled state.
Definition: Shader.hpp:1761
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:279
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:2225
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:2015
float frontShininess() const
Definition: Shader.hpp:809
StencilOp * getStencilOp()
Definition: Shader.hpp:2091
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:1991
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:1912
void setGreen(bool green)
Definition: Shader.hpp:1506
EColorMaterial colorMaterial() const
Definition: Shader.hpp:827
FrontFace * getFrontFace()
Definition: Shader.hpp:1999
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:2047
virtual ERenderState type() const
Definition: Shader.hpp:1465
void setPostConvolutionAlphaBias(float bias)
Definition: Shader.hpp:300
EnableSet * getEnableSet()
Definition: Shader.hpp:2240
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:2063
ShaderAnimator * shaderAnimator()
Returns the ShaderAnimator used to update/animate a Shader (see vl::ShaderAnimator documentation)...
Definition: Shader.hpp:2335
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:2195
void setRenderStateSet(RenderStateSet *rss)
Definition: Shader.hpp:2288
fvec4 mColor
Definition: Shader.hpp:952
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:2338
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:1920
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:2007
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:2050
float greenScale() const
Definition: Shader.hpp:245
float postConvolutionAlphaScale() const
Definition: Shader.hpp:265
TexParameter * getTexParameter()
The TexParameter used by the sampler used to override the one specified by the bound Texture...
Definition: Shader.hpp:1778
fvec4 mBackDiffuse
Definition: Shader.hpp:844
const AlphaFunc * getAlphaFunc() const
Definition: Shader.hpp:2038
void disableAll()
Definition: Shader.hpp:2177
EnableSet * gocEnableSet()
Definition: Shader.hpp:2238
virtual ref< RenderState > clone() const
Definition: Shader.hpp:637
const std::vector< ref< Uniform > > & uniforms() const
Equivalent to gocUniformSet()->uniforms(...)
Definition: Shader.hpp:2216
bool mLocalViewer
Definition: Shader.hpp:899
const fvec4 & eyePlaneS() const
Definition: Shader.hpp:1695
virtual ref< RenderState > clone() const
Definition: Shader.hpp:146
TextureSampler * getTextureSampler(int unit_index)
Definition: Shader.hpp:2141
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:2002
void setRenderState(RenderState *renderstate, int index)
Definition: Shader.hpp:2185
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:143
void setValue(const fvec3 &color)
Definition: Shader.hpp:176
PointSize * getPointSize()
Definition: Shader.hpp:2071
virtual ERenderState type() const
Definition: Shader.hpp:611
PixelTransfer * getPixelTransfer()
Definition: Shader.hpp:1987
fvec4 mEyePlaneS
Definition: Shader.hpp:1728
virtual ERenderState type() const
Definition: Shader.hpp:1191
const TexEnv * getTexEnv(int unit_index) const
Definition: Shader.hpp:2147
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:2010
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:2030
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:2082
void setBackEmission(const fvec4 &color)
Definition: Shader.hpp:814
float mEnd
Definition: Shader.hpp:956
const EnableSet * getEnableSet() const
Definition: Shader.hpp:2242
RenderStateSet & shallowCopyFrom(const RenderStateSet &other)
StencilOp(EStencilOp sfail=SO_KEEP, EStencilOp dpfail=SO_KEEP, EStencilOp dppass=SO_KEEP)
Definition: Shader.hpp:1351
Texture * texture()
The texture sampler by a texture unit.
Definition: Shader.hpp:1768
void setPostConvolutionAlphaScale(float scale)
Definition: Shader.hpp:296
ETexEnvSource source2Alpha() const
Definition: Shader.hpp:1622
LogicOp * getLogicOp()
Definition: Shader.hpp:2059
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:2189
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:2228
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:1821
void setShaderAnimator(ShaderAnimator *animator)
Installs the ShaderAnimator used to update/animate a Shader (see vl::ShaderAnimator documentation)...
Definition: Shader.hpp:2332
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
EColorMaterial mColorMaterial
Definition: Shader.hpp:851
void eraseRenderState(RenderState *rs, int index)
Definition: Shader.hpp:2200
fvec3 mDistanceAttenuation
Definition: Shader.hpp:1266
size_t renderStatesCount() const
Definition: Shader.hpp:2191
void setIndexShift(int index_shift)
Definition: Shader.hpp:273
virtual ERenderState type() const
Definition: Shader.hpp:138
void disable(EEnable capability)
Definition: Shader.hpp:2171
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
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
virtual ERenderState type() const
Definition: Shader.hpp:1757
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:2046
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:2043
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.
void setTexParameter(TexParameter *tex_param)
The TexParameter used by the sampler used to override the one specified by the bound Texture...
Definition: Shader.hpp:1775
virtual ref< RenderState > clone() const
Definition: Shader.hpp:944
Color * getColor()
Definition: Shader.hpp:2011
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
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:1866
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:2102
DepthFunc * getDepthFunc()
Definition: Shader.hpp:2003
const LogicOp * getLogicOp() const
Definition: Shader.hpp:2058
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
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:2183
fvec4 mBackSpecular
Definition: Shader.hpp:845
const Normal * getNormal() const
Definition: Shader.hpp:2018
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:2149
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:2208
void setFrontEmission(const fvec4 &color)
Definition: Shader.hpp:802
void setBackShininess(float shininess)
Definition: Shader.hpp:815
ref< ShaderAnimator > mShaderAnimator
Definition: Shader.hpp:2361
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:2087
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
const Texture * texture() const
The texture sampler by a texture unit.
Definition: Shader.hpp:1771
ref< Texture > mTexture
Definition: Shader.hpp:1793
void setZFar(float zfar)
Definition: Shader.hpp:1061
const DepthMask * getDepthMask() const
Definition: Shader.hpp:2006
PointParameter * getPointParameter()
Definition: Shader.hpp:2083
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:1986
const Material * getMaterial() const
Definition: Shader.hpp:2042
virtual ref< RenderState > clone() const
Definition: Shader.hpp:78
bool mapColor() const
Definition: Shader.hpp:240
The TextureSampler class associates a Texture object to an OpenGL texture unit.
Definition: Shader.hpp:1747
ColorMask * getColorMask()
Definition: Shader.hpp:2023
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:2163
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:2219
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:2019
EFrontFace mFrontFace
Definition: Shader.hpp:454
EHintMode mPointSmoothHint
Definition: Shader.hpp:384
const StencilMask * getStencilMask() const
Definition: Shader.hpp:2094
bool mapStencil() const
Definition: Shader.hpp:241
EBlendFactor
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:2079
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:2234
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:2231
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:1803
SampleCoverage * getSampleCoverage()
Definition: Shader.hpp:2107
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:2165
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:2026
EPolygonMode mFrontFace
Definition: Shader.hpp:559
void eraseAllRenderStates()
Definition: Shader.hpp:2202
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:2103
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:2362
void setEnabled(bool enable)
Whether the ShaderAnimator is enabled or not.
Definition: Shader.hpp:1818
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:1841
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:2320
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:2039
ELogicOp mLogicOp
Definition: Shader.hpp:1031
const BlendEquation * getBlendEquation() const
Definition: Shader.hpp:2034
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:2300
PolygonOffset * getPolygonOffset()
Definition: Shader.hpp:2055
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
virtual ERenderState type() const
Definition: Shader.hpp:1359
void setDstRGB(EBlendFactor factor)
Definition: Shader.hpp:623
TexGen * getTexGen(int unit_index)
Definition: Shader.hpp:2157
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:2090
EColorControl colorControl() const
Definition: Shader.hpp:885
const LineStipple * getLineStipple() const
Definition: Shader.hpp:2074
void setColorMaterial(EPolygonFace face, EColorMaterial color)
Definition: Shader.hpp:825
float depthBias() const
Definition: Shader.hpp:253
const RenderStateSet * getRenderStateSet() const
Definition: Shader.hpp:2248
const SampleCoverage * getSampleCoverage() const
Definition: Shader.hpp:2106
const LineWidth * getLineWidth() const
Definition: Shader.hpp:2066
UniformSet * getUniformSet()
Returns the UniformSet installed.
Definition: Shader.hpp:2272
PolygonMode * getPolygonMode()
Definition: Shader.hpp:2027
const CullFace * getCullFace() const
Definition: Shader.hpp:1994
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:2358
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:2246
unsigned int mask_Back() const
Definition: Shader.hpp:1322
float mPostColorMatrixRedBias
Definition: Shader.hpp:328
const PointSize * getPointSize() const
Definition: Shader.hpp:2070
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:1998
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:2022
StencilMask * getStencilMask()
Definition: Shader.hpp:2095
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:2311
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
const TexParameter * getTexParameter() const
The TexParameter used by the sampler used to override the one specified by the bound Texture...
Definition: Shader.hpp:1781
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
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:2222
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:2173
float start() const
Definition: Shader.hpp:940
virtual ERenderState type() const
Definition: RenderState.hpp:59
LineWidth * getLineWidth()
Definition: Shader.hpp:2067
const PolygonStipple * getPolygonStipple() const
Definition: Shader.hpp:2078
const BlendColor * getBlendColor() const
Definition: Shader.hpp:2098
Represents a virtual camera defining, among other things, the point of view from which scenes can be ...
Definition: Camera.hpp:50
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:2329
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
virtual ref< RenderState > clone() const
Definition: Shader.hpp:1785
EBlendFactor dstAlpha() const
Definition: Shader.hpp:635
const GLSLProgram * glslProgram() const
Returns the GLSLProgram associated to a Shader (if any)
Definition: Shader.hpp:2205
bool twoSide() const
Definition: Shader.hpp:883
ETexEnvSource source0RGB() const
Definition: Shader.hpp:1614
fvec4 mObjectPlaneT
Definition: Shader.hpp:1731
ref< TexParameter > mTexParameter
Definition: Shader.hpp:1794
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:2359
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:2014
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:2213
real lastUpdateTime() const
Last time this Actor was animated/updated using a shaderAnimator().
Definition: Shader.hpp:2341
ETexEnvSource
EPointSpriteCoordOrigin mPointSpriteCoordOrigin
Definition: Shader.hpp:1270
ref< Scissor > mScissor
Definition: Shader.hpp:2360
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:1967
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:1995
#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:2169
float blueScale() const
Definition: Shader.hpp:246
fvec4 mColor
Definition: Shader.hpp:1651
bool isBlendingEnabled() const
Definition: Shader.hpp:2179
const UniformSet * getUniformSet() const
Returns the UniformSet installed.
Definition: Shader.hpp:2284
void setPostColorMatrixAlphaBias(float bias)
Definition: Shader.hpp:292
const RenderStateSlot * renderStates() const
Definition: Shader.hpp:2193
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:2286
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:2198
const TexGen * getTexGen(int unit_index) const
Definition: Shader.hpp:2155
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
const TextureSampler * getTextureSampler(int unit_index) const
Definition: Shader.hpp:2139
ref< Shader > shallowCopy() const
Returns the shallow copy of a Shader.
Definition: Shader.hpp:1857
void setPostConvolutionBlueScale(float scale)
Definition: Shader.hpp:295
void setObjectPlaneR(const fvec4 &plane)
Definition: Shader.hpp:1707