~thumper/nux/next-changes

« back to all changes in this revision

Viewing changes to NuxGraphics/IOpenGLVolumeTexture.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 IOPENGLVOLUMETEXTURE_H
 
24
#define IOPENGLVOLUMETEXTURE_H
 
25
 
 
26
NAMESPACE_BEGIN_OGL
 
27
 
 
28
class IOpenGLBaseTexture;
 
29
class IOpenGLVolumeTexture: public IOpenGLBaseTexture
 
30
{
 
31
    DECLARE_OBJECT_TYPE(IOpenGLVolumeTexture, IOpenGLBaseTexture);
 
32
 
 
33
public:
 
34
    virtual ~IOpenGLVolumeTexture();
 
35
 
 
36
    int GetVolumeLevel(
 
37
        int Level,
 
38
        IOpenGLVolume ** ppVolumeLevel
 
39
        );
 
40
 
 
41
    int LockRect(
 
42
        int Slice,
 
43
        int Level,
 
44
        SURFACE_LOCKED_RECT * pLockedRect,
 
45
        const SURFACE_RECT * pRect);
 
46
 
 
47
    int UnlockRect(
 
48
        int Slice,
 
49
        int Level
 
50
        );
 
51
 
 
52
    int LockBox(
 
53
        int Level,
 
54
        VOLUME_LOCKED_BOX * pLockedVolume,
 
55
        const VOLUME_BOX * pBox);
 
56
 
 
57
    int UnlockBox(
 
58
        int Level
 
59
        );
 
60
 
 
61
    int GetLevelDepth(int MipLevel) const {return ImageSurface::GetLevelDim(_PixelFormat, _Depth, MipLevel);}
 
62
 
 
63
    int GetLevelDesc(
 
64
        int Level,
 
65
        VOLUME_DESC * pDesc
 
66
        )
 
67
    {
 
68
        nuxAssert(Level >= 0 );
 
69
        nuxAssert(Level < _NumMipLevel);
 
70
 
 
71
        if((Level < 0) || (Level > _NumMipLevel))
 
72
        {
 
73
            pDesc->Width    = 0;
 
74
            pDesc->Height   = 0;
 
75
            pDesc->Depth    = 0;
 
76
            pDesc->PixelFormat   = BITFMT_UNKNOWN;
 
77
            pDesc->Type     = _ResourceType;
 
78
        }
 
79
        else
 
80
        {
 
81
            pDesc->Width    = Max<unsigned int>(1, _Width >> Level);
 
82
            pDesc->Height   = Max<unsigned int>(1, _Height >> Level);
 
83
            pDesc->Depth    = _Depth;
 
84
            pDesc->PixelFormat   = _PixelFormat;
 
85
            pDesc->Type     = _ResourceType;
 
86
        }
 
87
    }
 
88
 
 
89
private:
 
90
 
 
91
    IOpenGLVolumeTexture(
 
92
        unsigned int Width
 
93
        , unsigned int Height
 
94
        , unsigned int Depth
 
95
        , unsigned int Levels
 
96
        , BitmapFormat PixelFormat);
 
97
 
 
98
    std::vector< TRefGL<IOpenGLSurface> > *_VolumeSurfaceArray;
 
99
    std::vector< TRefGL<IOpenGLVolume> > _VolumeArray;
 
100
 
 
101
    friend class GLDeviceFactory;
 
102
    friend class IOpenGLSurface;
 
103
};
 
104
 
 
105
NAMESPACE_END_OGL
 
106
 
 
107
#endif // IOPENGLVOLUMETEXTURE_H