OpenSceneGraph 3.6.5
TexEnv
Go to the documentation of this file.
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_TEXENV
15#define OSG_TEXENV 1
16
17#include <osg/GL>
18#include <osg/StateAttribute>
19#include <osg/Vec4>
20
21#ifndef OSG_GL_FIXED_FUNCTION_AVAILABLE
22 #define GL_MODULATE 0x2100
23 #define GL_ADD 0x0104
24 #define GL_MODULATE 0x2100
25 #define GL_DECAL 0x2101
26#endif
27
28namespace osg {
29
33{
34 public :
35
36 enum Mode {
39 BLEND = GL_BLEND,
40 REPLACE = GL_REPLACE,
42 };
43
45
47 TexEnv(const TexEnv& texenv,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
48 StateAttribute(texenv,copyop),
49 _mode(texenv._mode),
50 _color(texenv._color) {}
51
52
54
55 virtual bool isTextureAttribute() const { return true; }
56
58 virtual int compare(const StateAttribute& sa) const
59 {
60 // Check for equal types, then create the rhs variable
61 // used by the COMPARE_StateAttribute_Parameter macros below.
63
64 // Compare each parameter in turn against the rhs.
67
68 return 0; // Passed all the above comparison macros, so must be equal.
69 }
70
71
72 void setMode( Mode mode ) { _mode = mode; }
73
74 Mode getMode() const { return _mode; }
75
76 void setColor( const Vec4& color ) { _color = color; }
77
78 Vec4& getColor() { return _color; }
79
80 const Vec4& getColor() const { return _color; }
81
82
83 virtual void apply(State& state) const;
84
85 protected :
86
87 virtual ~TexEnv( void );
88
91};
92
93}
94
95#endif
#define GL_ADD
Definition TexEnv:23
#define GL_DECAL
Definition TexEnv:25
#define GL_MODULATE
Definition TexEnv:22
#define COMPARE_StateAttribute_Parameter(parameter)
COMPARE_StateAttribute_Parameter macro is a helper for implementing the StatateAtribute::compare(....
Definition StateAttribute:69
#define COMPARE_StateAttribute_Types(TYPE, rhs_attribute)
COMPARE_StateAttribute_Types macro is a helper for implementing the StateAtribute::compare(....
Definition StateAttribute:57
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
Vec4f Vec4
Definition Vec4:21
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,...
Definition State:80
@ TEXENV
Definition StateAttribute:144
virtual int compare(const StateAttribute &sa) const
Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.
Definition TexEnv:58
TexEnv(Mode mode=MODULATE)
Vec4 & getColor()
Definition TexEnv:78
META_StateAttribute(osg, TexEnv, TEXENV)
const Vec4 & getColor() const
Definition TexEnv:80
virtual bool isTextureAttribute() const
Return true if StateAttribute is a type which controls texturing and needs to be issued w....
Definition TexEnv:55
virtual void apply(State &state) const
apply the OpenGL state attributes.
Mode
Definition TexEnv:36
@ REPLACE
Definition TexEnv:40
@ ADD
Definition TexEnv:41
@ MODULATE
Definition TexEnv:38
@ DECAL
Definition TexEnv:37
@ BLEND
Definition TexEnv:39
virtual ~TexEnv(void)
Mode getMode() const
Definition TexEnv:74
void setMode(Mode mode)
Definition TexEnv:72
void setColor(const Vec4 &color)
Definition TexEnv:76
osg::Vec4 _color
Definition TexEnv:90
Mode _mode
Definition TexEnv:89
TexEnv(const TexEnv &texenv, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
Definition TexEnv:47
#define OSG_EXPORT
Definition Export:39

osg logo
Generated at Wed Jul 23 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.