1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2014 Robert Osfield
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.
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.
15#define OSG_BLENDFUNCI 1
17#include <osg/BlendFunc>
21/** Encapsulates glBlendFunci function : the index version of glBlendEquation for multiple render target.
23class OSG_EXPORT BlendFunci : public BlendFunc
29 BlendFunci(unsigned int buf, GLenum source, GLenum destination):
30 BlendFunc(source, destination),
33 BlendFunci(unsigned int buf, GLenum source, GLenum destination, GLenum source_alpha, GLenum destination_alpha):
34 BlendFunc(source, destination, source_alpha, destination_alpha),
37 /** Copy constructor using CopyOp to manage deep vs shallow copy. */
38 BlendFunci(const BlendFunci& cm,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
42 META_StateAttribute(osg, BlendFunci, BLENDFUNC);
44 /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
45 virtual int compare(const StateAttribute& sa) const
47 // Check for equal types, then create the rhs variable
48 // used by the COMPARE_StateAttribute_Parameter macros below.
49 COMPARE_StateAttribute_Types(BlendFunci,sa)
51 COMPARE_StateAttribute_Parameter(_index);
53 return BlendFunc::compare(sa);
56 /** Return the buffer index as the member identifier.*/
57 virtual unsigned int getMember() const { return _index; }
59 /** Set the renderbuffer index of the BlendFunci. */
60 void setIndex(unsigned int buf);
62 /** Get the renderbuffer index of the BlendFunci. */
63 unsigned int getIndex() const { return _index; }
65 virtual void apply(State& state) const;
69 virtual ~BlendFunci();