2006-07-18 23:21:48 +08:00
|
|
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
2003-01-22 00:45:36 +08:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2002-05-09 18:31:03 +08:00
|
|
|
|
2006-10-06 17:54:45 +08:00
|
|
|
#ifndef OSGGA_STATESTATE_MANIPULATOR
|
|
|
|
#define OSGGA_STATESTATE_MANIPULATOR 1
|
2002-05-09 18:31:03 +08:00
|
|
|
|
|
|
|
#include <osgGA/Export>
|
|
|
|
#include <osgGA/GUIEventAdapter>
|
|
|
|
#include <osgGA/GUIActionAdapter>
|
|
|
|
#include <osgGA/GUIEventHandler>
|
|
|
|
|
2002-05-22 16:50:05 +08:00
|
|
|
#include <osg/StateSet>
|
2006-10-02 03:19:31 +08:00
|
|
|
#include <osg/PolygonMode>
|
|
|
|
|
2002-05-22 16:50:05 +08:00
|
|
|
|
2002-05-09 18:31:03 +08:00
|
|
|
namespace osgGA{
|
|
|
|
|
2002-08-28 22:27:18 +08:00
|
|
|
/**
|
|
|
|
Experimental class, not been looked at for a while, but which will
|
|
|
|
be returned to at some point :-\
|
|
|
|
*/
|
2002-05-09 18:31:03 +08:00
|
|
|
class OSGGA_EXPORT StateSetManipulator : public GUIEventHandler
|
|
|
|
{
|
2002-08-28 22:27:18 +08:00
|
|
|
public:
|
2002-05-09 18:31:03 +08:00
|
|
|
|
2007-01-24 00:26:15 +08:00
|
|
|
StateSetManipulator(osg::StateSet* stateset=0);
|
2002-05-09 18:31:03 +08:00
|
|
|
|
2004-02-05 20:11:06 +08:00
|
|
|
virtual const char* className() const { return "StateSetManipulator"; }
|
2003-02-19 18:43:02 +08:00
|
|
|
|
2006-10-06 17:54:45 +08:00
|
|
|
/** attach a STATESTATE to the manipulator to be used for specifying view.*/
|
2002-08-28 22:27:18 +08:00
|
|
|
virtual void setStateSet(osg::StateSet*);
|
2002-05-09 18:31:03 +08:00
|
|
|
|
2006-10-06 17:54:45 +08:00
|
|
|
/** get the attached a STATESTATE.*/
|
2002-08-28 22:27:18 +08:00
|
|
|
virtual osg::StateSet * getStateSet();
|
2002-05-09 18:31:03 +08:00
|
|
|
|
2006-10-06 17:54:45 +08:00
|
|
|
/** get the attached a STATESTATE.*/
|
2002-08-28 22:27:18 +08:00
|
|
|
virtual const osg::StateSet * getStateSet() const;
|
2002-05-09 18:31:03 +08:00
|
|
|
|
2002-08-28 22:27:18 +08:00
|
|
|
/** Handle events, return true if handled, false otherwise.*/
|
|
|
|
virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& us);
|
2002-05-09 18:31:03 +08:00
|
|
|
|
2003-02-19 18:43:02 +08:00
|
|
|
/** Get the keyboard and mouse usage of this manipulator.*/
|
|
|
|
virtual void getUsage(osg::ApplicationUsage& usage) const;
|
2005-11-11 22:22:57 +08:00
|
|
|
|
|
|
|
void setMaximumNumOfTextureUnits(unsigned int i) { _maxNumOfTextureUnits = i; }
|
|
|
|
unsigned int getMaximumNumOfTextureUnits() const { return _maxNumOfTextureUnits; }
|
2006-10-02 03:19:31 +08:00
|
|
|
|
|
|
|
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();
|
2003-02-19 18:43:02 +08:00
|
|
|
|
2002-08-28 22:27:18 +08:00
|
|
|
protected:
|
2002-05-09 18:31:03 +08:00
|
|
|
|
2007-01-24 00:26:15 +08:00
|
|
|
virtual ~StateSetManipulator();
|
|
|
|
|
|
|
|
osg::ref_ptr<osg::StateSet> _stateset;
|
2002-05-09 18:31:03 +08:00
|
|
|
|
2007-01-24 00:26:15 +08:00
|
|
|
bool _initialized;
|
2002-05-09 18:31:03 +08:00
|
|
|
bool _backface;
|
|
|
|
bool _lighting;
|
|
|
|
bool _texture;
|
2005-11-11 22:22:57 +08:00
|
|
|
unsigned int _maxNumOfTextureUnits;
|
2006-10-02 03:19:31 +08:00
|
|
|
|
|
|
|
osg::PolygonMode* getOrCreatePolygonMode();
|
2002-05-09 18:31:03 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|