Skip to content

Commit

Permalink
#219: Rename GLSL program types
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Mar 26, 2022
1 parent a22844c commit 8b2cc39
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 58 deletions.
4 changes: 2 additions & 2 deletions radiantcore/CMakeLists.txt
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions radiantcore/rendersystem/backend/DepthFillPass.cpp
Expand Up @@ -2,7 +2,7 @@

#include "../OpenGLRenderSystem.h"
#include "GLProgramFactory.h"
#include "glprogram/GLSLDepthFillAlphaProgram.h"
#include "glprogram/DepthFillAlphaProgram.h"

namespace render
{
Expand Down Expand Up @@ -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<GLSLDepthFillAlphaProgram*>(state.glProgram));
assert(dynamic_cast<DepthFillAlphaProgram*>(state.glProgram));
}

}
Expand Down
2 changes: 1 addition & 1 deletion radiantcore/rendersystem/backend/DepthFillPass.h
@@ -1,7 +1,7 @@
#pragma once

#include "OpenGLShaderPass.h"
#include "glprogram/GLSLDepthFillAlphaProgram.h"
#include "glprogram/DepthFillAlphaProgram.h"

namespace render
{
Expand Down
8 changes: 4 additions & 4 deletions 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"
Expand All @@ -25,9 +25,9 @@ using CharBufPtr = std::shared_ptr<std::vector<char>>;
// Constructor, populates map with GLProgram instances
GLProgramFactory::GLProgramFactory()
{
_builtInPrograms[ShaderProgram::DepthFillAlpha] = std::make_shared<GLSLDepthFillAlphaProgram>();
_builtInPrograms[ShaderProgram::DepthFillAlpha] = std::make_shared<DepthFillAlphaProgram>();
_builtInPrograms[ShaderProgram::Interaction] = std::make_shared<InteractionProgram>();
_builtInPrograms[ShaderProgram::CubeMap] = std::make_shared<GLSLCubeMapProgram>();
_builtInPrograms[ShaderProgram::CubeMap] = std::make_shared<CubeMapProgram>();
_builtInPrograms[ShaderProgram::ShadowMap] = std::make_shared<ShadowMapProgram>();
}

Expand Down
4 changes: 2 additions & 2 deletions radiantcore/rendersystem/backend/LightInteractions.cpp
Expand Up @@ -2,7 +2,7 @@

#include "OpenGLShader.h"
#include "ObjectRenderer.h"
#include "glprogram/GLSLDepthFillAlphaProgram.h"
#include "glprogram/DepthFillAlphaProgram.h"
#include "glprogram/ShadowMapProgram.h"

namespace render
Expand Down Expand Up @@ -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<IGeometryStore::Slot>& untransformedObjectsWithoutAlphaTest)
{
std::vector<IGeometryStore::Slot> untransformedObjects;
Expand Down
4 changes: 2 additions & 2 deletions radiantcore/rendersystem/backend/LightInteractions.h
Expand Up @@ -14,7 +14,7 @@ namespace render

class OpenGLState;
class OpenGLShader;
class GLSLDepthFillAlphaProgram;
class DepthFillAlphaProgram;
class InteractionProgram;
class ShadowMapProgram;
class DepthFillPass;
Expand Down Expand Up @@ -114,7 +114,7 @@ class LightInteractions

void collectSurfaces(const IRenderView& view, const std::set<IRenderEntityPtr>& entities);

void fillDepthBuffer(OpenGLState& state, GLSLDepthFillAlphaProgram& program,
void fillDepthBuffer(OpenGLState& state, DepthFillAlphaProgram& program,
std::size_t renderTime, std::vector<IGeometryStore::Slot>& untransformedObjectsWithoutAlphaTest);

void drawShadowMap(OpenGLState& state, const Rectangle& rectangle, ShadowMapProgram& program, std::size_t renderTime);
Expand Down
10 changes: 5 additions & 5 deletions radiantcore/rendersystem/backend/LightingModeRenderer.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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<GLSLDepthFillAlphaProgram*>(current.glProgram);
auto depthFillProgram = dynamic_cast<DepthFillAlphaProgram*>(current.glProgram);
assert(depthFillProgram);

// Set the modelview and projection matrix
Expand Down Expand Up @@ -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<GLSLCubeMapProgram*>(current.glProgram))
if (dynamic_cast<CubeMapProgram*>(current.glProgram))
{
static_cast<GLSLCubeMapProgram*>(current.glProgram)->setViewer(view.getViewer());
static_cast<CubeMapProgram*>(current.glProgram)->setViewer(view.getViewer());
}

ObjectRenderer::SubmitObject(*object, _geometryStore);
Expand Down
2 changes: 1 addition & 1 deletion radiantcore/rendersystem/backend/OpenGLShaderPass.cpp
Expand Up @@ -11,7 +11,7 @@
#include "debugging/render.h"
#include "debugging/gl.h"

#include "glprogram/GLSLDepthFillAlphaProgram.h"
#include "glprogram/DepthFillAlphaProgram.h"

namespace render
{
Expand Down
@@ -1,4 +1,4 @@
#include "GLSLCubeMapProgram.h"
#include "CubeMapProgram.h"

#include "itextstream.h"
#include "debugging/gl.h"
Expand All @@ -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;
Expand Down Expand Up @@ -47,7 +47,7 @@ void GLSLCubeMapProgram::create()
debug::assertNoGlErrors();
}

void GLSLCubeMapProgram::enable()
void CubeMapProgram::enable()
{
GLSLProgramBase::enable();

Expand All @@ -59,7 +59,7 @@ void GLSLCubeMapProgram::enable()
debug::assertNoGlErrors();
}

void GLSLCubeMapProgram::disable()
void CubeMapProgram::disable()
{
GLSLProgramBase::disable();

Expand All @@ -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,
Expand Down
Expand Up @@ -5,15 +5,15 @@
namespace render
{

class GLSLCubeMapProgram :
class CubeMapProgram :
public GLSLProgramBase
{
private:
// Uniform/program-local parameter IDs.
GLint _locViewOrigin;

public:
GLSLCubeMapProgram() :
CubeMapProgram() :
_locViewOrigin(-1)
{}

Expand Down
@@ -1,4 +1,4 @@
#include "GLSLDepthFillAlphaProgram.h"
#include "DepthFillAlphaProgram.h"

#include "GLProgramAttributes.h"
#include "../GLProgramFactory.h"
Expand All @@ -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;
Expand Down Expand Up @@ -45,38 +45,38 @@ void GLSLDepthFillAlphaProgram::create()
debug::assertNoGlErrors();
}

void GLSLDepthFillAlphaProgram::enable()
void DepthFillAlphaProgram::enable()
{
GLSLProgramBase::enable();

glEnableVertexAttribArray(GLProgramAttribute::Position);
glEnableVertexAttribArray(GLProgramAttribute::TexCoord);
}

void GLSLDepthFillAlphaProgram::disable()
void DepthFillAlphaProgram::disable()
{
GLSLProgramBase::disable();

glDisableVertexAttribArray(GLProgramAttribute::Position);
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);
}
Expand Down
Expand Up @@ -5,7 +5,7 @@
namespace render
{

class GLSLDepthFillAlphaProgram :
class DepthFillAlphaProgram :
public GLSLProgramBase,
public ISupportsAlphaTest
{
Expand Down
Expand Up @@ -27,11 +27,4 @@ void GenericVFPProgram::disable()
// TODO
}

void GenericVFPProgram::applyRenderParams(const Vector3& viewer,
const Matrix4& localToWorld,
const Params& lightParams)
{
// TODO
}

} // namespace
8 changes: 4 additions & 4 deletions tools/msvc/DarkRadiantCore.vcxproj
Expand Up @@ -629,9 +629,9 @@
<ClCompile Include="..\..\radiantcore\rendersystem\backend\DepthFillPass.cpp" />
<ClCompile Include="..\..\radiantcore\rendersystem\backend\FullBrightRenderer.cpp" />
<ClCompile Include="..\..\radiantcore\rendersystem\backend\GLProgramFactory.cpp" />
<ClCompile Include="..\..\radiantcore\rendersystem\backend\glprogram\CubeMapProgram.cpp" />
<ClCompile Include="..\..\radiantcore\rendersystem\backend\glprogram\DepthFillAlphaProgram.cpp" />
<ClCompile Include="..\..\radiantcore\rendersystem\backend\glprogram\GenericVFPProgram.cpp" />
<ClCompile Include="..\..\radiantcore\rendersystem\backend\glprogram\GLSLCubeMapProgram.cpp" />
<ClCompile Include="..\..\radiantcore\rendersystem\backend\glprogram\GLSLDepthFillAlphaProgram.cpp" />
<ClCompile Include="..\..\radiantcore\rendersystem\backend\glprogram\GLSLProgramBase.cpp" />
<ClCompile Include="..\..\radiantcore\rendersystem\backend\glprogram\InteractionProgram.cpp" />
<ClCompile Include="..\..\radiantcore\rendersystem\backend\glprogram\ShadowMapProgram.cpp" />
Expand Down Expand Up @@ -1001,9 +1001,9 @@
<ClInclude Include="..\..\radiantcore\rendersystem\backend\FullBrightRenderer.h" />
<ClInclude Include="..\..\radiantcore\rendersystem\backend\GeometryRenderer.h" />
<ClInclude Include="..\..\radiantcore\rendersystem\backend\GLProgramFactory.h" />
<ClInclude Include="..\..\radiantcore\rendersystem\backend\glprogram\CubeMapProgram.h" />
<ClInclude Include="..\..\radiantcore\rendersystem\backend\glprogram\DepthFillAlphaProgram.h" />
<ClInclude Include="..\..\radiantcore\rendersystem\backend\glprogram\GenericVFPProgram.h" />
<ClInclude Include="..\..\radiantcore\rendersystem\backend\glprogram\GLSLCubeMapProgram.h" />
<ClInclude Include="..\..\radiantcore\rendersystem\backend\glprogram\GLSLDepthFillAlphaProgram.h" />
<ClInclude Include="..\..\radiantcore\rendersystem\backend\glprogram\GLSLProgramBase.h" />
<ClInclude Include="..\..\radiantcore\rendersystem\backend\glprogram\InteractionProgram.h" />
<ClInclude Include="..\..\radiantcore\rendersystem\backend\glprogram\ShadowMapProgram.h" />
Expand Down
24 changes: 12 additions & 12 deletions tools/msvc/DarkRadiantCore.vcxproj.filters
Expand Up @@ -1033,9 +1033,6 @@
<ClCompile Include="..\..\radiantcore\rendersystem\backend\glprogram\GLSLProgramBase.cpp">
<Filter>src\rendersystem\backend\glprogram</Filter>
</ClCompile>
<ClCompile Include="..\..\radiantcore\rendersystem\backend\glprogram\GLSLDepthFillAlphaProgram.cpp">
<Filter>src\rendersystem\backend\glprogram</Filter>
</ClCompile>
<ClCompile Include="..\..\radiantcore\rendersystem\backend\DepthFillPass.cpp">
<Filter>src\rendersystem\backend</Filter>
</ClCompile>
Expand Down Expand Up @@ -1117,9 +1114,6 @@
<ClCompile Include="..\..\radiantcore\rendersystem\backend\LightInteractions.cpp">
<Filter>src\rendersystem\backend</Filter>
</ClCompile>
<ClCompile Include="..\..\radiantcore\rendersystem\backend\glprogram\GLSLCubeMapProgram.cpp">
<Filter>src\rendersystem\backend\glprogram</Filter>
</ClCompile>
<ClCompile Include="..\..\radiantcore\rendersystem\backend\InteractionPass.cpp">
<Filter>src\rendersystem\backend</Filter>
</ClCompile>
Expand Down Expand Up @@ -1147,6 +1141,12 @@
<ClCompile Include="..\..\radiantcore\rendersystem\backend\glprogram\InteractionProgram.cpp">
<Filter>src\rendersystem\backend\glprogram</Filter>
</ClCompile>
<ClCompile Include="..\..\radiantcore\rendersystem\backend\glprogram\CubeMapProgram.cpp">
<Filter>src\rendersystem\backend\glprogram</Filter>
</ClCompile>
<ClCompile Include="..\..\radiantcore\rendersystem\backend\glprogram\DepthFillAlphaProgram.cpp">
<Filter>src\rendersystem\backend\glprogram</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\radiantcore\modulesystem\ModuleLoader.h">
Expand Down Expand Up @@ -2190,9 +2190,6 @@
<ClInclude Include="..\..\radiantcore\model\import\AseModel.h">
<Filter>src\model\import</Filter>
</ClInclude>
<ClInclude Include="..\..\radiantcore\rendersystem\backend\glprogram\GLSLDepthFillAlphaProgram.h">
<Filter>src\rendersystem\backend\glprogram</Filter>
</ClInclude>
<ClInclude Include="..\..\radiantcore\rendersystem\backend\glprogram\GLSLProgramBase.h">
<Filter>src\rendersystem\backend\glprogram</Filter>
</ClInclude>
Expand Down Expand Up @@ -2319,9 +2316,6 @@
<ClInclude Include="..\..\radiantcore\entity\RenderableObjectCollection.h">
<Filter>src\entity</Filter>
</ClInclude>
<ClInclude Include="..\..\radiantcore\rendersystem\backend\glprogram\GLSLCubeMapProgram.h">
<Filter>src\rendersystem\backend\glprogram</Filter>
</ClInclude>
<ClInclude Include="..\..\radiantcore\rendersystem\backend\InteractionPass.h">
<Filter>src\rendersystem\backend</Filter>
</ClInclude>
Expand Down Expand Up @@ -2367,5 +2361,11 @@
<ClInclude Include="..\..\radiantcore\rendersystem\backend\glprogram\InteractionProgram.h">
<Filter>src\rendersystem\backend\glprogram</Filter>
</ClInclude>
<ClInclude Include="..\..\radiantcore\rendersystem\backend\glprogram\CubeMapProgram.h">
<Filter>src\rendersystem\backend\glprogram</Filter>
</ClInclude>
<ClInclude Include="..\..\radiantcore\rendersystem\backend\glprogram\DepthFillAlphaProgram.h">
<Filter>src\rendersystem\backend\glprogram</Filter>
</ClInclude>
</ItemGroup>
</Project>

0 comments on commit 8b2cc39

Please sign in to comment.