14 #ifndef OSG_TEXENVCOMBINE
15 #define OSG_TEXENVCOMBINE 1
23 #ifndef GL_ARB_texture_env_combine
24 #define GL_COMBINE_ARB 0x8570
25 #define GL_COMBINE_RGB_ARB 0x8571
26 #define GL_COMBINE_ALPHA_ARB 0x8572
27 #define GL_SOURCE0_RGB_ARB 0x8580
28 #define GL_SOURCE1_RGB_ARB 0x8581
29 #define GL_SOURCE2_RGB_ARB 0x8582
30 #define GL_SOURCE0_ALPHA_ARB 0x8588
31 #define GL_SOURCE1_ALPHA_ARB 0x8589
32 #define GL_SOURCE2_ALPHA_ARB 0x858A
33 #define GL_OPERAND0_RGB_ARB 0x8590
34 #define GL_OPERAND1_RGB_ARB 0x8591
35 #define GL_OPERAND2_RGB_ARB 0x8592
36 #define GL_OPERAND0_ALPHA_ARB 0x8598
37 #define GL_OPERAND1_ALPHA_ARB 0x8599
38 #define GL_OPERAND2_ALPHA_ARB 0x859A
39 #define GL_RGB_SCALE_ARB 0x8573
40 #define GL_ADD_SIGNED_ARB 0x8574
41 #define GL_INTERPOLATE_ARB 0x8575
42 #define GL_SUBTRACT_ARB 0x84E7
43 #define GL_CONSTANT_ARB 0x8576
44 #define GL_PRIMARY_COLOR_ARB 0x8577
45 #define GL_PREVIOUS_ARB 0x8578
48 #ifndef GL_ARB_texture_env_dot3
49 #define GL_DOT3_RGB_ARB 0x86AE
50 #define GL_DOT3_RGBA_ARB 0x86AF
54 #define GL_TEXTURE0 0x84C0
70 _needsTexEnvCrossbar(texenv._needsTexEnvCrossbar),
71 _combine_RGB(texenv._combine_RGB),
72 _combine_Alpha(texenv._combine_Alpha),
73 _source0_RGB(texenv._source0_RGB),
74 _source1_RGB(texenv._source1_RGB),
75 _source2_RGB(texenv._source2_RGB),
76 _source0_Alpha(texenv._source0_Alpha),
77 _source1_Alpha(texenv._source1_Alpha),
78 _source2_Alpha(texenv._source2_Alpha),
79 _operand0_RGB(texenv._operand0_RGB),
80 _operand1_RGB(texenv._operand1_RGB),
81 _operand2_RGB(texenv._operand2_RGB),
82 _operand0_Alpha(texenv._operand0_Alpha),
83 _operand1_Alpha(texenv._operand1_Alpha),
84 _operand2_Alpha(texenv._operand2_Alpha),
85 _scale_RGB(texenv._scale_RGB),
86 _scale_Alpha(texenv._scale_Alpha),
87 _constantColor(texenv._constantColor) {}
128 REPLACE = GL_REPLACE,
138 void setCombine_RGB(GLint cm);
139 void setCombine_Alpha(GLint cm);
149 TEXTURE = GL_TEXTURE,
160 void setSource0_RGB(GLint sp);
161 void setSource1_RGB(GLint sp);
162 void setSource2_RGB(GLint sp);
164 void setSource0_Alpha(GLint sp);
165 void setSource1_Alpha(GLint sp);
166 void setSource2_Alpha(GLint sp);
178 SRC_COLOR = GL_SRC_COLOR,
179 ONE_MINUS_SRC_COLOR = GL_ONE_MINUS_SRC_COLOR,
180 SRC_ALPHA = GL_SRC_ALPHA,
181 ONE_MINUS_SRC_ALPHA = GL_ONE_MINUS_SRC_ALPHA
184 void setOperand0_RGB(GLint op);
185 void setOperand1_RGB(GLint op);
186 void setOperand2_RGB(GLint op);
188 void setOperand0_Alpha(GLint op);
189 void setOperand1_Alpha(GLint op);
190 void setOperand2_Alpha(GLint op);
201 void setScale_RGB(
float scale);
202 void setScale_Alpha(
float scale);
214 _constantColor.set((direction.
x()+1.0f)*0.5f,(direction.
y()+1.0f)*0.5f,(direction.
z()+1.0f)*0.5f,1.0f);
219 return Vec3(_constantColor.x()*2.0f-1.0f, _constantColor.y()*2.0f-1.0f, _constantColor.z()*2.0f-1.0f);
222 virtual void apply(
State& state)
const;
243 _needsTexEnvCrossbar = (needsTexEnvCombiner(_source0_RGB) ||
244 needsTexEnvCombiner(_source1_RGB) ||
245 needsTexEnvCombiner(_source2_RGB) ||
246 needsTexEnvCombiner(_source0_Alpha) ||
247 needsTexEnvCombiner(_source1_Alpha) ||
248 needsTexEnvCombiner(_source2_Alpha));
void computeNeedForTexEnvCombiners()
GLint getOperand1_RGB() const
#define COMPARE_StateAttribute_Types(TYPE, rhs_attribute)
bool needsTexEnvCombiner(GLint value) const
GLint getCombine_RGB() const
GLint getSource1_RGB() const
float getScale_RGB() const
GLint getOperand1_Alpha() const
GLint getSource2_Alpha() const
virtual bool isTextureAttribute() const
Vec3 getConstantColorAsLightDirection() const
const Vec4 & getConstantColor() const
GLint getOperand2_RGB() const
#define GL_INTERPOLATE_ARB
bool _needsTexEnvCrossbar
GLint getSource0_Alpha() const
GLint getOperand2_Alpha() const
GLint getOperand0_Alpha() const
#define GL_PRIMARY_COLOR_ARB
void setConstantColor(const Vec4 &color)
GLint getSource0_RGB() const
#define META_StateAttribute(library, name, type)
GLint getSource2_RGB() const
virtual int compare(const StateAttribute &sa) const
#define GL_ADD_SIGNED_ARB
GLint getOperand0_RGB() const
#define COMPARE_StateAttribute_Parameter(parameter)
TexEnvCombine(const TexEnvCombine &texenv, const CopyOp ©op=CopyOp::SHALLOW_COPY)
float getScale_Alpha() const
GLint getSource1_Alpha() const
void setConstantColorAsLightDirection(const Vec3 &direction)
GLint getCombine_Alpha() const