aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/source/Irrlicht/CDepthBuffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/irrlicht-1.8/source/Irrlicht/CDepthBuffer.cpp')
-rw-r--r--libraries/irrlicht-1.8/source/Irrlicht/CDepthBuffer.cpp352
1 files changed, 176 insertions, 176 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CDepthBuffer.cpp b/libraries/irrlicht-1.8/source/Irrlicht/CDepthBuffer.cpp
index 8658105..1cc8a26 100644
--- a/libraries/irrlicht-1.8/source/Irrlicht/CDepthBuffer.cpp
+++ b/libraries/irrlicht-1.8/source/Irrlicht/CDepthBuffer.cpp
@@ -1,176 +1,176 @@
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#include "IrrCompileConfig.h" 5#include "IrrCompileConfig.h"
6#include "SoftwareDriver2_compile_config.h" 6#include "SoftwareDriver2_compile_config.h"
7#include "CDepthBuffer.h" 7#include "CDepthBuffer.h"
8 8
9#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_ 9#ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
10 10
11namespace irr 11namespace irr
12{ 12{
13namespace video 13namespace video
14{ 14{
15 15
16 16
17//! constructor 17//! constructor
18CDepthBuffer::CDepthBuffer(const core::dimension2d<u32>& size) 18CDepthBuffer::CDepthBuffer(const core::dimension2d<u32>& size)
19: Buffer(0), Size(0,0) 19: Buffer(0), Size(0,0)
20{ 20{
21 #ifdef _DEBUG 21 #ifdef _DEBUG
22 setDebugName("CDepthBuffer"); 22 setDebugName("CDepthBuffer");
23 #endif 23 #endif
24 24
25 setSize(size); 25 setSize(size);
26} 26}
27 27
28 28
29 29
30//! destructor 30//! destructor
31CDepthBuffer::~CDepthBuffer() 31CDepthBuffer::~CDepthBuffer()
32{ 32{
33 if (Buffer) 33 if (Buffer)
34 delete [] Buffer; 34 delete [] Buffer;
35} 35}
36 36
37 37
38 38
39//! clears the zbuffer 39//! clears the zbuffer
40void CDepthBuffer::clear() 40void CDepthBuffer::clear()
41{ 41{
42 42
43#ifdef SOFTWARE_DRIVER_2_USE_WBUFFER 43#ifdef SOFTWARE_DRIVER_2_USE_WBUFFER
44 f32 zMax = 0.f; 44 f32 zMax = 0.f;
45#else 45#else
46 f32 zMax = 1.f; 46 f32 zMax = 1.f;
47#endif 47#endif
48 48
49 u32 zMaxValue; 49 u32 zMaxValue;
50 zMaxValue = IR(zMax); 50 zMaxValue = IR(zMax);
51 51
52 memset32 ( Buffer, zMaxValue, TotalSize ); 52 memset32 ( Buffer, zMaxValue, TotalSize );
53} 53}
54 54
55 55
56 56
57//! sets the new size of the zbuffer 57//! sets the new size of the zbuffer
58void CDepthBuffer::setSize(const core::dimension2d<u32>& size) 58void CDepthBuffer::setSize(const core::dimension2d<u32>& size)
59{ 59{
60 if (size == Size) 60 if (size == Size)
61 return; 61 return;
62 62
63 Size = size; 63 Size = size;
64 64
65 if (Buffer) 65 if (Buffer)
66 delete [] Buffer; 66 delete [] Buffer;
67 67
68 Pitch = size.Width * sizeof ( fp24 ); 68 Pitch = size.Width * sizeof ( fp24 );
69 TotalSize = Pitch * size.Height; 69 TotalSize = Pitch * size.Height;
70 Buffer = new u8[TotalSize]; 70 Buffer = new u8[TotalSize];
71 clear (); 71 clear ();
72} 72}
73 73
74 74
75 75
76//! returns the size of the zbuffer 76//! returns the size of the zbuffer
77const core::dimension2d<u32>& CDepthBuffer::getSize() const 77const core::dimension2d<u32>& CDepthBuffer::getSize() const
78{ 78{
79 return Size; 79 return Size;
80} 80}
81 81
82// ----------------------------------------------------------------- 82// -----------------------------------------------------------------
83 83
84//! constructor 84//! constructor
85CStencilBuffer::CStencilBuffer(const core::dimension2d<u32>& size) 85CStencilBuffer::CStencilBuffer(const core::dimension2d<u32>& size)
86: Buffer(0), Size(0,0) 86: Buffer(0), Size(0,0)
87{ 87{
88 #ifdef _DEBUG 88 #ifdef _DEBUG
89 setDebugName("CDepthBuffer"); 89 setDebugName("CDepthBuffer");
90 #endif 90 #endif
91 91
92 setSize(size); 92 setSize(size);
93} 93}
94 94
95 95
96 96
97//! destructor 97//! destructor
98CStencilBuffer::~CStencilBuffer() 98CStencilBuffer::~CStencilBuffer()
99{ 99{
100 if (Buffer) 100 if (Buffer)
101 delete [] Buffer; 101 delete [] Buffer;
102} 102}
103 103
104 104
105 105
106//! clears the zbuffer 106//! clears the zbuffer
107void CStencilBuffer::clear() 107void CStencilBuffer::clear()
108{ 108{
109 memset32 ( Buffer, 0, TotalSize ); 109 memset32 ( Buffer, 0, TotalSize );
110} 110}
111 111
112 112
113 113
114//! sets the new size of the zbuffer 114//! sets the new size of the zbuffer
115void CStencilBuffer::setSize(const core::dimension2d<u32>& size) 115void CStencilBuffer::setSize(const core::dimension2d<u32>& size)
116{ 116{
117 if (size == Size) 117 if (size == Size)
118 return; 118 return;
119 119
120 Size = size; 120 Size = size;
121 121
122 if (Buffer) 122 if (Buffer)
123 delete [] Buffer; 123 delete [] Buffer;
124 124
125 Pitch = size.Width * sizeof ( u32 ); 125 Pitch = size.Width * sizeof ( u32 );
126 TotalSize = Pitch * size.Height; 126 TotalSize = Pitch * size.Height;
127 Buffer = new u8[TotalSize]; 127 Buffer = new u8[TotalSize];
128 clear (); 128 clear ();
129} 129}
130 130
131 131
132 132
133//! returns the size of the zbuffer 133//! returns the size of the zbuffer
134const core::dimension2d<u32>& CStencilBuffer::getSize() const 134const core::dimension2d<u32>& CStencilBuffer::getSize() const
135{ 135{
136 return Size; 136 return Size;
137} 137}
138 138
139 139
140 140
141} // end namespace video 141} // end namespace video
142} // end namespace irr 142} // end namespace irr
143 143
144#endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_ 144#endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_
145 145
146namespace irr 146namespace irr
147{ 147{
148namespace video 148namespace video
149{ 149{
150 150
151//! creates a ZBuffer 151//! creates a ZBuffer
152IDepthBuffer* createDepthBuffer(const core::dimension2d<u32>& size) 152IDepthBuffer* createDepthBuffer(const core::dimension2d<u32>& size)
153{ 153{
154 #ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_ 154 #ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
155 return new CDepthBuffer(size); 155 return new CDepthBuffer(size);
156 #else 156 #else
157 return 0; 157 return 0;
158 #endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_ 158 #endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_
159} 159}
160 160
161 161
162//! creates a ZBuffer 162//! creates a ZBuffer
163IStencilBuffer* createStencilBuffer(const core::dimension2d<u32>& size) 163IStencilBuffer* createStencilBuffer(const core::dimension2d<u32>& size)
164{ 164{
165 #ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_ 165 #ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
166 return new CStencilBuffer(size); 166 return new CStencilBuffer(size);
167 #else 167 #else
168 return 0; 168 return 0;
169 #endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_ 169 #endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_
170} 170}
171 171
172} // end namespace video 172} // end namespace video
173} // end namespace irr 173} // end namespace irr
174 174
175 175
176 176