1 // Copyright (C) 2002-2012 Nikolaus Gebhardt / Thomas Alten
\r
2 // This file is part of the "Irrlicht Engine".
\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h
\r
5 #include "IrrCompileConfig.h"
\r
6 #include "SoftwareDriver2_compile_config.h"
\r
7 #include "CDepthBuffer.h"
\r
9 #ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
\r
18 CDepthBuffer::CDepthBuffer(const core::dimension2d<u32>& size)
\r
19 : Buffer(0), Size(0,0)
\r
22 setDebugName("CDepthBuffer");
\r
31 CDepthBuffer::~CDepthBuffer()
\r
42 //! clears the zbuffer
\r
43 void CDepthBuffer::clear(f32 value)
\r
47 #ifdef SOFTWARE_DRIVER_2_USE_WBUFFER
\r
48 zMaxValue.f = 1.f-value;
\r
50 zMaxValue.f = value;
\r
53 memset32 ( Buffer, zMaxValue.u, TotalSize );
\r
58 //! sets the new size of the buffer
\r
59 void CDepthBuffer::setSize(const core::dimension2d<u32>& size)
\r
68 Pitch = size.Width * sizeof ( fp24 );
\r
69 TotalSize = Pitch * size.Height;
\r
70 Buffer = new u8[align_next(TotalSize,16)];
\r
76 //! returns the size of the buffer
\r
77 const core::dimension2d<u32>& CDepthBuffer::getSize() const
\r
82 // -----------------------------------------------------------------
\r
85 CStencilBuffer::CStencilBuffer(const core::dimension2d<u32>& size, unsigned bit)
\r
86 : Buffer(0), Size(0,0),Bit(bit)
\r
89 setDebugName("CStencilBuffer");
\r
98 CStencilBuffer::~CStencilBuffer()
\r
109 //! clears the buffer
\r
110 void CStencilBuffer::clear(u8 value)
\r
118 memset32 ( Buffer, set, TotalSize );
\r
123 //! sets the new size of the buffer
\r
124 void CStencilBuffer::setSize(const core::dimension2d<u32>& size)
\r
133 Pitch = size.Width * sizeof (tStencilSample);
\r
134 TotalSize = Pitch * size.Height;
\r
135 Buffer = new u8[align_next(TotalSize,16)];
\r
141 //! returns the size of the buffer
\r
142 const core::dimension2d<u32>& CStencilBuffer::getSize() const
\r
149 } // end namespace video
\r
150 } // end namespace irr
\r
152 #endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_
\r
159 //! creates a ZBuffer
\r
160 IDepthBuffer* createDepthBuffer(const core::dimension2d<u32>& size)
\r
162 #ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
\r
163 return new CDepthBuffer(size);
\r
166 #endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_
\r
170 //! creates a Stencil Buffer
\r
171 IStencilBuffer* createStencilBuffer(const core::dimension2d<u32>& size, u32 bit)
\r
173 #ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_
\r
174 return new CStencilBuffer(size,bit);
\r
177 #endif // _IRR_COMPILE_WITH_BURNINGSVIDEO_
\r
180 } // end namespace video
\r
181 } // end namespace irr
\r