root/OpenSceneGraph/trunk/include/osg/TexEnvFilter @ 13041

Revision 13041, 2.2 kB (checked in by robert, 2 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
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.
7 *
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.
12*/
13
14#ifndef OSG_TEXENVFILTER
15#define OSG_TEXENVFILTER 1
16
17#include <osg/GL>
18#include <osg/StateAttribute>
19
20#ifndef GL_EXT_texture_lod_bias
21#define GL_MAX_TEXTURE_LOD_BIAS_EXT       0x84FD
22#define GL_TEXTURE_FILTER_CONTROL_EXT     0x8500
23#define GL_TEXTURE_LOD_BIAS_EXT           0x8501
24#endif
25
26namespace osg {
27
28/** TexEnvFilter - encapsulates the OpenGL glTexEnv (GL_TEXTURE_FILTER_CONTROL) state.*/
29class OSG_EXPORT TexEnvFilter : public StateAttribute
30{
31  public:
32    TexEnvFilter(float lodBias = 0.0f);
33
34    /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
35    TexEnvFilter(const TexEnvFilter& texenv,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
36            StateAttribute(texenv,copyop),
37            _lodBias(texenv._lodBias) {}
38
39    META_StateAttribute(osg, TexEnvFilter, TEXENVFILTER);
40
41    virtual bool isTextureAttribute() const { return true; }
42
43    /** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/
44    virtual int compare(const StateAttribute& sa) const
45    {
46        // check the types are equal and then create the rhs variable
47        // used by the COMPARE_StateAttribute_Parameter macros below.
48        COMPARE_StateAttribute_Types(TexEnvFilter, sa)
49
50        // compare each parameter in turn against the rhs.
51        COMPARE_StateAttribute_Parameter(_lodBias)
52
53        return 0; // passed all the above comparison macros, must be equal.
54    }
55
56    void  setLodBias( float lodBias ) { _lodBias = lodBias; }
57
58    float getLodBias() const { return _lodBias; }
59
60    virtual void apply(State& state) const;
61
62  protected:
63    virtual ~TexEnvFilter();
64
65    float   _lodBias;
66};
67
68}
69
70#endif
Note: See TracBrowser for help on using the browser.