OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Hint.h
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_HINT
15 #define OSG_HINT 1
16 
17 #include <osg/StateAttribute>
18 
19 namespace osg
20 {
21 
23 {
24 public:
25 
26  Hint():
27  _target(GL_NONE),
28  _mode(GL_DONT_CARE) {}
29 
30  Hint(GLenum target, GLenum mode):
31  _target(target),
32  _mode(mode) {}
33 
35  Hint(const Hint& hint,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
36  StateAttribute(hint,copyop),
37  _target(hint._target),
38  _mode(hint._mode) {}
39 
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; }
46 
47  virtual int compare(const StateAttribute& sa) const
48  {
49  // check the types are equal and then create the rhs variable
50  // used by the COMPARE_StateAttribute_Parameter macros below.
52 
53  // compare each parameter in turn against the rhs.
56 
57  return 0;
58  }
59 
61  virtual unsigned int getMember() const { return static_cast<unsigned int>(_target); }
62 
63  void setTarget(GLenum target);
64  inline GLenum getTarget() const { return _target; }
65 
66  inline void setMode(GLenum mode) { _mode = mode; }
67  inline GLenum getMode() const { return _mode; }
68 
69  virtual void apply(State& state) const;
70 
71 protected:
72 
73 
74  GLenum _target;
75  GLenum _mode;
76 };
77 
78 
79 }
80 
81 #endif
GLenum _target
Definition: Hint.h:74
#define OSG_EXPORT
Definition: Export.h:43
Definition: Hint.h:22
#define NULL
Definition: Export.h:59
#define COMPARE_StateAttribute_Types(TYPE, rhs_attribute)
void setMode(GLenum mode)
Definition: Hint.h:66
GLenum _mode
Definition: Hint.h:75
Hint(GLenum target, GLenum mode)
Definition: Hint.h:30
virtual Type getType() const
Definition: Hint.h:45
virtual unsigned int getMember() const
Definition: Hint.h:61
GLenum getTarget() const
Definition: Hint.h:64
virtual bool isSameKindAs(const osg::Object *obj) const
Definition: Hint.h:42
virtual osg::Object * clone(const osg::CopyOp &copyop) const
Definition: Hint.h:41
#define GL_NONE
Definition: GL.h:172
virtual osg::Object * cloneType() const
Definition: Hint.h:40
Hint(const Hint &hint, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition: Hint.h:35
Definition: AlphaFunc.h:19
#define COMPARE_StateAttribute_Parameter(parameter)
virtual const char * libraryName() const
Definition: Hint.h:43
Hint()
Definition: Hint.h:26
GLenum getMode() const
Definition: Hint.h:67
virtual const char * className() const
Definition: Hint.h:44
virtual int compare(const StateAttribute &sa) const
Definition: Hint.h:47