2006-07-18 23:21:48 +08:00
|
|
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
2004-03-09 17:42:07 +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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OSG_IMAGESTREAM
|
|
|
|
#define OSG_IMAGESTREAM 1
|
|
|
|
|
|
|
|
#include <osg/Image>
|
|
|
|
|
|
|
|
namespace osg {
|
|
|
|
|
|
|
|
/**
|
2004-09-13 23:14:11 +08:00
|
|
|
* Image Stream class.
|
|
|
|
*/
|
2005-04-12 01:14:17 +08:00
|
|
|
class OSG_EXPORT ImageStream : public Image
|
2004-03-09 17:42:07 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
ImageStream();
|
|
|
|
|
2004-09-13 23:14:11 +08:00
|
|
|
/** Copy constructor using CopyOp to manage deep vs shallow copy. */
|
2004-03-09 17:42:07 +08:00
|
|
|
ImageStream(const ImageStream& image,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
|
|
|
|
|
|
|
|
virtual Object* cloneType() const { return new ImageStream(); }
|
|
|
|
virtual Object* clone(const CopyOp& copyop) const { return new ImageStream(*this,copyop); }
|
|
|
|
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const ImageStream*>(obj)!=0; }
|
|
|
|
virtual const char* libraryName() const { return "osg"; }
|
|
|
|
virtual const char* className() const { return "ImageStream"; }
|
|
|
|
|
2004-09-13 23:14:11 +08:00
|
|
|
/** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
|
2004-03-09 17:42:07 +08:00
|
|
|
virtual int compare(const Image& rhs) const;
|
|
|
|
|
2005-11-18 01:44:48 +08:00
|
|
|
enum StreamStatus
|
2004-03-09 17:42:07 +08:00
|
|
|
{
|
2005-02-25 01:07:37 +08:00
|
|
|
INVALID,
|
2004-03-09 17:42:07 +08:00
|
|
|
PLAYING,
|
|
|
|
PAUSED,
|
|
|
|
REWINDING
|
|
|
|
};
|
|
|
|
|
|
|
|
virtual void play() { _status=PLAYING; }
|
|
|
|
|
|
|
|
virtual void pause() { _status=PAUSED; }
|
|
|
|
|
|
|
|
virtual void rewind() { _status=REWINDING; }
|
2004-07-23 17:15:22 +08:00
|
|
|
|
2004-09-13 23:14:11 +08:00
|
|
|
virtual void quit(bool /*waitForThreadToExit*/ = true) {}
|
2004-03-09 17:42:07 +08:00
|
|
|
|
|
|
|
StreamStatus getStatus() { return _status; }
|
|
|
|
|
2004-08-24 20:55:15 +08:00
|
|
|
|
|
|
|
enum LoopingMode
|
|
|
|
{
|
|
|
|
NO_LOOPING,
|
|
|
|
LOOPING
|
|
|
|
};
|
|
|
|
|
2007-06-02 03:19:23 +08:00
|
|
|
void setLoopingMode(LoopingMode mode) { _loopingMode = mode; applyLoopingMode(); }
|
2004-08-24 20:55:15 +08:00
|
|
|
LoopingMode getLoopingMode() const { return _loopingMode; }
|
|
|
|
|
|
|
|
|
2007-04-26 16:11:09 +08:00
|
|
|
virtual double getLength() const { return 0.0; }
|
|
|
|
|
2004-03-09 17:42:07 +08:00
|
|
|
virtual void setReferenceTime(double) {}
|
|
|
|
virtual double getReferenceTime() const { return 0.0; }
|
|
|
|
|
|
|
|
virtual void setTimeMultiplier(double) {}
|
2007-06-28 22:19:30 +08:00
|
|
|
virtual double getTimeMultiplier() const { return 0.0; }
|
|
|
|
|
|
|
|
virtual void setVolume(float) {}
|
|
|
|
virtual float getVolume() const { return 0.0f; }
|
2004-03-09 17:42:07 +08:00
|
|
|
|
|
|
|
|
|
|
|
protected:
|
2007-06-02 03:19:23 +08:00
|
|
|
virtual void applyLoopingMode() {}
|
2004-03-09 17:42:07 +08:00
|
|
|
|
|
|
|
virtual ~ImageStream() {}
|
|
|
|
|
|
|
|
StreamStatus _status;
|
2004-08-24 20:55:15 +08:00
|
|
|
LoopingMode _loopingMode;
|
2004-03-09 17:42:07 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif
|