diff options
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/CSoftwareTexture2.h')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/CSoftwareTexture2.h | 282 |
1 files changed, 141 insertions, 141 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CSoftwareTexture2.h b/libraries/irrlicht-1.8/source/Irrlicht/CSoftwareTexture2.h index cc8adc6..d11b552 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/CSoftwareTexture2.h +++ b/libraries/irrlicht-1.8/source/Irrlicht/CSoftwareTexture2.h | |||
@@ -1,141 +1,141 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt / Thomas Alten | 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt / Thomas Alten |
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_SOFTWARE_2_TEXTURE_H_INCLUDED__ | 5 | #ifndef __C_SOFTWARE_2_TEXTURE_H_INCLUDED__ |
6 | #define __C_SOFTWARE_2_TEXTURE_H_INCLUDED__ | 6 | #define __C_SOFTWARE_2_TEXTURE_H_INCLUDED__ |
7 | 7 | ||
8 | #include "SoftwareDriver2_compile_config.h" | 8 | #include "SoftwareDriver2_compile_config.h" |
9 | 9 | ||
10 | #include "ITexture.h" | 10 | #include "ITexture.h" |
11 | #include "CImage.h" | 11 | #include "CImage.h" |
12 | 12 | ||
13 | namespace irr | 13 | namespace irr |
14 | { | 14 | { |
15 | namespace video | 15 | namespace video |
16 | { | 16 | { |
17 | 17 | ||
18 | /*! | 18 | /*! |
19 | interface for a Video Driver dependent Texture. | 19 | interface for a Video Driver dependent Texture. |
20 | */ | 20 | */ |
21 | class CSoftwareTexture2 : public ITexture | 21 | class CSoftwareTexture2 : public ITexture |
22 | { | 22 | { |
23 | public: | 23 | public: |
24 | 24 | ||
25 | //! constructor | 25 | //! constructor |
26 | enum eTex2Flags | 26 | enum eTex2Flags |
27 | { | 27 | { |
28 | GEN_MIPMAP = 1, | 28 | GEN_MIPMAP = 1, |
29 | IS_RENDERTARGET = 2, | 29 | IS_RENDERTARGET = 2, |
30 | NP2_SIZE = 4, | 30 | NP2_SIZE = 4, |
31 | HAS_ALPHA = 8 | 31 | HAS_ALPHA = 8 |
32 | }; | 32 | }; |
33 | CSoftwareTexture2(IImage* surface, const io::path& name, u32 flags, void* mipmapData=0); | 33 | CSoftwareTexture2(IImage* surface, const io::path& name, u32 flags, void* mipmapData=0); |
34 | 34 | ||
35 | //! destructor | 35 | //! destructor |
36 | virtual ~CSoftwareTexture2(); | 36 | virtual ~CSoftwareTexture2(); |
37 | 37 | ||
38 | //! lock function | 38 | //! lock function |
39 | virtual void* lock(E_TEXTURE_LOCK_MODE mode=ETLM_READ_WRITE, u32 mipmapLevel=0) | 39 | virtual void* lock(E_TEXTURE_LOCK_MODE mode=ETLM_READ_WRITE, u32 mipmapLevel=0) |
40 | { | 40 | { |
41 | if (Flags & GEN_MIPMAP) | 41 | if (Flags & GEN_MIPMAP) |
42 | MipMapLOD=mipmapLevel; | 42 | MipMapLOD=mipmapLevel; |
43 | return MipMap[MipMapLOD]->lock(); | 43 | return MipMap[MipMapLOD]->lock(); |
44 | } | 44 | } |
45 | 45 | ||
46 | //! unlock function | 46 | //! unlock function |
47 | virtual void unlock() | 47 | virtual void unlock() |
48 | { | 48 | { |
49 | MipMap[MipMapLOD]->unlock(); | 49 | MipMap[MipMapLOD]->unlock(); |
50 | } | 50 | } |
51 | 51 | ||
52 | //! Returns original size of the texture. | 52 | //! Returns original size of the texture. |
53 | virtual const core::dimension2d<u32>& getOriginalSize() const | 53 | virtual const core::dimension2d<u32>& getOriginalSize() const |
54 | { | 54 | { |
55 | //return MipMap[0]->getDimension(); | 55 | //return MipMap[0]->getDimension(); |
56 | return OrigSize; | 56 | return OrigSize; |
57 | } | 57 | } |
58 | 58 | ||
59 | //! Returns the size of the largest mipmap. | 59 | //! Returns the size of the largest mipmap. |
60 | f32 getLODFactor( const f32 texArea ) const | 60 | f32 getLODFactor( const f32 texArea ) const |
61 | { | 61 | { |
62 | return OrigImageDataSizeInPixels * texArea; | 62 | return OrigImageDataSizeInPixels * texArea; |
63 | //return MipMap[0]->getImageDataSizeInPixels () * texArea; | 63 | //return MipMap[0]->getImageDataSizeInPixels () * texArea; |
64 | } | 64 | } |
65 | 65 | ||
66 | //! Returns (=size) of the texture. | 66 | //! Returns (=size) of the texture. |
67 | virtual const core::dimension2d<u32>& getSize() const | 67 | virtual const core::dimension2d<u32>& getSize() const |
68 | { | 68 | { |
69 | return MipMap[MipMapLOD]->getDimension(); | 69 | return MipMap[MipMapLOD]->getDimension(); |
70 | } | 70 | } |
71 | 71 | ||
72 | //! returns unoptimized surface | 72 | //! returns unoptimized surface |
73 | virtual CImage* getImage() const | 73 | virtual CImage* getImage() const |
74 | { | 74 | { |
75 | return MipMap[0]; | 75 | return MipMap[0]; |
76 | } | 76 | } |
77 | 77 | ||
78 | //! returns texture surface | 78 | //! returns texture surface |
79 | virtual CImage* getTexture() const | 79 | virtual CImage* getTexture() const |
80 | { | 80 | { |
81 | return MipMap[MipMapLOD]; | 81 | return MipMap[MipMapLOD]; |
82 | } | 82 | } |
83 | 83 | ||
84 | 84 | ||
85 | //! returns driver type of texture (=the driver, who created the texture) | 85 | //! returns driver type of texture (=the driver, who created the texture) |
86 | virtual E_DRIVER_TYPE getDriverType() const | 86 | virtual E_DRIVER_TYPE getDriverType() const |
87 | { | 87 | { |
88 | return EDT_BURNINGSVIDEO; | 88 | return EDT_BURNINGSVIDEO; |
89 | } | 89 | } |
90 | 90 | ||
91 | //! returns color format of texture | 91 | //! returns color format of texture |
92 | virtual ECOLOR_FORMAT getColorFormat() const | 92 | virtual ECOLOR_FORMAT getColorFormat() const |
93 | { | 93 | { |
94 | return BURNINGSHADER_COLOR_FORMAT; | 94 | return BURNINGSHADER_COLOR_FORMAT; |
95 | } | 95 | } |
96 | 96 | ||
97 | //! returns pitch of texture (in bytes) | 97 | //! returns pitch of texture (in bytes) |
98 | virtual u32 getPitch() const | 98 | virtual u32 getPitch() const |
99 | { | 99 | { |
100 | return MipMap[MipMapLOD]->getPitch(); | 100 | return MipMap[MipMapLOD]->getPitch(); |
101 | } | 101 | } |
102 | 102 | ||
103 | //! Regenerates the mip map levels of the texture. Useful after locking and | 103 | //! Regenerates the mip map levels of the texture. Useful after locking and |
104 | //! modifying the texture | 104 | //! modifying the texture |
105 | virtual void regenerateMipMapLevels(void* mipmapData=0); | 105 | virtual void regenerateMipMapLevels(void* mipmapData=0); |
106 | 106 | ||
107 | //! support mipmaps | 107 | //! support mipmaps |
108 | virtual bool hasMipMaps() const | 108 | virtual bool hasMipMaps() const |
109 | { | 109 | { |
110 | return (Flags & GEN_MIPMAP ) != 0; | 110 | return (Flags & GEN_MIPMAP ) != 0; |
111 | } | 111 | } |
112 | 112 | ||
113 | //! Returns if the texture has an alpha channel | 113 | //! Returns if the texture has an alpha channel |
114 | virtual bool hasAlpha() const | 114 | virtual bool hasAlpha() const |
115 | { | 115 | { |
116 | return (Flags & HAS_ALPHA ) != 0; | 116 | return (Flags & HAS_ALPHA ) != 0; |
117 | } | 117 | } |
118 | 118 | ||
119 | //! is a render target | 119 | //! is a render target |
120 | virtual bool isRenderTarget() const | 120 | virtual bool isRenderTarget() const |
121 | { | 121 | { |
122 | return (Flags & IS_RENDERTARGET) != 0; | 122 | return (Flags & IS_RENDERTARGET) != 0; |
123 | } | 123 | } |
124 | 124 | ||
125 | private: | 125 | private: |
126 | f32 OrigImageDataSizeInPixels; | 126 | f32 OrigImageDataSizeInPixels; |
127 | core::dimension2d<u32> OrigSize; | 127 | core::dimension2d<u32> OrigSize; |
128 | 128 | ||
129 | CImage * MipMap[SOFTWARE_DRIVER_2_MIPMAPPING_MAX]; | 129 | CImage * MipMap[SOFTWARE_DRIVER_2_MIPMAPPING_MAX]; |
130 | 130 | ||
131 | u32 MipMapLOD; | 131 | u32 MipMapLOD; |
132 | u32 Flags; | 132 | u32 Flags; |
133 | ECOLOR_FORMAT OriginalFormat; | 133 | ECOLOR_FORMAT OriginalFormat; |
134 | }; | 134 | }; |
135 | 135 | ||
136 | 136 | ||
137 | } // end namespace video | 137 | } // end namespace video |
138 | } // end namespace irr | 138 | } // end namespace irr |
139 | 139 | ||
140 | #endif | 140 | #endif |
141 | 141 | ||