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

feat: implement draco decoder #1

Merged
merged 8 commits into from
Nov 6, 2024
Merged

feat: implement draco decoder #1

merged 8 commits into from
Nov 6, 2024

Conversation

okwasniewski
Copy link
Member

@okwasniewski okwasniewski commented Oct 29, 2024

Summary

This PR implements DracoDecoderModule API.

It's following the spec from upstream google/draco.

// Create the Draco decoder.
const decoderModule = DracoDecoderModule();
const buffer = new decoderModule.DecoderBuffer();
buffer.Init(byteArray, byteArray.length);

// Create a buffer to hold the encoded data.
const decoder = new decoderModule.Decoder();
const geometryType = decoder.GetEncodedGeometryType(buffer);

// Decode the encoded geometry.
let outputGeometry;
let status;
if (geometryType == decoderModule.TRIANGULAR_MESH) {
  outputGeometry = new decoderModule.Mesh();
  status = decoder.DecodeBufferToMesh(buffer, outputGeometry);
} else {
  outputGeometry = new decoderModule.PointCloud();
  status = decoder.DecodeBufferToPointCloud(buffer, outputGeometry);
}

// You must explicitly delete objects created from the DracoDecoderModule
// or Decoder.
decoderModule.destroy(outputGeometry);
decoderModule.destroy(decoder);

Test plan

Test if decoding .drc files work properly.

@okwasniewski okwasniewski changed the title [DRAFT] wip draco decoder feat: implement draco decoder Nov 4, 2024
Copy link

@mani3xis mani3xis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found some remarks in the first reading pass.
I'll check the remaining code later when I'll find a time slot.

cpp/react-native-draco.cpp Outdated Show resolved Hide resolved
cpp/react-native-draco.cpp Outdated Show resolved Hide resolved
cpp/react-native-draco.cpp Outdated Show resolved Hide resolved
cpp/react-native-draco.cpp Outdated Show resolved Hide resolved
cpp/react-native-draco.cpp Outdated Show resolved Hide resolved
cpp/react-native-draco.cpp Outdated Show resolved Hide resolved
example/ios/Resources/resources.podspec Outdated Show resolved Hide resolved
Copy link

@fvlvte fvlvte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@okwasniewski okwasniewski merged commit d87cd6e into main Nov 6, 2024
5 checks passed
@okwasniewski okwasniewski deleted the feat/draco-decoder branch November 6, 2024 13:27
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.

3 participants