Crazy Eddies GUI System  0.6.2
d3d10texture.h
1 /***********************************************************************
2  filename: d3d10texture.h
3  created: 17/7/2004
4  author: Paul D Turner with D3D 9 Updates by Magnus �sterlind
5  D3D10 Port by Rajko Stojadinovic
6 
7  purpose: Defines concrete texture class for D3D10.0
8 *************************************************************************/
9 /***************************************************************************
10  * Copyright (C) 2004 - 2008 Paul D Turner & The CEGUI Development Team
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining
13  * a copy of this software and associated documentation files (the
14  * "Software"), to deal in the Software without restriction, including
15  * without limitation the rights to use, copy, modify, merge, publish,
16  * distribute, sublicense, and/or sell copies of the Software, and to
17  * permit persons to whom the Software is furnished to do so, subject to
18  * the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be
21  * included in all copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
26  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
27  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
28  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29  * OTHER DEALINGS IN THE SOFTWARE.
30  ***************************************************************************/
31 #ifndef _d3d10texture_h_
32 #define _d3d10texture_h_
33 
34 #include "CEGUIBase.h"
35 #include "CEGUIRenderer.h"
36 #include "CEGUITexture.h"
37 #include "d3d10renderer.h"
38 #include <d3d10.h>
39 #include <list>
40 
41 // Start of CEGUI namespace section
42 namespace CEGUI
43 {
48 class DIRECTX10_GUIRENDERER_API DirectX10Texture : public Texture
49 {
50 private:
51  /*************************************************************************
52  Friends (to allow construction and destruction)
53  *************************************************************************/
55  friend Texture* DirectX10Renderer::createTexture(const String& filename,
56  const String& resourceGroup);
57  friend Texture* DirectX10Renderer::createTexture(float size);
58  friend void DirectX10Renderer::destroyTexture(Texture* texture);
59 
60  /*************************************************************************
61  Construction & Destruction (by Renderer object only)
62  *************************************************************************/
63  DirectX10Texture(Renderer* owner);
64  virtual ~DirectX10Texture(void);
65 
66 public:
74  virtual ushort getWidth(void) const
75  { return d_width; }
76 
84  virtual ushort getHeight(void) const
85  { return d_height; }
86 
87  virtual ushort getOriginalWidth(void) const
88  { return d_orgWidth; }
89  virtual ushort getOriginalHeight(void) const
90  { return d_orgHeight; }
91 
106  virtual void loadFromFile(const String& filename,
107  const String& resourceGroup);
108 
129  virtual void loadFromMemory(const void* buffPtr, uint buffWidth,
130  uint buffHeight, PixelFormat pixelFormat);
131 
140  LPDIRECT3DTEXTURE2D getD3DTexture(void) const {return d_d3dtexture;}
141  ID3D10ShaderResourceView* getD3DResourceView(void) const {return d_srview;}
142 
154  void setD3DTextureSize(uint size);
155 
156 private:
157  /*************************************************************************
158  Implementation Functions
159  *************************************************************************/
161  void freeD3DTexture(void);
162 
168  void obtainActualTextureSize(void);
169 
170  /*************************************************************************
171  Implementation Data
172  *************************************************************************/
174  LPDIRECT3DTEXTURE2D d_d3dtexture;
175  ID3D10ShaderResourceView* d_srview;
177  String d_filename;
179  String d_resourceGroup;
181  bool d_isMemoryTexture;
183  ushort d_width;
185  ushort d_height;
187  ushort d_orgWidth;
189  ushort d_orgHeight;
190 };
191 
192 } // End of CEGUI namespace section
193 
194 #endif // end of guard _d3d10texture_h_