Initial revision
This commit is contained in:
45
include/osg/Switch
Normal file
45
include/osg/Switch
Normal file
@@ -0,0 +1,45 @@
|
||||
#ifndef OSG_SWITCH
|
||||
#define OSG_SWITCH 1
|
||||
|
||||
#include <osg/Group>
|
||||
|
||||
namespace osg {
|
||||
|
||||
/** Switch - Group node which allows switching between children.
|
||||
Typical uses would be for objects which might need to be rendered
|
||||
differently at different times, for instance a switch could be used
|
||||
to represent the different states of a traffic light.
|
||||
*/
|
||||
class SG_EXPORT Switch : public Group
|
||||
{
|
||||
public :
|
||||
|
||||
enum SwitchType {
|
||||
ALL_CHILDREN_ON=-1,
|
||||
ALL_CHILDREN_OFF=-2
|
||||
};
|
||||
|
||||
Switch();
|
||||
|
||||
virtual Object* clone() const { return new Switch(); }
|
||||
virtual bool isSameKindAs(Object* obj) { return dynamic_cast<Switch*>(obj)!=NULL; }
|
||||
virtual const char* className() const { return "Switch"; }
|
||||
virtual void accept(NodeVisitor& nv) { nv.apply(*this); }
|
||||
virtual void traverse(NodeVisitor& nv);
|
||||
|
||||
void setVal(int val) { _value = val; }
|
||||
int getVal() const { return _value; }
|
||||
|
||||
protected :
|
||||
|
||||
virtual ~Switch() {}
|
||||
|
||||
virtual bool readLocalData(Input& fr);
|
||||
virtual bool writeLocalData(Output& fw);
|
||||
|
||||
int _value;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user