Skip to content

Commit

Permalink
refactor: rename
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuxudong committed Jul 17, 2024
1 parent c8ac015 commit 7403430
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/shaderlab/src/shaders/Macros.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define MACROS_INCLUDED

#if defined(SCENE_SHADOW_TYPE) && defined(RENDERER_IS_RECEIVE_SHADOWS)
#define SCENE_IS_CALCULATE_SHADOWS
#define NEED_CALCULATE_SHADOWS
#endif


Expand Down
4 changes: 2 additions & 2 deletions packages/shaderlab/src/shaders/Shadow.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "Transform.glsl"
#include "Common.glsl"

#ifdef SCENE_IS_CALCULATE_SHADOWS
#ifdef NEED_CALCULATE_SHADOWS
#if SCENE_SHADOW_CASCADED_COUNT==1

mat4 scene_ShadowMatrices[SCENE_SHADOW_CASCADED_COUNT + 1];
Expand Down Expand Up @@ -77,7 +77,7 @@
#endif


#ifdef SCENE_IS_CALCULATE_SHADOWS
#ifdef NEED_CALCULATE_SHADOWS
// intensity, null, fadeScale, fadeBias
vec4 scene_ShadowInfo;
vec4 scene_ShadowMapSize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Varyings PBRVertex(Attributes attributes) {
#endif

// ShadowCoord
#if defined(SCENE_IS_CALCULATE_SHADOWS) && (SCENE_SHADOW_CASCADED_COUNT == 1)
#if defined(NEED_CALCULATE_SHADOWS) && (SCENE_SHADOW_CASCADED_COUNT == 1)
varyings.v_shadowCoord = getShadowCoord(vertexInputs.positionWS);
#endif

Expand Down
4 changes: 2 additions & 2 deletions packages/shaderlab/src/shaders/shadingPBR/LightDirectPBR.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void evaluateDirectRadiance(Varyings v, BRDFData brdfData, inout vec3 color){

#ifdef SCENE_DIRECT_LIGHT_COUNT
shadowAttenuation = 1.0;
#ifdef SCENE_IS_CALCULATE_SHADOWS
#ifdef NEED_CALCULATE_SHADOWS
shadowAttenuation *= sampleShadowMap(v);
#endif

Expand All @@ -133,7 +133,7 @@ void evaluateDirectRadiance(Varyings v, BRDFData brdfData, inout vec3 color){
directionalLight.direction = scene_DirectLightDirection[i];
#endif

#ifdef SCENE_IS_CALCULATE_SHADOWS
#ifdef NEED_CALCULATE_SHADOWS
if (i == 0) { // Sun light index is always 0
directionalLight.color *= shadowAttenuation;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/shaderlab/src/shaders/shadingPBR/VaryingsPBR.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct Varyings{
#endif


#if defined(SCENE_IS_CALCULATE_SHADOWS) && (SCENE_SHADOW_CASCADED_COUNT == 1)
#if defined(NEED_CALCULATE_SHADOWS) && (SCENE_SHADOW_CASCADED_COUNT == 1)
vec3 v_shadowCoord;
#endif
};
Expand Down

0 comments on commit 7403430

Please sign in to comment.