Crazy Eddies GUI System  0.7.9
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
CEGUIDirect3D10Texture.h
1 /***********************************************************************
2  filename: CEGUIDirect3D10Texture.h
3  created: Sat Mar 7 2009
4  author: Paul D Turner (parts based on code by Rajko Stojadinovic)
5 *************************************************************************/
6 /***************************************************************************
7  * Copyright (C) 2004 - 2009 Paul D Turner & The CEGUI Development Team
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining
10  * a copy of this software and associated documentation files (the
11  * "Software"), to deal in the Software without restriction, including
12  * without limitation the rights to use, copy, modify, merge, publish,
13  * distribute, sublicense, and/or sell copies of the Software, and to
14  * permit persons to whom the Software is furnished to do so, subject to
15  * the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be
18  * included in all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26  * OTHER DEALINGS IN THE SOFTWARE.
27  ***************************************************************************/
28 #ifndef _CEGUIDirect3D10Texture_h_
29 #define _CEGUIDirect3D10Texture_h_
30 
31 #include "../../CEGUITexture.h"
32 #include "CEGUIDirect3D10Renderer.h"
33 #include "../../CEGUISize.h"
34 #include "../../CEGUIVector.h"
35 
36 // d3d forward refs
37 struct ID3D10Device;
38 struct ID3D10Texture2D;
39 struct ID3D10ShaderResourceView;
40 
41 // Start of CEGUI namespace section
42 namespace CEGUI
43 {
45 class D3D10_GUIRENDERER_API Direct3D10Texture : public Texture
46 {
47 public:
53  void setDirect3DTexture(ID3D10Texture2D* tex);
54 
62  ID3D10Texture2D* getDirect3DTexture() const;
63 
71  ID3D10ShaderResourceView* getDirect3DShaderResourceView() const;
72 
80  void setOriginalDataSize(const Size& sz);
81 
82  // implement abstract members from base class.
83  const Size& getSize() const;
84  const Size& getOriginalDataSize() const;
85  const Vector2& getTexelScaling() const;
86  void loadFromFile(const String& filename, const String& resourceGroup);
87  void loadFromMemory(const void* buffer, const Size& buffer_size,
88  PixelFormat pixel_format);
89  void saveToMemory(void* buffer);
90 
91 protected:
92  // Friends to allow Renderer to peform construction and destruction
96  //friend Texture& Direct3D10Renderer::createTexture(ID3D10Texture2D* tex);
98 
100  Direct3D10Texture(ID3D10Device& device);
102  Direct3D10Texture(ID3D10Device& device, const String& filename,
103  const String& resourceGroup);
105  Direct3D10Texture(ID3D10Device& device, const Size& sz);
107  Direct3D10Texture(ID3D10Device& device, ID3D10Texture2D* tex);
109  virtual ~Direct3D10Texture();
110 
112  void cleanupDirect3D10Texture();
114  void updateCachedScaleValues();
116  void updateTextureSize();
118  void initialiseShaderResourceView();
119 
121  ID3D10Device& d_device;
123  ID3D10Texture2D* d_texture;
125  ID3D10ShaderResourceView* d_resourceView;
132 };
133 
134 
135 } // End of CEGUI namespace section
136 
137 #endif // end of guard _CEGUIDirect3D10Texture_h_
Class used as a two dimensional vector (aka a Point)
Definition: CEGUIVector.h:45
PixelFormat
Enumerated type containing the supported pixel formats that can be passed to loadFromMemory.
Definition: CEGUITexture.h:58
void destroyTexture(Texture &texture)
Destroy a Texture object that was previously created by calling the createTexture functions...
Class that holds the size (width & height) of something.
Definition: CEGUISize.h:43
ID3D10Texture2D * d_texture
The D3D 10 texture we're wrapping.
Definition: CEGUIDirect3D10Texture.h:123
ID3D10Device & d_device
D3D device used to do the business.
Definition: CEGUIDirect3D10Texture.h:121
Texture implementation for the Direct3D10Renderer.
Definition: CEGUIDirect3D10Texture.h:45
Abstract base class specifying the required interface for Texture objects.
Definition: CEGUITexture.h:50
Vector2 d_texelScaling
cached pixel to texel mapping scale values.
Definition: CEGUIDirect3D10Texture.h:131
ID3D10ShaderResourceView * d_resourceView
Shader resource view for the texture.
Definition: CEGUIDirect3D10Texture.h:125
Size d_size
Size of the texture.
Definition: CEGUIDirect3D10Texture.h:127
Texture & createTexture()
Create a 'null' Texture object.
String class used within the GUI system.
Definition: CEGUIString.h:57
Size d_dataSize
original pixel of size data loaded into texture
Definition: CEGUIDirect3D10Texture.h:129