Moved old osgPresentation source files to osgPresentation/deprecated subdirectory.

This commit is contained in:
Robert Osfield
2013-08-18 18:10:39 +00:00
parent 28ce02915a
commit 4e3715d4bb
24 changed files with 250 additions and 250 deletions

View File

@@ -0,0 +1,173 @@
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
*
* This software is open source and may be redistributed and/or modified under
* the terms of the GNU General Public License (GPL) version 2.0.
* The full license is in LICENSE.txt file included with this distribution,.
*
* This software 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
* include LICENSE.txt for more details.
*/
#ifndef OSG_ANIMATIONMATERIAL
#define OSG_ANIMATIONMATERIAL 1
#include <osg/Material>
#include <osg/NodeCallback>
#include <osgPresentation/Export>
#include <iosfwd>
#include <map>
#include <float.h>
namespace osgPresentation {
/** AnimationMaterial for specify the time varying transformation pathway to use when update camera and model objects.
* Subclassed from Transform::ComputeTransformCallback allows AnimationMaterial to
* be attached directly to Transform nodes to move subgraphs around the scene.
*/
class OSGPRESENTATION_EXPORT AnimationMaterial : public virtual osg::Object
{
public:
AnimationMaterial():_loopMode(LOOP) {}
AnimationMaterial(const AnimationMaterial& ap, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
Object(ap,copyop),
_timeControlPointMap(ap._timeControlPointMap),
_loopMode(ap._loopMode) {}
META_Object(osg,AnimationMaterial);
/** get the transformation matrix for a point in time.*/
bool getMaterial(double time,osg::Material& material) const;
void insert(double time,osg::Material* material);
double getFirstTime() const { if (!_timeControlPointMap.empty()) return _timeControlPointMap.begin()->first; else return 0.0;}
double getLastTime() const { if (!_timeControlPointMap.empty()) return _timeControlPointMap.rbegin()->first; else return 0.0;}
double getPeriod() const { return getLastTime()-getFirstTime();}
enum LoopMode
{
SWING,
LOOP,
NO_LOOPING
};
void setLoopMode(LoopMode lm) { _loopMode = lm; }
LoopMode getLoopMode() const { return _loopMode; }
typedef std::map<double, osg::ref_ptr<osg::Material> > TimeControlPointMap;
TimeControlPointMap& getTimeControlPointMap() { return _timeControlPointMap; }
const TimeControlPointMap& getTimeControlPointMap() const { return _timeControlPointMap; }
/** read the anumation path from a flat ascii file stream.*/
void read(std::istream& in);
/** write the anumation path to a flat ascii file stream.*/
void write(std::ostream& out) const;
bool requiresBlending() const;
protected:
virtual ~AnimationMaterial() {}
void interpolate(osg::Material& material, float r, const osg::Material& lhs,const osg::Material& rhs) const;
TimeControlPointMap _timeControlPointMap;
LoopMode _loopMode;
};
class OSGPRESENTATION_EXPORT AnimationMaterialCallback : public osg::NodeCallback
{
public:
AnimationMaterialCallback():
_timeOffset(0.0),
_timeMultiplier(1.0),
_firstTime(DBL_MAX),
_latestTime(0.0),
_pause(false),
_pauseTime(0.0) {}
AnimationMaterialCallback(const AnimationMaterialCallback& apc,const osg::CopyOp& copyop):
osg::NodeCallback(apc,copyop),
_animationMaterial(apc._animationMaterial),
_useInverseMatrix(apc._useInverseMatrix),
_timeOffset(apc._timeOffset),
_timeMultiplier(apc._timeMultiplier),
_firstTime(apc._firstTime),
_latestTime(apc._latestTime),
_pause(apc._pause),
_pauseTime(apc._pauseTime) {}
META_Object(osg,AnimationMaterialCallback);
AnimationMaterialCallback(AnimationMaterial* ap,double timeOffset=0.0f,double timeMultiplier=1.0f):
_animationMaterial(ap),
_useInverseMatrix(false),
_timeOffset(timeOffset),
_timeMultiplier(timeMultiplier),
_firstTime(DBL_MAX),
_latestTime(0.0),
_pause(false),
_pauseTime(0.0) {}
void setAnimationMaterial(AnimationMaterial* path) { _animationMaterial = path; }
AnimationMaterial* getAnimationMaterial() { return _animationMaterial.get(); }
const AnimationMaterial* getAnimationMaterial() const { return _animationMaterial.get(); }
void setTimeOffset(double offset) { _timeOffset = offset; }
double getTimeOffset() const { return _timeOffset; }
void setTimeMultiplier(double multiplier) { _timeMultiplier = multiplier; }
double getTimeMultiplier() const { return _timeMultiplier; }
void reset();
void setPause(bool pause);
/** get the animation time that is used to specify the position along the AnimationMaterial.
* Animation time is computed from the formula ((_latestTime-_firstTime)-_timeOffset)*_timeMultiplier.*/
double getAnimationTime() const;
/** implements the callback*/
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv);
void update(osg::Node& node);
public:
osg::ref_ptr<AnimationMaterial> _animationMaterial;
bool _useInverseMatrix;
double _timeOffset;
double _timeMultiplier;
double _firstTime;
double _latestTime;
bool _pause;
double _pauseTime;
protected:
~AnimationMaterialCallback(){}
};
}
#endif

View File

@@ -0,0 +1,45 @@
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
*
* This software is open source and may be redistributed and/or modified under
* the terms of the GNU General Public License (GPL) version 2.0.
* The full license is in LICENSE.txt file included with this distribution,.
*
* This software 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
* include LICENSE.txt for more details.
*/
#ifndef OSG_COMPILESLIDECALLBACK
#define OSG_COMPILESLIDECALLBACK 1
#include <osgViewer/Viewer>
#include <osgPresentation/Export>
namespace osgPresentation {
class OSGPRESENTATION_EXPORT CompileSlideCallback : public osg::Camera::DrawCallback
{
public:
CompileSlideCallback():
_needCompile(false),
_frameNumber(0) {}
virtual void operator()(const osg::Camera& camera) const;
void needCompile(osg::Node* node) { _needCompile=true; _sceneToCompile = node; }
protected:
virtual ~CompileSlideCallback() {}
mutable bool _needCompile;
mutable unsigned int _frameNumber;
osg::ref_ptr<osg::Node> _sceneToCompile;
};
}
#endif

