Skip to content

Commit 3302245

Browse files
committed
ClassificationPrimitives tests
1 parent 4a2b0f4 commit 3302245

4 files changed

+137
-60
lines changed

Source/Scene/InvertClassification.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ define([
112112
reference : 0,
113113
mask : StencilConstants.CLASSIFICATION_MASK
114114
},
115-
stencilMask : StencilConstants.CLASSIFICATION_MASK,
116115
blending : BlendingState.ALPHA_BLEND
117116
};
118117

@@ -130,15 +129,19 @@ define([
130129
reference : 0,
131130
mask : StencilConstants.CLASSIFICATION_MASK
132131
},
133-
stencilMask : StencilConstants.CLASSIFICATION_MASK,
134132
blending : BlendingState.ALPHA_BLEND
135133
};
136134

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

Source/Scene/Scene.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ define([
4646
'../Renderer/Framebuffer',
4747
'../Renderer/Pass',
4848
'../Renderer/PixelDatatype',
49+
'../Renderer/RenderState',
4950
'../Renderer/ShaderProgram',
5051
'../Renderer/ShaderSource',
5152
'../Renderer/Texture',
@@ -76,6 +77,7 @@ define([
7677
'./SceneTransitioner',
7778
'./ScreenSpaceCameraController',
7879
'./ShadowMap',
80+
'./StencilConstants',
7981
'./SunPostProcess',
8082
'./TweenCollection',
8183
'./View'
@@ -127,6 +129,7 @@ define([
127129
Framebuffer,
128130
Pass,
129131
PixelDatatype,
132+
RenderState,
130133
ShaderProgram,
131134
ShaderSource,
132135
Texture,
@@ -157,6 +160,7 @@ define([
157160
SceneTransitioner,
158161
ScreenSpaceCameraController,
159162
ShadowMap,
163+
StencilConstants,
160164
SunPostProcess,
161165
TweenCollection,
162166
View) {
@@ -322,6 +326,12 @@ define([
322326
this._stencilClearCommand = new ClearCommand({
323327
stencil : 0
324328
});
329+
this._classificationStencilClearCommand = new ClearCommand({
330+
stencil : 0,
331+
renderState : RenderState.fromCache({
332+
stencilMask : StencilConstants.CLASSIFICATION_MASK
333+
})
334+
});
325335

326336
this._depthOnlyRenderStateCache = {};
327337
this._pickRenderStateCache = {};
@@ -2146,6 +2156,7 @@ define([
21462156
var useDepthPlane = environmentState.useDepthPlane;
21472157
var clearDepth = scene._depthClearCommand;
21482158
var clearStencil = scene._stencilClearCommand;
2159+
var clearClassificationStencil = scene._classificationStencilClearCommand;
21492160
var depthPlane = scene._depthPlane;
21502161
var usePostProcessSelected = environmentState.usePostProcessSelected;
21512162

@@ -2304,7 +2315,7 @@ define([
23042315

23052316
// Clear stencil set by the classification for the next classification pass
23062317
if (length > 0 && context.stencilBuffer) {
2307-
clearStencil.execute(context, passState);
2318+
clearClassificationStencil.execute(context, passState);
23082319
}
23092320

23102321
// Draw style over classification.

Specs/Scene/Batched3DModel3DTileContentClassificationSpec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ defineSuite([
104104
asynchronous : false
105105
});
106106

107-
this.pass = pass;
107+
this._pass = pass;
108108
}
109109

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

115115
for (var i = startLength; i < commandList.length; ++i) {
116116
var command = commandList[i];
117-
command.pass = this.pass;
117+
command.pass = this._pass;
118118
}
119119
};
120120

0 commit comments

Comments
 (0)