generate_mesh
Generates a polygon mesh object using structured data supplied to the command. Supports shared vector data for efficiency and per vertex normals and texture coordinates. See below for the description of the mesh format.
References:
arguments
- "mesh" : Map
Map representing the mesh data to create. Below is an example of a single polygon with 4 vertices and edges, including normals and texture coordinates and a hole in that polygon is also defined. Holes are optional, the first number in the hole array is the index of the polygon into which the hole should be cut. Note that if you specify texture information on the vertices the hole vertices must also contain this. The tagged property controls whether polygons specify material ids or not. If true then the first element of each polygon represents the material id instead of the vertex index.
Note: When the mesh is created the object will not have its visible attribute set. You must call the element_set_attribute command to do so.
The normals and texture coordinates are optional however the position vectors must be provided. Position and normal vectors must be 3D while texture coordinates must be 2D. To use multiple texture coordinates per vertex use an array of indices instead of a single index.
Example:{ "tagged" : false, "vectors" : { "points" : [ {"x": 0.0, "y" : 0.0, "z" : 0.0}, {"x": 0.0, "y" : 0.0, "z" : 5.0}, {"x": 0.0, "y" : 5.0, "z" : 0.0}, {"x": 0.0, "y" : 5.0, "z" : 5.0}, {"x": 0.0, "y" : 1.0, "z" : 1.0}, {"x": 0.0, "y" : 1.0, "z" : 4.0}, {"x": 0.0, "y" : 4.0, "z" : 1.0}, {"x": 0.0, "y" : 4.0, "z" : 4.0} ], "normals" : [ {"x": -1.0, "y" : 0.0, "z" : 0.0} ], "uvs" : [ {"x": 0.0, "y" : 0.0}, {"x": 0.0, "y" : 1.0}, {"x": 1.0, "y" : 0.0}, {"x": 1.0, "y" : 1.0}, {"x": 0.2, "y" : 0.2}, {"x": 0.2, "y" : 0.8}, {"x": 0.8, "y" : 0.2}, {"x": 0.8, "y" : 0.8} ] }, "vertices" : [ {"v" : 0, "n" : 0, "t" : 2}, {"v" : 2, "n" : 0, "t" : 0}, {"v" : 3, "n" : 0, "t" : 1}, {"v" : 1, "n" : 0, "t" : 3}, {"v" : 4, "n" : 0, "t" : 6}, {"v" : 6, "n" : 0, "t" : 4}, {"v" : 7, "n" : 0, "t" : 5}, {"v" : 5, "n" : 0, "t" : 7} ], "polygons" : [ [0, 1, 2, 3] ], "holes" : [ [0, 4, 5, 6, 7] ] }
The generate_mesh command also accepts the optimized binary format generated by the geometry_get_mesh command. See the documentation for that command for more details on this format. This format is automatically detected by the presence of a points property in the top level map that is binary data. Per-vertex user data is only supported when using the binary representation. - "name" : String
Name to give the object once generated
return value
VoidVoid.