00001 /*********************************************************************** 00002 filename: d3d10texture.h 00003 created: 17/7/2004 00004 author: Paul D Turner with D3D 9 Updates by Magnus Österlind 00005 D3D10 Port by Rajko Stojadinovic 00006 00007 purpose: Defines concrete texture class for D3D10.0 00008 *************************************************************************/ 00009 /*************************************************************************** 00010 * Copyright (C) 2004 - 2008 Paul D Turner & The CEGUI Development Team 00011 * 00012 * Permission is hereby granted, free of charge, to any person obtaining 00013 * a copy of this software and associated documentation files (the 00014 * "Software"), to deal in the Software without restriction, including 00015 * without limitation the rights to use, copy, modify, merge, publish, 00016 * distribute, sublicense, and/or sell copies of the Software, and to 00017 * permit persons to whom the Software is furnished to do so, subject to 00018 * the following conditions: 00019 * 00020 * The above copyright notice and this permission notice shall be 00021 * included in all copies or substantial portions of the Software. 00022 * 00023 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00024 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00025 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00026 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00027 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00028 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00029 * OTHER DEALINGS IN THE SOFTWARE. 00030 ***************************************************************************/ 00031 #ifndef _d3d10texture_h_ 00032 #define _d3d10texture_h_ 00033 00034 #include "CEGUIBase.h" 00035 #include "CEGUIRenderer.h" 00036 #include "CEGUITexture.h" 00037 #include "d3d10renderer.h" 00038 #include <d3d10.h> 00039 #include <list> 00040 00041 // Start of CEGUI namespace section 00042 namespace CEGUI 00043 { 00048 class DIRECTX10_GUIRENDERER_API DirectX10Texture : public Texture 00049 { 00050 private: 00051 /************************************************************************* 00052 Friends (to allow construction and destruction) 00053 *************************************************************************/ 00054 friend Texture* DirectX10Renderer::createTexture(void); 00055 friend Texture* DirectX10Renderer::createTexture(const String& filename, 00056 const String& resourceGroup); 00057 friend Texture* DirectX10Renderer::createTexture(float size); 00058 friend void DirectX10Renderer::destroyTexture(Texture* texture); 00059 00060 /************************************************************************* 00061 Construction & Destruction (by Renderer object only) 00062 *************************************************************************/ 00063 DirectX10Texture(Renderer* owner); 00064 virtual ~DirectX10Texture(void); 00065 00066 public: 00074 virtual ushort getWidth(void) const 00075 { return d_width; } 00076 00084 virtual ushort getHeight(void) const 00085 { return d_height; } 00086 00087 virtual ushort getOriginalWidth(void) const 00088 { return d_orgWidth; } 00089 virtual ushort getOriginalHeight(void) const 00090 { return d_orgHeight; } 00091 00106 virtual void loadFromFile(const String& filename, 00107 const String& resourceGroup); 00108 00129 virtual void loadFromMemory(const void* buffPtr, uint buffWidth, 00130 uint buffHeight, PixelFormat pixelFormat); 00131 00140 LPDIRECT3DTEXTURE2D getD3DTexture(void) const {return d_d3dtexture;} 00141 ID3D10ShaderResourceView* getD3DResourceView(void) const {return d_srview;} 00142 00154 void setD3DTextureSize(uint size); 00155 00156 private: 00157 /************************************************************************* 00158 Implementation Functions 00159 *************************************************************************/ 00161 void freeD3DTexture(void); 00162 00168 void obtainActualTextureSize(void); 00169 00170 /************************************************************************* 00171 Implementation Data 00172 *************************************************************************/ 00174 LPDIRECT3DTEXTURE2D d_d3dtexture; 00175 ID3D10ShaderResourceView* d_srview; 00177 String d_filename; 00179 String d_resourceGroup; 00181 bool d_isMemoryTexture; 00183 ushort d_width; 00185 ushort d_height; 00187 ushort d_orgWidth; 00189 ushort d_orgHeight; 00190 }; 00191 00192 } // End of CEGUI namespace section 00193 00194 #endif // end of guard _d3d10texture_h_