Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

draco3d

Package Overview
Dependencies
Maintainers
5
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

draco3d

Draco is a library for compressing and decompressing 3D geometric meshes and point clouds. It is intended to improve the storage and transmission of 3D graphics.

  • 1.5.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
5
Created

What is draco3d?

The draco3d npm package is a library for compressing and decompressing 3D geometric meshes and point clouds. It is designed to improve the storage and transmission efficiency of 3D graphics data.

What are draco3d's main functionalities?

Compression

This feature allows you to compress 3D meshes to reduce their size. The code sample demonstrates how to use the draco3d library to encode a mesh into a compressed format.

const draco3d = require('draco3d');
const encoderModule = draco3d.createEncoderModule();
const encoder = new encoderModule.Encoder();
// Assume mesh is a valid mesh object
const encodedData = encoder.EncodeMeshToDracoBuffer(mesh);
console.log('Encoded data size:', encodedData.byteLength);

Decompression

This feature allows you to decompress 3D meshes that were previously compressed using the draco3d library. The code sample demonstrates how to decode a compressed mesh buffer back into a mesh object.

const draco3d = require('draco3d');
const decoderModule = draco3d.createDecoderModule();
const decoder = new decoderModule.Decoder();
// Assume buffer contains compressed mesh data
const buffer = new decoderModule.DecoderBuffer();
buffer.Init(new Int8Array(compressedData), compressedData.length);
const geometryType = decoder.GetEncodedGeometryType(buffer);
if (geometryType === decoderModule.TRIANGULAR_MESH) {
  const mesh = new decoderModule.Mesh();
  decoder.DecodeBufferToMesh(buffer, mesh);
  console.log('Decompressed mesh:', mesh);
}

Point Cloud Compression

This feature allows you to compress point clouds to reduce their size. The code sample demonstrates how to use the draco3d library to encode a point cloud into a compressed format.

const draco3d = require('draco3d');
const encoderModule = draco3d.createEncoderModule();
const encoder = new encoderModule.Encoder();
// Assume pointCloud is a valid point cloud object
const encodedData = encoder.EncodePointCloudToDracoBuffer(pointCloud);
console.log('Encoded point cloud size:', encodedData.byteLength);

Point Cloud Decompression

This feature allows you to decompress point clouds that were previously compressed using the draco3d library. The code sample demonstrates how to decode a compressed point cloud buffer back into a point cloud object.

const draco3d = require('draco3d');
const decoderModule = draco3d.createDecoderModule();
const decoder = new decoderModule.Decoder();
// Assume buffer contains compressed point cloud data
const buffer = new decoderModule.DecoderBuffer();
buffer.Init(new Int8Array(compressedData), compressedData.length);
const pointCloud = new decoderModule.PointCloud();
decoder.DecodeBufferToPointCloud(buffer, pointCloud);
console.log('Decompressed point cloud:', pointCloud);

Other packages similar to draco3d

Keywords

FAQs

Package last updated on 17 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc