openscenegraph
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),
37 _constantColor(trans._constantColor) {}
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
62 inline osg::Vec4& getConstantColor() { return _constantColor; }
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)
Definition StateAttribute:69
#define COMPARE_StateAttribute_Types(TYPE, rhs_attribute)
Definition StateAttribute:57
Definition BlendColor:27
const osg::Vec4 & getConstantColor() const
Definition BlendColor:64
BlendColor(const BlendColor &trans, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition BlendColor:35
virtual ~BlendColor()
osg::Vec4 _constantColor
Definition BlendColor:72
virtual void apply(State &state) const
META_StateAttribute(osg, BlendColor, BLENDCOLOR)
BlendColor(const osg::Vec4 &constantColor)
virtual int compare(const StateAttribute &sa) const
Definition BlendColor:42
virtual bool getModeUsage(StateAttribute::ModeUsage &usage) const
Definition BlendColor:54
osg::Vec4 & getConstantColor()
Definition BlendColor:62
void setConstantColor(const osg::Vec4 &color)
Definition BlendColor:60
Definition CopyOp:41
Definition StateAttribute:77
Definition State:80
Definition Vec4f:28
author: Julien Valentin 2017 (mp3butcher@hotmail.com)
Definition AlphaFunc:19
#define OSG_EXPORT
Definition osg/Export:39
Definition StateAttribute:308
virtual void usesMode(GLMode mode)=0