1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
18#include <osg/StateAttribute>
21#ifndef OSG_GL_FIXED_FUNCTION_AVAILABLE
22 #define GL_MODULATE 0x2100
24 #define GL_MODULATE 0x2100
25 #define GL_DECAL 0x2101
30/** TexEnv encapsulates the OpenGL glTexEnv (texture environment) state.
32class OSG_EXPORT TexEnv : public StateAttribute
38 MODULATE = GL_MODULATE,
44 TexEnv(Mode mode=MODULATE);
46 /** Copy constructor using CopyOp to manage deep vs shallow copy. */
47 TexEnv(const TexEnv& texenv,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
48 StateAttribute(texenv,copyop),
50 _color(texenv._color) {}
53 META_StateAttribute(osg, TexEnv, TEXENV);
55 virtual bool isTextureAttribute() const { return true; }
57 /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
58 virtual int compare(const StateAttribute& sa) const
60 // Check for equal types, then create the rhs variable
61 // used by the COMPARE_StateAttribute_Parameter macros below.
62 COMPARE_StateAttribute_Types(TexEnv,sa)
64 // Compare each parameter in turn against the rhs.
65 COMPARE_StateAttribute_Parameter(_mode)
66 COMPARE_StateAttribute_Parameter(_color)
68 return 0; // Passed all the above comparison macros, so must be equal.
72 void setMode( Mode mode ) { _mode = mode; }
74 Mode getMode() const { return _mode; }
76 void setColor( const Vec4& color ) { _color = color; }
78 Vec4& getColor() { return _color; }
80 const Vec4& getColor() const { return _color; }
83 virtual void apply(State& state) const;
87 virtual ~TexEnv( void );