Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CESIUM_primitive_outline performance #12084

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

- Updated geometric self-shadowing function to improve direct lighting on models using physically-based rendering. [#12063](https://github.com/CesiumGS/cesium/pull/12063)
- Fixed environment map LOD selection in image-based lighting. [#12070](https://github.com/CesiumGS/cesium/pull/12070)
- Fixed performance issues with GLTF extension CESIUM_primitive_outline since version 1.96. [#12077](https://github.com/CesiumGS/cesium/issues/12077)
- Corrected calculation of diffuse component in image-based lighting. [#12082](https://github.com/CesiumGS/cesium/pull/12082)

### 1.119 - 2024-07-01
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -391,3 +391,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
- [Peter A. Jonsson](https://github.com/pjonsson)
- [Zhongxiang Wang](https://github.com/plainheart)
- [Tim Schneider](https://github.com/Tim-S)
- [朱铭凡](https://github.com/MingFanZhu)
18 changes: 9 additions & 9 deletions packages/engine/Source/Scene/PrimitiveLoadPlan.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,15 @@ function generateOutlines(loadPlan) {
indices.typedArray = generator.updatedTriangleIndices;
indices.indexDatatype = IndexDatatype.fromTypedArray(indices.typedArray);

// Some vertices may be copied due to the addition of the new attribute
// which may have multiple values at a vertex depending on the face
const attributePlans = loadPlan.attributePlans;
const attributesLength = loadPlan.attributePlans.length;
for (let i = 0; i < attributesLength; i++) {
const attribute = attributePlans[i].attribute;
attribute.typedArray = generator.updateAttribute(attribute.typedArray);
}

// The outline generator creates a new attribute for the outline coordinates
// that are used with a lookup texture.
const outlineCoordinates = makeOutlineCoordinatesAttribute(
Expand All @@ -203,15 +212,6 @@ function generateOutlines(loadPlan) {
outlineCoordinatesPlan.loadTypedArray = false;
loadPlan.attributePlans.push(outlineCoordinatesPlan);
primitive.outlineCoordinates = outlineCoordinatesPlan.attribute;

// Some vertices may be copied due to the addition of the new attribute
// which may have multiple values at a vertex depending on the face
const attributePlans = loadPlan.attributePlans;
const attributesLength = loadPlan.attributePlans.length;
for (let i = 0; i < attributesLength; i++) {
const attribute = attributePlans[i].attribute;
attribute.typedArray = generator.updateAttribute(attribute.typedArray);
}
}

function makeOutlineCoordinatesAttribute(outlineCoordinatesTypedArray) {
Expand Down