DracoCodec

actual object DracoCodec

Platform bridge to Google's Draco geometry compression library (https://github.com/google/draco), used to compress/decompress the raw point clouds written every ~0.33s during object-capture scanning (see DracoFiles).

Position + color are the only geometry attributes (an unstructured point cloud, no faces). metadataText is stored verbatim as a single string entry in Draco's binary metadata section, which the encoder/decoder serialize as part of the normal point cloud buffer -- DracoFiles is responsible for formatting/parsing that string.

Implemented natively on Android via JNI over the vendored draco C++ sources (see core/src/androidMain/cpp/CMakeLists.txt and draco_bridge.cpp). ARCore-based object-capture scanning isn't shipped on iOS yet, so there is no iOS implementation today -- see DracoCodec.ios.kt. When iOS scanning ships, prefer bridging the same vendored draco C++ sources via cinterop/Obj-C++ rather than a separate Swift reimplementation, so both platforms stay bit-compatible and get bugfixes together.

expect object DracoCodec

Platform bridge to Google's Draco geometry compression library (https://github.com/google/draco), used to compress/decompress the raw point clouds written every ~0.33s during object-capture scanning (see DracoFiles).

Position + color are the only geometry attributes (an unstructured point cloud, no faces). metadataText is stored verbatim as a single string entry in Draco's binary metadata section, which the encoder/decoder serialize as part of the normal point cloud buffer -- DracoFiles is responsible for formatting/parsing that string.

Implemented natively on Android via JNI over the vendored draco C++ sources (see core/src/androidMain/cpp/CMakeLists.txt and draco_bridge.cpp). ARCore-based object-capture scanning isn't shipped on iOS yet, so there is no iOS implementation today -- see DracoCodec.ios.kt. When iOS scanning ships, prefer bridging the same vendored draco C++ sources via cinterop/Obj-C++ rather than a separate Swift reimplementation, so both platforms stay bit-compatible and get bugfixes together.

Functions

Link copied to clipboard

Decompresses bytes produced by encodePointCloud.

Decompresses bytes produced by encodePointCloud.

Link copied to clipboard
actual fun encodePointCloud(positions: FloatArray, colors: ByteArray, pointCount: Int, metadataText: String): ByteArray

Compresses pointCount points' worth of interleaved positions/colors.

expect fun encodePointCloud(positions: FloatArray, colors: ByteArray, pointCount: Int, metadataText: String): ByteArray

Compresses pointCount points' worth of interleaved positions/colors.