OpenSceneGraph 3.6.5
AlphaFunc
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_ALPHAFUNC
15#define OSG_ALPHAFUNC 1
16
17#include <osg/StateAttribute>
18
19namespace osg {
20
24{
25 public :
26
28 NEVER = GL_NEVER,
29 LESS = GL_LESS,
30 EQUAL = GL_EQUAL,
31 LEQUAL = GL_LEQUAL,
32 GREATER = GL_GREATER,
33 NOTEQUAL = GL_NOTEQUAL,
34 GEQUAL = GL_GEQUAL,
35 ALWAYS = GL_ALWAYS
36 };
37
38
40
44
50
52
54 virtual int compare(const StateAttribute& sa) const
55 {
56 // Check for equal types, then create the rhs variable
57 // used by the COMPARE_StateAttribute_Parameter macros below.
59
60 // Compare each parameter in turn against the rhs.
63
64 return 0; // Passed all the above comparison macros, so must be equal.
65 }
66
67 virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const
68 {
70 return true;
71 }
72
73 inline void setFunction(ComparisonFunction func,float ref)
74 {
75 _comparisonFunc = func;
77 }
78
81
82 inline void setReferenceValue(float value) { _referenceValue=value; }
83 inline float getReferenceValue() const { return _referenceValue; }
84
85 virtual void apply(State& state) const;
86
87 protected:
88
89 virtual ~AlphaFunc();
90
93
94};
95
96}
97
98#endif
#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
#define GL_ALPHA_TEST
Definition GLDefines:674
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
AlphaFunc(const AlphaFunc &af, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
Definition AlphaFunc:46
virtual int compare(const StateAttribute &sa) const
Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.
Definition AlphaFunc:54
virtual bool getModeUsage(StateAttribute::ModeUsage &usage) const
Return the modes associated with this StateAttribute.
Definition AlphaFunc:67
ComparisonFunction _comparisonFunc
Definition AlphaFunc:91
virtual ~AlphaFunc()
ComparisonFunction
Definition AlphaFunc:27
@ LEQUAL
Definition AlphaFunc:31
@ GEQUAL
Definition AlphaFunc:34
@ NOTEQUAL
Definition AlphaFunc:33
@ ALWAYS
Definition AlphaFunc:35
@ NEVER
Definition AlphaFunc:28
@ EQUAL
Definition AlphaFunc:30
@ GREATER
Definition AlphaFunc:32
@ LESS
Definition AlphaFunc:29
virtual void apply(State &state) const
apply the OpenGL state attributes.
void setReferenceValue(float value)
Definition AlphaFunc:82
void setFunction(ComparisonFunction func)
Definition AlphaFunc:79
float _referenceValue
Definition AlphaFunc:92
ComparisonFunction getFunction() const
Definition AlphaFunc:80
void setFunction(ComparisonFunction func, float ref)
Definition AlphaFunc:73
float getReferenceValue() const
Definition AlphaFunc:83
META_StateAttribute(osg, AlphaFunc, ALPHAFUNC)
AlphaFunc(ComparisonFunction func, float ref)
Definition AlphaFunc:41
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
int ref() const
Increment the reference count by one, indicating that this object has another pointer which is refere...
Definition Referenced:161
Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,...
Definition State:80
@ ALPHAFUNC
Definition StateAttribute:130
Definition StateAttribute:308
virtual void usesMode(GLMode mode)=0
#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.