Go to the documentation of this file.00001 #ifndef __NYTRO_Texture_H
00002 #define __NYTRO_Texture_H
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "system/nyCommon.h"
00012 #include "system/nyResource.h"
00013 #include "graphics/nyImage.h"
00014 #include "graphics/nyColor.h"
00015
00016 namespace Nytro
00017 {
00018 namespace Graphics
00019 {
00023 class NYTRO_API Texture : public Core::Resource
00024 {
00025 public:
00026
00028 enum ETextureType
00029 {
00030 eTextureType_1D,
00031 eTextureType_2D,
00032 eTextureType_Cubemap,
00033 eTextureType_Volume
00034 };
00035
00037 enum EAddressType
00038 {
00039 eAddressType_Wrap,
00040 eAddressType_Mirror,
00041 eAddressType_Clamp,
00042 eAddressType_Border
00043 };
00044
00046 enum EFilterType
00047 {
00048 eFilterType_Nearest,
00049 eFilterType_Linear,
00050 eFilterType_Anisotropic
00051 };
00052
00054 enum ETextureUsage
00055 {
00056 eTextureUsage_Static,
00057 eTextureUsage_Dynamic
00058 };
00059
00061 enum ERenderTargetFormat
00062 {
00063 eRenderTargetFormat_RGB8,
00064 eRenderTargetFormat_RGB16F,
00065 eRenderTargetFormat_RGB32F,
00066 eRenderTargetFormat_RGBA8,
00067 eRenderTargetFormat_RGBA16F,
00068 eRenderTargetFormat_RGBA32F
00069 };
00070
00071 protected:
00072
00076 Texture();
00077
00078 public:
00079
00080 virtual ~Texture();
00081
00083 Image& getImage();
00086 bool isKeepingImageData();
00088 bool isRenderTarget();
00090 virtual uint32 getWidth();
00092 virtual uint32 getHeight();
00094 virtual uint32 getDepth();
00096 uint32 getStage();
00098 EAddressType getAddressType();
00100 EFilterType getFilterType();
00102 ERenderTargetFormat getRenderTargetFormat();
00104 void setKeepData( bool bKeep );
00106 void setStage( uint32 aStage );
00108 void setAddressType( EAddressType aValue );
00110 void setFilterType( EFilterType aValue );
00112 virtual void setAsRenderTarget( ERenderTargetFormat aFormat, uint32 aWidth, uint32 aHeight, bool bWithColor, bool bWithDepth, bool bWithStencil );
00114 virtual void disableRenderTarget();
00117 virtual bool upload();
00119 bool isUploadPending();
00122 void setAutoRenderTargetScaling( bool bDoScale = true, float32 aScale = 1 );
00125 bool getAutoRenderTargetScaling( float32* pScale = NULL );
00127 virtual void useOnStage( uint32 aStage = 0 ) = 0;
00128
00129 protected:
00130
00131 uint32 m_stage;
00132 Image m_image;
00133 bool m_bAutoScale;
00134 float32 m_autoScale;
00135 uint32 m_width, m_height, m_depth;
00136 bool m_bKeepImageData, m_bIsRenderTarget;
00137 bool m_bWithColor, m_bWithDepth, m_bWithStencil;
00138 EAddressType m_addressType;
00139 EFilterType m_filterType;
00140 ERenderTargetFormat m_renderTargetFormat;
00141 volatile bool m_bUploadPending;
00142 };
00143
00144 struct NYTRO_API TextureAtlasRect
00145 {
00146 float32 m_u, m_v, m_uWidth, m_vHeight;
00147 };
00148
00149 class NYTRO_API TextureAtlasRects
00150 {
00151 public:
00152
00153 vector<TextureAtlasRect> m_rects;
00154 };
00155 };
00156 };
00157
00158 #endif