blob: 431b043354520ea69ffcc4965d6cb9b1f55ec384 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
/*
* Copyright (c) 2021, Stephan Unverwerth <s.unverwerth@gmx.de>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "DepthBuffer.h"
namespace GL {
DepthBuffer::DepthBuffer(Gfx::IntSize const& size)
: m_size(size)
, m_data(new float[size.width() * size.height()])
{
}
DepthBuffer::~DepthBuffer()
{
delete[] m_data;
}
float* DepthBuffer::scanline(int y)
{
VERIFY(y >= 0 && y < m_size.height());
return &m_data[y * m_size.width()];
}
void DepthBuffer::clear(float depth)
{
int num_entries = m_size.width() * m_size.height();
for (int i = 0; i < num_entries; ++i) {
m_data[i] = depth;
}
}
}
|