aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/irrlicht-1.8.1/source/Irrlicht/CZBuffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/irrlicht-1.8.1/source/Irrlicht/CZBuffer.cpp')
-rw-r--r--src/others/irrlicht-1.8.1/source/Irrlicht/CZBuffer.cpp109
1 files changed, 109 insertions, 0 deletions
diff --git a/src/others/irrlicht-1.8.1/source/Irrlicht/CZBuffer.cpp b/src/others/irrlicht-1.8.1/source/Irrlicht/CZBuffer.cpp
new file mode 100644
index 0000000..23b515b
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/source/Irrlicht/CZBuffer.cpp
@@ -0,0 +1,109 @@
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#include "IrrCompileConfig.h"
6#include "CZBuffer.h"
7#include "irrString.h"
8
9#ifdef _IRR_COMPILE_WITH_SOFTWARE_
10
11namespace irr
12{
13namespace video
14{
15
16
17//! constructor
18CZBuffer::CZBuffer(const core::dimension2d<u32>& size)
19: Buffer(0), BufferEnd(0), Size(0,0), TotalSize(0)
20{
21 #ifdef _DEBUG
22 setDebugName("CZBuffer");
23 #endif
24
25 setSize(size);
26}
27
28
29
30//! destructor
31CZBuffer::~CZBuffer()
32{
33 delete [] Buffer;
34}
35
36
37
38//! clears the zbuffer
39void CZBuffer::clear()
40{
41 memset(Buffer, 0, (BufferEnd-Buffer)*sizeof(TZBufferType));
42}
43
44
45
46//! sets the new size of the zbuffer
47void CZBuffer::setSize(const core::dimension2d<u32>& size)
48{
49 if (size == Size)
50 return;
51
52 Size = size;
53
54 delete [] Buffer;
55
56 TotalSize = size.Width * size.Height;
57 Buffer = new TZBufferType[TotalSize];
58 BufferEnd = Buffer + TotalSize;
59}
60
61
62
63//! returns the size of the zbuffer
64const core::dimension2d<u32>& CZBuffer::getSize() const
65{
66 return Size;
67}
68
69
70
71//! locks the zbuffer
72TZBufferType* CZBuffer::lock()
73{
74 return Buffer;
75}
76
77
78
79//! unlocks the zbuffer
80void CZBuffer::unlock()
81{
82}
83
84} // end namespace video
85} // end namespace irr
86
87#endif // _IRR_COMPILE_WITH_SOFTWARE_
88
89namespace irr
90{
91namespace video
92{
93
94//! creates a ZBuffer
95IZBuffer* createZBuffer(const core::dimension2d<u32>& size)
96{
97 #ifdef _IRR_COMPILE_WITH_SOFTWARE_
98 return new CZBuffer(size);
99 #else
100 return 0;
101 #endif // _IRR_COMPILE_WITH_SOFTWARE_
102}
103
104
105} // end namespace video
106} // end namespace irr
107
108
109