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

Revision 8990, 3.0 kB (checked in by robert, 5 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
Line 
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
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/**
22  * Image Stream class.
23*/
24class OSG_EXPORT ImageStream : public Image
25{
26    public:
27        ImageStream();
28
29        /** Copy constructor using CopyOp to manage deep vs shallow copy. */
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
38        /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
39        virtual int compare(const Image& rhs) const;
40
41        enum StreamStatus
42        {
43            INVALID,
44            PLAYING,
45            PAUSED,
46            REWINDING
47        };
48       
49        virtual void seek(double /*time*/) {}
50
51        virtual void play() { _status=PLAYING; }
52
53        virtual void pause() { _status=PAUSED; }
54
55        virtual void rewind() { _status=REWINDING; }
56       
57        virtual void quit(bool /*waitForThreadToExit*/ = true) {}
58
59        StreamStatus getStatus() { return _status; }
60       
61
62        enum LoopingMode
63        {
64            NO_LOOPING,
65            LOOPING
66        };
67       
68        void setLoopingMode(LoopingMode mode)
69        {
70            if (_loopingMode == mode) return;
71           
72            _loopingMode = mode;
73            applyLoopingMode();
74        }
75       
76        LoopingMode getLoopingMode() const { return _loopingMode; }
77
78
79        virtual double getLength() const { return 0.0; }
80       
81        virtual void setReferenceTime(double) {}
82        virtual double getReferenceTime() const { return 0.0; }
83               
84        virtual void setTimeMultiplier(double) {}
85        virtual double getTimeMultiplier() const { return 0.0; }
86       
87        virtual void setVolume(float) {}
88        virtual float getVolume() const { return 0.0f; }
89       
90
91    protected:
92        virtual void applyLoopingMode() {}
93
94        virtual ~ImageStream() {}
95
96        StreamStatus    _status;
97        LoopingMode     _loopingMode;
98};
99
100} // namespace
101
102#endif
Note: See TracBrowser for help on using the browser.