Skip to content

Commit

Permalink
Update when depth plane is rendered.
Browse files Browse the repository at this point in the history
  • Loading branch information
bagnell committed Aug 28, 2017
1 parent d7426a8 commit 1fda8c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
10 changes: 1 addition & 9 deletions Source/Scene/DepthPlane.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,15 @@ define([
}

var depthQuadScratch = FeatureDetection.supportsTypedArrays() ? new Float32Array(12) : [];
var scratchRadii = new Cartesian3();
var scratchCartesian1 = new Cartesian3();
var scratchCartesian2 = new Cartesian3();
var scratchCartesian3 = new Cartesian3();
var scratchCartesian4 = new Cartesian3();

function computeDepthQuad(ellipsoid, frameState) {
var radii = Cartesian3.clone(ellipsoid.radii, scratchRadii);
var radii = ellipsoid.radii;
var p = frameState.camera.positionWC;

// Where did this magical number come from? It's how far a GroundPrimitive will be extruded below the surface
// of the Earth. This effectively pushes the depth plane farther from the camera so that classifications on
// 3D Tiles do not intersect the depth plane. This can be removed when depth testing is enabled by default.
radii.x -= 11000.0;
radii.y -= 11000.0;
radii.z -= 11000.0;

// Find the corresponding position in the scaled space of the ellipsoid.
var q = Cartesian3.multiplyComponents(ellipsoid.oneOverRadii, p, scratchCartesian1);

Expand Down
7 changes: 4 additions & 3 deletions Source/Scene/Scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -1945,9 +1945,6 @@ define([

if (clearGlobeDepth) {
clearDepth.execute(context, passState);
if (useDepthPlane) {
depthPlane.execute(context, passState);
}
}

us.updatePass(Pass.CESIUM_3D_TILE);
Expand All @@ -1968,6 +1965,10 @@ define([
executeCommand(commands[j], scene, context, passState);
}

if (clearGlobeDepth && useDepthPlane) {
depthPlane.execute(context, passState);
}

// Execute commands in order by pass up to the translucent pass.
// Translucent geometry needs special handling (sorting/OIT).
var startPass = Pass.CESIUM_3D_TILE_CLASSIFICATION + 1;
Expand Down

0 comments on commit 1fda8c0

Please sign in to comment.