~thumper/nux/next-changes

« back to all changes in this revision

Viewing changes to NuxGraphics/IOpenGLAnimatedTexture.h

  • Committer: Neil Jagdish Patel
  • Date: 2010-09-01 21:15:42 UTC
  • Revision ID: neil.patel@canonical.com-20100901211542-cw2ce3ak28unouwb
Add NuxGraphics with licensing

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2010 Inalogic Inc.
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify it 
 
5
 * under the terms of the GNU Lesser General Public License version 3, as
 
6
 * published by the  Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful, but 
 
9
 * WITHOUT ANY WARRANTY; without even the implied warranties of 
 
10
 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR 
 
11
 * PURPOSE.  See the applicable version of the GNU Lesser General Public 
 
12
 * License for more details.
 
13
 * 
 
14
 * You should have received a copy of both the GNU Lesser General Public 
 
15
 * License version 3 along with this program.  If not, see 
 
16
 * <http://www.gnu.org/licenses/>
 
17
 *
 
18
 * Authored by: Jay Taoko <jay.taoko_AT_gmail_DOT_com>
 
19
 *
 
20
 */
 
21
 
 
22
 
 
23
#ifndef IOPENGLANIMATEDTEXTURE_H
 
24
#define IOPENGLANIMATEDTEXTURE_H
 
25
 
 
26
NAMESPACE_BEGIN_OGL
 
27
 
 
28
class IOpenGLBaseTexture;
 
29
class IOpenGLRectangleTexture;
 
30
 
 
31
// Note that for Animated texture, the Depth value is the number of frames.
 
32
// The number of mipmap levels is always 1;
 
33
class IOpenGLAnimatedTexture: public IOpenGLBaseTexture
 
34
{
 
35
    DECLARE_OBJECT_TYPE(IOpenGLAnimatedTexture, IOpenGLBaseTexture);
 
36
 
 
37
public:
 
38
    virtual ~IOpenGLAnimatedTexture();
 
39
 
 
40
    void GetSurfaceFrame(int Frame, TRefGL<IOpenGLSurface>& surface);
 
41
    TRefGL<IOpenGLSurface> GetSurfaceFrame(int Level);
 
42
 
 
43
    int LockRect(
 
44
        int Frame,
 
45
        SURFACE_LOCKED_RECT * pLockedRect,
 
46
        const SURFACE_RECT * pRect);
 
47
 
 
48
    int UnlockRect(
 
49
        int Frame
 
50
        );
 
51
 
 
52
    int GetDepth(int MipLevel) const {return _Depth;}
 
53
 
 
54
    int GetDesc(ANIMATEDTEXTURE_DESC* pDesc)
 
55
    {
 
56
        pDesc->Width    = Max<unsigned int>(1, _Width);
 
57
        pDesc->Height   = Max<unsigned int>(1, _Height);
 
58
        pDesc->Depth    = _Depth;
 
59
        pDesc->PixelFormat   = _PixelFormat;
 
60
        pDesc->Type     = _ResourceType;
 
61
    }
 
62
 
 
63
    void PresentFirstFrame();
 
64
    void PresentNextFrame();
 
65
    void PresentLastFrame();
 
66
    int GetFrameTime();
 
67
    t_u32 GetNumFrame();
 
68
    void SetFrameTime(int Frame, int time_ms);
 
69
 
 
70
private:
 
71
    IOpenGLAnimatedTexture(
 
72
        unsigned int Width
 
73
        , unsigned int Height
 
74
        , unsigned int Depth
 
75
        , BitmapFormat PixelFormat);
 
76
 
 
77
    //    unsigned int        _Width;
 
78
    //    unsigned int        _Height;
 
79
    //    unsigned int        _Depth;
 
80
    //std::vector<IOpenGLSurface*> _VolumeArray;
 
81
 
 
82
    int _CurrentFrame;
 
83
    std::vector< TRefGL<IOpenGLRectangleTexture> > _FrameTextureArray;
 
84
 
 
85
    std::vector< int >  _FrameTimeArray;
 
86
 
 
87
    friend class GLDeviceFactory;
 
88
    friend class IOpenGLSurface;
 
89
};
 
90
NAMESPACE_END_OGL
 
91
 
 
92
#endif // IOPENGLANIMATEDTEXTURE_H