Skip to content

Commit

Permalink
add classificationType changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ebogo1 committed Mar 8, 2021
1 parent a7b1859 commit 902f668
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Source/Scene/Batched3DModel3DTileContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ function Batched3DModel3DTileContent(
this._batchTable = undefined;
this._features = undefined;

this._classificationType = tileset.noClassificationModels
? undefined
: tileset.classificationType;

// Populate from gltf when available
this._batchIdAttributeName = undefined;
this._diffuseAttributeOrUniformName = {};
Expand Down Expand Up @@ -161,7 +165,7 @@ function getBatchIdAttributeName(gltf) {
function getVertexShaderCallback(content) {
return function (vs, programId) {
var batchTable = content._batchTable;
var handleTranslucent = !defined(content._tileset.classificationType);
var handleTranslucent = !defined(content._classificationType);

var gltf = content._model.gltf;
if (defined(gltf)) {
Expand All @@ -183,7 +187,7 @@ function getVertexShaderCallback(content) {
function getFragmentShaderCallback(content) {
return function (fs, programId) {
var batchTable = content._batchTable;
var handleTranslucent = !defined(content._tileset.classificationType);
var handleTranslucent = !defined(content._classificationType);

var gltf = content._model.gltf;
if (defined(gltf)) {
Expand Down Expand Up @@ -348,7 +352,7 @@ function initialize(content, arrayBuffer, byteOffset) {
}

var colorChangedCallback;
if (defined(tileset.classificationType)) {
if (defined(content._classificationType)) {
colorChangedCallback = createColorChangedCallback(content);
}

Expand Down Expand Up @@ -403,7 +407,7 @@ function initialize(content, arrayBuffer, byteOffset) {
new Matrix4()
);

if (!defined(tileset.classificationType)) {
if (!defined(content._classificationType)) {
// PERFORMANCE_IDEA: patch the shader on demand, e.g., the first time show/color changes.
// The pick shader still needs to be patched.
content._model = new Model({
Expand Down Expand Up @@ -571,7 +575,7 @@ Batched3DModel3DTileContent.prototype.update = function (tileset, frameState) {
if (
commandStart < commandEnd &&
(frameState.passes.render || frameState.passes.pick) &&
!defined(tileset.classificationType)
!defined(this._classificationType)
) {
this._batchTable.addDerivedCommands(frameState, commandStart);
}
Expand Down
6 changes: 6 additions & 0 deletions Source/Scene/Cesium3DTileset.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ import TileOrientedBoundingBox from "./TileOrientedBoundingBox.js";
* @param {Boolean} [options.debugShowRenderingStatistics=false] For debugging only. When true, draws labels to indicate the number of commands, points, triangles and features for each tile.
* @param {Boolean} [options.debugShowMemoryUsage=false] For debugging only. When true, draws labels to indicate the texture and geometry memory in megabytes used by each tile.
* @param {Boolean} [options.debugShowUrl=false] For debugging only. When true, draws labels to indicate the url of each tile.
* @param {Boolean} [options.noClassificationModels=false] Do not use b3dms for classification.
*
* @exception {DeveloperError} The tileset must be 3D Tiles version 0.0 or 1.0.
*
Expand Down Expand Up @@ -273,6 +274,11 @@ function Cesium3DTileset(options) {
this._clippingPlanesOriginMatrix = undefined; // Combines the above with any run-time transforms.
this._clippingPlanesOriginMatrixDirty = true;

this._noClassificationModels = defaultValue(
options.noClassificationModels,
false
);

/**
* Preload tiles when <code>tileset.show</code> is <code>false</code>. Loads tiles as if the tileset is visible but does not render them.
*
Expand Down

0 comments on commit 902f668

Please sign in to comment.