View File

@@ -0,0 +1,68 @@
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
*
* This software is open source and may be redistributed and/or modified under
* the terms of the GNU General Public License (GPL) version 2.0.
* The full license is in LICENSE.txt file included with this distribution,.
*
* This software 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
* include LICENSE.txt for more details.
*/
#ifndef KEYEVENTHANDLER
#define KEYEVENTHANDLER 1
#include <osg/StateSet>
#include <osg/Point>
#include <osgGA/GUIEventHandler>
#include <osgPresentation/deprecated/SlideEventHandler>
namespace osgPresentation
{
class OSGPRESENTATION_EXPORT KeyEventHandler : public osgGA::GUIEventHandler
{
public:
KeyEventHandler(int key, osgPresentation::Operation operation, const JumpData& jumpData=JumpData());
KeyEventHandler(int key, const std::string& str, osgPresentation::Operation operation, const JumpData& jumpData=JumpData());
KeyEventHandler(int key, const osgPresentation::KeyPosition& keyPos, const JumpData& jumpData=JumpData());
void setKey(int key) { _key = key; }
int getKey() const { return _key; }
void setOperation(osgPresentation::Operation operation) { _operation = operation; }
osgPresentation::Operation getOperation() const { return _operation; }
void setCommand(const std::string& str) { _command = str; }
const std::string& getCommand() const { return _command; }
void setKeyPosition(const osgPresentation::KeyPosition& keyPos) { _keyPos = keyPos; }
const osgPresentation::KeyPosition& getKeyPosition() const { return _keyPos; }
void setJumpData(const JumpData& jumpData) { _jumpData = jumpData; }
const JumpData& getJumpData() const { return _jumpData; }
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object* object, osg::NodeVisitor* nv);
virtual void accept(osgGA::GUIEventHandlerVisitor& v);
virtual void getUsage(osg::ApplicationUsage& usage) const;
void doOperation();
int _key;
std::string _command;
osgPresentation::KeyPosition _keyPos;
osgPresentation::Operation _operation;
JumpData _jumpData;
};
}
#endif

View File

@@ -0,0 +1,65 @@
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
*
* This software is open source and may be redistributed and/or modified under
* the terms of the GNU General Public License (GPL) version 2.0.
* The full license is in LICENSE.txt file included with this distribution,.
*
* This software 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
* include LICENSE.txt for more details.
*/
#ifndef PICKEVENTHANDLER
#define PICKEVENTHANDLER 1
#include <osg/StateSet>
#include <osg/Point>
#include <osgGA/GUIEventHandler>
#include <osgPresentation/deprecated/SlideEventHandler>
namespace osgPresentation
{
class OSGPRESENTATION_EXPORT PickEventHandler : public osgGA::GUIEventHandler
{
public:
PickEventHandler(osgPresentation::Operation operation, const JumpData& jumpData=JumpData());
PickEventHandler(const std::string& str, osgPresentation::Operation operation, const JumpData& jumpData=JumpData());
PickEventHandler(const osgPresentation::KeyPosition& keyPos, const JumpData& jumpData=JumpData());
void setOperation(osgPresentation::Operation operation) { _operation = operation; }
osgPresentation::Operation getOperation() const { return _operation; }
void setCommand(const std::string& str) { _command = str; }
const std::string& getCommand() const { return _command; }
void setKeyPosition(const osgPresentation::KeyPosition& keyPos) { _keyPos = keyPos; }
const osgPresentation::KeyPosition& getKeyPosition() const { return _keyPos; }
void setJumpData(const JumpData& jumpData) { _jumpData = jumpData; }
const JumpData& getJumpData() const { return _jumpData; }
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object* object, osg::NodeVisitor* nv);
virtual void accept(osgGA::GUIEventHandlerVisitor& v);
virtual void getUsage(osg::ApplicationUsage& usage) const;
void doOperation();
std::string _command;
osgPresentation::KeyPosition _keyPos;
osgPresentation::Operation _operation;
JumpData _jumpData;
std::set<osg::Drawable*> _drawablesOnPush;
};
}
#endif

View File

