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