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