CesiumGS / CesiumGS/cesium

Exception for vector- or matrix typed `noData` metadata values without `default`

Open
#11,802 0 comments 0 reactions 0 assignees View on GitHub
category - 3d tiles type - bug
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

(Similar or related to https://github.com/CesiumGS/cesium/issues/11796 )

The [`MetadataTableProperty.get` function](https://github.com/CesiumGS/cesium/blob/737c4538d587767008fcd7a1dfce67213180fb77/packages/engine/Source/Scene/MetadataTableProperty.js#L329) checks wheher the given value is a `noData` value, by passing it to [`MetadataClassProperty.handleNoData`](https://github.com/CesiumGS/cesium/blob/737c4538d587767008fcd7a1dfce67213180fb77/packages/engine/Source/Scene/MetadataClassProperty.js#L826). When the value is a vector type (for example, a `VEC3` that arrives there as a 3-element `number` array), and it is the same as the `noData` value, then the `handleNoData` function will return `undefined`, In this case, the value will be set to the `default` value, and passed to `unpackVectorAndMatrixTypes`. But when the `default` value is _also_ `undefined`, then this will lead to an exception at the end of `unpackVectorAndMatrixTypes`.

![Cesium noData vector undefined](https://github.com/CesiumGS/cesium/assets/5597569/2161b916-f02f-4d00-9c93-84663db52bf0)

Reported at https://community.cesium.com/t/metadata-property-vector3-float32-throws-exception-when-using-nodata/29655 with test data at https://github.com/bertt/cesium_issues/tree/b14b8f8af2aa0c289000b3b095270d0e8e195672/vector3_float32_nodata

Contributor guide

Open the contributing guide

Research direction

Read packages/engine/Source/Scene/MetadataTableProperty.js around MetadataTableProperty.get and packages/engine/Source/Scene/MetadataClassProperty.js around MetadataClassProperty.handleNoData and unpackVectorAndMatrixTypes. Reproduce the vector noData case using the linked test data, then verify that a vector or matrix noData value without a default no longer throws an exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.