mirror of https://github.com/CesiumGS/cesium.git
Compare commits
7 Commits
af406755b3
...
28213a796f
| Author | SHA1 | Date |
|---|---|---|
|
|
28213a796f | |
|
|
ee2b3813b2 | |
|
|
4e3980cc53 | |
|
|
c92d0d80a1 | |
|
|
16d0cccfdb | |
|
|
5213dfc1c0 | |
|
|
bd5aa3ff29 |
|
|
@ -7,7 +7,9 @@
|
|||
#### 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)
|
||||
- Fixed image alignment in large billboard collections [#13042](https://github.com/CesiumGS/cesium/issues/13042)
|
||||
|
||||
#### Additions :tada:
|
||||
|
||||
|
|
|
|||
|
|
@ -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 });
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -364,26 +364,17 @@ TextureAtlas.prototype._resize = function (context, queueOffset = 0) {
|
|||
toPack.push(queue[i]);
|
||||
}
|
||||
|
||||
// At minimum, the texture will need to scale to accommodate the largest width and height
|
||||
width = Math.max(maxWidth, width);
|
||||
height = Math.max(maxHeight, height);
|
||||
// At minimum, atlas must fit its largest input images. Texture coordinates are
|
||||
// compressed to 0–1 with 12-bit precision, so use power-of-two size to align pixels.
|
||||
width = CesiumMath.nextPowerOfTwo(Math.max(maxWidth, width));
|
||||
height = CesiumMath.nextPowerOfTwo(Math.max(maxHeight, height));
|
||||
|
||||
if (!context.webgl2) {
|
||||
width = CesiumMath.nextPowerOfTwo(width);
|
||||
height = CesiumMath.nextPowerOfTwo(height);
|
||||
}
|
||||
|
||||
// Determine by what factor the texture need to be scaled by at minimum
|
||||
const areaDifference = areaQueued;
|
||||
let scalingFactor = 1.0;
|
||||
while (areaDifference / width / height >= 1.0) {
|
||||
scalingFactor *= 2.0;
|
||||
|
||||
// Resize by one dimension
|
||||
// Iteratively double the smallest dimension until atlas area is (approximately) sufficient.
|
||||
while (areaQueued >= width * height) {
|
||||
if (width > height) {
|
||||
height *= scalingFactor;
|
||||
height *= 2;
|
||||
} else {
|
||||
width *= scalingFactor;
|
||||
width *= 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue