Skip to content

Commit c148fef

Browse files
committed
NUKE forward lighting dynamic light renderer
It still kinda worked but we don't want to maintain it. Fixes #747.
1 parent 6834195 commit c148fef

30 files changed

Lines changed: 59 additions & 4393 deletions

pkg/daemon_src.dpkdir/scripts/engine.shader

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -28,46 +28,3 @@ gfx/2d/bigchars
2828
rgbgen vertex
2929
}
3030
}
31-
32-
lights/defaultDynamicLight
33-
{
34-
{
35-
stage attenuationMapZ
36-
map lights/mkintsquarelight1a
37-
edgeClamp
38-
}
39-
{
40-
stage attenuationMapXY
41-
forceHighQuality
42-
map lights/round
43-
colored
44-
zeroClamp
45-
}
46-
}
47-
48-
lights/defaultPointLight
49-
{
50-
// this will also be the falloff for any
51-
// point light shaders that don't specify one
52-
lightFalloffImage lights/mkintsquarelight1a
53-
{
54-
stage attenuationMapXY
55-
forceHighQuality
56-
map lights/squarelight1
57-
colored
58-
zeroClamp
59-
}
60-
}
61-
62-
lights/defaultProjectedLight
63-
{
64-
// by default, stay bright almost all the way to the end
65-
lightFalloffImage lights/mkintsquarelight1b
66-
{
67-
stage attenuationMapXY
68-
forceHighQuality
69-
map lights/squarelight1
70-
colored
71-
zeroClamp
72-
}
73-
}

src.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,6 @@ set(GLSLSOURCELIST
185185
# Regular shaders
186186
${ENGINE_DIR}/renderer/glsl_source/fogQuake3_vp.glsl
187187
${ENGINE_DIR}/renderer/glsl_source/fogQuake3_fp.glsl
188-
${ENGINE_DIR}/renderer/glsl_source/forwardLighting_vp.glsl
189-
${ENGINE_DIR}/renderer/glsl_source/forwardLighting_fp.glsl
190188
${ENGINE_DIR}/renderer/glsl_source/generic_vp.glsl
191189
${ENGINE_DIR}/renderer/glsl_source/generic_fp.glsl
192190
${ENGINE_DIR}/renderer/glsl_source/heatHaze_vp.glsl

src/engine/client/cg_msgdef.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ namespace Render {
411411
using AddPolyToSceneMsg = IPC::Message<IPC::Id<VM::QVM, CG_R_ADDPOLYTOSCENE>, int, std::vector<polyVert_t>>;
412412
using AddPolysToSceneMsg = IPC::Message<IPC::Id<VM::QVM, CG_R_ADDPOLYSTOSCENE>, int, std::vector<polyVert_t>, int, int>;
413413
using AddLightToSceneMsg = IPC::Message<IPC::Id<VM::QVM, CG_R_ADDLIGHTTOSCENE>, std::array<float, 3>, float, float, float, float, float, int, int>;
414+
// TODO(0.56): remove, it does the same as AddLightToSceneMsg
414415
using AddAdditiveLightToSceneMsg = IPC::Message<IPC::Id<VM::QVM, CG_R_ADDADDITIVELIGHTTOSCENE>, std::array<float, 3>, float, float, float, float>;
415416
using SetColorMsg = IPC::Message<IPC::Id<VM::QVM, CG_R_SETCOLOR>, Color::Color>;
416417
using SetClipRegionMsg = IPC::Message<IPC::Id<VM::QVM, CG_R_SETCLIPREGION>, std::array<float, 4>>;

src/engine/client/cl_cgame.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,6 +1673,7 @@ void CGameVM::CmdBuffer::HandleCommandBufferSyscall(int major, int minor, Util::
16731673
break;
16741674

16751675
case CG_R_ADDLIGHTTOSCENE:
1676+
// TODO(0.56): remove `shader` and maybe `flags`
16761677
HandleMsg<Render::AddLightToSceneMsg>(std::move(reader), [this] (const std::array<float, 3>& point, float radius, float intensity, float r, float g, float b, int shader, int flags) {
16771678
re.AddLightToScene(point.data(), radius, intensity, r, g, b, shader, flags);
16781679
});

src/engine/qcommon/q_shared.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,6 +1899,7 @@ inline vec_t VectorNormalize2( const vec3_t v, vec3_t out )
18991899

19001900
using GameStateCSs = std::array<std::string, MAX_CONFIGSTRINGS>;
19011901

1902+
// TODO(0.56): NUKE all
19021903
#define REF_FORCE_DLIGHT ( 1 << 31 ) // RF, passed in through overdraw parameter, force this dlight under all conditions
19031904
#define REF_JUNIOR_DLIGHT ( 1 << 30 ) // (SA) this dlight does not light surfaces. it only affects dynamic light grid
19041905
#define REF_DIRECTED_DLIGHT ( 1 << 29 ) // ydnar: global directional light, origin should be interpreted as a normal vector

src/engine/renderer/Material.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -793,11 +793,9 @@ void BindShaderLightMapping( Material* material ) {
793793
gl_lightMappingShaderMaterial->SetUniformBlock_Lights( tr.dlightUBO );
794794

795795
// bind u_LightTiles
796-
if ( r_realtimeLightingRenderer.Get() == Util::ordinal( realtimeLightingRenderer_t::TILED ) ) {
797-
gl_lightMappingShaderMaterial->SetUniform_LightTilesBindless(
798-
GL_BindToTMU( BIND_LIGHTTILES, tr.lighttileRenderImage )
799-
);
800-
}
796+
gl_lightMappingShaderMaterial->SetUniform_LightTilesBindless(
797+
GL_BindToTMU( BIND_LIGHTTILES, tr.lighttileRenderImage )
798+
);
801799
}
802800

803801
gl_lightMappingShaderMaterial->SetUniform_ViewOrigin( backEnd.orientation.viewOrigin );
@@ -1428,9 +1426,7 @@ void MaterialSystem::AddStageTextures( MaterialSurface* surface, shader_t* shade
14281426
surface->texDataDynamic[stage] = dynamic;
14291427

14301428
if ( glConfig2.realtimeLighting ) {
1431-
if ( r_realtimeLightingRenderer.Get() == Util::ordinal( realtimeLightingRenderer_t::TILED ) ) {
1432-
material->AddTexture( tr.lighttileRenderImage->texture );
1433-
}
1429+
material->AddTexture( tr.lighttileRenderImage->texture );
14341430
}
14351431
}
14361432

src/engine/renderer/gl_shader.cpp

Lines changed: 0 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ GLShader_generic *gl_genericShader = nullptr;
6464
GLShader_genericMaterial *gl_genericShaderMaterial = nullptr;
6565
GLShader_lightMapping *gl_lightMappingShader = nullptr;
6666
GLShader_lightMappingMaterial *gl_lightMappingShaderMaterial = nullptr;
67-
GLShader_forwardLighting_omniXYZ *gl_forwardLightingShader_omniXYZ = nullptr;
68-
GLShader_forwardLighting_projXYZ *gl_forwardLightingShader_projXYZ = nullptr;
69-
GLShader_forwardLighting_directionalSun *gl_forwardLightingShader_directionalSun = nullptr;
7067
GLShader_fogQuake3 *gl_fogQuake3Shader = nullptr;
7168
GLShader_fogQuake3Material *gl_fogQuake3ShaderMaterial = nullptr;
7269
GLShader_heatHaze *gl_heatHazeShader = nullptr;
@@ -691,7 +688,6 @@ static std::string GenEngineConstants() {
691688
if ( glConfig2.realtimeLighting )
692689
{
693690
AddDefine( str, "r_realtimeLighting", 1 );
694-
AddDefine( str, "r_realtimeLightingRenderer", r_realtimeLightingRenderer.Get() );
695691
}
696692

697693
if ( r_showNormalMaps->integer )
@@ -2558,160 +2554,6 @@ void GLShader_lightMappingMaterial::SetShaderProgramUniforms( ShaderProgramDescr
25582554
}
25592555
}
25602556

2561-
GLShader_forwardLighting_omniXYZ::GLShader_forwardLighting_omniXYZ():
2562-
GLShader( "forwardLighting_omniXYZ", ATTR_POSITION | ATTR_TEXCOORD | ATTR_QTANGENT,
2563-
false, "forwardLighting", "forwardLighting" ),
2564-
u_DiffuseMap( this ),
2565-
u_NormalMap( this ),
2566-
u_MaterialMap( this ),
2567-
u_AttenuationMapXY( this ),
2568-
u_AttenuationMapZ( this ),
2569-
u_RandomMap( this ),
2570-
u_HeightMap( this ),
2571-
u_TextureMatrix( this ),
2572-
u_SpecularExponent( this ),
2573-
u_AlphaThreshold( this ),
2574-
u_ColorModulateColorGen_Float( this ),
2575-
u_ColorModulateColorGen_Uint( this ),
2576-
u_Color_Float( this ),
2577-
u_Color_Uint( this ),
2578-
u_ViewOrigin( this ),
2579-
u_LightOrigin( this ),
2580-
u_LightColor( this ),
2581-
u_LightRadius( this ),
2582-
u_LightScale( this ),
2583-
u_LightAttenuationMatrix( this ),
2584-
u_ModelMatrix( this ),
2585-
u_ModelViewProjectionMatrix( this ),
2586-
u_Bones( this ),
2587-
u_VertexInterpolation( this ),
2588-
u_ReliefDepthScale( this ),
2589-
u_ReliefOffsetBias( this ),
2590-
u_NormalScale( this ),
2591-
GLDeformStage( this ),
2592-
GLCompileMacro_USE_VERTEX_SKINNING( this ),
2593-
GLCompileMacro_USE_VERTEX_ANIMATION( this ),
2594-
GLCompileMacro_USE_HEIGHTMAP_IN_NORMALMAP( this ),
2595-
GLCompileMacro_USE_RELIEF_MAPPING( this )
2596-
{
2597-
}
2598-
2599-
void GLShader_forwardLighting_omniXYZ::SetShaderProgramUniforms( ShaderProgramDescriptor *shaderProgram )
2600-
{
2601-
glUniform1i( glGetUniformLocation( shaderProgram->id, "u_DiffuseMap" ), 0 );
2602-
glUniform1i( glGetUniformLocation( shaderProgram->id, "u_NormalMap" ), 1 );
2603-
glUniform1i( glGetUniformLocation( shaderProgram->id, "u_MaterialMap" ), 2 );
2604-
glUniform1i( glGetUniformLocation( shaderProgram->id, "u_AttenuationMapXY" ), 3 );
2605-
glUniform1i( glGetUniformLocation( shaderProgram->id, "u_AttenuationMapZ" ), 4 );
2606-
glUniform1i( glGetUniformLocation( shaderProgram->id, "u_RandomMap" ), 6 );
2607-
glUniform1i( glGetUniformLocation( shaderProgram->id, "u_HeightMap" ), 15 );
2608-
}
2609-
2610-
GLShader_forwardLighting_projXYZ::GLShader_forwardLighting_projXYZ():
2611-
GLShader( "forwardLighting_projXYZ", ATTR_POSITION | ATTR_TEXCOORD | ATTR_QTANGENT,
2612-
false, "forwardLighting", "forwardLighting" ),
2613-
u_DiffuseMap( this ),
2614-
u_NormalMap( this ),
2615-
u_MaterialMap( this ),
2616-
u_AttenuationMapXY( this ),
2617-
u_AttenuationMapZ( this ),
2618-
u_RandomMap( this ),
2619-
u_HeightMap( this ),
2620-
u_TextureMatrix( this ),
2621-
u_SpecularExponent( this ),
2622-
u_AlphaThreshold( this ),
2623-
u_ColorModulateColorGen_Float( this ),
2624-
u_ColorModulateColorGen_Uint( this ),
2625-
u_Color_Float( this ),
2626-
u_Color_Uint( this ),
2627-
u_ViewOrigin( this ),
2628-
u_LightOrigin( this ),
2629-
u_LightColor( this ),
2630-
u_LightRadius( this ),
2631-
u_LightScale( this ),
2632-
u_LightAttenuationMatrix( this ),
2633-
u_ModelMatrix( this ),
2634-
u_ModelViewProjectionMatrix( this ),
2635-
u_Bones( this ),
2636-
u_VertexInterpolation( this ),
2637-
u_ReliefDepthScale( this ),
2638-
u_ReliefOffsetBias( this ),
2639-
u_NormalScale( this ),
2640-
GLDeformStage( this ),
2641-
GLCompileMacro_USE_VERTEX_SKINNING( this ),
2642-
GLCompileMacro_USE_VERTEX_ANIMATION( this ),
2643-
GLCompileMacro_USE_HEIGHTMAP_IN_NORMALMAP( this ),
2644-
GLCompileMacro_USE_RELIEF_MAPPING( this )
2645-
{
2646-
}
2647-
2648-
void GLShader_forwardLighting_projXYZ::BuildShaderCompileMacros( std::string& compileMacros )
2649-
{
2650-
compileMacros += "LIGHT_PROJ ";
2651-
}
2652-
2653-
void GLShader_forwardLighting_projXYZ::SetShaderProgramUniforms( ShaderProgramDescriptor *shaderProgram )
2654-
{
2655-
glUniform1i( glGetUniformLocation( shaderProgram->id, "u_DiffuseMap" ), 0 );
2656-
glUniform1i( glGetUniformLocation( shaderProgram->id, "u_NormalMap" ), 1 );
2657-
glUniform1i( glGetUniformLocation( shaderProgram->id, "u_MaterialMap" ), 2 );
2658-
glUniform1i( glGetUniformLocation( shaderProgram->id, "u_AttenuationMapXY" ), 3 );
2659-
glUniform1i( glGetUniformLocation( shaderProgram->id, "u_AttenuationMapZ" ), 4 );
2660-
glUniform1i( glGetUniformLocation( shaderProgram->id, "u_RandomMap" ), 6 );
2661-
glUniform1i( glGetUniformLocation( shaderProgram->id, "u_HeightMap" ), 15 );
2662-
}
2663-
2664-
GLShader_forwardLighting_directionalSun::GLShader_forwardLighting_directionalSun():
2665-
GLShader( "forwardLighting_directionalSun", ATTR_POSITION | ATTR_TEXCOORD | ATTR_QTANGENT,
2666-
false, "forwardLighting", "forwardLighting" ),
2667-
u_DiffuseMap( this ),
2668-
u_NormalMap( this ),
2669-
u_MaterialMap( this ),
2670-
u_HeightMap( this ),
2671-
u_TextureMatrix( this ),
2672-
u_SpecularExponent( this ),
2673-
u_AlphaThreshold( this ),
2674-
u_ColorModulateColorGen_Float( this ),
2675-
u_ColorModulateColorGen_Uint( this ),
2676-
u_Color_Float( this ),
2677-
u_Color_Uint( this ),
2678-
u_ViewOrigin( this ),
2679-
u_LightDir( this ),
2680-
u_LightColor( this ),
2681-
u_LightRadius( this ),
2682-
u_LightScale( this ),
2683-
u_LightAttenuationMatrix( this ),
2684-
u_ModelMatrix( this ),
2685-
u_ViewMatrix( this ),
2686-
u_ModelViewProjectionMatrix( this ),
2687-
u_Bones( this ),
2688-
u_VertexInterpolation( this ),
2689-
u_ReliefDepthScale( this ),
2690-
u_ReliefOffsetBias( this ),
2691-
u_NormalScale( this ),
2692-
GLDeformStage( this ),
2693-
GLCompileMacro_USE_VERTEX_SKINNING( this ),
2694-
GLCompileMacro_USE_VERTEX_ANIMATION( this ),
2695-
GLCompileMacro_USE_HEIGHTMAP_IN_NORMALMAP( this ),
2696-
GLCompileMacro_USE_RELIEF_MAPPING( this )
2697-
{
2698-
}
2699-
2700-
void GLShader_forwardLighting_directionalSun::BuildShaderCompileMacros( std::string& compileMacros )
2701-
{
2702-
compileMacros += "LIGHT_DIRECTIONAL ";
2703-
}
2704-
2705-
void GLShader_forwardLighting_directionalSun::SetShaderProgramUniforms( ShaderProgramDescriptor *shaderProgram )
2706-
{
2707-
glUniform1i( glGetUniformLocation( shaderProgram->id, "u_DiffuseMap" ), 0 );
2708-
glUniform1i( glGetUniformLocation( shaderProgram->id, "u_NormalMap" ), 1 );
2709-
glUniform1i( glGetUniformLocation( shaderProgram->id, "u_MaterialMap" ), 2 );
2710-
//glUniform1i(glGetUniformLocation( shaderProgram->id, "u_AttenuationMapXY" ), 3);
2711-
//glUniform1i(glGetUniformLocation( shaderProgram->id, "u_AttenuationMapZ" ), 4);
2712-
glUniform1i( glGetUniformLocation( shaderProgram->id, "u_HeightMap" ), 15 );
2713-
}
2714-
27152557
GLShader_reflection::GLShader_reflection():
27162558
GLShader( "reflection", ATTR_POSITION | ATTR_TEXCOORD | ATTR_QTANGENT,
27172559
false, "reflection_CB", "reflection_CB" ),

0 commit comments

Comments
 (0)