Compare commits

...

8 Commits

Author SHA1 Message Date
Adam Beili 46d2ee5259
Merge 275219a777 into ee2b3813b2 2025-11-23 00:56:53 -05:00
jjspace ee2b3813b2
Merge pull request #13038 from CesiumGS/fix/textureatlas-border-internal
deploy / deploy (push) Has been cancelled Details
dev / lint (push) Has been cancelled Details
dev / coverage (push) Has been cancelled Details
dev / release-tests (push) Has been cancelled Details
dev / node-20 (push) Has been cancelled Details
sandcastle-dev / deploy (push) Has been cancelled Details
fix(textureatlas): Apply internal padding between images
2025-11-21 17:14:38 +00:00
Don McCurdy 4e3980cc53 fix(textureatlas): Apply internal padding between images 2025-11-21 11:44:18 -05:00
jjspace c92d0d80a1
Merge pull request #13037 from CesiumGS/chore/textureatlas-visual-tests
chore(textureatlas): Refactor unit tests for visual output
2025-11-20 17:39:22 +00:00
Don McCurdy 16d0cccfdb chore(textureatlas): Fix vertical order unit test debug output 2025-11-20 09:31:57 -05:00
Don McCurdy 5213dfc1c0 update empty space character with '.' 2025-11-18 16:44:20 -05:00
Don McCurdy bd5aa3ff29 chore(textureatlas): Refactor unit tests for visual output 2025-11-18 15:34:19 -05:00
Adam Beili 275219a777 Add ScreenSpaceCameraController.collisionHeightReference 2025-10-10 23:33:30 +03:00
5 changed files with 722 additions and 470 deletions

View File

@ -7,7 +7,8 @@
#### Fixes :wrench:
- Billboards using `imageSubRegion` now render as expected. [#12585](https://github.com/CesiumGS/cesium/issues/12585)
- Improved scaling of SVGs in billboards [#TODO](https://github.com/CesiumGS/cesium/issues/TODO)
- Improved scaling of SVGs in billboards [#13020](https://github.com/CesiumGS/cesium/issues/13020)
- Fixed unexpected outline artifacts around billboards [#13038](https://github.com/CesiumGS/cesium/issues/13038)
#### Additions :tada:

View File

@ -122,6 +122,8 @@ TexturePacker.prototype._findNode = function (node, { width, height }) {
return node;
}
const borderPadding = this._borderPadding;
// Vertical split (childNode1 = left half, childNode2 = right half).
if (widthDifference > heightDifference) {
node.childNode1 = new TextureNode({
@ -130,12 +132,18 @@ TexturePacker.prototype._findNode = function (node, { width, height }) {
width,
height: nodeHeight,
});
node.childNode2 = new TextureNode({
x: rectangle.x + width,
y: rectangle.y,
width: widthDifference,
height: nodeHeight,
});
// Apply padding only along the vertical "cut".
const widthDifferencePadded = widthDifference - borderPadding;
if (widthDifferencePadded > 0) {
node.childNode2 = new TextureNode({
x: rectangle.x + width + borderPadding,
y: rectangle.y,
width: widthDifferencePadded,
height: nodeHeight,
});
}
return this._findNode(node.childNode1, { width, height });
}
@ -147,12 +155,19 @@ TexturePacker.prototype._findNode = function (node, { width, height }) {
width: nodeWidth,
height,
});
node.childNode2 = new TextureNode({
x: rectangle.x,
y: rectangle.y + height,
width: nodeWidth,
height: heightDifference,
});
// Apply padding only along the horizontal "cut".
const heightDifferencePadded = heightDifference - borderPadding;
if (heightDifferencePadded > 0) {
node.childNode2 = new TextureNode({
x: rectangle.x,
y: rectangle.y + height + borderPadding,
width: nodeWidth,
height: heightDifferencePadded,
});
}
return this._findNode(node.childNode1, { width, height });
}

View File

@ -3943,12 +3943,26 @@ function callAfterRenderFunctions(scene) {
}
}
/**
* Calculate the height of the globe at the camera position based on the value of {@link ScreenSpaceCameraController.collisionHeightReference},
* or undefined if the height cannot be determined.
*
* @param {Scene} scene
* @returns {number|undefined}
*/
function getGlobeHeight(scene) {
if (scene.mode === SceneMode.MORPHING) {
if (
scene.mode === SceneMode.MORPHING ||
scene._screenSpaceCameraController.collisionHeightReference ===
HeightReference.NONE
) {
return;
}
const cartographic = scene.camera.positionCartographic;
return scene.getHeight(cartographic);
return scene.getHeight(
cartographic,
scene._screenSpaceCameraController.collisionHeightReference,
);
}
function getMaxPrimitiveHeight(primitive, cartographic, scene) {

View File

@ -24,6 +24,7 @@ import MapMode2D from "./MapMode2D.js";
import SceneMode from "./SceneMode.js";
import SceneTransforms from "./SceneTransforms.js";
import TweenCollection from "./TweenCollection.js";
import HeightReference from "./HeightReference.js";
/**
* Modifies the camera position and orientation based on mouse input to a canvas.
@ -265,13 +266,13 @@ function ScreenSpaceCameraController(scene) {
: ellipsoid.minimumRadius * 1.175;
this._minimumTrackBallHeight = this.minimumTrackBallHeight;
/**
* When disabled, the values of <code>maximumZoomDistance</code> and <code>minimumZoomDistance</code> are ignored.
* Also used in conjunction with {@link Cesium3DTileset#enableCollision} to prevent the camera from moving through or below a 3D Tileset surface.
* This may also affect clamping behavior when using {@link HeightReference.CLAMP_TO_GROUND} on 3D Tiles.
* @type {boolean}
* @default true
* This value controls the height reference for the {@link ScreenSpaceCameraController} collision, which is used to limit the camera minimum and maximum zoom.
* When set to {@link HeightReference.NONE}, the camera can go underground, and the values of <code>maximumZoomDistance</code> and <code>minimumZoomDistance</code> are ignored.
* For all other values, the camera is constrained to be above the terrain and/or 3D Tiles (depending on {@link Cesium3DTileset#enableCollision}).
* @type {HeightReference}
* @default HeightReference.CLAMP_TO_GROUND
*/
this.enableCollisionDetection = true;
this.collisionHeightReference = HeightReference.CLAMP_TO_GROUND;
/**
* The angle, relative to the ellipsoid normal, restricting the maximum amount that the user can tilt the camera. If <code>undefined</code>, the angle of the camera tilt is unrestricted.
* @type {number|undefined}
@ -353,6 +354,27 @@ function ScreenSpaceCameraController(scene) {
this._maximumUndergroundPickDistance = 10000.0;
}
Object.defineProperties(ScreenSpaceCameraController.prototype, {
/**
* When disabled, the values of <code>maximumZoomDistance</code> and <code>minimumZoomDistance</code> are ignored.
* Also used in conjunction with {@link Cesium3DTileset#enableCollision} to prevent the camera from moving through or below a 3D Tileset surface.
* This may also affect clamping behavior when using {@link HeightReference.CLAMP_TO_GROUND} on 3D Tiles.
* @type {boolean}
* @default true
* @deprecated Use {@link ScreenSpaceCameraController#collisionHeightReference} instead.
*/
enableCollisionDetection: {
get: function () {
return this.collisionHeightReference !== HeightReference.NONE;
},
set: function (value) {
this.collisionHeightReference = value
? HeightReference.CLAMP_TO_GROUND
: HeightReference.NONE;
},
},
});
function decay(time, coefficient) {
if (time < 0) {
return 0.0;

File diff suppressed because it is too large Load Diff