About ZBuffer ( probably a stupid question)
Posted: January 26th, 2023, 1:38 pm
In the series the ZBuffer class has an overload for the At method:
My question is why is it using const_cast<Zbuffer> rather than const_cast<float*>? I mean, the point of this is to return a CONST reference to the pbuffer amiright?
Code: Select all
float& At(int x, int y)
{
assert(x >= 0);
assert(x < width);
assert(y >= 0);
assert(y < height);
return pBuffer[y * width + x];
}
const float& At(int x, int y) const
{
return const_cast<ZBuffer*>(this)->At(x, y);
}