OpenSceneGraph 3.6.5
Hint
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
19namespace osg
20{
21
23{
24public:
25
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
71protected:
72
73
74 GLenum _target;
75 GLenum _mode;
76};
77
78
79}
80
81#endif
#define COMPARE_StateAttribute_Parameter(parameter)
COMPARE_StateAttribute_Parameter macro is a helper for implementing the StatateAtribute::compare(....
Definition StateAttribute:69
#define COMPARE_StateAttribute_Types(TYPE, rhs_attribute)
COMPARE_StateAttribute_Types macro is a helper for implementing the StateAtribute::compare(....
Definition StateAttribute:57
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
void setTarget(GLenum target)
virtual const char * className() const
Return the name of the attribute's class type.
Definition Hint:44
Hint(const Hint &hint, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
Definition Hint:35
virtual unsigned int getMember() const
Return the member identifier within the attribute's class type.
Definition Hint:61
GLenum getMode() const
Definition Hint:67
virtual int compare(const StateAttribute &sa) const
Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.
Definition Hint:47
Hint()
Definition Hint:26
GLenum getTarget() const
Definition Hint:64
GLenum _target
Definition Hint:74
Hint(GLenum target, GLenum mode)
Definition Hint:30
virtual bool isSameKindAs(const osg::Object *obj) const
Return true if this and obj are of the same kind of object.
Definition Hint:42
GLenum _mode
Definition Hint:75
void setMode(GLenum mode)
Definition Hint:66
virtual void apply(State &state) const
apply the OpenGL state attributes.
virtual osg::Object * clone(const osg::CopyOp &copyop) const
Clone an attribute, with Object* return type.
Definition Hint:41
virtual osg::Object * cloneType() const
Clone the type of an attribute, with Object* return type.
Definition Hint:40
virtual const char * libraryName() const
Return the name of the attribute's library.
Definition Hint:43
virtual Type getType() const
Return the Type identifier of the attribute's class type.
Definition Hint:45
Base class/standard interface for objects which require IO support, cloning and reference counting.
Definition Object:61
Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,...
Definition State:80
Type
Type identifier to differentiate between different state types.
Definition StateAttribute:124
@ HINT
Definition StateAttribute:166
#define NULL
Definition Export:55
#define OSG_EXPORT
Definition Export:39

osg logo
Generated at Sun Jul 27 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.