xeokit / xeokit-xkt-utils

Deprecated JavaScript tools to generate .XKT files; replaced by https://github.com/xeokit/xeokit-convert
Other
10 stars 9 forks source link

XKT Format V7 #7

Closed xeolabs closed 3 years ago

xeolabs commented 3 years ago

The next version of the XKT file format.

Improved Geometry Reuse

XKT V7 reuses geometry data in a more flexible and granular way, resulting in smaller file sizes.

In XKT V6, the file structure is as shown below:

XKTTile(aabb)
    -> XKTEntity(id, matrix) 
        -> XKTPrimitiveInstance() 
            -> XKTPrimitive(positions, normals, indices, edgeIndices, color, opacity)

An XKTPrimitive is a triangle mesh, that has a color and an opacity. XKTPrimitives are used by XKTEntities, which each have a transform matrix. XKTTiles spatially group XKTEntitys.

This is wasteful, because in practice we often have multiple differently-colored XKTPrimitives that have the same shape, eg. a box. In that case, it means we would need to redundantly repeat that box-shaped geometry data, in order to have an object composed of differently-colored boxes.

This also means that, since an XKTEntity transforms all its XKTMeshes using the same matrix, the Local-space positions of those XKTMeshes must be nicely positioned relative to each other, ready to transform as a unit, via that matrix, into World-space.

In XKT V7, we fix this wastage like so:

XKTTile(aabb)
    -> XKTEntity(id) 
        -> XKTMesh(matrix, color, opacity) 
            -> XKTGeometry(type, positions, normals, indices, edgeIndices)

New Geometry Types

Support three geometry types: "triangles", "lines" and "points"

TODO: describe

Auto-flagging watertight geometries

TODO: describe