163 lines
4.8 KiB
C++
163 lines
4.8 KiB
C++
/*
|
|
ZTexture.hpp
|
|
Author: James Russell <jcrussell@762studios.com>
|
|
Created: 04/06/2011
|
|
|
|
Purpose:
|
|
|
|
Texture interface for the ZEngine. Texture instances are loaded and created by the
|
|
renderer, which acts as a factory for the correct type of texture.
|
|
|
|
License:
|
|
|
|
TODO
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#ifndef _ZTEXTURE_HPP
|
|
#define _ZTEXTURE_HPP
|
|
|
|
#include <ZRenderer/ZRendererBuild.hpp>
|
|
#include <ZRenderer/ZRendererResource.hpp>
|
|
|
|
#include <ZUtil/ZUtil.hpp>
|
|
#include <ZUtil/ZBitmap.hpp>
|
|
|
|
//Our maximum size for a texture
|
|
#ifndef ZT_MAX_TEXTURE_DIMENSION
|
|
#define ZT_MAX_TEXTURE_DIMENSION (8096)
|
|
#endif
|
|
|
|
/*
|
|
Enumeration of texture types. Not all are currently supported.
|
|
*/
|
|
enum ZTextureType
|
|
{
|
|
ZTT_TEXTURE1D, //1D texture map
|
|
ZTT_TEXTURE2D, //2D texture map
|
|
ZTT_TEXTURE3D, //3D texture map (unsupported)
|
|
ZTT_TEXTURE_CUBE, //Cubic texture map (unsupported)
|
|
ZTT_SIZE
|
|
};
|
|
|
|
/*
|
|
Enumeration of internal storage format for texture types.
|
|
*/
|
|
enum ZTextureFormat
|
|
{
|
|
ZTF_R8, //8-bit Unsigned Red (Normalized)
|
|
ZTF_R8_SNORM, //8-bit Signed Red (Normalized)
|
|
ZTF_R8I, //8-bit Signed Red
|
|
ZTF_R8UI, //8-bit Unsigned Red
|
|
ZTF_R16, //16-bit Unsigned Red (Normalized)
|
|
ZTF_R16_SNORM, //16-bit Signed Red (Normalized)
|
|
ZTF_R16I, //16-bit Signed Red
|
|
ZTF_R16UI, //16-bit Unsigned Red
|
|
ZTF_R16F, //16-bit Floating Point Red
|
|
ZTF_R32I, //32-bit Signed Red
|
|
ZTF_R32UI, //32-bit Unsigned Red
|
|
ZTF_R32F, //32-bit Floating Point Red
|
|
|
|
ZTF_RG8, //8-bit Unsigned Red, Green (Normalized)
|
|
ZTF_RG8_SNORM, //8-bit Signed Red, Green (Normalized)
|
|
ZTF_RG8I, //8-bit Signed Red, Green
|
|
ZTF_RG8UI, //8-bit Unsigned Red, Green
|
|
ZTF_RG16, //16-bit Unsigned Red, Green (Normalized)
|
|
ZTF_RG16_SNORM, //16-bit Signed Red, Green (Normalized)
|
|
ZTF_RG16I, //16-bit Signed Red, Green
|
|
ZTF_RG16UI, //16-bit Unsigned Red, Green
|
|
ZTF_RG16F, //16-bit Floating Point Red, Green
|
|
ZTF_RG32, //32-bit Unsigned Red, Green (Normalized)
|
|
ZTF_RG32_SNORM, //32-bit Signed Red, Green (Normalized)
|
|
ZTF_RG32I, //32-bit Signed Red, Green
|
|
ZTF_RG32UI, //32-bit Unsigned Red, Green
|
|
ZTF_RG32F, //32-bit Floating Point Red, Green
|
|
|
|
ZTF_RGB8, //8-bit Unsigned Red, Green, Blue (Normalized)
|
|
ZTF_RGB8_SNORM, //8-bit Signed Red, Green, Blue (Normalized)
|
|
ZTF_RGB8I, //8-bit Signed Red, Green, Blue
|
|
ZTF_RGB8UI, //8-bit Unsigned Red, Green, Blue
|
|
ZTF_RGB16, //16-bit Unsigned Red, Green, Blue (Normalized)
|
|
ZTF_RGB16_SNORM, //16-bit Signed Red, Green, Blue (Normalized)
|
|
ZTF_RGB16I, //16-bit Signed Red, Green, Blue
|
|
ZTF_RGB16UI, //16-bit Unsigned Red, Green, Blue
|
|
ZTF_RGB16F, //16-bit Floating Point Red, Green, Blue
|
|
ZTF_RGB32, //32-bit Unsigned Red, Green, Blue (Normalized)
|
|
ZTF_RGB32_SNORM, //32-bit Signed Red, Green, Blue (Normalized)
|
|
ZTF_RGB32I, //32-bit Signed Red, Green, Blue
|
|
ZTF_RGB32UI, //32-bit Unsigned Red, Green, Blue
|
|
ZTF_RGB32F, //32-bit Floating Point Red, Green, Blue
|
|
|
|
ZTF_RGBA8, //8-bit Unsigned Red, Green, Blue, Alpha (Normalized)
|
|
ZTF_RGBA8_SNORM, //8-bit Signed Red, Green, Blue, Alpha (Normalized)
|
|
ZTF_RGBA8I, //8-bit Signed Red, Green, Blue, Alpha
|
|
ZTF_RGBA8UI, //8-bit Unsigned Red, Green, Blue, Alpha
|
|
ZTF_RGBA16, //16-bit Unsigned Red, Green, Blue, Alpha (Normalized)
|
|
ZTF_RGBA16_SNORM, //16-bit Signed Red, Green, Blue, Alpha (Normalized)
|
|
ZTF_RGBA16I, //16-bit Signed Red, Green, Blue, Alpha
|
|
ZTF_RGBA16UI, //16-bit Unsigned Red, Green, Blue, Alpha
|
|
ZTF_RGBA16F, //16-bit Floating Point Red, Green, Blue, Alpha
|
|
ZTF_RGBA32, //32-bit Unsigned Red, Green, Blue, Alpha (Normalized)
|
|
ZTF_RGBA32_SNORM, //32-bit Signed Red, Green, Blue, Alpha (Normalized)
|
|
ZTF_RGBA32I, //32-bit Signed Red, Green, Blue, Alpha
|
|
ZTF_RGBA32UI, //32-bit Unsigned Red, Green, Blue, Alpha
|
|
ZTF_RGBA32F, //32-bit Floating Point Red, Green, Blue, Alpha
|
|
|
|
ZTF_DEPTH16, //16-bit Depth Texture
|
|
ZTF_DEPTH24, //24-bit Depth Texture
|
|
ZTF_DEPTH32, //32-bit Depth Texture
|
|
ZTF_DEPTH24_STENCIL8, //32-bit Depth, 8-bit Stencil
|
|
|
|
ZTF_SIZE
|
|
};
|
|
|
|
/*
|
|
Enumeration of texture usage types.
|
|
*/
|
|
enum ZTextureUsage
|
|
{
|
|
ZTU_STATIC, //Static Texture (never or rarely updated)
|
|
ZTU_DYNAMIC, //Dynamic Texture (updated frequently)
|
|
ZTU_STREAMING, //Streaming Texture (updated every frame)
|
|
ZTU_SIZE
|
|
};
|
|
|
|
class ZTexture : public ZRendererResource
|
|
{
|
|
public:
|
|
//Virtual Destructor
|
|
virtual ~ZTexture() { }
|
|
|
|
/*
|
|
virtual public ZTexture::GetType
|
|
|
|
Gets the type of this texture.
|
|
|
|
@return (ZTextureType) - the type of texture
|
|
*/
|
|
virtual ZTextureType GetType() = 0;
|
|
|
|
/*
|
|
virtual public ZTexture::GetUsage
|
|
|
|
Gets the usage type of this texture.
|
|
|
|
@return (ZTextureUsage)
|
|
@context (all)
|
|
*/
|
|
virtual ZTextureUsage GetUsage() = 0;
|
|
|
|
/*
|
|
public ZTexture::IsMipmapped
|
|
|
|
Tells you whether or not this texture has been mipmapped.
|
|
|
|
@return (bool) - true if mipmapped, false otherwise
|
|
@context (all)
|
|
*/
|
|
virtual bool IsMipmapped() = 0;
|
|
};
|
|
|
|
#endif
|