diff --git a/radiantcore/CMakeLists.txt b/radiantcore/CMakeLists.txt index 5ea295014e..7078cf9f77 100644 --- a/radiantcore/CMakeLists.txt +++ b/radiantcore/CMakeLists.txt @@ -212,11 +212,11 @@ add_library(radiantcore MODULE patch/PatchTesselation.cpp Radiant.cpp rendersystem/backend/GLProgramFactory.cpp + rendersystem/backend/glprogram/CubeMapProgram.cpp + rendersystem/backend/glprogram/DepthFillAlphaProgram.cpp rendersystem/backend/glprogram/GenericVFPProgram.cpp rendersystem/backend/glprogram/GLSLProgramBase.cpp rendersystem/backend/glprogram/InteractionProgram.cpp - rendersystem/backend/glprogram/GLSLCubeMapProgram.cpp - rendersystem/backend/glprogram/GLSLDepthFillAlphaProgram.cpp rendersystem/backend/glprogram/ShadowMapProgram.cpp rendersystem/backend/BuiltInShader.cpp rendersystem/backend/ColourShader.cpp diff --git a/radiantcore/rendersystem/backend/DepthFillPass.cpp b/radiantcore/rendersystem/backend/DepthFillPass.cpp index b13c0381a6..8bc849b8ce 100644 --- a/radiantcore/rendersystem/backend/DepthFillPass.cpp +++ b/radiantcore/rendersystem/backend/DepthFillPass.cpp @@ -2,7 +2,7 @@ #include "../OpenGLRenderSystem.h" #include "GLProgramFactory.h" -#include "glprogram/GLSLDepthFillAlphaProgram.h" +#include "glprogram/DepthFillAlphaProgram.h" namespace render { @@ -33,7 +33,7 @@ inline void setDepthFillStateFlags(OpenGLState& state, GLProgramFactory& program // Load the GLSL program tailored for this pass state.glProgram = programFactory.getBuiltInProgram(ShaderProgram::DepthFillAlpha); - assert(dynamic_cast(state.glProgram)); + assert(dynamic_cast(state.glProgram)); } } diff --git a/radiantcore/rendersystem/backend/DepthFillPass.h b/radiantcore/rendersystem/backend/DepthFillPass.h index 408b1d5e0e..a5eccf3b70 100644 --- a/radiantcore/rendersystem/backend/DepthFillPass.h +++ b/radiantcore/rendersystem/backend/DepthFillPass.h @@ -1,7 +1,7 @@ #pragma once #include "OpenGLShaderPass.h" -#include "glprogram/GLSLDepthFillAlphaProgram.h" +#include "glprogram/DepthFillAlphaProgram.h" namespace render { diff --git a/radiantcore/rendersystem/backend/GLProgramFactory.cpp b/radiantcore/rendersystem/backend/GLProgramFactory.cpp index 93e398d18e..9dd5c966bd 100644 --- a/radiantcore/rendersystem/backend/GLProgramFactory.cpp +++ b/radiantcore/rendersystem/backend/GLProgramFactory.cpp @@ -1,8 +1,8 @@ #include "GLProgramFactory.h" #include "glprogram/GLSLDepthFillProgram.h" -#include "glprogram/GLSLDepthFillAlphaProgram.h" -#include "glprogram/GLSLCubeMapProgram.h" +#include "glprogram/DepthFillAlphaProgram.h" +#include "glprogram/CubeMapProgram.h" #include "glprogram/InteractionProgram.h" #include "glprogram/GenericVFPProgram.h" #include "glprogram/ShadowMapProgram.h" @@ -25,9 +25,9 @@ using CharBufPtr = std::shared_ptr>; // Constructor, populates map with GLProgram instances GLProgramFactory::GLProgramFactory() { - _builtInPrograms[ShaderProgram::DepthFillAlpha] = std::make_shared(); + _builtInPrograms[ShaderProgram::DepthFillAlpha] = std::make_shared(); _builtInPrograms[ShaderProgram::Interaction] = std::make_shared(); - _builtInPrograms[ShaderProgram::CubeMap] = std::make_shared(); + _builtInPrograms[ShaderProgram::CubeMap] = std::make_shared(); _builtInPrograms[ShaderProgram::ShadowMap] = std::make_shared(); } diff --git a/radiantcore/rendersystem/backend/LightInteractions.cpp b/radiantcore/rendersystem/backend/LightInteractions.cpp index 1bca6d64d2..24fd294011 100644 --- a/radiantcore/rendersystem/backend/LightInteractions.cpp +++ b/radiantcore/rendersystem/backend/LightInteractions.cpp @@ -2,7 +2,7 @@ #include "OpenGLShader.h" #include "ObjectRenderer.h" -#include "glprogram/GLSLDepthFillAlphaProgram.h" +#include "glprogram/DepthFillAlphaProgram.h" #include "glprogram/ShadowMapProgram.h" namespace render @@ -81,7 +81,7 @@ void LightInteractions::collectSurfaces(const IRenderView& view, const std::set< } } -void LightInteractions::fillDepthBuffer(OpenGLState& state, GLSLDepthFillAlphaProgram& program, +void LightInteractions::fillDepthBuffer(OpenGLState& state, DepthFillAlphaProgram& program, std::size_t renderTime, std::vector& untransformedObjectsWithoutAlphaTest) { std::vector untransformedObjects; diff --git a/radiantcore/rendersystem/backend/LightInteractions.h b/radiantcore/rendersystem/backend/LightInteractions.h index b8aaec3f51..dbabd75e62 100644 --- a/radiantcore/rendersystem/backend/LightInteractions.h +++ b/radiantcore/rendersystem/backend/LightInteractions.h @@ -14,7 +14,7 @@ namespace render class OpenGLState; class OpenGLShader; -class GLSLDepthFillAlphaProgram; +class DepthFillAlphaProgram; class InteractionProgram; class ShadowMapProgram; class DepthFillPass; @@ -114,7 +114,7 @@ class LightInteractions void collectSurfaces(const IRenderView& view, const std::set& entities); - void fillDepthBuffer(OpenGLState& state, GLSLDepthFillAlphaProgram& program, + void fillDepthBuffer(OpenGLState& state, DepthFillAlphaProgram& program, std::size_t renderTime, std::vector& untransformedObjectsWithoutAlphaTest); void drawShadowMap(OpenGLState& state, const Rectangle& rectangle, ShadowMapProgram& program, std::size_t renderTime); diff --git a/radiantcore/rendersystem/backend/LightingModeRenderer.cpp b/radiantcore/rendersystem/backend/LightingModeRenderer.cpp index f78f836ae4..6bdf717d0c 100644 --- a/radiantcore/rendersystem/backend/LightingModeRenderer.cpp +++ b/radiantcore/rendersystem/backend/LightingModeRenderer.cpp @@ -7,8 +7,8 @@ #include "OpenGLShader.h" #include "ObjectRenderer.h" #include "OpenGLState.h" -#include "glprogram/GLSLCubeMapProgram.h" -#include "glprogram/GLSLDepthFillAlphaProgram.h" +#include "glprogram/CubeMapProgram.h" +#include "glprogram/DepthFillAlphaProgram.h" #include "glprogram/InteractionProgram.h" namespace render @@ -271,7 +271,7 @@ void LightingModeRenderer::drawDepthFillPass(OpenGLState& current, RenderStateFl // Prepare the current state for depth filling depthFillState.applyTo(current, globalFlagsMask); - auto depthFillProgram = dynamic_cast(current.glProgram); + auto depthFillProgram = dynamic_cast(current.glProgram); assert(depthFillProgram); // Set the modelview and projection matrix @@ -341,9 +341,9 @@ void LightingModeRenderer::drawNonInteractionPasses(OpenGLState& current, Render // Apply our state to the current state object pass.evaluateStagesAndApplyState(current, globalFlagsMask, time, entity.get()); - if (dynamic_cast(current.glProgram)) + if (dynamic_cast(current.glProgram)) { - static_cast(current.glProgram)->setViewer(view.getViewer()); + static_cast(current.glProgram)->setViewer(view.getViewer()); } ObjectRenderer::SubmitObject(*object, _geometryStore); diff --git a/radiantcore/rendersystem/backend/OpenGLShaderPass.cpp b/radiantcore/rendersystem/backend/OpenGLShaderPass.cpp index f3b4780e7f..61750da3bf 100644 --- a/radiantcore/rendersystem/backend/OpenGLShaderPass.cpp +++ b/radiantcore/rendersystem/backend/OpenGLShaderPass.cpp @@ -11,7 +11,7 @@ #include "debugging/render.h" #include "debugging/gl.h" -#include "glprogram/GLSLDepthFillAlphaProgram.h" +#include "glprogram/DepthFillAlphaProgram.h" namespace render { diff --git a/radiantcore/rendersystem/backend/glprogram/GLSLCubeMapProgram.cpp b/radiantcore/rendersystem/backend/glprogram/CubeMapProgram.cpp similarity index 92% rename from radiantcore/rendersystem/backend/glprogram/GLSLCubeMapProgram.cpp rename to radiantcore/rendersystem/backend/glprogram/CubeMapProgram.cpp index 974cd58a23..33dcbd4b02 100644 --- a/radiantcore/rendersystem/backend/glprogram/GLSLCubeMapProgram.cpp +++ b/radiantcore/rendersystem/backend/glprogram/CubeMapProgram.cpp @@ -1,4 +1,4 @@ -#include "GLSLCubeMapProgram.h" +#include "CubeMapProgram.h" #include "itextstream.h" #include "debugging/gl.h" @@ -15,7 +15,7 @@ namespace const char* const FP_FILENAME = "cubemap_fp.glsl"; } -void GLSLCubeMapProgram::create() +void CubeMapProgram::create() { // Create the program object rMessage() << "[renderer] Creating GLSL CubeMap program" << std::endl; @@ -47,7 +47,7 @@ void GLSLCubeMapProgram::create() debug::assertNoGlErrors(); } -void GLSLCubeMapProgram::enable() +void CubeMapProgram::enable() { GLSLProgramBase::enable(); @@ -59,7 +59,7 @@ void GLSLCubeMapProgram::enable() debug::assertNoGlErrors(); } -void GLSLCubeMapProgram::disable() +void CubeMapProgram::disable() { GLSLProgramBase::disable(); @@ -71,7 +71,7 @@ void GLSLCubeMapProgram::disable() debug::assertNoGlErrors(); } -void GLSLCubeMapProgram::setViewer(const Vector3& viewer) +void CubeMapProgram::setViewer(const Vector3& viewer) { // Pass the current viewer origin to the shader glUniform3f(_locViewOrigin, diff --git a/radiantcore/rendersystem/backend/glprogram/GLSLCubeMapProgram.h b/radiantcore/rendersystem/backend/glprogram/CubeMapProgram.h similarity index 88% rename from radiantcore/rendersystem/backend/glprogram/GLSLCubeMapProgram.h rename to radiantcore/rendersystem/backend/glprogram/CubeMapProgram.h index c90e602e50..38f5e787d5 100644 --- a/radiantcore/rendersystem/backend/glprogram/GLSLCubeMapProgram.h +++ b/radiantcore/rendersystem/backend/glprogram/CubeMapProgram.h @@ -5,7 +5,7 @@ namespace render { -class GLSLCubeMapProgram : +class CubeMapProgram : public GLSLProgramBase { private: @@ -13,7 +13,7 @@ class GLSLCubeMapProgram : GLint _locViewOrigin; public: - GLSLCubeMapProgram() : + CubeMapProgram() : _locViewOrigin(-1) {} diff --git a/radiantcore/rendersystem/backend/glprogram/GLSLDepthFillAlphaProgram.cpp b/radiantcore/rendersystem/backend/glprogram/DepthFillAlphaProgram.cpp similarity index 79% rename from radiantcore/rendersystem/backend/glprogram/GLSLDepthFillAlphaProgram.cpp rename to radiantcore/rendersystem/backend/glprogram/DepthFillAlphaProgram.cpp index 02f9b5950d..096bf9d549 100644 --- a/radiantcore/rendersystem/backend/glprogram/GLSLDepthFillAlphaProgram.cpp +++ b/radiantcore/rendersystem/backend/glprogram/DepthFillAlphaProgram.cpp @@ -1,4 +1,4 @@ -#include "GLSLDepthFillAlphaProgram.h" +#include "DepthFillAlphaProgram.h" #include "GLProgramAttributes.h" #include "../GLProgramFactory.h" @@ -15,7 +15,7 @@ namespace const char* DEPTHFILL_ALPHA_FP_FILENAME = "zfill_alpha_fp.glsl"; } -void GLSLDepthFillAlphaProgram::create() +void DepthFillAlphaProgram::create() { // Create the program object rMessage() << "[renderer] Creating GLSL depthfill+alpha program" << std::endl; @@ -45,7 +45,7 @@ void GLSLDepthFillAlphaProgram::create() debug::assertNoGlErrors(); } -void GLSLDepthFillAlphaProgram::enable() +void DepthFillAlphaProgram::enable() { GLSLProgramBase::enable(); @@ -53,7 +53,7 @@ void GLSLDepthFillAlphaProgram::enable() glEnableVertexAttribArray(GLProgramAttribute::TexCoord); } -void GLSLDepthFillAlphaProgram::disable() +void DepthFillAlphaProgram::disable() { GLSLProgramBase::disable(); @@ -61,22 +61,22 @@ void GLSLDepthFillAlphaProgram::disable() glDisableVertexAttribArray(GLProgramAttribute::TexCoord); } -void GLSLDepthFillAlphaProgram::setAlphaTest(float alphaTest) +void DepthFillAlphaProgram::setAlphaTest(float alphaTest) { glUniform1f(_locAlphaTest, alphaTest); } -void GLSLDepthFillAlphaProgram::setModelViewProjection(const Matrix4& modelViewProjection) +void DepthFillAlphaProgram::setModelViewProjection(const Matrix4& modelViewProjection) { loadMatrixUniform(_locModelViewProjection, modelViewProjection); } -void GLSLDepthFillAlphaProgram::setObjectTransform(const Matrix4& transform) +void DepthFillAlphaProgram::setObjectTransform(const Matrix4& transform) { loadMatrixUniform(_locObjectTransform, transform); } -void GLSLDepthFillAlphaProgram::setDiffuseTextureTransform(const Matrix4& transform) +void DepthFillAlphaProgram::setDiffuseTextureTransform(const Matrix4& transform) { loadTextureMatrixUniform(_locDiffuseTextureMatrix, transform); } diff --git a/radiantcore/rendersystem/backend/glprogram/GLSLDepthFillAlphaProgram.h b/radiantcore/rendersystem/backend/glprogram/DepthFillAlphaProgram.h similarity index 94% rename from radiantcore/rendersystem/backend/glprogram/GLSLDepthFillAlphaProgram.h rename to radiantcore/rendersystem/backend/glprogram/DepthFillAlphaProgram.h index 4a723c31a6..f88c6360c9 100644 --- a/radiantcore/rendersystem/backend/glprogram/GLSLDepthFillAlphaProgram.h +++ b/radiantcore/rendersystem/backend/glprogram/DepthFillAlphaProgram.h @@ -5,7 +5,7 @@ namespace render { -class GLSLDepthFillAlphaProgram : +class DepthFillAlphaProgram : public GLSLProgramBase, public ISupportsAlphaTest { diff --git a/radiantcore/rendersystem/backend/glprogram/GenericVFPProgram.cpp b/radiantcore/rendersystem/backend/glprogram/GenericVFPProgram.cpp index 4b9e12a07e..74626f64ec 100644 --- a/radiantcore/rendersystem/backend/glprogram/GenericVFPProgram.cpp +++ b/radiantcore/rendersystem/backend/glprogram/GenericVFPProgram.cpp @@ -27,11 +27,4 @@ void GenericVFPProgram::disable() // TODO } -void GenericVFPProgram::applyRenderParams(const Vector3& viewer, - const Matrix4& localToWorld, - const Params& lightParams) -{ - // TODO -} - } // namespace diff --git a/tools/msvc/DarkRadiantCore.vcxproj b/tools/msvc/DarkRadiantCore.vcxproj index a4b144a48a..727da99c1b 100644 --- a/tools/msvc/DarkRadiantCore.vcxproj +++ b/tools/msvc/DarkRadiantCore.vcxproj @@ -629,9 +629,9 @@ + + - - @@ -1001,9 +1001,9 @@ + + - - diff --git a/tools/msvc/DarkRadiantCore.vcxproj.filters b/tools/msvc/DarkRadiantCore.vcxproj.filters index 1530ed3e41..dead67e734 100644 --- a/tools/msvc/DarkRadiantCore.vcxproj.filters +++ b/tools/msvc/DarkRadiantCore.vcxproj.filters @@ -1033,9 +1033,6 @@ src\rendersystem\backend\glprogram - - src\rendersystem\backend\glprogram - src\rendersystem\backend @@ -1117,9 +1114,6 @@ src\rendersystem\backend - - src\rendersystem\backend\glprogram - src\rendersystem\backend @@ -1147,6 +1141,12 @@ src\rendersystem\backend\glprogram + + src\rendersystem\backend\glprogram + + + src\rendersystem\backend\glprogram + @@ -2190,9 +2190,6 @@ src\model\import - - src\rendersystem\backend\glprogram - src\rendersystem\backend\glprogram @@ -2319,9 +2316,6 @@ src\entity - - src\rendersystem\backend\glprogram - src\rendersystem\backend @@ -2367,5 +2361,11 @@ src\rendersystem\backend\glprogram + + src\rendersystem\backend\glprogram + + + src\rendersystem\backend\glprogram + \ No newline at end of file