Add mjs_makeMesh to create a builtin mesh.

PiperOrigin-RevId: 788538127
Change-Id: I999733399a1a0da07b0f915f34d31364ab8b3b52
This commit is contained in:
Alessio Quaglino
2025-07-29 11:30:19 -07:00
committed by Copybara-Service
parent 46dc67b7eb
commit 89f4789085
23 changed files with 569 additions and 649 deletions
+54
View File
@@ -1323,6 +1323,60 @@ The full list of processing steps applied by the compiler to each mesh is as fol
Reference orientation relative to which the 3D vertex coordinates and normals are defined. The conjugate of this
quaternion is used to rotate the positions and normals. The model compiler normalizes the quaternion automatically.
.. _asset-mesh-builtin:
:at:`builtin`: :at-val:`string, optional`
The mesh is generated by the compiler from a set of parameters specified in :ref:`params<asset-mesh-params>`.
When saved to XML, meshes produced this way are converted to explicit vertices.
The available built-in types, their parameters and semantics are:
:at-val:`sphere` (subdivision)
Repeated subdivisions :math:`s` of a unit icosahedron. Has :math:`2 + 10 \cdot 4^s` vertices.
**subdivision**: integer in [0-4]: The number of subdivisions to apply to icosahedron faces.
:at-val:`hemisphere` (subdivision)
Repeated subdivisions :math:`s` of a square-based pyramid. Has :math:`1 + 2(s+1)(s+2)` vertices.
**subdivision**: integer in [0-10]: The number of subdivisions to apply to the pyramid.
:at-val:`prism` (nvert)
An extruded regular unit polygon.
**nvert**: integer >= 3: The number vertices in the polygon.
:at-val:`cone` (nvert)
The convex hull of a regular unit polygon and the vertex (0, 0, 1).
**nvert**: integer >= 3: The number vertices in the polygon.
:at-val:`torus` (radius, resolution)
A torus with major radius of 1 and given minor radius.
**radius**: real in (0, 1]: The minor radius of the torus.
|br| **resolution** integer >= 4: The discretization of both major and minor radii.
:at-val:`wedge` (res_phi, res_theta, fov_phi, fov_theta, gamma)
A slice of a unit spherical shell in spherical coordinates.
**res_phi**: integer >= 0: The vertical resolution of the slice.
|br| **res_theta**: integer >= 0: The horizontal resolution of the slice.
|br| **fov_phi**: real in (0, 180]: The horizontal field of view (longitude) in degrees.
|br| **fov_phi**: real in (0, 90): The vertical field of view (latitude) in degrees.
|br| **gamma**: real in [0, 1]: Foveal deformation of the discretization.
:at-val:`plate` (res_x, res_y)
A rectangular plate with resolution in each dimension.
**res_x**: integer > 0: The horizontal resolution of the plate.
|br| **res_y**: integer > 0: The vertical resolution of the plate.
.. _asset-mesh-params:
:at:`params`: :at-val:`real(nparam), optional`
The parameters used to generate a builtin mesh. The number and type of parameters and their semantic depends on the
mesh type. See :ref:`mesh/builtin<asset-mesh-builtin>` for details.
.. _mesh-plugin:
:el-prefix:`mesh/` |-| **plugin** (?)