Texture2DArray.h 2.46 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
/*
 *	(c) LSIIT, UMR CNRS/UdS
 *	Authors: F. Larue.
 *
 *	See licence.txt for additional information.
 */


#ifndef __GPU__TEXTURE2DARRAY_H__
#define __GPU__TEXTURE2DARRAY_H__




#include "GPUdefs.h"
#include "InstantiatedObject.h"
#include <map>
#include <vector>
#include "Texture2D.h"


/*
 *
 *  CLASS DECLARATION.
 *
 */

namespace GPU
{
    class Texture2DArray : public InstantiatedObject, public Texture
    {
        /********************\
        | Member variable(s) |
        \********************/
    private:
        unsigned int        m_Width;
        unsigned int        m_Height;
        unsigned int        m_Depth;

        /*****************************\
        | Constructor(s) / destructor |
        \*****************************/
    public:
        inline              Texture2DArray() : InstantiatedObject(), Texture(GL_TEXTURE_2D_ARRAY), m_Width(0), m_Height(0), m_Depth(0) {}
        inline              ~Texture2DArray()                                    { Release(); }

        /********************\
        | Member function(s) |
        \********************/
    protected:
        bool                Allocate();
        bool                Unallocate();

    public:
        bool                Create();
        inline bool         Create( GLenum internalFormat,
                                    GLsizei width,
                                    GLsizei height,
                                    GLsizei depth,
60
                                    GLsizei nMipMaps = 1 )  { GLenum f[] = {internalFormat,GL_NONE}; return Create(f,width,height,depth,nMipMaps); }
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
        bool                Create( GLenum internalFormats[],
                                    GLsizei width,
                                    GLsizei height,
                                    GLsizei depth,
                                    GLsizei nMipMaps = 1 );

        bool                LoadSlice( GLsizei sliceDepth,
                                       GLenum format,
                                       GLenum type,
                                       const GLvoid* data,
                                       GLint level = 0 );

        inline unsigned int Width() const                                       { return m_Width; }
        inline unsigned int Height() const                                      { return m_Height; }
        inline unsigned int Depth() const                                       { return m_Depth; }
    };
};




#endif //__GPU__TEXTURE2DARRAY_H__