diff options
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/CD3D9Texture.h')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/CD3D9Texture.h | 260 |
1 files changed, 130 insertions, 130 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CD3D9Texture.h b/libraries/irrlicht-1.8/source/Irrlicht/CD3D9Texture.h index 812aa71..ef7fd70 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/CD3D9Texture.h +++ b/libraries/irrlicht-1.8/source/Irrlicht/CD3D9Texture.h | |||
@@ -1,130 +1,130 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt | 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt |
2 | // This file is part of the "Irrlicht Engine". | 2 | // This file is part of the "Irrlicht Engine". |
3 | // For conditions of distribution and use, see copyright notice in irrlicht.h | 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h |
4 | 4 | ||
5 | #ifndef __C_DIRECTX9_TEXTURE_H_INCLUDED__ | 5 | #ifndef __C_DIRECTX9_TEXTURE_H_INCLUDED__ |
6 | #define __C_DIRECTX9_TEXTURE_H_INCLUDED__ | 6 | #define __C_DIRECTX9_TEXTURE_H_INCLUDED__ |
7 | 7 | ||
8 | #include "IrrCompileConfig.h" | 8 | #include "IrrCompileConfig.h" |
9 | #ifdef _IRR_COMPILE_WITH_DIRECT3D_9_ | 9 | #ifdef _IRR_COMPILE_WITH_DIRECT3D_9_ |
10 | 10 | ||
11 | #include "ITexture.h" | 11 | #include "ITexture.h" |
12 | #include "IImage.h" | 12 | #include "IImage.h" |
13 | #if defined(__BORLANDC__) || defined (__BCPLUSPLUS__) | 13 | #if defined(__BORLANDC__) || defined (__BCPLUSPLUS__) |
14 | #include "irrMath.h" // needed by borland for sqrtf define | 14 | #include "irrMath.h" // needed by borland for sqrtf define |
15 | #endif | 15 | #endif |
16 | #include <d3d9.h> | 16 | #include <d3d9.h> |
17 | 17 | ||
18 | namespace irr | 18 | namespace irr |
19 | { | 19 | { |
20 | namespace video | 20 | namespace video |
21 | { | 21 | { |
22 | 22 | ||
23 | class CD3D9Driver; | 23 | class CD3D9Driver; |
24 | // forward declaration for RTT depth buffer handling | 24 | // forward declaration for RTT depth buffer handling |
25 | struct SDepthSurface; | 25 | struct SDepthSurface; |
26 | /*! | 26 | /*! |
27 | interface for a Video Driver dependent Texture. | 27 | interface for a Video Driver dependent Texture. |
28 | */ | 28 | */ |
29 | class CD3D9Texture : public ITexture | 29 | class CD3D9Texture : public ITexture |
30 | { | 30 | { |
31 | public: | 31 | public: |
32 | 32 | ||
33 | //! constructor | 33 | //! constructor |
34 | CD3D9Texture(IImage* image, CD3D9Driver* driver, | 34 | CD3D9Texture(IImage* image, CD3D9Driver* driver, |
35 | u32 flags, const io::path& name, void* mipmapData=0); | 35 | u32 flags, const io::path& name, void* mipmapData=0); |
36 | 36 | ||
37 | //! rendertarget constructor | 37 | //! rendertarget constructor |
38 | CD3D9Texture(CD3D9Driver* driver, const core::dimension2d<u32>& size, const io::path& name, | 38 | CD3D9Texture(CD3D9Driver* driver, const core::dimension2d<u32>& size, const io::path& name, |
39 | const ECOLOR_FORMAT format = ECF_UNKNOWN); | 39 | const ECOLOR_FORMAT format = ECF_UNKNOWN); |
40 | 40 | ||
41 | //! destructor | 41 | //! destructor |
42 | virtual ~CD3D9Texture(); | 42 | virtual ~CD3D9Texture(); |
43 | 43 | ||
44 | //! lock function | 44 | //! lock function |
45 | virtual void* lock(E_TEXTURE_LOCK_MODE mode=ETLM_READ_WRITE, u32 mipmapLevel=0); | 45 | virtual void* lock(E_TEXTURE_LOCK_MODE mode=ETLM_READ_WRITE, u32 mipmapLevel=0); |
46 | 46 | ||
47 | //! unlock function | 47 | //! unlock function |
48 | virtual void unlock(); | 48 | virtual void unlock(); |
49 | 49 | ||
50 | //! Returns original size of the texture. | 50 | //! Returns original size of the texture. |
51 | virtual const core::dimension2d<u32>& getOriginalSize() const; | 51 | virtual const core::dimension2d<u32>& getOriginalSize() const; |
52 | 52 | ||
53 | //! Returns (=size) of the texture. | 53 | //! Returns (=size) of the texture. |
54 | virtual const core::dimension2d<u32>& getSize() const; | 54 | virtual const core::dimension2d<u32>& getSize() const; |
55 | 55 | ||
56 | //! returns driver type of texture (=the driver, who created the texture) | 56 | //! returns driver type of texture (=the driver, who created the texture) |
57 | virtual E_DRIVER_TYPE getDriverType() const; | 57 | virtual E_DRIVER_TYPE getDriverType() const; |
58 | 58 | ||
59 | //! returns color format of texture | 59 | //! returns color format of texture |
60 | virtual ECOLOR_FORMAT getColorFormat() const; | 60 | virtual ECOLOR_FORMAT getColorFormat() const; |
61 | 61 | ||
62 | //! returns pitch of texture (in bytes) | 62 | //! returns pitch of texture (in bytes) |
63 | virtual u32 getPitch() const; | 63 | virtual u32 getPitch() const; |
64 | 64 | ||
65 | //! returns the DIRECT3D9 Texture | 65 | //! returns the DIRECT3D9 Texture |
66 | IDirect3DBaseTexture9* getDX9Texture() const; | 66 | IDirect3DBaseTexture9* getDX9Texture() const; |
67 | 67 | ||
68 | //! returns if texture has mipmap levels | 68 | //! returns if texture has mipmap levels |
69 | bool hasMipMaps() const; | 69 | bool hasMipMaps() const; |
70 | 70 | ||
71 | //! Regenerates the mip map levels of the texture. Useful after locking and | 71 | //! Regenerates the mip map levels of the texture. Useful after locking and |
72 | //! modifying the texture | 72 | //! modifying the texture |
73 | virtual void regenerateMipMapLevels(void* mipmapData=0); | 73 | virtual void regenerateMipMapLevels(void* mipmapData=0); |
74 | 74 | ||
75 | //! returns if it is a render target | 75 | //! returns if it is a render target |
76 | virtual bool isRenderTarget() const; | 76 | virtual bool isRenderTarget() const; |
77 | 77 | ||
78 | //! Returns pointer to the render target surface | 78 | //! Returns pointer to the render target surface |
79 | IDirect3DSurface9* getRenderTargetSurface(); | 79 | IDirect3DSurface9* getRenderTargetSurface(); |
80 | 80 | ||
81 | private: | 81 | private: |
82 | friend class CD3D9Driver; | 82 | friend class CD3D9Driver; |
83 | 83 | ||
84 | void createRenderTarget(const ECOLOR_FORMAT format = ECF_UNKNOWN); | 84 | void createRenderTarget(const ECOLOR_FORMAT format = ECF_UNKNOWN); |
85 | 85 | ||
86 | //! creates the hardware texture | 86 | //! creates the hardware texture |
87 | bool createTexture(u32 flags, IImage * image); | 87 | bool createTexture(u32 flags, IImage * image); |
88 | 88 | ||
89 | //! copies the image to the texture | 89 | //! copies the image to the texture |
90 | bool copyTexture(IImage * image); | 90 | bool copyTexture(IImage * image); |
91 | 91 | ||
92 | //! Helper function for mipmap generation. | 92 | //! Helper function for mipmap generation. |
93 | bool createMipMaps(u32 level=1); | 93 | bool createMipMaps(u32 level=1); |
94 | 94 | ||
95 | //! Helper function for mipmap generation. | 95 | //! Helper function for mipmap generation. |
96 | void copy16BitMipMap(char* src, char* tgt, | 96 | void copy16BitMipMap(char* src, char* tgt, |
97 | s32 width, s32 height, s32 pitchsrc, s32 pitchtgt) const; | 97 | s32 width, s32 height, s32 pitchsrc, s32 pitchtgt) const; |
98 | 98 | ||
99 | //! Helper function for mipmap generation. | 99 | //! Helper function for mipmap generation. |
100 | void copy32BitMipMap(char* src, char* tgt, | 100 | void copy32BitMipMap(char* src, char* tgt, |
101 | s32 width, s32 height, s32 pitchsrc, s32 pitchtgt) const; | 101 | s32 width, s32 height, s32 pitchsrc, s32 pitchtgt) const; |
102 | 102 | ||
103 | //! set Pitch based on the d3d format | 103 | //! set Pitch based on the d3d format |
104 | void setPitch(D3DFORMAT d3dformat); | 104 | void setPitch(D3DFORMAT d3dformat); |
105 | 105 | ||
106 | IDirect3DDevice9* Device; | 106 | IDirect3DDevice9* Device; |
107 | IDirect3DTexture9* Texture; | 107 | IDirect3DTexture9* Texture; |
108 | IDirect3DSurface9* RTTSurface; | 108 | IDirect3DSurface9* RTTSurface; |
109 | CD3D9Driver* Driver; | 109 | CD3D9Driver* Driver; |
110 | SDepthSurface* DepthSurface; | 110 | SDepthSurface* DepthSurface; |
111 | core::dimension2d<u32> TextureSize; | 111 | core::dimension2d<u32> TextureSize; |
112 | core::dimension2d<u32> ImageSize; | 112 | core::dimension2d<u32> ImageSize; |
113 | s32 Pitch; | 113 | s32 Pitch; |
114 | u32 MipLevelLocked; | 114 | u32 MipLevelLocked; |
115 | ECOLOR_FORMAT ColorFormat; | 115 | ECOLOR_FORMAT ColorFormat; |
116 | 116 | ||
117 | bool HasMipMaps; | 117 | bool HasMipMaps; |
118 | bool HardwareMipMaps; | 118 | bool HardwareMipMaps; |
119 | bool IsRenderTarget; | 119 | bool IsRenderTarget; |
120 | }; | 120 | }; |
121 | 121 | ||
122 | 122 | ||
123 | } // end namespace video | 123 | } // end namespace video |
124 | } // end namespace irr | 124 | } // end namespace irr |
125 | 125 | ||
126 | #endif // _IRR_COMPILE_WITH_DIRECT3D_9_ | 126 | #endif // _IRR_COMPILE_WITH_DIRECT3D_9_ |
127 | 127 | ||
128 | #endif // __C_DIRECTX9_TEXTURE_H_INCLUDED__ | 128 | #endif // __C_DIRECTX9_TEXTURE_H_INCLUDED__ |
129 | 129 | ||
130 | 130 | ||