OpenSceneGraph 3.6.5
BlendColor
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_BLENDCOLOR
15#define OSG_BLENDCOLOR 1
16
17#include <osg/GL>
18#include <osg/StateAttribute>
19#include <osg/ref_ptr>
20#include <osg/Vec4>
21
22
23namespace osg {
24
27{
28 public :
29
31
32 BlendColor(const osg::Vec4& constantColor);
33
35 BlendColor(const BlendColor& trans,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
36 StateAttribute(trans,copyop),
38
40
42 virtual int compare(const StateAttribute& sa) const
43 {
44 // Check for equal types, then create the rhs variable
45 // used by the COMPARE_StateAttribute_Parameter macros below.
47
48 // Compare each parameter in turn against the rhs.
50
51 return 0; // Passed all the above comparison macros, so must be equal.
52 }
53
54 virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const
55 {
56 usage.usesMode(GL_BLEND);
57 return true;
58 }
59
60 void setConstantColor(const osg::Vec4& color) { _constantColor = color; }
61
63
64 inline const osg::Vec4& getConstantColor() const { return _constantColor; }
65
66 virtual void apply(State& state) const;
67
68 protected :
69
70 virtual ~BlendColor();
71
73};
74
75}
76
77#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
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
Vec4f Vec4
Definition Vec4:21
const osg::Vec4 & getConstantColor() const
Definition BlendColor:64
BlendColor(const BlendColor &trans, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
Definition BlendColor:35
virtual ~BlendColor()
osg::Vec4 _constantColor
Definition BlendColor:72
virtual void apply(State &state) const
apply the OpenGL state attributes.
META_StateAttribute(osg, BlendColor, BLENDCOLOR)
BlendColor(const osg::Vec4 &constantColor)
virtual int compare(const StateAttribute &sa) const
Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.
Definition BlendColor:42
virtual bool getModeUsage(StateAttribute::ModeUsage &usage) const
Return the modes associated with this StateAttribute.
Definition BlendColor:54
osg::Vec4 & getConstantColor()
Definition BlendColor:62
void setConstantColor(const osg::Vec4 &color)
Definition BlendColor:60
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
@ BLENDCOLOR
Definition StateAttribute:157
Definition StateAttribute:308
virtual void usesMode(GLMode mode)=0
#define OSG_EXPORT
Definition Export:39

osg logo
Generated at Sun Jul 20 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.