mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-07 06:35:40 +12:00
[OpenGL] Same for depth mask
This commit is contained in:
parent
d80785cbb5
commit
7307bd270b
4 changed files with 18 additions and 5 deletions
|
@ -22,8 +22,9 @@ struct GLStateManager {
|
|||
bool depthEnabled;
|
||||
bool scissorEnabled;
|
||||
|
||||
// Colour mask
|
||||
// Colour/depth masks
|
||||
bool redMask, greenMask, blueMask, alphaMask;
|
||||
bool depthMask;
|
||||
|
||||
GLuint boundVAO;
|
||||
GLuint boundVBO;
|
||||
|
@ -108,7 +109,14 @@ struct GLStateManager {
|
|||
b = blueMask;
|
||||
a = alphaMask;
|
||||
|
||||
glColorMask(r, g, b, a);
|
||||
OpenGL::setColourMask(r, g, b, a);
|
||||
}
|
||||
}
|
||||
|
||||
void setDepthMask(bool mask) {
|
||||
if (depthMask != mask) {
|
||||
depthMask = mask;
|
||||
OpenGL::setDepthMask(mask);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -528,6 +528,8 @@ namespace OpenGL {
|
|||
static void disableClipPlane(GLuint index) { glDisable(GL_CLIP_DISTANCE0 + index); }
|
||||
|
||||
static void setDepthFunc(DepthFunc func) { glDepthFunc(static_cast<GLenum>(func)); }
|
||||
static void setColourMask(GLboolean r, GLboolean g, GLboolean b, GLboolean a) { glColorMask(r, g, b, a); }
|
||||
static void setDepthMask(GLboolean mask) { glDepthMask(mask); }
|
||||
|
||||
enum Primitives {
|
||||
Triangle = GL_TRIANGLES,
|
||||
|
|
|
@ -896,14 +896,14 @@ void Renderer::drawVertices(PICA::PrimType primType, std::span<const Vertex> ver
|
|||
// Because it attaches a depth texture to the aforementioned colour buffer
|
||||
if (depthEnable) {
|
||||
gl.enableDepth();
|
||||
gl.setDepthMask(depthWriteEnable ? GL_TRUE : GL_FALSE);
|
||||
glDepthFunc(depthModes[depthFunc]);
|
||||
glDepthMask(depthWriteEnable ? GL_TRUE : GL_FALSE);
|
||||
bindDepthBuffer();
|
||||
} else {
|
||||
if (depthWriteEnable) {
|
||||
gl.enableDepth();
|
||||
gl.setDepthMask(GL_TRUE);
|
||||
glDepthFunc(GL_ALWAYS);
|
||||
glDepthMask(GL_TRUE);
|
||||
bindDepthBuffer();
|
||||
} else {
|
||||
gl.disableDepth();
|
||||
|
|
|
@ -7,12 +7,15 @@ void GLStateManager::resetBlend() {
|
|||
|
||||
void GLStateManager::resetColourMask() {
|
||||
redMask = greenMask = blueMask = alphaMask = true;
|
||||
glColorMask(redMask, greenMask, blueMask, alphaMask);
|
||||
OpenGL::setColourMask(redMask, greenMask, blueMask, alphaMask);
|
||||
}
|
||||
|
||||
void GLStateManager::resetDepth() {
|
||||
depthEnabled = false;
|
||||
depthMask = true;
|
||||
|
||||
OpenGL::disableDepth();
|
||||
OpenGL::setDepthMask(true);
|
||||
}
|
||||
|
||||
void GLStateManager::resetScissor() {
|
||||
|
|
Loading…
Add table
Reference in a new issue