Intial work towards support an interaction <imagesequence> tag in Present3D.

This commit is contained in:
Robert Osfield
2012-10-29 15:58:02 +00:00
parent ce623c697e
commit d879cd7715
6 changed files with 249 additions and 99 deletions

View File

@@ -142,17 +142,20 @@ struct dereference_less
}
};
// forward declare
class SlideEventHandler;
struct ObjectOperator : public osg::Referenced
{
inline bool operator < (const ObjectOperator& rhs) const { return ptr() < rhs.ptr(); }
virtual void* ptr() const = 0;
virtual void enter() = 0;
virtual void maintain() = 0;
virtual void leave() = 0;
virtual void setPause(bool pause) = 0;
virtual void reset() = 0;
virtual void enter(SlideEventHandler*) = 0;
virtual void maintain(SlideEventHandler*) = 0;
virtual void leave(SlideEventHandler*) = 0;
virtual void setPause(SlideEventHandler*, bool pause) = 0;
virtual void reset(SlideEventHandler*) = 0;
virtual ~ObjectOperator() {}
};
@@ -165,21 +168,21 @@ public:
void collect(osg::Node* incommingNode, osg::NodeVisitor::TraversalMode tm = osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN);
void process();
void process(SlideEventHandler* seh);
void setPause(bool pause);
void setPause(SlideEventHandler* seh, bool pause);
bool getPause() const { return _pause; }
void reset();
void reset(SlideEventHandler* seh);
typedef std::set< osg::ref_ptr<ObjectOperator>, dereference_less > OperatorList;
protected:
void processOutgoing();
void processIncomming();
void processMaintained();
void processOutgoing(SlideEventHandler* seh);
void processIncomming(SlideEventHandler* seh);
void processMaintained(SlideEventHandler* seh);
bool _pause;
OperatorList _previous;
@@ -266,6 +269,8 @@ public:
void setRequestReload(bool flag);
bool getRequestReload() const { return _requestReload; }
void setNormalizedMousePosition(const osg::Vec2& pos) { _normalizedMousePosition = pos; }
const osg::Vec2& getNormalizedMousePosition() const { return _normalizedMousePosition; }
protected:
@@ -277,6 +282,8 @@ protected:
void updateAlpha(bool, bool, float x, float y);
void updateLight(float x, float y);
void updateOperators();
osg::observer_ptr<osgViewer::Viewer> _viewer;
@@ -320,8 +327,7 @@ protected:
bool _requestReload;
void updateOperators();
osg::Vec2 _normalizedMousePosition;
};
}

View File

@@ -242,7 +242,9 @@ public:
backgroundColor(1.0f,1.0f,1.0f,1.0f),
fps(30.0),
duration(-1.0),
imageSequencePagingMode(osg::ImageSequence::PAGE_AND_DISCARD_USED_IMAGES)
imageSequence(false),
imageSequencePagingMode(osg::ImageSequence::PAGE_AND_DISCARD_USED_IMAGES),
imageSequenceInteractionMode(PLAY_AUTOMATICALLY_LIKE_MOVIE)
{}
std::string options;
@@ -256,7 +258,17 @@ public:
osg::Vec4 backgroundColor;
double fps;
double duration;
bool imageSequence;
osg::ImageSequence::Mode imageSequencePagingMode;
enum ImageSequenceInteractionMode
{
PLAY_AUTOMATICALLY_LIKE_MOVIE,
USE_MOUSE_X_POSITION
};
ImageSequenceInteractionMode imageSequenceInteractionMode;
};
struct VolumeData