Skip to content

Commit

Permalink
Close #12
Browse files Browse the repository at this point in the history
  • Loading branch information
lwjglgamedev committed Mar 24, 2024
1 parent b7c5258 commit 1d8866e
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 10 deletions.
3 changes: 1 addition & 2 deletions chapter-17/resources/shaders/scene.frag
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,10 @@ void main() {

vec4 diffuseSpecularComp = calcDirLight(diffuse, specular, dirLight, outViewPosition, normal);

int cascadeIndex;
int cascadeIndex = 0;
for (int i=0; i<NUM_CASCADES - 1; i++) {
if (outViewPosition.z < cascadeshadows[i].splitDistance) {
cascadeIndex = i + 1;
break;
}
}
float shadowFactor = calcShadow(outWorldPosition, cascadeIndex);
Expand Down
3 changes: 1 addition & 2 deletions chapter-18/resources/shaders/scene.frag
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,10 @@ void main() {

vec4 diffuseSpecularComp = calcDirLight(diffuse, specular, dirLight, outViewPosition, normal);

int cascadeIndex;
int cascadeIndex = 0;
for (int i=0; i<NUM_CASCADES - 1; i++) {
if (outViewPosition.z < cascadeshadows[i].splitDistance) {
cascadeIndex = i + 1;
break;
}
}
float shadowFactor = calcShadow(outWorldPosition, cascadeIndex);
Expand Down
3 changes: 1 addition & 2 deletions chapter-19/resources/shaders/lights.frag
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,10 @@ void main()

vec4 diffuseSpecularComp = calcDirLight(diffuse, specular, reflectance, dirLight, view_pos, normal);

int cascadeIndex;
int cascadeIndex = 0;
for (int i=0; i<NUM_CASCADES - 1; i++) {
if (view_pos.z < cascadeshadows[i].splitDistance) {
cascadeIndex = i + 1;
break;
}
}
float shadowFactor = calcShadow(world_pos, cascadeIndex);
Expand Down
3 changes: 1 addition & 2 deletions chapter-20/resources/shaders/lights.frag
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,10 @@ void main()

vec4 diffuseSpecularComp = calcDirLight(diffuse, specular, reflectance, dirLight, view_pos, normal);

int cascadeIndex;
int cascadeIndex = 0;
for (int i=0; i<NUM_CASCADES - 1; i++) {
if (view_pos.z < cascadeshadows[i].splitDistance) {
cascadeIndex = i + 1;
break;
}
}
float shadowFactor = calcShadow(world_pos, cascadeIndex);
Expand Down
3 changes: 1 addition & 2 deletions chapter-21/resources/shaders/lights.frag
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,10 @@ void main()

vec4 diffuseSpecularComp = calcDirLight(diffuse, specular, reflectance, dirLight, view_pos, normal);

int cascadeIndex;
int cascadeIndex = 0;
for (int i=0; i<NUM_CASCADES - 1; i++) {
if (view_pos.z < cascadeshadows[i].splitDistance) {
cascadeIndex = i + 1;
break;
}
}
float shadowFactor = calcShadow(world_pos, cascadeIndex);
Expand Down

0 comments on commit 1d8866e

Please sign in to comment.