Skip to content

Commit

Permalink
Merge pull request #3871 from AnalyticalGraphicsInc/shadows-skirts
Browse files Browse the repository at this point in the history
Render terrain skirts when casting shadows
  • Loading branch information
lilleyse committed Apr 21, 2016
2 parents 0c8fe3d + 32956e5 commit c5f0f98
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions Source/Scene/ShadowMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -1417,7 +1417,7 @@ define([
return combine(uniforms, mapUniforms, false);
}

function createCastDerivedCommand(shadowMap, command, context, skirtIndex, oldShaderId, result) {
function createCastDerivedCommand(shadowMap, command, context, oldShaderId, result) {
var castShader;
var castRenderState;
var castUniformMap;
Expand Down Expand Up @@ -1475,11 +1475,6 @@ define([
result.renderState = castRenderState;
result.uniformMap = castUniformMap;

if (defined(skirtIndex)) {
// Don't render terrain skirts when casting into the shadow map. Render all indices of the tile up to the skirt index.
result.count = skirtIndex;
}

return result;
}

Expand All @@ -1494,10 +1489,8 @@ define([
var isTerrain = command.pass === Pass.GLOBE;

var hasTerrainNormal = false;
var skirtIndex;
if (isTerrain) {
hasTerrainNormal = command.owner.data.pickTerrain.mesh.encoding.hasVertexNormals;
skirtIndex = command.owner.data.terrainData._skirtIndex;
}

if (command.castShadows) {
Expand All @@ -1512,7 +1505,7 @@ define([
castCommands.length = shadowMapLength;

for (var i = 0; i < shadowMapLength; ++i) {
castCommands[i] = createCastDerivedCommand(shadowMaps[i], command, context, skirtIndex, oldShaderId, castCommands[i]);
castCommands[i] = createCastDerivedCommand(shadowMaps[i], command, context, oldShaderId, castCommands[i]);
}

result.castShaderProgramId = command.shaderProgram.id;
Expand Down

0 comments on commit c5f0f98

Please sign in to comment.