Skip to content

Commit

Permalink
ClassificationPrimitives tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleyse committed Dec 18, 2018
1 parent 4a2b0f4 commit 3302245
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 60 deletions.
7 changes: 5 additions & 2 deletions Source/Scene/InvertClassification.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ define([
reference : 0,
mask : StencilConstants.CLASSIFICATION_MASK
},
stencilMask : StencilConstants.CLASSIFICATION_MASK,
blending : BlendingState.ALPHA_BLEND
};

Expand All @@ -130,15 +129,19 @@ define([
reference : 0,
mask : StencilConstants.CLASSIFICATION_MASK
},
stencilMask : StencilConstants.CLASSIFICATION_MASK,
blending : BlendingState.ALPHA_BLEND
};

// Set the 3D Tiles bit when rendering back into the scene's framebuffer. This is only needed if
// invert classification does not use the scene's depth-stencil texture, which is the case if the invert
// classification color is translucent.
var rsDefault = {
depthMask : true,
depthTest : {
enabled : true
},
stencilTest : StencilConstants.setCesium3DTileBit(),
stencilMask : StencilConstants.CESIUM_3D_TILE_MASK,
blending : BlendingState.ALPHA_BLEND
};

Expand Down
13 changes: 12 additions & 1 deletion Source/Scene/Scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ define([
'../Renderer/Framebuffer',
'../Renderer/Pass',
'../Renderer/PixelDatatype',
'../Renderer/RenderState',
'../Renderer/ShaderProgram',
'../Renderer/ShaderSource',
'../Renderer/Texture',
Expand Down Expand Up @@ -76,6 +77,7 @@ define([
'./SceneTransitioner',
'./ScreenSpaceCameraController',
'./ShadowMap',
'./StencilConstants',
'./SunPostProcess',
'./TweenCollection',
'./View'
Expand Down Expand Up @@ -127,6 +129,7 @@ define([
Framebuffer,
Pass,
PixelDatatype,
RenderState,
ShaderProgram,
ShaderSource,
Texture,
Expand Down Expand Up @@ -157,6 +160,7 @@ define([
SceneTransitioner,
ScreenSpaceCameraController,
ShadowMap,
StencilConstants,
SunPostProcess,
TweenCollection,
View) {
Expand Down Expand Up @@ -322,6 +326,12 @@ define([
this._stencilClearCommand = new ClearCommand({
stencil : 0
});
this._classificationStencilClearCommand = new ClearCommand({
stencil : 0,
renderState : RenderState.fromCache({
stencilMask : StencilConstants.CLASSIFICATION_MASK
})
});

this._depthOnlyRenderStateCache = {};
this._pickRenderStateCache = {};
Expand Down Expand Up @@ -2146,6 +2156,7 @@ define([
var useDepthPlane = environmentState.useDepthPlane;
var clearDepth = scene._depthClearCommand;
var clearStencil = scene._stencilClearCommand;
var clearClassificationStencil = scene._classificationStencilClearCommand;
var depthPlane = scene._depthPlane;
var usePostProcessSelected = environmentState.usePostProcessSelected;

Expand Down Expand Up @@ -2304,7 +2315,7 @@ define([

// Clear stencil set by the classification for the next classification pass
if (length > 0 && context.stencilBuffer) {
clearStencil.execute(context, passState);
clearClassificationStencil.execute(context, passState);
}

// Draw style over classification.
Expand Down
4 changes: 2 additions & 2 deletions Specs/Scene/Batched3DModel3DTileContentClassificationSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ defineSuite([
asynchronous : false
});

this.pass = pass;
this._pass = pass;
}

MockPrimitive.prototype.update = function(frameState) {
Expand All @@ -114,7 +114,7 @@ defineSuite([

for (var i = startLength; i < commandList.length; ++i) {
var command = commandList[i];
command.pass = this.pass;
command.pass = this._pass;
}
};

Expand Down
Loading

0 comments on commit 3302245

Please sign in to comment.