root/OpenSceneGraph/trunk/include/osg/ImageStream @ 8990

Revision 8990, 3.0 kB (checked in by robert, 6 years ago)

Refactored ImageSequence? to provided a cleaner and more robust implementation

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
RevLine 
[5328]1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
[2793]2 *
3 * This library is open source and may be redistributed and/or modified under 
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version.  The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSG_IMAGESTREAM
15#define OSG_IMAGESTREAM 1
16
17#include <osg/Image>
18
19namespace osg {
20
21/**
[3405]22  * Image Stream class.
23*/
[4021]24class OSG_EXPORT ImageStream : public Image
[2793]25{
26    public:
27        ImageStream();
28
[3405]29        /** Copy constructor using CopyOp to manage deep vs shallow copy. */
[2793]30        ImageStream(const ImageStream& image,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
31
32        virtual Object* cloneType() const { return new ImageStream(); }
33        virtual Object* clone(const CopyOp& copyop) const { return new ImageStream(*this,copyop); }
34        virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const ImageStream*>(obj)!=0; }
35        virtual const char* libraryName() const { return "osg"; }
36        virtual const char* className() const { return "ImageStream"; }
37
[3405]38        /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
[2793]39        virtual int compare(const Image& rhs) const;
40
[4803]41        enum StreamStatus
[2793]42        {
[3859]43            INVALID,
[2793]44            PLAYING,
45            PAUSED,
46            REWINDING
47        };
48       
[8755]49        virtual void seek(double /*time*/) {}
50
[2793]51        virtual void play() { _status=PLAYING; }
52
53        virtual void pause() { _status=PAUSED; }
54
55        virtual void rewind() { _status=REWINDING; }
[3179]56       
[3405]57        virtual void quit(bool /*waitForThreadToExit*/ = true) {}
[2793]58
59        StreamStatus getStatus() { return _status; }
60       
[3317]61
62        enum LoopingMode
63        {
64            NO_LOOPING,
65            LOOPING
66        };
67       
[8990]68        void setLoopingMode(LoopingMode mode)
69        {
70            if (_loopingMode == mode) return;
71           
72            _loopingMode = mode;
73            applyLoopingMode();
74        }
75       
[3317]76        LoopingMode getLoopingMode() const { return _loopingMode; }
77
78
[6557]79        virtual double getLength() const { return 0.0; }
80       
[2793]81        virtual void setReferenceTime(double) {}
82        virtual double getReferenceTime() const { return 0.0; }
83               
84        virtual void setTimeMultiplier(double) {}
[7042]85        virtual double getTimeMultiplier() const { return 0.0; }
[2793]86       
[7042]87        virtual void setVolume(float) {}
88        virtual float getVolume() const { return 0.0f; }
89       
[2793]90
91    protected:
[6802]92        virtual void applyLoopingMode() {}
[2793]93
94        virtual ~ImageStream() {}
95
96        StreamStatus    _status;
[3317]97        LoopingMode     _loopingMode;
[2793]98};
99
100} // namespace
101
102#endif
Note: See TracBrowser for help on using the browser.