draco/javascript/emscripten/draco_web.idl
Ondrej Stava ef7ad0fda3 Merging latest changes from the private repo.
1. Added support for loading sub-objects in .OBJ into a generic
attribute.

2. Added missing mesh_are_equivlent classes needed for certain unit
tests.

3. Updated javascript decoder reflecting our latest changes + added
support for GeometryAttribute::custom_id() method.

4. Added checks for valid quantization bits to our draco_encoder app.
2017-02-14 14:33:55 -08:00

97 lines
2.5 KiB
Plaintext

// Interface exposed to emscripten's WebIDL Binder.
// http://kripken.github.io/emscripten-site/docs/porting/connecting_cpp_and_javascript/WebIDL-Binder.html
[Prefix="draco::"]
interface DecoderBuffer {
void DecoderBuffer();
void Init([Const] byte[] data, unsigned long data_size);
};
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"
};
[Prefix="draco::"]
interface PointAttribute {
void PointAttribute();
long size();
// From GeometryAttribute
long attribute_type();
long data_type();
byte components_count();
boolean normalized();
long byte_stride();
long byte_offset();
long custom_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();
};
// Draco version of typed arrays. The memory of these arrays is allocated on the
// emscripten heap.
[Prefix="draco::"]
interface DracoFloat32Array {
void DracoFloat32Array();
float GetValue(long index);
};
[Prefix="draco::"]
interface DracoInt32Array {
void DracoInt32Array();
long GetValue(long index);
};
[Prefix="draco::"]
interface WebIDLWrapper {
void WebIDLWrapper();
draco_EncodedGeometryType GetEncodedGeometryType(DecoderBuffer in_buffer);
PointCloud DecodePointCloudFromBuffer(DecoderBuffer in_buffer);
Mesh DecodeMeshFromBuffer(DecoderBuffer in_buffer);
[Const] long GetAttributeId([Ref, Const] PointCloud pc,
draco_GeometryAttribute_Type type);
[Const] PointAttribute GetAttribute([Ref, Const] PointCloud pc, long att_id);
boolean GetFaceFromMesh([Ref, Const] Mesh m, long face_id,
DracoInt32Array out_values);
boolean GetAttributeFloat([Ref, Const] PointAttribute pa,
long att_index,
DracoFloat32Array out_values);
boolean GetAttributeFloatForAllPoints([Ref, Const] PointCloud pc,
[Ref, Const] PointAttribute pa,
DracoFloat32Array out_values);
};