mirror of
https://git.mirrors.martin98.com/https://github.com/google/draco
synced 2025-06-22 05:05:56 +08:00

The latest version of Draco brings many new enhancements to improve the development experience: * Stable API release * Support for npm Javascript package management * Javascript based encoder * Generalized metadata for meshes and point clouds * Now supporting material properties included along with encoded file * Improved compression rates: * 15% better compression on smaller models * 40% better compression of normals * Performance improvements (~10% faster encoding, decoding) * Reduced GPU memory usage: * Option to store decoded quantized attributes * Support for triangle strip connectivity on decoded meshes * iOS 9 Javascript decoder * Bitstream specification now available
117 lines
3.1 KiB
Plaintext
117 lines
3.1 KiB
Plaintext
// Interface exposed to emscripten's WebIDL Binder.
|
|
// http://kripken.github.io/emscripten-site/docs/porting/connecting_cpp_and_javascript/WebIDL-Binder.html
|
|
enum draco_GeometryAttribute_Type {
|
|
"draco_GeometryAttribute::INVALID",
|
|
"draco_GeometryAttribute::POSITION",
|
|
"draco_GeometryAttribute::NORMAL",
|
|
"draco_GeometryAttribute::COLOR",
|
|
"draco_GeometryAttribute::TEX_COORD",
|
|
"draco_GeometryAttribute::GENERIC"
|
|
};
|
|
|
|
[Prefix="draco::"]
|
|
interface GeometryAttribute {
|
|
void GeometryAttribute();
|
|
};
|
|
|
|
enum draco_EncodedGeometryType {
|
|
"draco::INVALID_GEOMETRY_TYPE",
|
|
"draco::POINT_CLOUD",
|
|
"draco::TRIANGULAR_MESH"
|
|
};
|
|
|
|
enum draco_MeshEncoderMethod {
|
|
"draco::MESH_SEQUENTIAL_ENCODING",
|
|
"draco::MESH_EDGEBREAKER_ENCODING"
|
|
};
|
|
|
|
[Prefix="draco::"]
|
|
interface PointAttribute {
|
|
void PointAttribute();
|
|
long size();
|
|
|
|
// From GeometryAttribute
|
|
long attribute_type();
|
|
long data_type();
|
|
byte num_components();
|
|
boolean normalized();
|
|
long byte_stride();
|
|
long byte_offset();
|
|
long unique_id();
|
|
};
|
|
|
|
[Prefix="draco::"]
|
|
interface PointCloud {
|
|
void PointCloud();
|
|
|
|
long num_attributes();
|
|
long num_points();
|
|
};
|
|
|
|
[Prefix="draco::"]
|
|
interface Mesh : PointCloud {
|
|
void Mesh();
|
|
long num_faces();
|
|
|
|
// From PointCloud
|
|
long num_attributes();
|
|
long num_points();
|
|
void set_num_points(long num_points);
|
|
};
|
|
|
|
[Prefix="draco::"]
|
|
interface Metadata {
|
|
void Metadata();
|
|
};
|
|
|
|
// TODO(zhafang): Move DracoTypedArray to be shared between encoder and decoder
|
|
// Draco version of typed arrays. The memory of these arrays is allocated on the
|
|
// emscripten heap.
|
|
interface DracoFloat32Array {
|
|
void DracoFloat32Array();
|
|
float GetValue(long index);
|
|
long size();
|
|
};
|
|
|
|
interface DracoInt8Array {
|
|
void DracoInt8Array();
|
|
long GetValue(long index);
|
|
long size();
|
|
};
|
|
|
|
interface MetadataBuilder {
|
|
void MetadataBuilder();
|
|
|
|
boolean AddStringEntry(Metadata metadata,
|
|
[Const] DOMString entry_name,
|
|
[Const] DOMString entry_value);
|
|
boolean AddIntEntry(Metadata metadata,
|
|
[Const] DOMString entry_name,
|
|
long entry_value);
|
|
boolean AddDoubleEntry(Metadata metadata,
|
|
[Const] DOMString entry_name,
|
|
double entry_value);
|
|
};
|
|
|
|
interface MeshBuilder {
|
|
void MeshBuilder();
|
|
|
|
boolean AddFacesToMesh(Mesh mesh, long num_faces, [Const] long[] faces);
|
|
long AddFloatAttributeToMesh(Mesh mesh, draco_GeometryAttribute_Type type,
|
|
long num_vertices, long num_components,
|
|
[Const] float[] att_values);
|
|
boolean SetMetadataForAttribute(Mesh mesh, long attribute_id,
|
|
[Const] Metadata metadata);
|
|
boolean AddMetadataToMesh(Mesh mesh, [Const] Metadata metadata);
|
|
};
|
|
|
|
interface Encoder {
|
|
void Encoder();
|
|
void SetEncodingMethod(draco_MeshEncoderMethod method);
|
|
void SetAttributeQuantization(draco_GeometryAttribute_Type type,
|
|
long quantization_bits);
|
|
void SetSpeedOptions(long encoding_speed, long decoding_speed);
|
|
long EncodeMeshToDracoBuffer(Mesh mesh,
|
|
DracoInt8Array encoded_data);
|
|
};
|