~thumper/nux/next-changes

« back to all changes in this revision

Viewing changes to NuxGraphics/IOpenGLCubeTexture.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 IOPENGLCUBETEXTURE_H
 
24
#define IOPENGLCUBETEXTURE_H
 
25
 
 
26
NAMESPACE_BEGIN_OGL
 
27
 
 
28
class IOpenGLBaseTexture;
 
29
class IOpenGLCubeTexture: public IOpenGLBaseTexture
 
30
{
 
31
    DECLARE_OBJECT_TYPE(IOpenGLCubeTexture, IOpenGLBaseTexture);
 
32
 
 
33
public:
 
34
    virtual ~IOpenGLCubeTexture();
 
35
 
 
36
    int GetCubeMapSurface(
 
37
        eCUBEMAP_FACES FaceType,
 
38
        int Level,
 
39
        IOpenGLSurface ** ppCubeMapSurface
 
40
        );
 
41
 
 
42
    int LockRect(
 
43
        eCUBEMAP_FACES FaceType,
 
44
        int Level,
 
45
        SURFACE_LOCKED_RECT * pLockedRect,
 
46
        const SURFACE_RECT * pRect);
 
47
 
 
48
    int UnlockRect(
 
49
        eCUBEMAP_FACES FaceType,
 
50
        int Level
 
51
        );
 
52
 
 
53
    unsigned int EnableGammaCorrection(bool b);
 
54
 
 
55
    int GetLevelDesc(
 
56
        int Level,
 
57
        SURFACE_DESC * pDesc
 
58
        )
 
59
    {
 
60
        nuxAssert(Level >= 0 );
 
61
        nuxAssert(Level < _NumMipLevel);
 
62
 
 
63
        if((Level < 0) || (Level > _NumMipLevel))
 
64
        {
 
65
            pDesc->Width    = 0;
 
66
            pDesc->Height   = 0;
 
67
            pDesc->PixelFormat   = BITFMT_UNKNOWN;
 
68
            pDesc->Type     = _ResourceType;
 
69
        }
 
70
        else
 
71
        {
 
72
            pDesc->Width    = Max<unsigned int>(1, _Width >> Level);
 
73
            pDesc->Height   = Max<unsigned int>(1, _Height >> Level);
 
74
            pDesc->PixelFormat   = _PixelFormat;
 
75
            pDesc->Type     = _ResourceType;
 
76
        }
 
77
 
 
78
        return 1;
 
79
    }
 
80
private:
 
81
 
 
82
    IOpenGLCubeTexture(
 
83
        unsigned int EdgeLength
 
84
        , int Levels
 
85
        , BitmapFormat PixelFormat);
 
86
 
 
87
    //    unsigned int        _Width;
 
88
    //    unsigned int        _Height;
 
89
    std::map<eCUBEMAP_FACES, std::vector<IOpenGLSurface*>* > _SurfaceArray;
 
90
 
 
91
    friend class GLDeviceFactory;
 
92
    friend class IOpenGLSurface;
 
93
};
 
94
 
 
95
NAMESPACE_END_OGL
 
96
#endif // IOPENGLCUBETEXTURE_H