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

Revision 13041, 3.4 kB (checked in by robert, 2 years ago)

Ran script to remove trailing spaces and tabs

  • 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#include <osg/AudioStream>
19
20namespace osg {
21
22/**
23  * Image Stream class.
24*/
25class OSG_EXPORT ImageStream : public Image
26{
27    public:
28        ImageStream();
29
30        /** Copy constructor using CopyOp to manage deep vs shallow copy. */
31        ImageStream(const ImageStream& image,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
32
33        virtual Object* cloneType() const { return new ImageStream(); }
34        virtual Object* clone(const CopyOp& copyop) const { return new ImageStream(*this,copyop); }
35        virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const ImageStream*>(obj)!=0; }
36        virtual const char* libraryName() const { return "osg"; }
37        virtual const char* className() const { return "ImageStream"; }
38
39        /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
40        virtual int compare(const Image& rhs) const;
41
42        enum StreamStatus
43        {
44            INVALID,
45            PLAYING,
46            PAUSED,
47            REWINDING
48        };
49
50        virtual void seek(double /*time*/) {}
51
52        virtual void play() { _status=PLAYING; }
53
54        virtual void pause() { _status=PAUSED; }
55
56        virtual void rewind() { _status=REWINDING; }
57
58        virtual void quit(bool /*waitForThreadToExit*/ = true) {}
59
60        StreamStatus getStatus() { return _status; }
61
62
63        enum LoopingMode
64        {
65            NO_LOOPING,
66            LOOPING
67        };
68
69        void setLoopingMode(LoopingMode mode)
70        {
71            if (_loopingMode == mode) return;
72
73            _loopingMode = mode;
74            applyLoopingMode();
75        }
76
77        LoopingMode getLoopingMode() const { return _loopingMode; }
78
79        virtual double getCreationTime() const { return HUGE_VAL; }
80        virtual double getLength() const { return 0.0; }
81        virtual double getFrameRate() const { return 0.0; }
82        virtual double getCurrentTime() const { return 0.0; }
83
84        virtual void setReferenceTime(double) {}
85        virtual double getReferenceTime() const { return 0.0; }
86
87        virtual void setTimeMultiplier(double) {}
88        virtual double getTimeMultiplier() const { return 0.0; }
89
90        virtual void setVolume(float) {}
91        virtual float getVolume() const { return 0.0f; }
92
93        typedef std::vector< osg::ref_ptr<osg::AudioStream> > AudioStreams;
94        void setAudioStreams(const AudioStreams& asl) { _audioStreams = asl; }
95        AudioStreams& getAudioStreams() { return _audioStreams; }
96        const AudioStreams& getAudioStreams() const { return _audioStreams; }
97
98
99    protected:
100        virtual void applyLoopingMode() {}
101
102        virtual ~ImageStream() {}
103
104        StreamStatus    _status;
105        LoopingMode     _loopingMode;
106
107        AudioStreams    _audioStreams;
108};
109
110} // namespace
111
112#endif
Note: See TracBrowser for help on using the browser.