Crazy Eddies GUI System 0.7.6
|
00001 /*********************************************************************** 00002 filename: CEGUIDirect3D9Texture.h 00003 created: Mon Feb 9 2009 00004 author: Paul D Turner 00005 *************************************************************************/ 00006 /*************************************************************************** 00007 * Copyright (C) 2004 - 2009 Paul D Turner & The CEGUI Development Team 00008 * 00009 * Permission is hereby granted, free of charge, to any person obtaining 00010 * a copy of this software and associated documentation files (the 00011 * "Software"), to deal in the Software without restriction, including 00012 * without limitation the rights to use, copy, modify, merge, publish, 00013 * distribute, sublicense, and/or sell copies of the Software, and to 00014 * permit persons to whom the Software is furnished to do so, subject to 00015 * the following conditions: 00016 * 00017 * The above copyright notice and this permission notice shall be 00018 * included in all copies or substantial portions of the Software. 00019 * 00020 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00021 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00022 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00023 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00024 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00025 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00026 * OTHER DEALINGS IN THE SOFTWARE. 00027 ***************************************************************************/ 00028 #ifndef _CEGUIDirect3D9Texture_h_ 00029 #define _CEGUIDirect3D9Texture_h_ 00030 00031 #include "../../CEGUIBase.h" 00032 #include "../../CEGUIRenderer.h" 00033 #include "../../CEGUITexture.h" 00034 #include "CEGUIDirect3D9Renderer.h" 00035 00036 // Start of CEGUI namespace section 00037 namespace CEGUI 00038 { 00040 class DIRECT3D9_GUIRENDERER_API Direct3D9Texture : public Texture 00041 { 00042 public: 00048 void setDirect3D9Texture(LPDIRECT3DTEXTURE9 tex); 00049 00057 LPDIRECT3DTEXTURE9 getDirect3D9Texture() const; 00058 00066 void setOriginalDataSize(const Size& sz); 00067 00069 void preD3DReset(); 00070 00072 void postD3DReset(); 00073 00074 // implement abstract members from base class. 00075 const Size& getSize() const; 00076 const Size& getOriginalDataSize() const; 00077 const Vector2& getTexelScaling() const; 00078 void loadFromFile(const String& filename, const String& resourceGroup); 00079 void loadFromMemory(const void* buffer, const Size& buffer_size, 00080 PixelFormat pixel_format); 00081 void saveToMemory(void* buffer); 00082 00083 protected: 00084 // Friends (to allow construction and destruction) 00085 friend Texture& Direct3D9Renderer::createTexture(void); 00086 friend Texture& Direct3D9Renderer::createTexture(const String&, const String&); 00087 friend Texture& Direct3D9Renderer::createTexture(const Size&); 00088 friend Texture& Direct3D9Renderer::createTexture(LPDIRECT3DTEXTURE9 tex); 00089 friend void Direct3D9Renderer::destroyTexture(Texture&); 00090 00092 Direct3D9Texture(Direct3D9Renderer& owner); 00094 Direct3D9Texture(Direct3D9Renderer& owner, const String& filename, 00095 const String& resourceGroup); 00097 Direct3D9Texture(Direct3D9Renderer& owner, const Size& sz); 00099 Direct3D9Texture(Direct3D9Renderer& owner, LPDIRECT3DTEXTURE9 tex); 00101 virtual ~Direct3D9Texture(); 00102 00104 void cleanupDirect3D9Texture(); 00106 void updateCachedScaleValues(); 00108 void updateTextureSize(); 00109 00111 Direct3D9Renderer& d_owner; 00113 LPDIRECT3DTEXTURE9 d_texture; 00115 Size d_size; 00117 Size d_dataSize; 00119 Vector2 d_texelScaling; 00121 D3DSURFACE_DESC d_savedSurfaceDesc; 00123 bool d_savedSurfaceDescValid; 00124 }; 00125 00126 } // End of CEGUI namespace section 00127 00128 00129 #endif // end of guard _CEGUIDirect3D9Texture_h_