PLAYGROUND3D: Added viewport test

This commit is contained in:
Paweł Kołodziejski 2021-11-08 09:00:01 +01:00
parent d5648a0a8c
commit 0c5e091215
No known key found for this signature in database
GPG key ID: 0BDADC9E74440FF7
9 changed files with 169 additions and 29 deletions

View file

@ -94,10 +94,11 @@ void ShaderRenderer::clear(const Math::Vector4d &clearColor) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
void ShaderRenderer::drawCube(const Math::Vector3d &pos, const Math::Vector3d &roll) {
Common::Rect vp = viewport();
glViewport(vp.left, _system->getHeight() - vp.top - vp.height(), vp.width(), vp.height());
void ShaderRenderer::setupViewport(int x, int y, int width, int height) {
glViewport(x, y, width, height);
}
void ShaderRenderer::drawCube(const Math::Vector3d &pos, const Math::Vector3d &roll) {
auto rotateMatrix = (Math::Quaternion::fromEuler(roll.x(), roll.y(), roll.z(), Math::EO_XYZ)).inverse().toMatrix();
_cubeShader->use();
_cubeShader->setUniform("textured", false);
@ -118,9 +119,6 @@ void ShaderRenderer::drawPolyOffsetTest(const Math::Vector3d &pos, const Math::V
}
void ShaderRenderer::dimRegionInOut(float fade) {
Common::Rect vp = viewport();
glViewport(vp.left, _system->getHeight() - vp.top - vp.height(), vp.width(), vp.height());
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glDisable(GL_DEPTH_TEST);
@ -132,6 +130,10 @@ void ShaderRenderer::dimRegionInOut(float fade) {
_fadeShader->unbind();
}
void ShaderRenderer::drawInViewport() {
// TODO
}
} // End of namespace Playground3d
#endif