openscenegraph
StateSetManipulator
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 OSGGA_STATESET_MANIPULATOR
15#define OSGGA_STATESET_MANIPULATOR 1
16
17#include <osgGA/Export>
18#include <osgGA/GUIEventAdapter>
20#include <osgGA/GUIEventHandler>
21
22#include <osg/StateSet>
23#include <osg/PolygonMode>
24
25
26namespace osgGA {
27
33{
34public:
35
37
38 virtual const char* className() const { return "StateSetManipulator"; }
39
41 virtual void setStateSet(osg::StateSet*);
42
45
47 virtual const osg::StateSet * getStateSet() const;
48
49
51 virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& us);
52
54 virtual void getUsage(osg::ApplicationUsage& usage) const;
55
56 void setMaximumNumOfTextureUnits(unsigned int i) { _maxNumOfTextureUnits = i; }
57 unsigned int getMaximumNumOfTextureUnits() const { return _maxNumOfTextureUnits; }
58
59 void setBackfaceEnabled(bool newbackface);
60 bool getBackfaceEnabled() const {return _backface;};
61
62 void setLightingEnabled(bool newlighting);
63 bool getLightingEnabled() const {return _lighting;};
64
65 void setTextureEnabled(bool newtexture);
66 bool getTextureEnabled() const {return _texture;};
67
70
72
73
74 void setKeyEventToggleBackfaceCulling(int key) { _keyEventToggleBackfaceCulling = key; }
75 int getKeyEventToggleBackfaceCulling() const { return _keyEventToggleBackfaceCulling; }
76
77 void setKeyEventToggleLighting(int key) { _keyEventToggleLighting = key; }
78 int getKeyEventToggleLighting() const { return _keyEventToggleLighting; }
79
80 void setKeyEventToggleTexturing(int key) { _keyEventToggleTexturing = key; }
81 int getKeyEventToggleTexturing() const { return _keyEventToggleTexturing; }
82
83 void setKeyEventCyclePolygonMode(int key) { _keyEventCyclePolygonMode = key; }
84 int getKeyEventCyclePolygonMode() const { return _keyEventCyclePolygonMode; }
85
86protected:
87
89
90 void clone();
91
93
99
104
106};
107
108}
109
110#endif
Definition GUIActionAdapter:62
Definition GUIEventAdapter:82
Definition GUIEventHandler:50
Definition StateSetManipulator:33
void setKeyEventToggleTexturing(int key)
Definition StateSetManipulator:80
void setKeyEventCyclePolygonMode(int key)
Definition StateSetManipulator:83
int getKeyEventCyclePolygonMode() const
Definition StateSetManipulator:84
bool getLightingEnabled() const
Definition StateSetManipulator:63
virtual const osg::StateSet * getStateSet() const
int _keyEventCyclePolygonMode
Definition StateSetManipulator:103
virtual void getUsage(osg::ApplicationUsage &usage) const
void setBackfaceEnabled(bool newbackface)
void setKeyEventToggleLighting(int key)
Definition StateSetManipulator:77
StateSetManipulator(osg::StateSet *stateset=0)
void setMaximumNumOfTextureUnits(unsigned int i)
Definition StateSetManipulator:56
osg::ref_ptr< osg::StateSet > _stateset
Definition StateSetManipulator:92
virtual const char * className() const
Definition StateSetManipulator:38
bool _initialized
Definition StateSetManipulator:94
int getKeyEventToggleTexturing() const
Definition StateSetManipulator:81
void setTextureEnabled(bool newtexture)
void setPolygonMode(osg::PolygonMode::Mode newpolygonmode)
bool _lighting
Definition StateSetManipulator:96
void setLightingEnabled(bool newlighting)
unsigned int getMaximumNumOfTextureUnits() const
Definition StateSetManipulator:57
void setKeyEventToggleBackfaceCulling(int key)
Definition StateSetManipulator:74
bool getBackfaceEnabled() const
Definition StateSetManipulator:60
virtual bool handle(const GUIEventAdapter &ea, GUIActionAdapter &us)
bool getTextureEnabled() const
Definition StateSetManipulator:66
unsigned int _maxNumOfTextureUnits
Definition StateSetManipulator:98
virtual osg::StateSet * getStateSet()
osg::PolygonMode * getOrCreatePolygonMode()
int getKeyEventToggleLighting() const
Definition StateSetManipulator:78
bool _backface
Definition StateSetManipulator:95
int _keyEventToggleBackfaceCulling
Definition StateSetManipulator:100
virtual void setStateSet(osg::StateSet *)
osg::PolygonMode::Mode getPolygonMode() const
bool _texture
Definition StateSetManipulator:97
int _keyEventToggleLighting
Definition StateSetManipulator:101
int getKeyEventToggleBackfaceCulling() const
Definition StateSetManipulator:75
int _keyEventToggleTexturing
Definition StateSetManipulator:102
Definition ApplicationUsage:26
Definition PolygonMode:31
Mode
Definition PolygonMode:34
Definition StateSet:46
Definition ref_ptr:32
Definition Callback:21
#define OSGGA_EXPORT
Definition osgGA/Export:40