@@ -0,0 +1,210 @@
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
*
* This software is open source and may be redistributed and/or modified under
* the terms of the GNU General Public License (GPL) version 2.0.
* The full license is in LICENSE.txt file included with this distribution,.
*
* This software 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
* include LICENSE.txt for more details.
*/
#ifndef PROPERTYMANAGER
#define PROPERTYMANAGER 1
#include <osg/UserDataContainer>
#include <osg/ValueObject>
#include <osg/NodeCallback>
#include <osg/ImageSequence>
#include <osgGA/GUIEventHandler>
#include <osgPresentation/Export>
#include <sstream>
namespace osgPresentation
{
class PropertyManager : protected osg::Object
{
public:
PropertyManager() {}
PropertyManager(const PropertyManager& pm, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
osg::Object(pm,copyop) {}
META_Object(osgPresentation, PropertyManager)
/** Convinience method that casts the named UserObject to osg::TemplateValueObject<T> and gets the value.
* To use this template method you need to include the osg/ValueObject header.*/
template<typename T>
bool getProperty(const std::string& name, T& value) const
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
return getUserValue(name, value);
}
/** Convinience method that creates the osg::TemplateValueObject<T> to store the
* specified value and adds it as a named UserObject.
* To use this template method you need to include the osg/ValueObject header. */
template<typename T>
void setProperty(const std::string& name, const T& value)
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
return setUserValue(name, value);
}
int ref() const { return osg::Referenced::ref(); }
int unref() const { return osg::Referenced::unref(); }
protected:
mutable OpenThreads::Mutex _mutex;
};
extern OSGPRESENTATION_EXPORT const osg::Object* getUserObject(const osg::NodePath& nodepath, const std::string& name);
template<typename T>
bool getUserValue(const osg::NodePath& nodepath, const std::string& name, T& value)
{
typedef osg::TemplateValueObject<T> UserValueObject;
const osg::Object* object = getUserObject(nodepath, name);
const UserValueObject* uvo = dynamic_cast<const UserValueObject*>(object);
if (uvo)
{
value = uvo->getValue();
return true;
}
else
{
return false;
}
}
extern OSGPRESENTATION_EXPORT bool containsPropertyReference(const std::string& str);
struct PropertyReader
{
PropertyReader(const osg::NodePath& nodePath, const std::string& str):
_errorGenerated(false),
_nodePath(nodePath),
_sstream(str) {}
template<typename T>
bool read(T& value)
{
// skip white space.
while(!_sstream.fail() && _sstream.peek()==' ') _sstream.ignore();
// check to see if a &propertyName is used.
if (_sstream.peek()=='$')
{
std::string propertyName;
_sstream.ignore(1);
_sstream >> propertyName;
OSG_NOTICE<<"Reading propertyName="<<propertyName<<std::endl;
if (!_sstream.fail() && !propertyName.empty()) return getUserValue(_nodePath, propertyName, value);
else return false;
}
else
{
_sstream >> value;
OSG_NOTICE<<"Reading value="<<value<<std::endl;
return !_sstream.fail();
}
}
template<typename T>
PropertyReader& operator>>( T& value ) { if (!read(value)) _errorGenerated=true; return *this; }
bool ok() { return !_sstream.fail() && !_errorGenerated; }
bool fail() { return _sstream.fail() || _errorGenerated; }
bool _errorGenerated;
osg::NodePath _nodePath;
std::istringstream _sstream;
};
class OSGPRESENTATION_EXPORT PropertyAnimation : public osg::NodeCallback
{
public:
PropertyAnimation():
_firstTime(DBL_MAX),
_latestTime(0.0),
_pause(false),
_pauseTime(0.0) {}
void setPropertyManager(PropertyManager* pm) { _pm = pm; }
PropertyManager* getPropertyManager() const { return _pm.get(); }
typedef std::map<double, osg::ref_ptr<osg::UserDataContainer> > KeyFrameMap;
KeyFrameMap& getKeyFrameMap() { return _keyFrameMap; }
const KeyFrameMap& getKeyFrameMap() const { return _keyFrameMap; }
void addKeyFrame(double time, osg::UserDataContainer* udc)
{
_keyFrameMap[time] = udc;
}
virtual void reset();
void setPause(bool pause);
bool getPause() const { return _pause; }
double getAnimationTime() const;
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv);
virtual void update(osg::Node& node);
protected:
osg::ref_ptr<PropertyManager> _pm;
void assign(osg::UserDataContainer* destination, osg::UserDataContainer* source);
void assign(osg::UserDataContainer* udc, osg::Object* obj);
KeyFrameMap _keyFrameMap;
double _firstTime;
double _latestTime;
bool _pause;
double _pauseTime;
};
struct OSGPRESENTATION_EXPORT ImageSequenceUpdateCallback : public osg::NodeCallback
{
ImageSequenceUpdateCallback(osg::ImageSequence* is, PropertyManager* pm, const std::string& propertyName):
_imageSequence(is),
_propertyManager(pm),
_propertyName(propertyName) {}
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv);
osg::ref_ptr<osg::ImageSequence> _imageSequence;
osg::ref_ptr<PropertyManager> _propertyManager;
std::string _propertyName;
};
struct OSGPRESENTATION_EXPORT PropertyEventCallback : public osgGA::GUIEventHandler
{
PropertyEventCallback(PropertyManager* pm):
_propertyManager(pm) {}
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&);
osg::ref_ptr<PropertyManager> _propertyManager;
};
}
#endif

View File

