Skip to content

3D Tiles Writer#412

Merged
kring merged 1 commit intomainfrom
tileset-writer
Dec 17, 2021
Merged

3D Tiles Writer#412
kring merged 1 commit intomainfrom
tileset-writer

Conversation

@lilleyse
Copy link
Contributor

@lilleyse lilleyse commented Dec 7, 2021

Adds a new project Cesium3DTilesWriter that serializes a Tileset struct to a tileset JSON.

Much of this work is built on top of #306 and #307 with similar generated code and improved handling of extensions, extras, and default values.

@krupkad's original summary still mostly applies

Writer generation:

  • Writers are primarily implemented as overloads of writeJson in an anonymous namespace in cpp files
  • They are exposed as classes (e.g. TilesetWriter) with a single static method write, which just calls writeJson
  • The cpp files contain writeJson implementations for primitive types (double, string, integer, bool), composites (string->X dictionary, array), and optional

The code generation is split between generate.js and generateCombinedWriter.js. generate.js creates the pieces for each writer and generateCombinedWriter.js combines them into a single header and cpp file. There's special handling for default values. We don't write a property if

  • The property is optional and the value is the default value. This is important for both keeping the files small and preventing invalid files from being generated. For example, in glTF matrix and translation/rotation/scale are mutually exclusive and we shouldn't write out default values for both.
  • The property is an optional glTF id with value -1
  • The property is a vector or map type that's empty
  • The property has the std::optional type and it doesn't have a value

The code has been tested with both 3D Tiles (this PR) and glTF (follow up PR) and seems to produce valid results for both, though there could be lingering issues with the default value checks.

@lilleyse lilleyse requested a review from kring December 7, 2021 00:37
@kring
Copy link
Member

kring commented Dec 17, 2021

Thanks @lilleyse!

@kring kring merged commit 8b9dfce into main Dec 17, 2021
@kring kring deleted the tileset-writer branch December 17, 2021 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments