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