geometry_get_mesh
Retrieves mesh data from a Polygon_mesh or Triangle_mesh element in the format used by the generate_mesh command or alternatively in an optimized binary representation. Note that the non-binary format is not able to represent holes in a Polygon_mesh due to the way this data is stored internally. If you require holes please use the binary representation. User data is also only supported when using the binary representation.
References:
arguments
- "binary" : Boolean (default: false)
If true a binary representation of the mesh will be returned instead of the format used for the generate_mesh command. This is primarily intended for consumption within server-side V8 JavaScript commands and is much faster to generate. Here is an example of the binary format returned. Note that almost all elements will be ArrayBuffer types which you should use buffer views to access (Float32Array, Uint32Array or Uint8Array depending on the type).
{ type: "Polygon_mesh", tagged: true, points: ArrayBuffer (Float32), normals: ArrayBuffer (Float32), uvs: [ ArrayBuffer (Float32), ... ], uv_sizes: [ 2, ... ], user: [ ArrayBuffer (Float32), ... ], user_sizes: [ 3, ... ], user_names: [ "name1", ... ], corners: ArrayBuffer (Uint32), offsets: ArrayBuffer (Uint32), material_ids: ArrayBuffer (Uint32), holes: ArrayBuffer (Uint8), point_indices: ArrayBuffer (Uint32), normal_indices: ArrayBuffer (Uint32), uv_indices: [ ArrayBuffer (Uint32), ... ], user_indices: [ ArrayBuffer (Uint32), ... ] }
Point information is mandatory but normals, UVs, user data and material ids are optional. The Triangle_mesh variant of the above format differs only in that it does not contain the corner, offset or hole information which is not needed since all primitives have 3 corners in the case of a Triangle_mesh. If the tagged property is true then the material_ids property must be present. When using holes, polygon order is important. Hole polygons must be added immediately after the non-hole polygon they are to be cut into. When using this command this will be the case however when using this representation with the generate_mesh command you must take care to ensure the correct order yourself. - "geometry_name" : String
Name of the Polygon_mesh or Triangle_mesh element to retrieve