1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 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.
17#include <osg/StateAttribute>
22class OSG_EXPORT Hint : public StateAttribute
28 _mode(GL_DONT_CARE) {}
30 Hint(GLenum target, GLenum mode):
34 /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
35 Hint(const Hint& hint,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
36 StateAttribute(hint,copyop),
37 _target(hint._target),
40 virtual osg::Object* cloneType() const { return new Hint( _target, GL_DONT_CARE ); }
41 virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new Hint(*this,copyop); }
42 virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const Hint *>(obj)!=NULL; }
43 virtual const char* libraryName() const { return "osg"; }
44 virtual const char* className() const { return "Hint"; }
45 virtual Type getType() const { return HINT; }
47 virtual int compare(const StateAttribute& sa) const
49 // check the types are equal and then create the rhs variable
50 // used by the COMPARE_StateAttribute_Parameter macros below.
51 COMPARE_StateAttribute_Types(Hint,sa)
53 // compare each parameter in turn against the rhs.
54 COMPARE_StateAttribute_Parameter(_target)
55 COMPARE_StateAttribute_Parameter(_mode)
60 /** Return the member identifier within the attribute's class type. Used for light number/clip plane number etc.*/
61 virtual unsigned int getMember() const { return static_cast<unsigned int>(_target); }
63 void setTarget(GLenum target);
64 inline GLenum getTarget() const { return _target; }
66 inline void setMode(GLenum mode) { _mode = mode; }
67 inline GLenum getMode() const { return _mode; }
69 virtual void apply(State& state) const;