Skip to content

Commit d7313ae

Browse files
committed
Merge branch 'main' into polygon-culling-2d-fix
2 parents e5a2e88 + e8d9917 commit d7313ae

16 files changed

+320
-169
lines changed

CHANGES.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@
44

55
### @cesium/engine
66

7-
### Fixes :wrench:
7+
#### Fixes :wrench:
88

9-
- Fixes incorrect polygon culling in 2D scene mode [#1552](https://github.com/CesiumGS/cesium/issues/1552)
10-
- Fixes material flashing when changing properties [#1640](https://github.com/CesiumGS/cesium/issues/1640), [12716](https://github.com/CesiumGS/cesium/issues/12716)
9+
- Fixes incorrect polygon culling in 2D scene mode. [#1552](https://github.com/CesiumGS/cesium/issues/1552)
10+
- Fixes material flashing when changing properties. [#1640](https://github.com/CesiumGS/cesium/issues/1640), [#12716](https://github.com/CesiumGS/cesium/issues/12716)
11+
- Fixed an issue where draped imagery on tilesets was not updated based on the visibility of the imagery layer. [#12742](https://github.com/CesiumGS/cesium/issues/12742)
12+
- Fixes an exception when removing a Gaussian splat tileset from the scene primitives when it has more than one tile. [#12726](https://github.com/CesiumGS/cesium/pull/12726)
13+
- Fixes rendering of Gaussian splats when they are scaled by the glTF transform, tileset transform, or model matrix. [#12721](https://github.com/CesiumGS/cesium/issues/12721), [#12718](https://github.com/CesiumGS/cesium/issues/12718)
1114
- Updated the type of many properties and functions of `Scene` to clarify that they may be `undefined`. For the full list check PR: [#12736](https://github.com/CesiumGS/cesium/pull/12736)
15+
- Fixes Gaussian splats incorrectly rendering when `Cesium3DTileset.show` is `false`. [#12748](https://github.com/CesiumGS/cesium/pull/12748)
1216

1317
#### Additions :tada:
1418

@@ -18,7 +22,7 @@
1822

1923
### @cesium/engine
2024

21-
### Fixes :wrench:
25+
#### Fixes :wrench:
2226

2327
- Updates use of deprecated options on createImageBitmap. [#12664](https://github.com/CesiumGS/cesium/pull/12664)
2428
- Fixed raymarching step size for cylindrical voxels. [#12681](https://github.com/CesiumGS/cesium/pull/12681)

ThirdParty.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"license": [
1313
"BSD-3-Clause"
1414
],
15-
"version": "2.7.62",
15+
"version": "2.7.63",
1616
"url": "https://www.npmjs.com/package/@zip.js/zip.js"
1717
},
1818
{
@@ -61,7 +61,7 @@
6161
"license": [
6262
"ISC"
6363
],
64-
"version": "3.0.1",
64+
"version": "3.0.2",
6565
"url": "https://www.npmjs.com/package/earcut"
6666
},
6767
{

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cesium",
3-
"version": "1.131.0",
3+
"version": "1.131.1-ion.0",
44
"description": "CesiumJS is a JavaScript library for creating 3D globes and 2D maps in a web browser without a plugin.",
55
"homepage": "http://cesium.com/cesiumjs/",
66
"license": "Apache-2.0",
@@ -51,8 +51,8 @@
5151
"./Specs/**/*"
5252
],
5353
"dependencies": {
54-
"@cesium/engine": "^18.3.0",
55-
"@cesium/widgets": "^12.3.0"
54+
"@cesium/engine": "^18.3.1-ion.0",
55+
"@cesium/widgets": "^12.3.1-ion.0"
5656
},
5757
"devDependencies": {
5858
"@cesium/eslint-config": "^12.0.0",
@@ -159,4 +159,4 @@
159159
"packages/engine",
160160
"packages/widgets"
161161
]
162-
}
162+
}

packages/engine/Source/Scene/GaussianSplat3DTileContent.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,15 @@ GaussianSplat3DTileContent.prototype.isDestroyed = function () {
513513
*/
514514
GaussianSplat3DTileContent.prototype.destroy = function () {
515515
this.splatPrimitive = undefined;
516-
this._tileset.gaussianSplatPrimitive.destroy();
516+
517+
if (
518+
defined(this._tileset.gaussianSplatPrimitive) &&
519+
!this._tileset.gaussianSplatPrimitive.isDestroyed()
520+
) {
521+
this._tileset.gaussianSplatPrimitive.destroy();
522+
}
517523
this._tileset.gaussianSplatPrimitive = undefined;
524+
518525
this._tile = undefined;
519526
this._tileset = undefined;
520527
this._resource = undefined;

packages/engine/Source/Scene/GaussianSplatPrimitive.js

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import Matrix4 from "../Core/Matrix4.js";
33
import ModelUtility from "./Model/ModelUtility.js";
44
import GaussianSplatSorter from "./GaussianSplatSorter.js";
55
import GaussianSplatTextureGenerator from "./GaussianSplatTextureGenerator.js";
6-
import Check from "../Core/Check.js";
76
import ComponentDatatype from "../Core/ComponentDatatype.js";
87
import PixelDatatype from "../Renderer/PixelDatatype.js";
98
import PixelFormat from "../Core/PixelFormat.js";
@@ -123,13 +122,7 @@ function GaussianSplatPrimitive(options) {
123122
* @private
124123
*/
125124
this._needsGaussianSplatTexture = true;
126-
/**
127-
* The scale of the Gaussian splats.
128-
* This is used to control the size of the splats when rendered.
129-
* @type {number}
130-
* @private
131-
*/
132-
this._splatScale = 1.0;
125+
133126
/**
134127
* The previous view matrix used to determine if the primitive needs to be updated.
135128
* This is used to avoid unnecessary updates when the view matrix hasn't changed.
@@ -297,26 +290,6 @@ Object.defineProperties(GaussianSplatPrimitive.prototype, {
297290
return this._ready;
298291
},
299292
},
300-
/**
301-
* Scaling factor applied to the Gaussian splats indepdendent of the
302-
* Gaussian splat scale attribute. Applied uniformly to all splats.
303-
* @memberof GaussianSplatPrimitive.prototype
304-
* @type {number}
305-
* @default 1.0
306-
*/
307-
308-
splatScale: {
309-
get: function () {
310-
return this._splatScale;
311-
},
312-
set: function (splatScale) {
313-
//>>includeStart('debug', pragmas.debug);
314-
Check.typeOf.number("splatScale", splatScale);
315-
//>>includeEnd('debug');
316-
317-
this._splatScale = splatScale;
318-
},
319-
},
320293

321294
/**
322295
* The {@link SplitDirection} to apply to this point.
@@ -628,14 +601,8 @@ GaussianSplatPrimitive.buildGSplatDrawCommand = function (
628601
ShaderDestination.VERTEX,
629602
);
630603

631-
shaderBuilder.addUniform("float", "u_splatScale", ShaderDestination.VERTEX);
632-
633604
const uniformMap = renderResources.uniformMap;
634605

635-
uniformMap.u_splatScale = function () {
636-
return primitive.splatScale;
637-
};
638-
639606
uniformMap.u_splatAttributeTexture = function () {
640607
return primitive.gaussianSplatTexture;
641608
};
@@ -753,7 +720,7 @@ GaussianSplatPrimitive.prototype.update = function (frameState) {
753720
this._rootTransform = tileset.root.computedTransform;
754721
}
755722

756-
if (this._drawCommand) {
723+
if (this._drawCommand && tileset.show) {
757724
frameState.commandList.push(this._drawCommand);
758725
}
759726

packages/engine/Source/Scene/Model/ImageryConfiguration.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
*/
1313
class ImageryConfiguration {
1414
constructor(imageryLayer) {
15+
this.show = imageryLayer.show;
1516
this.alpha = imageryLayer.alpha;
1617
this.brightness = imageryLayer.brightness;
1718
this.contrast = imageryLayer.contrast;

packages/engine/Source/Scene/Model/ImageryPipelineStage.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@ class ImageryPipelineStage {
109109
);
110110

111111
// This can happen when none of the imagery textures could
112-
// be obtained, because they had all been INVALID/FAILED.
112+
// be obtained, because they had all been INVALID/FAILED,
113+
// or when none of the imagery layers is actually visible
114+
// according to `show==true`
113115
// Bail out in this case
114116
if (imageryInputs.length === 0) {
115117
return;
@@ -758,7 +760,8 @@ class ImageryPipelineStage {
758760
* pipeline stage for draping the given imagery layers over the primitive
759761
* that is described by the given model primitive imagery.
760762
*
761-
* This will obtain the <code>ImageryCoverage</code> objects that are provided by
763+
* For each imagery layer that is currently visible (as of `show==true`), this
764+
* will obtain the <code>ImageryCoverage</code> objects that are provided by
762765
* the given model primitive imagery (and that describe the imagery tiles
763766
* that are covered by the primitive), and create one <code>ImageryInput</code> for
764767
* each of them.
@@ -791,6 +794,9 @@ class ImageryPipelineStage {
791794

792795
for (let i = 0; i < imageryLayers.length; i++) {
793796
const imageryLayer = imageryLayers.get(i);
797+
if (!imageryLayer.show) {
798+
continue;
799+
}
794800
const imageryTexCoordAttributeSetIndex =
795801
imageryTexCoordAttributeSetIndices[i];
796802
const mappedPositions =

packages/engine/Source/Scene/Model/ModelImagery.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,9 @@ class ModelImagery {
335335
const imageryLayer = imageryLayers.get(i);
336336
const imageryConfiguration = imageryConfigurations[i];
337337

338+
if (imageryLayer.show !== imageryConfiguration.show) {
339+
return true;
340+
}
338341
if (imageryLayer.alpha !== imageryConfiguration.alpha) {
339342
return true;
340343
}

packages/engine/Source/Shaders/PrimitiveGaussianSplatVS.glsl

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,11 @@ vec4 calcCovVectors(vec3 viewPos, mat3 Vrk) {
2222
0.0, 0.0, 0.0
2323
);
2424

25-
//We need to take our view and remove the scale component
26-
//quantized models can have a scaled matrix which will throw our splat size off
2725
mat3 R = mat3(czm_modelView);
28-
vec3 scale;
29-
scale.x = length(R[0].xyz);
30-
scale.y = length(R[1].xyz);
31-
scale.z = length(R[2].xyz);
32-
33-
mat3 Rs = mat3(
34-
R[0].xyz / scale.x,
35-
R[1].xyz / scale.y,
36-
R[2].xyz / scale.z
37-
);
3826

3927
//transform our covariance into view space
4028
//ensures orientation is correct
41-
mat3 Vrk_view = Rs * Vrk * transpose(Rs);
42-
29+
mat3 Vrk_view = R * Vrk * transpose(R);
4330
mat3 cov = transpose(J) * Vrk_view * J;
4431

4532
float diagonal1 = cov[0][0] + .3;
@@ -86,9 +73,6 @@ void main() {
8673
vec2 u3 = unpackHalf2x16(covariance.z);
8774
mat3 Vrk = mat3(u1.x, u1.y, u2.x, u1.y, u2.y, u3.x, u2.x, u3.x, u3.y);
8875

89-
//we can still apply scale here even though cov3d is pre-computed
90-
Vrk *= u_splatScale;
91-
9276
vec4 covVectors = calcCovVectors(splatViewPos.xyz, Vrk);
9377

9478
if (dot(covVectors.xy, covVectors.xy) < 4.0 && dot(covVectors.zw, covVectors.zw) < 4.0) {

packages/engine/Specs/Scene/GaussianSplat3DTileContentSpec.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,26 @@ describe(
9696
},
9797
);
9898
});
99+
it("Create and destroy GaussianSplat3DTileContent", async function () {
100+
const tileset = await Cesium3DTilesTester.loadTileset(
101+
scene,
102+
tilesetUrl,
103+
options,
104+
);
105+
scene.camera.lookAt(
106+
tileset.boundingSphere.center,
107+
new HeadingPitchRange(0.0, -1.57, tileset.boundingSphere.radius),
108+
);
109+
const tile = await Cesium3DTilesTester.waitForTileContentReady(
110+
scene,
111+
tileset.root,
112+
);
113+
114+
scene.primitives.remove(tileset);
115+
expect(tileset.isDestroyed()).toBe(true);
116+
expect(tile.isDestroyed()).toBe(true);
117+
expect(tile.content).toBeUndefined();
118+
});
99119
},
100120
"WebGL",
101121
);

0 commit comments

Comments
 (0)