feat(gx): implement GLSDLDevice::SetScissor

This commit is contained in:
superp00t 2023-11-30 22:32:07 -05:00
parent 1620994f02
commit 56439993ba
2 changed files with 21 additions and 3 deletions

View File

@ -2468,8 +2468,26 @@ void GLSDLDevice::SetModelView(GLEnum transform) {
}
}
void GLSDLDevice::SetScissor(bool a2, const GLRect& a3) {
// TODO
void GLSDLDevice::SetScissor(bool enable, const GLRect& rect) {
if (enable) {
if (this->m_States.rasterizer.scissorEnable) {
glEnable(GL_SCISSOR_TEST);
}
if (rect.left == this->m_States.rasterizer.scissor.left &&
rect.top == this->m_States.rasterizer.scissor.top &&
rect.width == this->m_States.rasterizer.scissor.width &&
rect.height == this->m_States.rasterizer.scissor.height) {
return;
}
glScissor(rect.left, rect.top, rect.width, rect.height);
this->m_States.rasterizer.scissor = rect;
} else if (this->m_States.rasterizer.scissorEnable) {
glDisable(GL_SCISSOR_TEST);
this->m_States.rasterizer.scissorEnable = false;
}
}
void GLSDLDevice::SetShader(GLShader::ShaderType shaderType, GLShader* shader) {

View File

@ -171,7 +171,7 @@ class GLSDLDevice {
void SetIndexBuffer(GLBuffer* buffer);
void SetLightingEnable(bool enable);
void SetModelView(GLEnum transform);
void SetScissor(bool a2, const GLRect& a3);
void SetScissor(bool enable, const GLRect& rect);
void SetShader(GLShader::ShaderType shaderType, GLShader* shader);
void SetShaderConstants(GLShader::ShaderType shaderType, uint32_t index, const float* constants, uint32_t count);
void SetShaderConstantsInternal(GLShader::ShaderType shaderType, uint32_t index, const float* constants, uint32_t count);