2012-03-22 01:36:20 +08:00
|
|
|
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
|
2009-04-27 19:02:18 +08:00
|
|
|
*
|
2012-03-22 01:36:20 +08:00
|
|
|
* This software is open source and may be redistributed and/or modified under
|
2009-04-27 19:02:18 +08:00
|
|
|
* the terms of the GNU General Public License (GPL) version 2.0.
|
|
|
|
* The full license is in LICENSE.txt file included with this distribution,.
|
2012-03-22 01:36:20 +08:00
|
|
|
*
|
2009-04-27 19:02:18 +08:00
|
|
|
* This software is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2012-03-22 01:36:20 +08:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2009-04-27 19:02:18 +08:00
|
|
|
* include LICENSE.txt for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SLIDEEVENTHANDLER
|
|
|
|
#define SLIDEEVENTHANDLER 1
|
|
|
|
|
|
|
|
#include <osg/Switch>
|
|
|
|
#include <osg/Timer>
|
2012-11-01 00:07:23 +08:00
|
|
|
#include <osg/ValueObject>
|
|
|
|
#include <osg/ImageSequence>
|
2009-04-27 19:02:18 +08:00
|
|
|
|
|
|
|
#include <osgGA/GUIEventHandler>
|
|
|
|
#include <osgViewer/Viewer>
|
|
|
|
|
2013-08-19 02:10:39 +08:00
|
|
|
#include <osgPresentation/deprecated/CompileSlideCallback>
|
|
|
|
#include <osgPresentation/deprecated/PropertyManager>
|
2009-04-30 04:30:21 +08:00
|
|
|
|
|
|
|
namespace osgPresentation
|
|
|
|
{
|
|
|
|
|
2012-11-10 05:32:54 +08:00
|
|
|
// forward declare
|
|
|
|
class SlideEventHandler;
|
2013-08-19 02:10:39 +08:00
|
|
|
|
2009-04-30 04:30:21 +08:00
|
|
|
/// Operations related to click to run/load/key events.
|
|
|
|
enum Operation
|
|
|
|
{
|
|
|
|
RUN,
|
|
|
|
LOAD,
|
|
|
|
EVENT,
|
2013-01-07 20:17:26 +08:00
|
|
|
JUMP,
|
2014-01-23 23:37:48 +08:00
|
|
|
FORWARD_MOUSE_EVENT,
|
|
|
|
FORWARD_TOUCH_EVENT
|
2009-04-30 04:30:21 +08:00
|
|
|
};
|
|
|
|
|
2014-03-11 03:08:46 +08:00
|
|
|
struct JumpData : public osg::Object
|
2012-11-10 05:32:54 +08:00
|
|
|
{
|
|
|
|
JumpData():
|
2012-11-12 18:36:21 +08:00
|
|
|
relativeJump(true),
|
2012-11-10 05:32:54 +08:00
|
|
|
slideNum(0),
|
|
|
|
layerNum(0) {}
|
2013-08-19 02:10:39 +08:00
|
|
|
|
2012-11-10 05:32:54 +08:00
|
|
|
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):
|
2012-11-12 18:36:21 +08:00
|
|
|
relativeJump(true),
|
|
|
|
slideNum(0),
|
|
|
|
layerNum(0),
|
2012-11-10 05:32:54 +08:00
|
|
|
slideName(in_slideName),
|
|
|
|
layerName(in_layerName) {}
|
|
|
|
|
2014-03-11 03:08:46 +08:00
|
|
|
JumpData(const JumpData& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
|
|
|
|
osg::Object(rhs, copyop),
|
2012-11-10 05:32:54 +08:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2014-03-11 03:08:46 +08:00
|
|
|
META_Object(osgPresentation, JumpData);
|
|
|
|
|
2012-11-10 05:32:54 +08:00
|
|
|
bool requiresJump() const
|
|
|
|
{
|
|
|
|
if (!slideName.empty() || !layerName.empty()) return true;
|
|
|
|
return relativeJump ? (slideNum!=0 || layerNum!=0) : true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool jump(SlideEventHandler* seh) const;
|
|
|
|
|
2014-03-11 03:08:46 +08:00
|
|
|
void setRelativeJump(bool flag) { relativeJump = flag; }
|
|
|
|
bool getRelativeJump() const { return relativeJump; }
|
|
|
|
|
|
|
|
void setSlideNum(int num) { slideNum = num; }
|
|
|
|
int getSlideNum() const { return slideNum; }
|
|
|
|
|
|
|
|
void setLayerNum(int num) { layerNum = num; }
|
|
|
|
int getLayerNum() const { return layerNum; }
|
|
|
|
|
|
|
|
void setSlideName(const std::string& name) { slideName = name; }
|
|
|
|
const std::string& getSlideName() const { return slideName; }
|
|
|
|
|
|
|
|
void setLayerName(const std::string& name) { layerName = name; }
|
|
|
|
const std::string& getLayerName() const { return layerName; }
|
|
|
|
|
2012-11-10 05:32:54 +08:00
|
|
|
bool relativeJump;
|
|
|
|
int slideNum;
|
|
|
|
int layerNum;
|
|
|
|
|
|
|
|
std::string slideName;
|
|
|
|
std::string layerName;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2014-03-11 03:08:46 +08:00
|
|
|
struct HomePosition : public osg::Object
|
2009-04-30 04:30:21 +08:00
|
|
|
{
|
2014-03-11 03:08:46 +08:00
|
|
|
HomePosition():
|
|
|
|
eye(0.0, -1.0, 0.0),
|
|
|
|
center(0.0, 0.0, 0.0),
|
|
|
|
up(0.0, 0.0, 1.0) {}
|
2009-04-30 04:30:21 +08:00
|
|
|
|
|
|
|
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) {}
|
|
|
|
|
2014-03-11 03:08:46 +08:00
|
|
|
HomePosition(const HomePosition& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
|
|
|
|
osg::Object(rhs, copyop),
|
|
|
|
eye(rhs.eye),
|
|
|
|
center(rhs.center),
|
|
|
|
up(rhs.up) {}
|
|
|
|
|
|
|
|
HomePosition& operator = (const HomePosition& rhs)
|
|
|
|
{
|
|
|
|
if (&rhs==this) return *this;
|
|
|
|
eye = rhs.eye;
|
|
|
|
center = rhs.center;
|
|
|
|
up = rhs.up;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
META_Object(osgPresentation, HomePosition);
|
|
|
|
|
|
|
|
void setEye(const osg::Vec3d& e) { eye = e; }
|
|
|
|
const osg::Vec3d& getEye() const { return eye; }
|
|
|
|
|
|
|
|
void setCenter(const osg::Vec3d& c) { center = c; }
|
|
|
|
const osg::Vec3d& getCenter() const { return center; }
|
|
|
|
|
|
|
|
void setUp(const osg::Vec3d& u) { up = u; }
|
|
|
|
const osg::Vec3d& getUp() const { return up; }
|
|
|
|
|
|
|
|
osg::Vec3d eye;
|
|
|
|
osg::Vec3d center;
|
|
|
|
osg::Vec3d up;
|
2009-04-30 04:30:21 +08:00
|
|
|
};
|
|
|
|
|
2014-03-11 03:08:46 +08:00
|
|
|
struct KeyPosition : public osg::Object
|
2009-04-30 04:30:21 +08:00
|
|
|
{
|
2013-12-19 21:49:27 +08:00
|
|
|
KeyPosition(unsigned int key=0, float x=FLT_MAX, float y=FLT_MAX, bool forward_to_devices = false):
|
2009-04-30 04:30:21 +08:00
|
|
|
_key((osgGA::GUIEventAdapter::KeySymbol)key),
|
|
|
|
_x(x),
|
2013-12-19 21:49:27 +08:00
|
|
|
_y(y),
|
|
|
|
_forwardToDevices(forward_to_devices) {}
|
2009-04-30 04:30:21 +08:00
|
|
|
|
2014-03-11 03:08:46 +08:00
|
|
|
KeyPosition(const KeyPosition& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
|
|
|
|
osg::Object(rhs, copyop),
|
|
|
|
_key(rhs._key),
|
|
|
|
_x(rhs._x),
|
|
|
|
_y(rhs._y),
|
|
|
|
_forwardToDevices(rhs._forwardToDevices) {}
|
|
|
|
|
|
|
|
META_Object(osgPresentation, KeyPosition);
|
|
|
|
|
|
|
|
KeyPosition& operator = (const KeyPosition& rhs)
|
|
|
|
{
|
|
|
|
if (&rhs==this) return *this;
|
|
|
|
_key = rhs._key;
|
|
|
|
_x = rhs._x;
|
|
|
|
_y = rhs._y;
|
|
|
|
_forwardToDevices = rhs._forwardToDevices;
|
|
|
|
return *this;
|
|
|
|
}
|
2009-04-30 04:30:21 +08:00
|
|
|
|
2013-12-19 21:49:27 +08:00
|
|
|
void set(unsigned int key=0, float x=FLT_MAX, float y=FLT_MAX, bool forward_to_devices = false)
|
2009-04-30 04:30:21 +08:00
|
|
|
{
|
|
|
|
_key = (osgGA::GUIEventAdapter::KeySymbol)key;
|
|
|
|
_x = x;
|
|
|
|
_y = y;
|
2013-12-19 21:49:27 +08:00
|
|
|
_forwardToDevices = forward_to_devices;
|
2009-04-30 04:30:21 +08:00
|
|
|
}
|
|
|
|
|
2014-03-11 03:08:46 +08:00
|
|
|
void setKey(int key) { _key = static_cast<osgGA::GUIEventAdapter::KeySymbol>(key); }
|
|
|
|
int getKey() const { return _key; }
|
|
|
|
|
|
|
|
void setX(float x) { _x = x; }
|
|
|
|
float getX() const { return _x; }
|
|
|
|
|
|
|
|
void setY(float y) { _y = y; }
|
|
|
|
float getY() const { return _y; }
|
|
|
|
|
|
|
|
void setForwardToDevices(bool flag) { _forwardToDevices = flag; }
|
|
|
|
bool getForwardToDevices() const { return _forwardToDevices; }
|
|
|
|
|
|
|
|
|
2009-04-30 04:30:21 +08:00
|
|
|
osgGA::GUIEventAdapter::KeySymbol _key;
|
2014-03-11 03:08:46 +08:00
|
|
|
float _x;
|
|
|
|
float _y;
|
|
|
|
bool _forwardToDevices;
|
2009-04-30 04:30:21 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct LayerCallback : public virtual osg::Referenced
|
|
|
|
{
|
|
|
|
virtual void operator() (osg::Node* node) const = 0;
|
|
|
|
};
|
|
|
|
|
2009-06-25 00:03:49 +08:00
|
|
|
struct OSGPRESENTATION_EXPORT LayerAttributes : public virtual osg::Referenced
|
2009-04-30 04:30:21 +08:00
|
|
|
{
|
2012-11-10 05:32:54 +08:00
|
|
|
LayerAttributes():_duration(0) {}
|
|
|
|
LayerAttributes(double in_duration):_duration(in_duration) {}
|
2009-04-30 04:30:21 +08:00
|
|
|
|
|
|
|
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); }
|
|
|
|
|
2012-11-10 05:32:54 +08:00
|
|
|
void setJump(const JumpData& jumpData) { _jumpData = jumpData; }
|
|
|
|
const JumpData& getJumpData() const { return _jumpData; }
|
2009-04-30 04:30:21 +08:00
|
|
|
|
2012-11-10 05:32:54 +08:00
|
|
|
double _duration;
|
|
|
|
Keys _keys;
|
|
|
|
RunStrings _runStrings;
|
|
|
|
JumpData _jumpData;
|
2009-04-30 04:30:21 +08:00
|
|
|
|
|
|
|
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;
|
|
|
|
};
|
2009-04-27 19:02:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2012-10-29 23:58:02 +08:00
|
|
|
virtual void enter(SlideEventHandler*) = 0;
|
2013-01-11 03:55:50 +08:00
|
|
|
virtual void frame(SlideEventHandler*) {} ;
|
2012-10-29 23:58:02 +08:00
|
|
|
virtual void maintain(SlideEventHandler*) = 0;
|
|
|
|
virtual void leave(SlideEventHandler*) = 0;
|
|
|
|
virtual void setPause(SlideEventHandler*, bool pause) = 0;
|
|
|
|
virtual void reset(SlideEventHandler*) = 0;
|
2009-04-27 19:02:18 +08:00
|
|
|
|
|
|
|
virtual ~ObjectOperator() {}
|
|
|
|
};
|
|
|
|
|
2009-06-25 00:03:49 +08:00
|
|
|
class OSGPRESENTATION_EXPORT ActiveOperators
|
2009-04-27 19:02:18 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
ActiveOperators();
|
|
|
|
~ActiveOperators();
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2009-04-27 19:02:18 +08:00
|
|
|
void collect(osg::Node* incommingNode, osg::NodeVisitor::TraversalMode tm = osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN);
|
|
|
|
|
2012-10-29 23:58:02 +08:00
|
|
|
void process(SlideEventHandler* seh);
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2013-01-11 03:55:50 +08:00
|
|
|
void frame(SlideEventHandler*);
|
|
|
|
|
2012-10-29 23:58:02 +08:00
|
|
|
void setPause(SlideEventHandler* seh, bool pause);
|
2009-04-27 19:02:18 +08:00
|
|
|
bool getPause() const { return _pause; }
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2012-10-29 23:58:02 +08:00
|
|
|
void reset(SlideEventHandler* seh);
|
2009-04-27 19:02:18 +08:00
|
|
|
|
|
|
|
typedef std::set< osg::ref_ptr<ObjectOperator>, dereference_less > OperatorList;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2012-10-29 23:58:02 +08:00
|
|
|
void processOutgoing(SlideEventHandler* seh);
|
|
|
|
void processIncomming(SlideEventHandler* seh);
|
|
|
|
void processMaintained(SlideEventHandler* seh);
|
2013-08-19 02:10:39 +08:00
|
|
|
|
2009-04-27 19:02:18 +08:00
|
|
|
bool _pause;
|
|
|
|
|
|
|
|
OperatorList _previous;
|
|
|
|
OperatorList _current;
|
|
|
|
|
|
|
|
OperatorList _outgoing;
|
|
|
|
OperatorList _incomming;
|
|
|
|
OperatorList _maintained;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2009-06-25 00:03:49 +08:00
|
|
|
class OSGPRESENTATION_EXPORT SlideEventHandler : public osgGA::GUIEventHandler
|
2009-04-27 19:02:18 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
SlideEventHandler(osgViewer::Viewer* viewer=0);
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2009-04-27 19:02:18 +08:00
|
|
|
static SlideEventHandler* instance();
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2014-03-11 03:08:46 +08:00
|
|
|
META_Object(osgPresentation,SlideEventHandler);
|
2009-04-27 19:02:18 +08:00
|
|
|
|
|
|
|
void set(osg::Node* model);
|
|
|
|
|
|
|
|
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&);
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2009-04-27 19:02:18 +08:00
|
|
|
virtual void getUsage(osg::ApplicationUsage& usage) const;
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2009-04-27 19:02:18 +08:00
|
|
|
osgViewer::Viewer* getViewer() { return _viewer.get(); }
|
|
|
|
|
2012-11-10 05:32:54 +08:00
|
|
|
osg::Switch* getPresentationSwitch() { return _presentationSwitch.get(); }
|
|
|
|
|
2009-04-27 19:02:18 +08:00
|
|
|
enum WhichPosition
|
|
|
|
{
|
|
|
|
FIRST_POSITION = 0,
|
2009-05-04 02:51:13 +08:00
|
|
|
LAST_POSITION = -1
|
2009-04-27 19:02:18 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
void compileSlide(unsigned int slideNum);
|
|
|
|
void releaseSlide(unsigned int slideNum);
|
|
|
|
|
|
|
|
unsigned int getNumSlides();
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2009-05-04 02:51:13 +08:00
|
|
|
int getActiveSlide() const { return _activeSlide; }
|
|
|
|
int getActiveLayer() const { return _activeLayer; }
|
2009-04-27 19:02:18 +08:00
|
|
|
|
2012-11-10 05:32:54 +08:00
|
|
|
osg::Switch* getSlide(int slideNum);
|
|
|
|
osg::Node* getLayer(int slideNum, int layerNum);
|
|
|
|
|
2009-05-04 02:51:13 +08:00
|
|
|
bool selectSlide(int slideNum,int layerNum=FIRST_POSITION);
|
|
|
|
bool selectLayer(int layerNum);
|
2009-04-27 19:02:18 +08:00
|
|
|
|
|
|
|
bool nextLayerOrSlide();
|
|
|
|
bool previousLayerOrSlide();
|
|
|
|
|
|
|
|
bool nextSlide();
|
|
|
|
bool previousSlide();
|
|
|
|
|
|
|
|
bool nextLayer();
|
|
|
|
bool previousLayer();
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2009-04-27 19:02:18 +08:00
|
|
|
bool home();
|
|
|
|
|
|
|
|
void setAutoSteppingActive(bool flag = true) { _autoSteppingActive = flag; }
|
|
|
|
bool getAutoSteppingActive() const { return _autoSteppingActive; }
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2009-04-27 19:02:18 +08:00
|
|
|
void setTimeDelayBetweenSlides(double dt) { _timePerSlide = dt; }
|
|
|
|
double getTimeDelayBetweenSlides() const { return _timePerSlide; }
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2009-04-27 19:02:18 +08:00
|
|
|
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; }
|
|
|
|
|
2014-03-11 03:08:46 +08:00
|
|
|
|
2010-03-05 20:55:08 +08:00
|
|
|
void dispatchEvent(const KeyPosition& keyPosition);
|
2014-03-11 03:08:46 +08:00
|
|
|
void dispatchEvent(osgGA::Event* event);
|
|
|
|
|
2013-12-19 21:49:27 +08:00
|
|
|
void forwardEventToDevices(osgGA::Event* event);
|
2009-04-27 19:02:18 +08:00
|
|
|
|
2011-11-04 20:50:05 +08:00
|
|
|
void setRequestReload(bool flag);
|
|
|
|
bool getRequestReload() const { return _requestReload; }
|
|
|
|
|
2013-01-11 03:55:50 +08:00
|
|
|
double getReferenceTime() const { return _referenceTime; }
|
|
|
|
|
2009-04-27 19:02:18 +08:00
|
|
|
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);
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2012-10-29 23:58:02 +08:00
|
|
|
void updateOperators();
|
|
|
|
|
2009-04-27 19:02:18 +08:00
|
|
|
|
|
|
|
osg::observer_ptr<osgViewer::Viewer> _viewer;
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2009-04-30 04:55:48 +08:00
|
|
|
osg::observer_ptr<osg::Switch> _showSwitch;
|
2009-05-04 02:51:13 +08:00
|
|
|
int _activePresentation;
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2009-04-30 04:55:48 +08:00
|
|
|
osg::observer_ptr<osg::Switch> _presentationSwitch;
|
2009-05-04 02:51:13 +08:00
|
|
|
int _activeSlide;
|
2009-04-27 19:02:18 +08:00
|
|
|
|
2009-04-30 04:55:48 +08:00
|
|
|
osg::observer_ptr<osg::Switch> _slideSwitch;
|
2009-05-04 02:51:13 +08:00
|
|
|
int _activeLayer;
|
2009-04-27 19:02:18 +08:00
|
|
|
|
|
|
|
bool _firstTraversal;
|
2013-01-11 03:55:50 +08:00
|
|
|
double _referenceTime;
|
2009-04-27 19:02:18 +08:00
|
|
|
double _previousTime;
|
|
|
|
double _timePerSlide;
|
|
|
|
bool _autoSteppingActive;
|
|
|
|
bool _loopPresentation;
|
|
|
|
bool _pause;
|
|
|
|
bool _hold;
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2009-04-27 19:02:18 +08:00
|
|
|
bool _updateLightActive;
|
|
|
|
bool _updateOpacityActive;
|
|
|
|
float _previousX, _previousY;
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2009-04-27 19:02:18 +08:00
|
|
|
bool _cursorOn;
|
|
|
|
|
|
|
|
bool _releaseAndCompileOnEachNewSlide;
|
|
|
|
|
|
|
|
bool _firstSlideOrLayerChange;
|
|
|
|
osg::Timer_t _tickAtFirstSlideOrLayerChange;
|
|
|
|
osg::Timer_t _tickAtLastSlideOrLayerChange;
|
|
|
|
|
|
|
|
float _timeDelayOnNewSlideWithMovies;
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2009-04-27 19:02:18 +08:00
|
|
|
double _minimumTimeBetweenKeyPresses;
|
|
|
|
double _timeLastKeyPresses;
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2009-04-27 19:02:18 +08:00
|
|
|
ActiveOperators _activeOperators;
|
2012-03-22 01:36:20 +08:00
|
|
|
|
2009-06-25 00:03:49 +08:00
|
|
|
osg::ref_ptr<CompileSlideCallback> _compileSlideCallback;
|
2009-04-27 19:02:18 +08:00
|
|
|
|
2011-11-04 20:50:05 +08:00
|
|
|
bool _requestReload;
|
2009-04-27 19:02:18 +08:00
|
|
|
};
|
|
|
|
|
2009-04-30 04:30:21 +08:00
|
|
|
}
|
|
|
|
|
2009-04-27 19:02:18 +08:00
|
|
|
#endif
|