@@ -0,0 +1,386 @@
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
*
* This software is open source and may be redistributed and/or modified under
* the terms of the GNU General Public License (GPL) version 2.0.
* The full license is in LICENSE.txt file included with this distribution,.
*
* This software 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
* include LICENSE.txt for more details.
*/
#ifndef SLIDEEVENTHANDLER
#define SLIDEEVENTHANDLER 1
#include <osg/Switch>
#include <osg/Timer>
#include <osg/ValueObject>
#include <osg/ImageSequence>
#include <osgGA/GUIEventHandler>
#include <osgViewer/Viewer>
#include <osgPresentation/deprecated/CompileSlideCallback>
#include <osgPresentation/deprecated/PropertyManager>
namespace osgPresentation
{
// forward declare
class SlideEventHandler;
/// Operations related to click to run/load/key events.
enum Operation
{
RUN,
LOAD,
EVENT,
JUMP,
FORWARD_EVENT
};
struct JumpData
{
JumpData():
relativeJump(true),
slideNum(0),
layerNum(0) {}
JumpData(bool in_relativeJump, int in_slideNum, int in_layerNum):
relativeJump(in_relativeJump),
slideNum(in_slideNum),
layerNum(in_layerNum) {}
JumpData(const std::string& in_slideName, const std::string& in_layerName):
relativeJump(true),
slideNum(0),
layerNum(0),
slideName(in_slideName),
layerName(in_layerName) {}
JumpData(const JumpData& rhs):
relativeJump(rhs.relativeJump),
slideNum(rhs.slideNum),
layerNum(rhs.layerNum),
slideName(rhs.slideName),
layerName(rhs.layerName) {}
JumpData& operator = (const JumpData& rhs)
{
if (&rhs==this) return *this;
relativeJump = rhs.relativeJump;
slideNum = rhs.slideNum;
layerNum = rhs.layerNum;
slideName = rhs.slideName;
layerName = rhs.layerName;
return *this;
}
bool requiresJump() const
{
if (!slideName.empty() || !layerName.empty()) return true;
return relativeJump ? (slideNum!=0 || layerNum!=0) : true;
}
bool jump(SlideEventHandler* seh) const;
bool relativeJump;
int slideNum;
int layerNum;
std::string slideName;
std::string layerName;
};
struct HomePosition : public virtual osg::Referenced
{
HomePosition() {}
HomePosition(const osg::Vec3& in_eye, const osg::Vec3& in_center, const osg::Vec3& in_up):
eye(in_eye),
center(in_center),
up(in_up) {}
osg::Vec3 eye;
osg::Vec3 center;
osg::Vec3 up;
};
struct KeyPosition
{
KeyPosition(unsigned int key=0, float x=FLT_MAX, float y=FLT_MAX):
_key((osgGA::GUIEventAdapter::KeySymbol)key),
_x(x),
_y(y) {}
void set(unsigned int key=0, float x=FLT_MAX, float y=FLT_MAX)
{
_key = (osgGA::GUIEventAdapter::KeySymbol)key;
_x = x;
_y = y;
}
osgGA::GUIEventAdapter::KeySymbol _key;
float _x;
float _y;
};
struct LayerCallback : public virtual osg::Referenced
{
virtual void operator() (osg::Node* node) const = 0;
};
struct OSGPRESENTATION_EXPORT LayerAttributes : public virtual osg::Referenced
{
LayerAttributes():_duration(0) {}
LayerAttributes(double in_duration):_duration(in_duration) {}
void setDuration(double duration) { _duration = duration; }
double getDuration() const { return _duration; }
typedef std::vector<KeyPosition> Keys;
typedef std::vector<std::string> RunStrings;
void setKeys(const Keys& keys) { _keys = keys; }
const Keys& getKeys() const { return _keys; }
void addKey(const KeyPosition& kp) { _keys.push_back(kp); }
void setRunStrings(const RunStrings& runStrings) { _runStrings = runStrings; }
const RunStrings& getRunStrings() const { return _runStrings; }
void addRunString(const std::string& runString) { _runStrings.push_back(runString); }
void setJump(const JumpData& jumpData) { _jumpData = jumpData; }
const JumpData& getJumpData() const { return _jumpData; }
double _duration;
Keys _keys;
RunStrings _runStrings;
JumpData _jumpData;
void addEnterCallback(LayerCallback* lc) { _enterLayerCallbacks.push_back(lc); }
void addLeaveCallback(LayerCallback* lc) { _leaveLayerCallbacks.push_back(lc); }
void callEnterCallbacks(osg::Node* node);
void callLeaveCallbacks(osg::Node* node);
typedef std::list< osg::ref_ptr<LayerCallback> > LayerCallbacks;
LayerCallbacks _enterLayerCallbacks;
LayerCallbacks _leaveLayerCallbacks;
};
struct FilePathData : public virtual osg::Referenced
{
FilePathData(const osgDB::FilePathList& fpl):filePathList(fpl) {}
osgDB::FilePathList filePathList;
};
struct dereference_less
{
template<class T, class U>
inline bool operator() (const T& lhs,const U& rhs) const
{
return *lhs < *rhs;
}
};
struct ObjectOperator : public osg::Referenced
{
inline bool operator < (const ObjectOperator& rhs) const { return ptr() < rhs.ptr(); }
virtual void* ptr() const = 0;
virtual void enter(SlideEventHandler*) = 0;
virtual void frame(SlideEventHandler*) {} ;
virtual void maintain(SlideEventHandler*) = 0;
virtual void leave(SlideEventHandler*) = 0;
virtual void setPause(SlideEventHandler*, bool pause) = 0;
virtual void reset(SlideEventHandler*) = 0;
virtual ~ObjectOperator() {}
};
class OSGPRESENTATION_EXPORT ActiveOperators
{
public:
ActiveOperators();
~ActiveOperators();
void collect(osg::Node* incommingNode, osg::NodeVisitor::TraversalMode tm = osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN);
void process(SlideEventHandler* seh);
void frame(SlideEventHandler*);
void setPause(SlideEventHandler* seh, bool pause);
bool getPause() const { return _pause; }
void reset(SlideEventHandler* seh);
typedef std::set< osg::ref_ptr<ObjectOperator>, dereference_less > OperatorList;
protected:
void processOutgoing(SlideEventHandler* seh);
void processIncomming(SlideEventHandler* seh);
void processMaintained(SlideEventHandler* seh);
bool _pause;
OperatorList _previous;
OperatorList _current;
OperatorList _outgoing;
OperatorList _incomming;
OperatorList _maintained;
};
class OSGPRESENTATION_EXPORT SlideEventHandler : public osgGA::GUIEventHandler
{
public:
SlideEventHandler(osgViewer::Viewer* viewer=0);
static SlideEventHandler* instance();
META_Object(osgslideshowApp,SlideEventHandler);
void set(osg::Node* model);
virtual void accept(osgGA::GUIEventHandlerVisitor& v) { v.visit(*this); }
/** Event traversal node callback method.*/
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv);
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&);
virtual void getUsage(osg::ApplicationUsage& usage) const;
osgViewer::Viewer* getViewer() { return _viewer.get(); }
osg::Switch* getPresentationSwitch() { return _presentationSwitch.get(); }
enum WhichPosition
{
FIRST_POSITION = 0,
LAST_POSITION = -1
};
void compileSlide(unsigned int slideNum);
void releaseSlide(unsigned int slideNum);
unsigned int getNumSlides();
int getActiveSlide() const { return _activeSlide; }
int getActiveLayer() const { return _activeLayer; }
osg::Switch* getSlide(int slideNum);
osg::Node* getLayer(int slideNum, int layerNum);
bool selectSlide(int slideNum,int layerNum=FIRST_POSITION);
bool selectLayer(int layerNum);
bool nextLayerOrSlide();
bool previousLayerOrSlide();
bool nextSlide();
bool previousSlide();
bool nextLayer();
bool previousLayer();
bool home();
void setAutoSteppingActive(bool flag = true) { _autoSteppingActive = flag; }
bool getAutoSteppingActive() const { return _autoSteppingActive; }
void setTimeDelayBetweenSlides(double dt) { _timePerSlide = dt; }
double getTimeDelayBetweenSlides() const { return _timePerSlide; }
double getDuration(const osg::Node* node) const;
double getCurrentTimeDelayBetweenSlides() const;
void setReleaseAndCompileOnEachNewSlide(bool flag) { _releaseAndCompileOnEachNewSlide = flag; }
bool getReleaseAndCompileOnEachNewSlide() const { return _releaseAndCompileOnEachNewSlide; }
void setTimeDelayOnNewSlideWithMovies(float t) { _timeDelayOnNewSlideWithMovies = t; }
float getTimeDelayOnNewSlideWithMovies() const { return _timeDelayOnNewSlideWithMovies; }
void setLoopPresentation(bool loop) { _loopPresentation = loop; }
bool getLoopPresentation() const { return _loopPresentation; }
void dispatchEvent(const KeyPosition& keyPosition);
void setRequestReload(bool flag);
bool getRequestReload() const { return _requestReload; }
double getReferenceTime() const { return _referenceTime; }
protected:
~SlideEventHandler() {}
SlideEventHandler(const SlideEventHandler&,const osg::CopyOp&) {}
bool home(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa);
void updateAlpha(bool, bool, float x, float y);
void updateLight(float x, float y);
void updateOperators();
osg::observer_ptr<osgViewer::Viewer> _viewer;
osg::observer_ptr<osg::Switch> _showSwitch;
int _activePresentation;
osg::observer_ptr<osg::Switch> _presentationSwitch;
int _activeSlide;
osg::observer_ptr<osg::Switch> _slideSwitch;
int _activeLayer;
bool _firstTraversal;
double _referenceTime;
double _previousTime;
double _timePerSlide;
bool _autoSteppingActive;
bool _loopPresentation;
bool _pause;
bool _hold;
bool _updateLightActive;
bool _updateOpacityActive;
float _previousX, _previousY;
bool _cursorOn;
bool _releaseAndCompileOnEachNewSlide;
bool _firstSlideOrLayerChange;
osg::Timer_t _tickAtFirstSlideOrLayerChange;
osg::Timer_t _tickAtLastSlideOrLayerChange;
float _timeDelayOnNewSlideWithMovies;
double _minimumTimeBetweenKeyPresses;
double _timeLastKeyPresses;
ActiveOperators _activeOperators;
osg::ref_ptr<CompileSlideCallback> _compileSlideCallback;
bool _requestReload;
};
}
#endif

