StateSetManipulator
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGGA_STATESET_MANIPULATOR
#define OSGGA_STATESET_MANIPULATOR 1
#include <osgGA/Export>
#include <osgGA/GUIEventAdapter>
#include <osgGA/GUIActionAdapter>
#include <osgGA/GUIEventHandler>
#include <osg/StateSet>
#include <osg/PolygonMode>
namespace osgGA {
class OSGGA_EXPORT StateSetManipulator : public GUIEventHandler
{
public:
StateSetManipulator(osg::StateSet* stateset=0);
virtual const char* className() const { return "StateSetManipulator"; }
virtual void setStateSet(osg::StateSet*);
virtual osg::StateSet * getStateSet();
virtual const osg::StateSet * getStateSet() const;
virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& us);
virtual void getUsage(osg::ApplicationUsage& usage) const;
void setMaximumNumOfTextureUnits(unsigned int i) { _maxNumOfTextureUnits = i; }
unsigned int getMaximumNumOfTextureUnits() const { return _maxNumOfTextureUnits; }
void setBackfaceEnabled(bool newbackface);
bool getBackfaceEnabled() const {return _backface;};
void setLightingEnabled(bool newlighting);
bool getLightingEnabled() const {return _lighting;};
void setTextureEnabled(bool newtexture);
bool getTextureEnabled() const {return _texture;};
void setPolygonMode(osg::PolygonMode::Mode newpolygonmode);
osg::PolygonMode::Mode getPolygonMode() const;
void cyclePolygonMode();
void setKeyEventToggleBackfaceCulling(int key) { _keyEventToggleBackfaceCulling = key; }
int getKeyEventToggleBackfaceCulling() const { return _keyEventToggleBackfaceCulling; }
void setKeyEventToggleLighting(int key) { _keyEventToggleLighting = key; }
int getKeyEventToggleLighting() const { return _keyEventToggleLighting; }
void setKeyEventToggleTexturing(int key) { _keyEventToggleTexturing = key; }
int getKeyEventToggleTexturing() const { return _keyEventToggleTexturing; }
void setKeyEventCyclePolygonMode(int key) { _keyEventCyclePolygonMode = key; }
int getKeyEventCyclePolygonMode() const { return _keyEventCyclePolygonMode; }
protected:
virtual ~StateSetManipulator();
void clone();
osg::ref_ptr<osg::StateSet> _stateset;
bool _initialized;
bool _backface;
bool _lighting;
bool _texture;
unsigned int _maxNumOfTextureUnits;
int _keyEventToggleBackfaceCulling;
int _keyEventToggleLighting;
int _keyEventToggleTexturing;
int _keyEventCyclePolygonMode;
osg::PolygonMode* getOrCreatePolygonMode();
};
}
#endif
GUIActionAdapter
GUIEventAdapter
GUIEventHandler
PolygonMode
StateSet
osgGA::GUIActionAdapter
Definition GUIActionAdapter:62
osgGA::GUIEventAdapter
Definition GUIEventAdapter:82
osgGA::GUIEventHandler::GUIEventHandler
GUIEventHandler()
Definition GUIEventHandler:53
osgGA::StateSetManipulator::setKeyEventToggleTexturing
void setKeyEventToggleTexturing(int key)
Definition StateSetManipulator:80
osgGA::StateSetManipulator::setKeyEventCyclePolygonMode
void setKeyEventCyclePolygonMode(int key)
Definition StateSetManipulator:83
osgGA::StateSetManipulator::getKeyEventCyclePolygonMode
int getKeyEventCyclePolygonMode() const
Definition StateSetManipulator:84
osgGA::StateSetManipulator::cyclePolygonMode
void cyclePolygonMode()
osgGA::StateSetManipulator::getLightingEnabled
bool getLightingEnabled() const
Definition StateSetManipulator:63
osgGA::StateSetManipulator::getStateSet
virtual const osg::StateSet * getStateSet() const
osgGA::StateSetManipulator::_keyEventCyclePolygonMode
int _keyEventCyclePolygonMode
Definition StateSetManipulator:103
osgGA::StateSetManipulator::getUsage
virtual void getUsage(osg::ApplicationUsage &usage) const
osgGA::StateSetManipulator::setBackfaceEnabled
void setBackfaceEnabled(bool newbackface)
osgGA::StateSetManipulator::setKeyEventToggleLighting
void setKeyEventToggleLighting(int key)
Definition StateSetManipulator:77
osgGA::StateSetManipulator::StateSetManipulator
StateSetManipulator(osg::StateSet *stateset=0)
osgGA::StateSetManipulator::setMaximumNumOfTextureUnits
void setMaximumNumOfTextureUnits(unsigned int i)
Definition StateSetManipulator:56
osgGA::StateSetManipulator::_stateset
osg::ref_ptr< osg::StateSet > _stateset
Definition StateSetManipulator:92
osgGA::StateSetManipulator::className
virtual const char * className() const
Definition StateSetManipulator:38
osgGA::StateSetManipulator::_initialized
bool _initialized
Definition StateSetManipulator:94
osgGA::StateSetManipulator::getKeyEventToggleTexturing
int getKeyEventToggleTexturing() const
Definition StateSetManipulator:81
osgGA::StateSetManipulator::setTextureEnabled
void setTextureEnabled(bool newtexture)
osgGA::StateSetManipulator::setPolygonMode
void setPolygonMode(osg::PolygonMode::Mode newpolygonmode)
osgGA::StateSetManipulator::_lighting
bool _lighting
Definition StateSetManipulator:96
osgGA::StateSetManipulator::setLightingEnabled
void setLightingEnabled(bool newlighting)
osgGA::StateSetManipulator::getMaximumNumOfTextureUnits
unsigned int getMaximumNumOfTextureUnits() const
Definition StateSetManipulator:57
osgGA::StateSetManipulator::setKeyEventToggleBackfaceCulling
void setKeyEventToggleBackfaceCulling(int key)
Definition StateSetManipulator:74
osgGA::StateSetManipulator::getBackfaceEnabled
bool getBackfaceEnabled() const
Definition StateSetManipulator:60
osgGA::StateSetManipulator::handle
virtual bool handle(const GUIEventAdapter &ea, GUIActionAdapter &us)
osgGA::StateSetManipulator::getTextureEnabled
bool getTextureEnabled() const
Definition StateSetManipulator:66
osgGA::StateSetManipulator::_maxNumOfTextureUnits
unsigned int _maxNumOfTextureUnits
Definition StateSetManipulator:98
osgGA::StateSetManipulator::getStateSet
virtual osg::StateSet * getStateSet()
osgGA::StateSetManipulator::getOrCreatePolygonMode
osg::PolygonMode * getOrCreatePolygonMode()
osgGA::StateSetManipulator::getKeyEventToggleLighting
int getKeyEventToggleLighting() const
Definition StateSetManipulator:78
osgGA::StateSetManipulator::clone
void clone()
osgGA::StateSetManipulator::~StateSetManipulator
virtual ~StateSetManipulator()
osgGA::StateSetManipulator::_backface
bool _backface
Definition StateSetManipulator:95
osgGA::StateSetManipulator::_keyEventToggleBackfaceCulling
int _keyEventToggleBackfaceCulling
Definition StateSetManipulator:100
osgGA::StateSetManipulator::setStateSet
virtual void setStateSet(osg::StateSet *)
osgGA::StateSetManipulator::getPolygonMode
osg::PolygonMode::Mode getPolygonMode() const
osgGA::StateSetManipulator::_texture
bool _texture
Definition StateSetManipulator:97
osgGA::StateSetManipulator::_keyEventToggleLighting
int _keyEventToggleLighting
Definition StateSetManipulator:101
osgGA::StateSetManipulator::getKeyEventToggleBackfaceCulling
int getKeyEventToggleBackfaceCulling() const
Definition StateSetManipulator:75
osgGA::StateSetManipulator::_keyEventToggleTexturing
int _keyEventToggleTexturing
Definition StateSetManipulator:102
osg::ApplicationUsage
Definition ApplicationUsage:26
osg::PolygonMode
Definition PolygonMode:31
osg::PolygonMode::Mode
Mode
Definition PolygonMode:34
osg::StateSet
Definition StateSet:46
osg::ref_ptr
Definition ref_ptr:32
osgGA
Definition Callback:21
Export
OSGGA_EXPORT
#define OSGGA_EXPORT
Definition osgGA/Export:40