Skip to content

Commit

Permalink
Merge branch 'main' into custom-shader-xor-styling
Browse files Browse the repository at this point in the history
  • Loading branch information
ptrgags committed Oct 29, 2021
2 parents 949ad42 + 4f582c4 commit 6689991
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 34 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Added `ScreenOverlay` support to `KMLDataSource`. [#9864](https://github.com/CesiumGS/cesium/pull/9864)
- Fixed crashes caused by the cloud noise texture exceeding WebGL's maximum supported texture size. [#9885](https://github.com/CesiumGS/cesium/pull/9885)
- Updated third-party zip.js library to 2.3.12, fixing compatibility with Webpack 4. [#9897][https://github.com/cesiumgs/cesium/pull/9897]

##### Fixes :wrench:

Expand Down
10 changes: 10 additions & 0 deletions Source/Scene/Cesium3DTileBatchTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,16 @@ Cesium3DTileBatchTable.prototype.getPropertyNames = function (
return results;
};

/**
* @private
*/
Cesium3DTileBatchTable.prototype.getPropertyBySemantic = function (
batchId,
name
) {
return undefined;
};

Cesium3DTileBatchTable.prototype.getProperty = function (batchId, name) {
//>>includeStart('debug', pragmas.debug);
checkBatchId(batchId, this.featuresLength);
Expand Down
5 changes: 5 additions & 0 deletions Source/Scene/Cesium3DTileFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ Cesium3DTileFeature.getPropertyInherited = function (content, batchId, name) {
var value;
var batchTable = content.batchTable;
if (defined(batchTable)) {
value = batchTable.getPropertyBySemantic(batchId, name);
if (defined(value)) {
return value;
}

value = batchTable.getProperty(batchId, name);
if (defined(value)) {
return value;
Expand Down
28 changes: 12 additions & 16 deletions Source/Scene/ModelExperimental/ModelExperimental.js
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,18 @@ ModelExperimental.prototype.update = function (frameState) {
return;
}

var featureTables = this._featureTables;
if (defined(featureTables)) {
for (var i = 0; i < featureTables.length; i++) {
featureTables[i].update(frameState);
// Check if the types of style commands needed have changed and trigger a reset of the draw commands
// to ensure that translucent and opaque features are handled in the correct passes.
if (featureTables[i].styleCommandsNeededDirty) {
this.resetDrawCommands();
}
}
}

if (!this._drawCommandsBuilt) {
this._sceneGraph.buildDrawCommands(frameState);
this._drawCommandsBuilt = true;
Expand All @@ -653,22 +665,6 @@ ModelExperimental.prototype.update = function (frameState) {
});
}

var featureTables = this._featureTables;
if (defined(featureTables)) {
var that = this;
for (var i = 0; i < featureTables.length; i++) {
featureTables[i].update(frameState);
// Check if the types of style commands needed have changed and trigger a reset of the draw commands
// to ensure that translucent and opaque features are handled in the correct passes.
if (featureTables[i].styleCommandsNeededDirty) {
// Reset the draw commands after the current render to avoid flickering.
frameState.afterRender.push(function () {
that.resetDrawCommands();
});
}
}
}

if (this._debugShowBoundingVolumeDirty) {
updateShowBoundingVolume(this._sceneGraph, this._debugShowBoundingVolume);
this._debugShowBoundingVolumeDirty = false;
Expand Down
4 changes: 2 additions & 2 deletions Source/Scene/ModelExperimental/ModelFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@ ModelFeature.prototype.getProperty = function (name) {
* @private
*/
ModelFeature.prototype.getPropertyInherited = function (name) {
var value = this._featureTable.getProperty(this._featureId, name);
var value = this._featureTable.getPropertyBySemantic(this._featureId, name);
if (defined(value)) {
return value;
}

return this._featureTable.getPropertyBySemantic(this._featureId, name);
return this._featureTable.getProperty(this._featureId, name);
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ describe(
model._drawCommandsBuilt = false;
sceneGraph._drawCommands = [];
frameState.commandList = [];

// Run this twice to let the post-render reset call run.
scene.renderForSpecs();
scene.renderForSpecs();
expect(sceneGraph._drawCommands.length).toEqual(1);
expect(frameState.commandList.length).toEqual(1);
Expand All @@ -101,8 +98,6 @@ describe(
model._drawCommandsBuilt = false;
sceneGraph._drawCommands = [];
frameState.commandList = [];
// Run this twice to let the post-render reset call run.
scene.renderForSpecs();
scene.renderForSpecs();
expect(sceneGraph._drawCommands.length).toEqual(1);
expect(frameState.commandList.length).toEqual(1);
Expand Down Expand Up @@ -131,8 +126,6 @@ describe(
model._drawCommandsBuilt = false;
sceneGraph._drawCommands = [];
frameState.commandList = [];
// Run this twice to let the post-render reset call run.
scene.renderForSpecs();
scene.renderForSpecs();
expect(sceneGraph._drawCommands.length).toEqual(2);
expect(frameState.commandList.length).toEqual(2);
Expand Down Expand Up @@ -160,7 +153,6 @@ describe(

var frameState = scene.frameState;
frameState.commandList = [];

scene.renderForSpecs();
expect(
ModelExperimentalSceneGraph.prototype.buildDrawCommands
Expand All @@ -174,7 +166,6 @@ describe(
model._drawCommandsBuilt = false;
sceneGraph._drawCommands = [];
frameState.commandList = [];

scene.renderForSpecs();
expect(
ModelExperimentalSceneGraph.prototype.buildDrawCommands
Expand Down
20 changes: 14 additions & 6 deletions Specs/Scene/ModelExperimental/ModelFeatureTableSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@ import MetadataTester from "../../MetadataTester.js";
describe("Scene/ModelExperimental/ModelFeatureTable", function () {
var properties = {
height: {
semantic: "_HEIGHT",
semantic: "HEIGHT_SEMANTIC",
componentType: "FLOAT32",
},
name: {
componentType: "STRING",
},
HEIGHT_SEMANTIC: {
componentType: "FLOAT32",
},
};
var propertyValues = {
height: [1.0, 2.0],
name: ["A", "B"],
HEIGHT_SEMANTIC: [3.0, 4.0],
};

var mockPropertyTable = MetadataTester.createPropertyTable({
Expand Down Expand Up @@ -102,7 +106,7 @@ describe("Scene/ModelExperimental/ModelFeatureTable", function () {
}
});

it("getPropertyBySemantic works", function () {
it("getPropertyInherited works", function () {
var table = new ModelFeatureTable({
model: {},
propertyTable: mockPropertyTable,
Expand All @@ -112,7 +116,7 @@ describe("Scene/ModelExperimental/ModelFeatureTable", function () {

var i;
var feature;
// getProperty check

for (i = 0; i < modelFeatures.length; i++) {
feature = modelFeatures[i];
expect(feature.getPropertyInherited("height")).toEqual(
Expand All @@ -121,10 +125,10 @@ describe("Scene/ModelExperimental/ModelFeatureTable", function () {
expect(feature.getPropertyInherited("_height")).toBeUndefined();
}

// getPropertyBySemantic check
// Check if the semantic is prioritized over the property name.
for (i = 0; i < modelFeatures.length; i++) {
feature = modelFeatures[i];
expect(feature.getPropertyInherited("_HEIGHT")).toEqual(
expect(feature.getPropertyInherited("HEIGHT_SEMANTIC")).toEqual(
propertyValues["height"][i]
);
expect(feature.getPropertyInherited("_HEIGHT_")).toBeUndefined();
Expand All @@ -141,7 +145,11 @@ describe("Scene/ModelExperimental/ModelFeatureTable", function () {
for (var i = 0; i < modelFeatures.length; i++) {
results = [];
var feature = modelFeatures[i];
expect(feature.getPropertyNames(results)).toEqual(["height", "name"]);
expect(feature.getPropertyNames(results)).toEqual([
"height",
"name",
"HEIGHT_SEMANTIC",
]);
}
});

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"devDependencies": {
"@rollup/plugin-commonjs": "^15.1.0",
"@rollup/plugin-node-resolve": "^11.2.1",
"@zip.js/zip.js": "^2.3.8",
"@zip.js/zip.js": "^2.3.12",
"autolinker": "^3.14.3",
"aws-sdk": "^2.932.0",
"bitmap-sdf": "^1.0.3",
Expand Down

0 comments on commit 6689991

Please sign in to comment.