View File

@@ -0,0 +1,589 @@
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
*
* This software is open source and may be redistributed and/or modified under
* the terms of the GNU General Public License (GPL) version 2.0.
* The full license is in LICENSE.txt file included with this distribution,.
*
* This software 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
* include LICENSE.txt for more details.
*/
#ifndef SLIDESHOWCONSTRUCTOR
#define SLIDESHOWCONSTRUCTOR
#include <osg/Vec3>
#include <osg/Vec4>
#include <osg/ImageUtils>
#include <osg/Group>
#include <osg/ClearNode>
#include <osg/Switch>
#include <osg/AnimationPath>
#include <osg/TransferFunction>
#include <osg/ImageStream>
#include <osg/ImageSequence>
#include <osgText/Text>
#include <osgGA/GUIEventAdapter>
#include <osgDB/FileUtils>
#include <osgVolume/VolumeTile>
#include <osgVolume/Property>
#include <osgPresentation/deprecated/AnimationMaterial>
#include <osgPresentation/deprecated/SlideEventHandler>
#include <osgPresentation/deprecated/PropertyManager>
#include <osgPresentation/deprecated/Timeout>
namespace osgPresentation
{
class OSGPRESENTATION_EXPORT HUDTransform : public osg::Transform
{
public:
HUDTransform(HUDSettings* hudSettings);
virtual bool computeLocalToWorldMatrix(osg::Matrix& matrix,osg::NodeVisitor* nv) const;
virtual bool computeWorldToLocalMatrix(osg::Matrix& matrix,osg::NodeVisitor*) const;
protected:
virtual ~HUDTransform();
osg::ref_ptr<HUDSettings> _hudSettings;
};
class OSGPRESENTATION_EXPORT SlideShowConstructor
{
public:
enum CoordinateFrame { SLIDE, MODEL };
LayerAttributes* getOrCreateLayerAttributes(osg::Node* node);
void setDuration(osg::Node* node,double duration)
{
getOrCreateLayerAttributes(node)->setDuration(duration);
}
void addKey(osg::Node* node,const KeyPosition& kp)
{
getOrCreateLayerAttributes(node)->addKey(kp);
}
void addRunString(osg::Node* node, const std::string& runString)
{
getOrCreateLayerAttributes(node)->addRunString(runString);
}
void setJump(osg::Node* node, const JumpData& jumpData)
{
getOrCreateLayerAttributes(node)->setJump(jumpData);
}
void addPresentationKey(const KeyPosition& kp)
{
if (!_presentationSwitch) createPresentation();
if (_presentationSwitch.valid()) addKey( _presentationSwitch.get(), kp);
}
void addPresentationRunString(const std::string& runString)
{
if (!_presentationSwitch) createPresentation();
if (_presentationSwitch.valid()) addRunString( _presentationSwitch.get(),runString);
}
void addSlideKey(const KeyPosition& kp)
{
if (!_slide) addSlide();
if (_slide.valid()) addKey(_slide.get(),kp);
}
void addSlideRunString(const std::string& runString)
{
if (!_slide) addSlide();
if (_slide.valid()) addRunString(_slide.get(),runString);
}
void setSlideJump(const JumpData& jumpData)
{
if (!_slide) addSlide();
if (_slide.valid()) setJump(_slide.get(),jumpData);
}
void addLayerKey(const KeyPosition& kp)
{
if (!_currentLayer) addLayer();
if (_currentLayer.valid()) addKey(_currentLayer.get(),kp);
}
void addLayerRunString(const std::string& runString)
{
if (!_currentLayer) addLayer();
if (_currentLayer.valid()) addRunString(_currentLayer.get(),runString);
}
void setLayerJump(const JumpData& jumpData)
{
if (!_currentLayer) addLayer();
if (_currentLayer.valid()) setJump(_currentLayer.get(),jumpData);
}
struct PositionData
{
PositionData():
frame(SlideShowConstructor::SLIDE),
position(0.0f,1.0f,0.0f),
//position(0.5f,0.5f,0.0f),
scale(1.0f,1.0f,1.0f),
rotate(0.0f,0.0f,0.0f,1.0f),
rotation(0.0f,0.0f,1.0f,0.0f),
absolute_path(false),
inverse_path(false),
path_time_offset(0.0),
path_time_multiplier(1.0f),
path_loop_mode(osg::AnimationPath::NO_LOOPING),
animation_material_time_offset(0.0),
animation_material_time_multiplier(1.0),
animation_material_loop_mode(AnimationMaterial::NO_LOOPING),
autoRotate(false),
autoScale(false),
hud(false) {}
bool requiresPosition() const
{
return (position[0]!=0.0f || position[1]!=1.0f || position[2]!=1.0f);
}
bool requiresScale() const
{
return (scale[0]!=1.0f || scale[1]!=1.0f || scale[2]!=1.0f);
}
bool requiresRotate() const
{
return rotate[0]!=0.0f;
}
bool requiresAnimation() const
{
return (rotation[0]!=0.0f || !path.empty());
}
bool requiresMaterialAnimation() const
{
return !animation_material_filename.empty() || !fade.empty();
}
CoordinateFrame frame;
osg::Vec3 position;
osg::Vec3 scale;
osg::Vec4 rotate;
osg::Vec4 rotation;
std::string animation_name;
bool absolute_path;
bool inverse_path;
double path_time_offset;
double path_time_multiplier;
osg::AnimationPath::LoopMode path_loop_mode;
std::string path;
double animation_material_time_offset;
double animation_material_time_multiplier;
AnimationMaterial::LoopMode animation_material_loop_mode;
std::string animation_material_filename;
std::string fade;
bool autoRotate;
bool autoScale;
bool hud;
};
struct ModelData
{
ModelData() {}
std::string region;
std::string effect;
std::string options;
};
struct ImageData
{
ImageData():
width(1.0f),
height(1.0f),
region(0.0f,0.0f,1.0f,1.0f),
region_in_pixel_coords(false),
texcoord_rotate(0.0f),
loopingMode(osg::ImageStream::NO_LOOPING),
page(-1),
backgroundColor(1.0f,1.0f,1.0f,1.0f),
fps(30.0),
duration(-1.0),
imageSequence(false),
imageSequencePagingMode(osg::ImageSequence::PAGE_AND_DISCARD_USED_IMAGES),
imageSequenceInteractionMode(PLAY_AUTOMATICALLY_LIKE_MOVIE),
blendingHint(USE_IMAGE_ALPHA),
delayTime(0.0),
startTime(0.0),
stopTime(-1.0),
volume("")
{}
std::string options;
float width;
float height;
osg::Vec4 region;
bool region_in_pixel_coords;
float texcoord_rotate;
osg::ImageStream::LoopingMode loopingMode;
int page;
osg::Vec4 backgroundColor;
double fps;
double duration;
bool imageSequence;
osg::ImageSequence::Mode imageSequencePagingMode;
enum ImageSequenceInteractionMode
{
PLAY_AUTOMATICALLY_LIKE_MOVIE,
USE_MOUSE_X_POSITION,
USE_MOUSE_Y_POSITION
};
ImageSequenceInteractionMode imageSequenceInteractionMode;
enum BlendingHint
{
USE_IMAGE_ALPHA,
OFF,
ON
};
BlendingHint blendingHint;
double delayTime;
double startTime;
double stopTime;
std::string volume;
};
struct VolumeData
{
enum ShadingModel
{
Standard,
Light,
Isosurface,
MaximumIntensityProjection
};
VolumeData():
shadingModel(Standard),
useTabbedDragger(false),
useTrackballDragger(false),
region_in_pixel_coords(false),
alphaValue("1.0"),
cutoffValue("0.1"),
sampleDensityValue("0.005"),
colorSpaceOperation(osg::NO_COLOR_SPACE_OPERATION),
colorModulate(1.0f,1.0f,1.0f,1.0f)
{
}
std::string options;
ShadingModel shadingModel;
osg::ref_ptr<osg::TransferFunction1D> transferFunction;
bool useTabbedDragger;
bool useTrackballDragger;
std::string region;
bool region_in_pixel_coords;
std::string alphaValue;
std::string cutoffValue;
std::string sampleDensityValue;
std::string sampleDensityWhenMovingValue;
osg::ColorSpaceOperation colorSpaceOperation;
osg::Vec4 colorModulate;
};
struct FontData
{
FontData():
font("fonts/arial.ttf"),
layout(osgText::Text::LEFT_TO_RIGHT),
alignment(osgText::Text::LEFT_BASE_LINE),
axisAlignment(osgText::Text::XZ_PLANE),
characterSizeMode(osgText::Text::OBJECT_COORDS),
characterSize(0.04f),
maximumHeight(1.0f),
maximumWidth(1.0f),
color(1.0f,1.0f,1.0f,1.0f) {}
std::string font;
osgText::Text::Layout layout;
osgText::Text::AlignmentType alignment;
osgText::Text::AxisAlignment axisAlignment;
osgText::Text::CharacterSizeMode characterSizeMode;
float characterSize;
float maximumHeight;
float maximumWidth;
osg::Vec4 color;
};
SlideShowConstructor(osgDB::Options* options);
void createPresentation();
void setBackgroundColor(const osg::Vec4& color, bool updateClearNode);
const osg::Vec4& getBackgroundColor() const { return _backgroundColor; }
void setTextColor(const osg::Vec4& color);
const osg::Vec4& getTextColor() const { return _textFontDataDefault.color; }
void setPresentationName(const std::string& name);
void setPresentationAspectRatio(float aspectRatio);
void setPresentationAspectRatio(const std::string& str);
void setPresentationDuration(double duration);
void addSlide();
void selectSlide(int slideNum);
void setSlideTitle(const std::string& name, PositionData& positionData, FontData& fontData)
{
_titlePositionData = positionData;
_titleFontData = fontData;
_slideTitle = name;
}
void setSlideBackgrondHUD(bool hud) { _slideBackgroundAsHUD = hud; }
void setSlideBackground(const std::string& name) { _slideBackgroundImageFileName = name; }
void setSlideDuration(double duration);
Timeout* addTimeout();
void addLayer(bool inheritPreviousLayers=true, bool defineAsBaseLayer=false);
void selectLayer(int layerNum);
void setLayerDuration(double duration);
// title settings
FontData& getTitleFontData() { return _titleFontData; }
FontData& getTitleFontDataDefault() { return _titleFontDataDefault; }
PositionData& getTitlePositionData() { return _titlePositionData; }
PositionData& getTitlePositionDataDefault() { return _titlePositionDataDefault; }
// text settings
FontData& getTextFontData() { return _textFontData; }
FontData& getTextFontDataDefault() { return _textFontDataDefault; }
PositionData& getTextPositionData() { return _textPositionData; }
PositionData& getTextPositionDataDefault() { return _textPositionDataDefault; }
void translateTextCursor(const osg::Vec3& delta) { _textPositionData.position += delta; }
// image settings
PositionData& getImagePositionData() { return _imagePositionData; }
PositionData& getImagePositionDataDefault() { return _imagePositionDataDefault; }
// model settings
PositionData& getModelPositionData() { return _modelPositionData; }
PositionData& getModelPositionDataDefault() { return _modelPositionDataDefault; }
enum PresentationContext {
CURRENT_PRESENTATION,
CURRENT_SLIDE,
CURRENT_LAYER
};
void addEventHandler(PresentationContext presentationContext, osg::ref_ptr<osgGA::GUIEventHandler> handler);
void keyToDoOperation(PresentationContext presentationContext, int key, Operation operation, const JumpData& jumpData=JumpData());
void keyToDoOperation(PresentationContext presentationContext, int key, const std::string& command, Operation operation, const JumpData& jumpData=JumpData());
void keyEventOperation(PresentationContext presentationContext, int key, const KeyPosition& keyPos, const JumpData& jumpData=JumpData());
void layerClickToDoOperation(Operation operation, const JumpData& jumpData=JumpData());
void layerClickToDoOperation(const std::string& command, Operation operation, const JumpData& jumpData=JumpData());
void layerClickEventOperation(const KeyPosition& keyPos, const JumpData& jumpData=JumpData());
void addPropertyAnimation(PresentationContext presentationContext, PropertyAnimation* propertyAnimation);
void addToCurrentLayer(osg::Node* subgraph);
void addBullet(const std::string& bullet, PositionData& positionData, FontData& fontData);
void addParagraph(const std::string& paragraph, PositionData& positionData, FontData& fontData);
osg::Image* readImage(const std::string& filename, const ImageData& imageData);
void addImage(const std::string& filename,const PositionData& positionData, const ImageData& imageData);
void addStereoImagePair(const std::string& filenameLeft, const ImageData& imageDataLeft, const std::string& filenameRight,const ImageData& imageDataRight, const PositionData& positionData);
void addGraph(const std::string& filename,const PositionData& positionData, const ImageData& imageData);
void addVNC(const std::string& filename,const PositionData& positionData, const ImageData& imageData, const std::string& password);
void addBrowser(const std::string& filename,const PositionData& positionData, const ImageData& imageData);
void addPDF(const std::string& filename,const PositionData& positionData, const ImageData& imageData);
osg::Image* addInteractiveImage(const std::string& filename,const PositionData& positionData, const ImageData& imageData);
void addModel(osg::Node* subgraph, const PositionData& positionData, const ModelData& modelData);
void addModel(const std::string& filename, const PositionData& positionData, const ModelData& modelData);
void setUpVolumeScalarProperty(osgVolume::VolumeTile* tile, osgVolume::ScalarProperty* property, const std::string& source);
void addVolume(const std::string& filename, const PositionData& positionData, const VolumeData& volumeData);
osg::Group* takePresentation() { return _root.release(); }
osg::Group* getPresentation() { return _root.get(); }
osg::Switch* getPresentationSwitch() { return _presentationSwitch.get(); }
osg::Switch* getCurrentSlide() { return _slide.get(); }
void pushCurrentLayer();
void popCurrentLayer();
osg::Group* getCurrentLayer() { return _currentLayer.get(); }
void setLoopPresentation(bool loop) { _loopPresentation = loop; }
bool getLoopPresentation() const { return _loopPresentation; }
void setAutoSteppingActive(bool flag = true) { _autoSteppingActive = flag; }
bool getAutoSteppingActive() const { return _autoSteppingActive; }
void setHUDSettings(HUDSettings* hudSettings) { _hudSettings = hudSettings; }
HUDSettings* getHUDSettings() { return _hudSettings.get(); }
const HUDSettings* getHUDSettings() const { return _hudSettings.get(); }
protected:
void findImageStreamsAndAddCallbacks(osg::Node* node);
osg::Geometry* createTexturedQuadGeometry(const osg::Vec3& pos, const osg::Vec4& rotation, float width,float height, osg::Image* image, bool& usedTextureRectangle);
void setUpMovieVolume(osg::Node* subgraph, osg::ImageStream* imageStream, const ImageData& imageData);
osg::Vec3 computePositionInModelCoords(const PositionData& positionData) const;
void updatePositionFromInModelCoords(const osg::Vec3& vertex, PositionData& positionData) const;
osg::Vec3 convertSlideToModel(const osg::Vec3& position) const;
osg::Vec3 convertModelToSlide(const osg::Vec3& position) const;
osg::AnimationPathCallback* getAnimationPathCallback(const PositionData& positionData);
osg::Node* attachMaterialAnimation(osg::Node* model, const PositionData& positionData);
bool attachTexMat(osg::StateSet* stateset, const ImageData& imageData, float s, float t, bool textureRectangle);
osg::StateSet* createTransformStateSet()
{
osg::StateSet* stateset = new osg::StateSet;
#if !defined(OSG_GLES2_AVAILABLE)
stateset->setMode(GL_NORMALIZE,osg::StateAttribute::ON);
#endif
return stateset;
}
osg::Node* decorateSubgraphForPosition(osg::Node* node, PositionData& positionData);
osg::ref_ptr<osgDB::Options> _options;
osg::Vec3 _slideOrigin;
osg::Vec3 _eyeOrigin;
double _slideWidth;
double _slideHeight;
double _slideDistance;
unsigned int _leftEyeMask;
unsigned int _rightEyeMask;
osg::ref_ptr<HUDSettings> _hudSettings;
// title settings
FontData _titleFontData;
FontData _titleFontDataDefault;
PositionData _titlePositionData;
PositionData _titlePositionDataDefault;
// text settings
FontData _textFontData;
FontData _textFontDataDefault;
PositionData _textPositionData;
PositionData _textPositionDataDefault;
// image settings
PositionData _imagePositionData;
PositionData _imagePositionDataDefault;
// model settings
PositionData _modelPositionData;
PositionData _modelPositionDataDefault;
bool _loopPresentation;
bool _autoSteppingActive;
osg::Vec4 _backgroundColor;
std::string _presentationName;
double _presentationDuration;
osg::ref_ptr<osgPresentation::PropertyManager> _propertyManager;
osg::ref_ptr<osgPresentation::PropertyEventCallback> _propertyEventCallback;
osg::ref_ptr<osg::Group> _root;
osg::ref_ptr<osg::Switch> _presentationSwitch;
osg::ref_ptr<osg::ClearNode> _slideClearNode;
osg::ref_ptr<osg::Switch> _slide;
std::string _slideTitle;
std::string _slideBackgroundImageFileName;
bool _slideBackgroundAsHUD;
osg::ref_ptr<osg::Group> _previousLayer;
osg::ref_ptr<osg::Group> _currentLayer;
typedef std::vector< osg::ref_ptr<osg::Group> > LayerStack;
LayerStack _layerStack;
osg::ref_ptr<FilePathData> _filePathData;
osg::ref_ptr<osg::Group> _layerToApplyEventCallbackTo;
typedef std::list< osg::ref_ptr<osgGA::GUIEventHandler> > EventHandlerList;
EventHandlerList _currentEventCallbacksToApply;
std::string findFileAndRecordPath(const std::string& filename);
void recordOptionsFilePath(const osgDB::Options* options);
};
}
#endif

