openscenegraph
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 {
37 DECAL = GL_DECAL,
38 MODULATE = GL_MODULATE,
39 BLEND = GL_BLEND,
40 REPLACE = GL_REPLACE,
41 ADD = GL_ADD
42 };
43
44 TexEnv(Mode mode=MODULATE);
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 COMPARE_StateAttribute_Parameter(parameter)
Definition StateAttribute:69
#define COMPARE_StateAttribute_Types(TYPE, rhs_attribute)
Definition StateAttribute:57
#define GL_ADD
Definition TexEnv:23
#define GL_DECAL
Definition TexEnv:25
#define GL_MODULATE
Definition TexEnv:22
Definition CopyOp:41
Definition StateAttribute:77
Definition State:80
Definition TexEnv:33
virtual int compare(const StateAttribute &sa) const
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
Definition TexEnv:55
virtual void apply(State &state) const
Mode
Definition TexEnv:36
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)
Definition TexEnv:47
Definition Vec4f:28
author: Julien Valentin 2017 (mp3butcher@hotmail.com)
Definition AlphaFunc:19
#define OSG_EXPORT
Definition osg/Export:39