BlendEquationi 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2014 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. #ifndef OSG_BLENDEQUATIONI
  14. #define OSG_BLENDEQUATIONI 1
  15. #include <osg/BlendEquation>
  16. namespace osg {
  17. /** Encapsulates glBlendEquationi function : the index version of glBlendEquation for multiple render target.
  18. */
  19. class OSG_EXPORT BlendEquationi : public BlendEquation
  20. {
  21. public :
  22. BlendEquationi();
  23. BlendEquationi(unsigned int buf, Equation equation):
  24. BlendEquation(equation),
  25. _index(buf) {}
  26. BlendEquationi(unsigned int buf, Equation equationRGB, Equation equationAlpha):
  27. BlendEquation(equationRGB, equationAlpha),
  28. _index(buf) {}
  29. /** Copy constructor using CopyOp to manage deep vs shallow copy. */
  30. BlendEquationi(const BlendEquationi& cm,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
  31. BlendEquation(cm,copyop),
  32. _index(cm._index) {}
  33. META_StateAttribute(osg, BlendEquationi, BLENDEQUATION);
  34. /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
  35. virtual int compare(const StateAttribute& sa) const
  36. {
  37. // Check for equal types, then create the rhs variable
  38. // used by the COMPARE_StateAttribute_Parameter macros below.
  39. COMPARE_StateAttribute_Types(BlendEquationi,sa)
  40. COMPARE_StateAttribute_Parameter(_index);
  41. return BlendEquation::compare(sa);
  42. }
  43. /** Return the buffer index as the member identifier.*/
  44. virtual unsigned int getMember() const { return _index; }
  45. /** Set the renderbuffer index of the BlendEquationi. */
  46. void setIndex(unsigned int buf);
  47. /** Get the renderbuffer index of the BlendEquationi. */
  48. unsigned int getIndex() const { return _index; }
  49. virtual void apply(State& state) const;
  50. protected:
  51. virtual ~BlendEquationi();
  52. unsigned int _index;
  53. };
  54. }
  55. #endif