From 77f4d4e5f8288bb83a23ef64bab77ceae8fc2b22 Mon Sep 17 00:00:00 2001 From: Geoff Hutchison Date: Sat, 12 Oct 2024 16:35:02 -0400 Subject: [PATCH] Turn off default depth blur, shadows, edge for speed Signed-off-by: Geoff Hutchison --- avogadro/rendering/solidpipeline.cpp | 78 ++++++++++++++-------------- 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/avogadro/rendering/solidpipeline.cpp b/avogadro/rendering/solidpipeline.cpp index eeec7ad0ac..4707c85ec8 100644 --- a/avogadro/rendering/solidpipeline.cpp +++ b/avogadro/rendering/solidpipeline.cpp @@ -6,8 +6,8 @@ #include "solidpipeline.h" #include "avogadrogl.h" -#include "shader.h" #include "camera.h" +#include "shader.h" #include "shaderprogram.h" #include "solid_vs.h" @@ -57,12 +57,8 @@ class SolidPipeline::Private }; static const GLfloat s_fullscreenQuad[] = { - -1.0f, -1.0f, 0.0f, - 1.0f, -1.0f, 0.0f, - -1.0f, 1.0f, 0.0f, - -1.0f, 1.0f, 0.0f, - 1.0f, -1.0f, 0.0f, - 1.0f, 1.0f, 0.0f, + -1.0f, -1.0f, 0.0f, 1.0f, -1.0f, 0.0f, -1.0f, 1.0f, 0.0f, + -1.0f, 1.0f, 0.0f, 1.0f, -1.0f, 0.0f, 1.0f, 1.0f, 0.0f, }; void initializeFramebuffer(GLuint* outFBO, GLuint* texRGB, GLuint* texDepth) @@ -88,10 +84,11 @@ void initializeFramebuffer(GLuint* outFBO, GLuint* texRGB, GLuint* texDepth) } SolidPipeline::SolidPipeline() - : m_pixelRatio(1.0f), m_aoEnabled(true), m_dofEnabled(true), m_aoStrength(1.0f), - m_fogStrength(1.0f), m_fogPosition(1.0), m_fogEnabled(true), m_edEnabled(true), - m_edStrength(1.0f), m_width(0), m_height(0), m_dofStrength(1.0f), - m_dofPosition(1.0), m_backgroundColor(0,0,0,0), d(new Private) + : m_pixelRatio(1.0f), m_aoEnabled(false), m_dofEnabled(false), + m_aoStrength(1.0f), m_fogStrength(1.0f), m_fogPosition(1.0), + m_fogEnabled(true), m_edEnabled(false), m_edStrength(1.0f), m_width(0), + m_height(0), m_dofStrength(1.0f), m_dofPosition(1.0), + m_backgroundColor(0, 0, 0, 0), d(new Private) { } @@ -157,43 +154,48 @@ void SolidPipeline::end() glBindFramebuffer(GL_FRAMEBUFFER, 0); glDrawBuffer(GL_BACK); } - d->attachStage(d->firstStageShaders, "inRGBTex", d->renderTexture, "inDepthTex", - d->depthTexture, m_width, m_height); - d->firstStageShaders.setUniformValue("inAoEnabled", m_aoEnabled ? 1.0f : 0.0f); - d->firstStageShaders.setUniformValue("inDofEnabled", m_dofEnabled ? 1.0f : 0.0f); - d->firstStageShaders.setUniformValue("inDofStrength", m_dofEnabled ? (m_dofStrength * 100.0f) : 0.0f); - d->firstStageShaders.setUniformValue("inDofPosition", ((m_dofPosition) /10.0f)); + d->attachStage(d->firstStageShaders, "inRGBTex", d->renderTexture, + "inDepthTex", d->depthTexture, m_width, m_height); + d->firstStageShaders.setUniformValue("inAoEnabled", + m_aoEnabled ? 1.0f : 0.0f); + d->firstStageShaders.setUniformValue("inDofEnabled", + m_dofEnabled ? 1.0f : 0.0f); + d->firstStageShaders.setUniformValue( + "inDofStrength", m_dofEnabled ? (m_dofStrength * 100.0f) : 0.0f); + d->firstStageShaders.setUniformValue("inDofPosition", + ((m_dofPosition) / 10.0f)); d->firstStageShaders.setUniformValue("inAoStrength", m_aoStrength); d->firstStageShaders.setUniformValue("inEdStrength", m_edStrength); - d->firstStageShaders.setUniformValue("inFogEnabled", m_fogEnabled ? 1.0f : 0.0f); - d->firstStageShaders.setUniformValue("inFogStrength", m_fogEnabled ? m_fogStrength : 0.0f); + d->firstStageShaders.setUniformValue("inFogEnabled", + m_fogEnabled ? 1.0f : 0.0f); + d->firstStageShaders.setUniformValue("inFogStrength", + m_fogEnabled ? m_fogStrength : 0.0f); d->firstStageShaders.setUniformValue("inFogPosition", m_fogPosition); - d->firstStageShaders.setUniformValue("fogR", (m_backgroundColor[0])/255.0f); - d->firstStageShaders.setUniformValue("fogG", (m_backgroundColor[1])/255.0f); - d->firstStageShaders.setUniformValue("fogB", (m_backgroundColor[2])/255.0f); + d->firstStageShaders.setUniformValue("fogR", (m_backgroundColor[0]) / 255.0f); + d->firstStageShaders.setUniformValue("fogG", (m_backgroundColor[1]) / 255.0f); + d->firstStageShaders.setUniformValue("fogB", (m_backgroundColor[2]) / 255.0f); glDrawArrays(GL_TRIANGLES, 0, 6); glDisableVertexAttribArray(0); } -void SolidPipeline::adjustOffset(const Camera& cam) { - - // The numbers used in calculations are random. - // They help define an offset with the projection-matrix - // to make the fog dynamic as the molecule moves away - // from the camera or come closer. - Eigen::Matrix4f projectView = cam.projection().matrix(); +void SolidPipeline::adjustOffset(const Camera& cam) +{ - float project = ((((5000 + projectView(2,3) * 1000)/6) + 55) * 100); + // The numbers used in calculations are random. + // They help define an offset with the projection-matrix + // to make the fog dynamic as the molecule moves away + // from the camera or come closer. + Eigen::Matrix4f projectView = cam.projection().matrix(); - float offSet = 0.000102337 * pow(project,2) - 3.84689 * project + 36182.2; - if(project >= 21018.106 && project<21595.588){ - offSet = 2.63129 * project - 54768.4; - } - else if(project >= 21595.588 ){ - offSet = 9.952 * project - 212865; - } - d->firstStageShaders.setUniformValue("uoffset", offSet); + float project = ((((5000 + projectView(2, 3) * 1000) / 6) + 55) * 100); + float offSet = 0.000102337 * pow(project, 2) - 3.84689 * project + 36182.2; + if (project >= 21018.106 && project < 21595.588) { + offSet = 2.63129 * project - 54768.4; + } else if (project >= 21595.588) { + offSet = 9.952 * project - 212865; + } + d->firstStageShaders.setUniformValue("uoffset", offSet); } void SolidPipeline::resize(int width, int height)