View File

@@ -0,0 +1,121 @@
/* -*-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 OSGPRESENTATION_TIMOUTOUT
#define OSGPRESENTATION_TIMOUTOUT 1
#include <osg/Transform>
#include <osgPresentation/deprecated/SlideEventHandler>
namespace osgPresentation {
class OSGPRESENTATION_EXPORT HUDSettings : public osg::Referenced
{
public:
HUDSettings(double slideDistance, float eyeOffset, unsigned int leftMask, unsigned int rightMask);
virtual bool getModelViewMatrix(osg::Matrix& matrix, osg::NodeVisitor* nv) const;
virtual bool getInverseModelViewMatrix(osg::Matrix& matrix, osg::NodeVisitor* nv) const;
double _slideDistance;
double _eyeOffset;
unsigned int _leftMask;
unsigned int _rightMask;
protected:
virtual ~HUDSettings();
};
class OSGPRESENTATION_EXPORT Timeout : public osg::Transform
{
public:
Timeout(HUDSettings* hudSettings=0);
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
Timeout(const Timeout& timeout,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Node(osgPresentation, Timeout);
void setIdleDurationBeforeTimeoutDisplay(double t) { _idleDurationBeforeTimeoutDisplay = t; }
double getIdleDurationBeforeTimeoutDisplay() const { return _idleDurationBeforeTimeoutDisplay; }
void setIdleDurationBeforeTimeoutAction(double t) { _idleDurationBeforeTimeoutAction = t; }
double getIdleDurationBeforeTimeoutAction() const { return _idleDurationBeforeTimeoutAction; }
void setKeyStartsTimoutDisplay(int key) { _keyStartsTimoutDisplay = key; }
int getKeyStartsTimoutDisplay() const { return _keyStartsTimoutDisplay; }
void setKeyDismissTimoutDisplay(int key) { _keyDismissTimoutDisplay = key; }
int getKeyDismissTimoutDisplay() const { return _keyDismissTimoutDisplay; }
void setKeyRunTimoutAction(int key) { _keyRunTimeoutAction = key; }
int getKeyRunTimoutAction() const { return _keyRunTimeoutAction; }
void setDisplayBroadcastKeyPosition(const osgPresentation::KeyPosition& keyPos) { _displayBroadcastKeyPos = keyPos; }
const osgPresentation::KeyPosition& getDisplayBroadcastKeyPosition() const { return _displayBroadcastKeyPos; }
void setDismissBroadcastKeyPosition(const osgPresentation::KeyPosition& keyPos) { _dismissBroadcastKeyPos = keyPos; }
const osgPresentation::KeyPosition& getDismissBroadcastKeyPosition() const { return _dismissBroadcastKeyPos; }
void setActionKeyPosition(const osgPresentation::KeyPosition& keyPos) { _actionKeyPos = keyPos; }
const osgPresentation::KeyPosition& getActionKeyPosition() const { return _actionKeyPos; }
void setActionBroadcastKeyPosition(const osgPresentation::KeyPosition& keyPos) { _actionBroadcastKeyPos = keyPos; }
const osgPresentation::KeyPosition& getActionBroadcastKeyPosition() const { return _actionBroadcastKeyPos; }
void setActionJumpData(const JumpData& jumpData) { _actionJumpData = jumpData; }
const JumpData& getActionJumpData() const { return _actionJumpData; }
virtual bool computeLocalToWorldMatrix(osg::Matrix& matrix,osg::NodeVisitor* nv) const;
virtual bool computeWorldToLocalMatrix(osg::Matrix& matrix,osg::NodeVisitor*) const;
virtual void traverse(osg::NodeVisitor& nv);
protected:
virtual ~Timeout();
void broadcastEvent(osgViewer::Viewer* viewer, const osgPresentation::KeyPosition& keyPos);
osg::ref_ptr<HUDSettings> _hudSettings;
int _previousFrameNumber;
double _timeOfLastEvent;
bool _displayTimeout;
double _idleDurationBeforeTimeoutDisplay;
double _idleDurationBeforeTimeoutAction;
int _keyStartsTimoutDisplay;
int _keyDismissTimoutDisplay;
int _keyRunTimeoutAction;
osgPresentation::KeyPosition _displayBroadcastKeyPos;
osgPresentation::KeyPosition _dismissBroadcastKeyPos;
osgPresentation::KeyPosition _actionKeyPos;
osgPresentation::KeyPosition _actionBroadcastKeyPos;
JumpData _actionJumpData;
};
}
#endif