.. _stdlib_primitives_core: =============== Mesh primitives =============== Here you can find useful functions for requesting mesh primitives such as cubes, spheres, cylinders, etc. Furthermore, you can create solids of revolution and extruder meshes. +++++++++ Constants +++++++++ .. _global-primitives_core-QUAD_MESH_ID: .. das:attribute:: QUAD_MESH_ID = request_mesh_primitive("%builtin_package/quad.mesh") MeshId of the default quad mesh .. _global-primitives_core-SPHERE_MESH_ID: .. das:attribute:: SPHERE_MESH_ID = request_mesh_primitive("%builtin_package/sphere.mesh") MeshId of the default sphere mesh .. _global-primitives_core-CUBE_MESH_ID: .. das:attribute:: CUBE_MESH_ID = request_mesh_primitive("%builtin_package/cube.mesh") MeshId of the default cube mesh .. _global-primitives_core-PLANE_MESH_ID: .. das:attribute:: PLANE_MESH_ID = request_mesh_primitive("%builtin_package/plane.mesh") MeshId of the default plane mesh .. _global-primitives_core-PRISM_MESH_ID: .. das:attribute:: PRISM_MESH_ID = request_mesh_primitive("%builtin_package/prism.mesh") MeshId of the default prism mesh .. _global-primitives_core-CYLINDER_MESH_ID: .. das:attribute:: CYLINDER_MESH_ID = request_mesh_primitive("%builtin_package/cylinder.mesh") MeshId of the default cylinder mesh .. _global-primitives_core-PYRAMID_MESH_ID: .. das:attribute:: PYRAMID_MESH_ID = request_mesh_primitive("%builtin_package/pyramid.mesh") MeshId of the default pyramid mesh .. _global-primitives_core-CONE_MESH_ID: .. das:attribute:: CONE_MESH_ID = request_mesh_primitive("%builtin_package/cone.mesh") MeshId of the default cone mesh .. _global-primitives_core-CAPSULE_MESH_ID: .. das:attribute:: CAPSULE_MESH_ID = request_mesh_primitive("%builtin_package/capsule.mesh") MeshId of the default capsule mesh .. _global-polygon_mesh_geometry-MIN_SIDES: .. das:attribute:: MIN_SIDES = 3 Minimum number of subdivisions for polygon mesh geometry .. _global-sphere_mesh_geometry-MIN_SPHERE_SUBDIVISIONS: .. das:attribute:: MIN_SPHERE_SUBDIVISIONS = 3 Minimum number of subdivisions for sphere mesh geometry .. _global-plane_mesh_geometry-MIN_CELLS: .. das:attribute:: MIN_CELLS = 1 Minimum number of cells for plane mesh geometry .. _global-cone_mesh_geometry-MIN_CONE_SUBDIVISIONS: .. das:attribute:: MIN_CONE_SUBDIVISIONS = 3 Minimum number of subdivisions for cone mesh generation .. _global-capsule_mesh_geometry-MIN_CAPSULE_SUBDIVISIONS: .. das:attribute:: MIN_CAPSULE_SUBDIVISIONS = 3 Minimum number of subdivisions for capsule mesh generation .. _global-solid_of_revolution_mesh_geometry-MIN_SOLID_OF_REVOLUTION_SUBDIVISIONS: .. das:attribute:: MIN_SOLID_OF_REVOLUTION_SUBDIVISIONS = 3 Minimum number of subdivisions for solid of revolution mesh generation .. _global-extruder_mesh_geometry-MIN_EXTRUDER_SUBDIVISIONS: .. das:attribute:: MIN_EXTRUDER_SUBDIVISIONS = 3 Minimum number of subdivisions for extruder mesh generation .. _global-pipe_mesh_geometry-MIN_PIPE_SUBDIVISIONS: .. das:attribute:: MIN_PIPE_SUBDIVISIONS = 3 Minimum number of subdivisions for pipe mesh generation ++++++++++ Structures ++++++++++ .. _struct-primitives_core-QuadInit: .. das:attribute:: QuadInit QuadInit struct is used to initialize a quad mesh :Fields: * **width** : float = 1f - The width of the quad * **height** : float = 1f - The height of the quad .. _struct-primitives_core-PolygonInit: .. das:attribute:: PolygonInit PolygonInit struct is used to initialize a polygon mesh :Fields: * **sides** : int = 24 - The number of sides of the polygon * **radius** : float = 0.5f - The radius of the polygon .. _struct-primitives_core-SphereInit: .. das:attribute:: SphereInit SphereInit struct is used to initialize a sphere mesh :Fields: * **radius** : float = 0.5f - The radius of the sphere * **subdivisions** : int = 24 - The number of subdivisions. The more subdivisions, the smoother the sphere .. _struct-primitives_core-CubeInit: .. das:attribute:: CubeInit CubeInit struct is used to initialize a rectangular parallelepiped cuboid :Fields: * **width** : float = 1f - The width of the cuboid * **height** : float = 1f - The height of the cuboid * **depth** : float = 1f - The depth of the cuboid .. _struct-primitives_core-PlaneInit: .. das:attribute:: PlaneInit PlaneInit struct is used to initialize a plane mesh. :Fields: * **cells** : int = 1 - The number of cells along one axis of the plane. The total number of cells will be ``cells * cells`` .. _struct-primitives_core-PrismInit: .. das:attribute:: PrismInit PrismInit struct is used to initialize a regular right prism mesh :Fields: * **sides** : int = 3 - The number of sides of the prism * **height** : float = 2f - The height of the prism * **radius** : float = 0.5f - The radius of the prism base * **axis** : string = "y" - Specifies the orientation of the prism, can be "x", "y", or "z". Default is "y" * **cap** : bool = true - Specifies whether to generate caps for the prism. Default is true .. _struct-primitives_core-CylinderInit: .. das:attribute:: CylinderInit CylinderInit struct is used to initialize a cylinder mesh :Fields: * **height** : float = 2f - The height of the cylinder * **radius** : float = 0.5f - The radius of the cylinder * **axis** : string = "y" - Specifies the orientation of the cylinder, can be "x", "y", or "z". Default is "y" * **subdivisions** : int = 24 - The number of subdivisions. The more subdivisions, the smoother the cylinder * **cap** : bool = true - Specifies whether to generate caps for the cylinder. Default is true .. _struct-primitives_core-PyramidInit: .. das:attribute:: PyramidInit PyramidInit struct is used to initialize a pyramid mesh :Fields: * **sides** : int = 4 - The number of sides of the pyramid * **height** : float = 1f - The height of the pyramid * **radius** : float = 0.5f - The radius of the pyramid at the base * **frustumRadius** : float = 0f - The radius of the pyramid at the top (if it is truncated). Default is 0, which means the pyramid is not truncated * **axis** : string = "y" - Specifies the orientation of the pyramid, can be "x", "y", or "z". Default is "y" * **cap** : bool = true - Specifies whether to generate a cap for the pyramid. Default is true * **tessellation** : int = 1 - The number of subdivisions along the height of the pyramid, there will be at least the same amount of subdivisions along the base perimeter. Default is 1. Increase this value if you have problems with texture stretching, but keep in mind that it will increase the number of vertices and triangles. .. _struct-primitives_core-ConeInit: .. das:attribute:: ConeInit ConeInit struct is used to initialize a cone mesh :Fields: * **height** : float = 1f - The height of the cone * **radius** : float = 0.5f - The radius of the cone at the base * **frustumRadius** : float = 0f - The radius of the cone at the top (if it is truncated). Default is 0, which means the cone is not truncated * **axis** : string = "y" - Specifies the orientation of the cone, can be "x", "y", or "z". Default is "y" * **subdivisions** : int = 24 - The number of subdivisions. The more subdivisions, the smoother the cone * **cap** : bool = true - Specifies whether to generate a cap for the cone. Default is true * **tessellation** : int = 4 - The number of subdivisions along the height of the cone. Default is 4. Increase this value if you have problems with cone smoothness or texture stretching, but keep in mind that it will increase the number of vertices and triangles. .. _struct-primitives_core-CapsuleInit: .. das:attribute:: CapsuleInit CapsuleInit struct is used to initialize a capsule mesh :Fields: * **height** : float = 2f - Total height of the capsule, including the cylinder and the two hemispheres * **radius** : float = 0.5f - The radius of the capsule * **axis** : string = "y" - Specifies the orientation of the capsule, can be "x", "y", or "z". Default is "y" * **subdivisions** : int = 24 - Number of subdivisions. The more subdivisions, the smoother the capsule .. _struct-primitives_core-RevolutionInit: .. das:attribute:: RevolutionInit RevolutionInit struct is used to initialize a solid of revolution mesh :Fields: * **points** : array - An array of 2D points (float2) that define the profile of the solid of revolution * **subdivisions** : int = 24 - The number of subdivisions. The more subdivisions, the smoother the solid of revolution * **cap** : bool = true - Specifies whether to generate caps for the mesh. Default is true .. _struct-primitives_core-ExtruderInit: .. das:attribute:: ExtruderInit ExtruderInit struct is used to initialize an extruder mesh :Fields: * **polygonPoints** : array - Represents the profile of the extruder. Clockwise order of the polygon points makes the normals point outwards making the extruder visible from the outside, counterclockwise order makes the normals point inwards making the extruder visible from the inside like a corridor * **points** : array - Represents the path of the extruder * **bendRadius** : float = 1f - The radius of all bends in the extruder * **subdivisions** : int = 24 - The number of subdivisions. The more subdivisions, the smoother the extruder * **cap** : bool = true - Specifies whether to generate caps for the mesh or not. Default is true * **closed** : bool = false - Specifies whether the path is closed, forming a loop. Default is false * **smoothNormals** : bool = false - Specifies whether the extruder profile is smoothed or not. Default is false .. _struct-primitives_core-PipeInit: .. das:attribute:: PipeInit PipeInit struct is used to initialize a pipe mesh :Fields: * **points** : array - The path of the pipe * **radius** : float = 1f - The radius of pipe's section * **bendRadius** : float = 1f - The radius of all bends of the pipe * **subdivisions** : int = 24 - The number of subdivisions. The more subdivisions, the smoother the pipe * **cap** : bool = true - Specifies whether to generate caps for the mesh or not. Default is true * **closed** : bool = false - Specifies whether the path is closed, forming a loop. Default is false +++++++++ Functions +++++++++ * :ref:`create_quad_mesh (init_params: QuadInit) : MeshId ` * :ref:`create_polygon_mesh (init_params: PolygonInit = PolygonInit()) : MeshId ` * :ref:`create_sphere_mesh (init_params: SphereInit) : MeshId ` * :ref:`create_cube_mesh (init_params: CubeInit) : MeshId ` * :ref:`create_plane_mesh (init_params: PlaneInit) : MeshId ` * :ref:`create_prism_mesh (init_params: PrismInit) : MeshId ` * :ref:`create_cylinder_mesh (init_params: CylinderInit) : MeshId ` * :ref:`create_pyramid_mesh (init_params: PyramidInit) : MeshId ` * :ref:`create_cone_mesh (init_params: ConeInit) : MeshId ` * :ref:`create_capsule_mesh (init_params: CapsuleInit) : MeshId ` * :ref:`create_solid_of_revolution_mesh (var init_params: RevolutionInit) : MeshId ` * :ref:`create_extruder_mesh (var init_params: ExtruderInit) : MeshId ` * :ref:`create_pipe_mesh (var init_params: PipeInit) : MeshId ` * :ref:`create_quad_mesh_geometry (width: float; height: float) : MeshGeometry ` * :ref:`create_polygon_mesh_geometry (var sides: int = 24; radius: float = 0.5f) : MeshGeometry ` * :ref:`create_sphere_mesh_geometry (var subdivisions: int = 64; radius: float = 0.5f) : MeshGeometry ` * :ref:`create_cube_mesh_geometry (sizeX: float = 1f; sizeY: float = 1f; sizeZ: float = 1f) : MeshGeometry ` * :ref:`create_plane_mesh_geometry (var cells: int) : MeshGeometry ` * :ref:`create_cone_mesh_geometry (var subdivisions: int = 24; height: float = 1f; radius: float = 0.5f; frustumRadius: float = 0f; cap: bool = true; smoothNormals: bool = true; axis: string = "y"; tessellation: int = 1) : MeshGeometry ` * :ref:`create_capsule_mesh_geometry (var subdivisions: int = 24; height: float = 2f; radius: float = 0.5f; axis: string = "y") : MeshGeometry ` * :ref:`create_solid_of_revolution_mesh_geometry (var points: array\; var subdivisions: int; cap: bool = true) : MeshGeometry ` * :ref:`create_extruder_mesh_geometry (var polygonPoints: array\; points: array\; var subdivisions: int; var bendRadius: float; cap: bool = true; closed: bool = false; smoothNormals: bool = false) : MeshGeometry ` * :ref:`create_pipe_mesh_geometry (points: array\; var subdivisions: int; radius: float; var bendRadius: float; cap: bool = true; closed: bool = false) : MeshGeometry ` .. _function-primitives_core_create_quad_mesh_QuadInit: .. das:function:: create_quad_mesh(init_params: QuadInit) : MeshId Generates a quad mesh The quad will lie in the XY plane with its normal pointing to the camera (in the negative Z direction). The center of the quad will have coordinates (0, 0) :Arguments: * **init_params** : :ref:`QuadInit ` - The data to build the quad mesh from :Returns: * :ref:`MeshId ` - MeshId of the resulting quad mesh Usage example:: let quadMesh = create_quad_mesh(QuadInit(width = 16.0, height = 9.0)) let quadNode = create_node() add_component(quadNode, new Mesh(meshId = quadMesh)) .. _function-primitives_core_create_polygon_mesh_PolygonInit: .. das:function:: create_polygon_mesh(init_params: PolygonInit = PolygonInit()) : MeshId Generates a polygon mesh The polygon will lie in the XY plane with its normal pointing to the camera (in the negative Z direction). The center of the polygon will have coordinates (0, 0) :Arguments: * **init_params** : :ref:`PolygonInit ` - The data to build the polygon mesh from :Returns: * :ref:`MeshId ` - MeshId of the resulting polygon mesh Usage example:: let polygonMesh = create_polygon_mesh(PolygonInit(sides = 6, radius = 1.0)) let polygonNode = create_node() add_component(polygonNode, new Mesh(meshId = polygonMesh)) .. _function-primitives_core_create_sphere_mesh_SphereInit: .. das:function:: create_sphere_mesh(init_params: SphereInit) : MeshId Generates a sphere mesh Note that it's recommended to make several nodes with the same sphere mesh and scale them instead of creating multiple meshes with different radii - each mesh will have its own draw call :Arguments: * **init_params** : :ref:`SphereInit ` - The data to build the sphere mesh from :Returns: * :ref:`MeshId ` - MeshId of the resulting sphere mesh Usage example:: let sphereMesh = create_sphere_mesh(SphereInit(subdivisions = 64, radius = 1.f)) let sphereNode = create_node() add_component(sphereNode, new Mesh(meshId = sphereMesh)) .. _function-primitives_core_create_cube_mesh_CubeInit: .. das:function:: create_cube_mesh(init_params: CubeInit) : MeshId Generates a cube mesh Note that it's recommended to make several nodes with the same cube mesh and scale them instead of creating multiple meshes with different sizes - each mesh will have its own draw call :Arguments: * **init_params** : :ref:`CubeInit ` - The data to build the cube mesh from :Returns: * :ref:`MeshId ` - MeshId of the resulting cuboid mesh Usage example:: let stickMesh = create_cube_mesh(CubeInit(width = 0.1, height = 1.0, depth = 0.1)) let cubeNode = create_node() add_component(cubeNode, new Mesh(meshId = stickMesh)) .. _function-primitives_core_create_plane_mesh_PlaneInit: .. das:function:: create_plane_mesh(init_params: PlaneInit) : MeshId Generates a plane mesh The plane will lie in the XZ (horizontal) plane with its normal pointing upwards (in the positive Y direction). The plane can be subdivided to cointain more than one cell :Arguments: * **init_params** : :ref:`PlaneInit ` - The data to build the plane mesh from :Returns: * :ref:`MeshId ` - MeshId of the resulting plane mesh Usage example:: let planeMesh = create_plane_mesh(PlaneInit()) let planeNode = create_node() add_component(planeNode, new Mesh(meshId = planeMesh)) .. _function-primitives_core_create_prism_mesh_PrismInit: .. das:function:: create_prism_mesh(init_params: PrismInit) : MeshId Generates a prism mesh Note that it's recommended to make several nodes with the same prism mesh and scale them instead of creating multiple meshes with different sizes - each mesh will have its own draw call :Arguments: * **init_params** : :ref:`PrismInit ` - The data to build the prism mesh from :Returns: * :ref:`MeshId ` - MeshId of the resulting prism mesh Usage example:: let prismMesh = create_prism_mesh(PrismInit(sides = 5, height = 4.0, radius = 1.0)) let prismNode = create_node() add_component(prismNode, new Mesh(meshId = prismMesh)) .. _function-primitives_core_create_cylinder_mesh_CylinderInit: .. das:function:: create_cylinder_mesh(init_params: CylinderInit) : MeshId Generates a cylinder mesh Note that it's recommended to make several nodes with the same cylinder mesh and scale them instead of creating multiple meshes with different sizes - each mesh will have its own draw call :Arguments: * **init_params** : :ref:`CylinderInit ` - The data to build the cylinder mesh from :Returns: * :ref:`MeshId ` - MeshId of the resulting cylinder mesh Usage example:: let cylinderMesh = create_cylinder_mesh(CylinderInit(height = 4.0, radius = 1.0)) let cylinderNode = create_node() add_component(cylinderNode, new Mesh(meshId = cylinderMesh)) .. _function-primitives_core_create_pyramid_mesh_PyramidInit: .. das:function:: create_pyramid_mesh(init_params: PyramidInit) : MeshId Generates a pyramid mesh Note that it's recommended to make several nodes with the same pyramid mesh and scale them instead of creating multiple meshes with different sizes - each mesh will have its own draw call :Arguments: * **init_params** : :ref:`PyramidInit ` - The data to build the pyramid mesh from :Returns: * :ref:`MeshId ` - MeshId of the resulting pyramid mesh Usage example:: let pyramidMesh = create_pyramid_mesh(PyramidInit(sides = 5, height = 4.0, radius = 1.0)) let pyramidNode = create_node() add_component(pyramidNode, new Mesh(meshId = pyramidMesh)) .. _function-primitives_core_create_cone_mesh_ConeInit: .. das:function:: create_cone_mesh(init_params: ConeInit) : MeshId Generates a cone mesh Note that it's recommended to make several nodes with the same cone mesh and scale them instead of creating multiple meshes with different sizes - each mesh will have its own draw call :Arguments: * **init_params** : :ref:`ConeInit ` - The data to build the cone mesh from :Returns: * :ref:`MeshId ` - MeshId of the resulting cone mesh Usage example:: let coneMesh = create_cone_mesh(ConeInit(height = 4.0, radius = 1.0)) let coneNode = create_node() add_component(coneNode, new Mesh(meshId = coneMesh)) .. _function-primitives_core_create_capsule_mesh_CapsuleInit: .. das:function:: create_capsule_mesh(init_params: CapsuleInit) : MeshId Generates a capsule mesh :Arguments: * **init_params** : :ref:`CapsuleInit ` - The data to build the capsule mesh from :Returns: * :ref:`MeshId ` - MeshId of the resulting capsule mesh Usage example:: let capsuleMesh = create_capsule_mesh(CapsuleInit(height = 4.0, radius = 0.5)) let capsuleNode = create_node() add_component(capsuleNode, new Mesh(meshId = capsuleMesh)) .. _function-primitives_core_create_solid_of_revolution_mesh_RevolutionInit: .. das:function:: create_solid_of_revolution_mesh(init_params: RevolutionInit) : MeshId Generates a solid of revolution mesh The function takes an array of float2 points and rotates it around Z-axis to create a solid of revolution mesh :Arguments: * **init_params** : :ref:`RevolutionInit ` - The data to build the solid of revolution mesh from :Returns: * :ref:`MeshId ` - MeshId of the resulting solid of revolution mesh Usage example:: let coneMesh = create_solid_of_revolution_mesh(RevolutionInit( points = [float2(0, 0), float2(1, 0), float2(0, 2)] // 2D profile of cone mesh )) let coneNode = create_node() add_component(coneNode, new Mesh(meshId = coneMesh)) .. _function-primitives_core_create_extruder_mesh_ExtruderInit: .. das:function:: create_extruder_mesh(init_params: ExtruderInit) : MeshId Generates an extruder mesh The function creates a mesh with pipe-like geometry by extruding a 'polygonPoints' profile along a path with 'points' :Arguments: * **init_params** : :ref:`ExtruderInit ` - The data to build the extruder mesh from :Returns: * :ref:`MeshId ` - MeshId of the resulting extruder mesh Usage example:: let extruderMesh = create_extruder_mesh(ExtruderInit(// Generates an extruder mesh with a square profile and a three-point path. polygonPoints = [float2(-0.5, -0.5), float2(-0.5, 0.5), float2(0.5, 0.5), float2(0.5, -0.5)], points = [float3(0, 0, 0), float3(10, 0, 0), float3(0, 20, 0)] )) let extruderNode = create_node() add_component(extruderNode, new Mesh(meshId = extruderMesh)) .. _function-primitives_core_create_pipe_mesh_PipeInit: .. das:function:: create_pipe_mesh(init_params: PipeInit) : MeshId Generates a pipe mesh :Arguments: * **init_params** : :ref:`PipeInit ` - The data to build the pipe mesh from :Returns: * :ref:`MeshId ` - MeshId of the resulting pipe mesh Usage example:: let pipeMesh = create_pipe_mesh(PipeInit(// Generates a pipe mesh with a three-point path. points = [float3(0, 0, 0), float3(10, 0, 0), float3(0, 20, 0)] )) let pipeNode = create_node() add_component(pipeNode, new Mesh(meshId = pipeMesh)) .. _function-quad_mesh_geometry_create_quad_mesh_geometry_float_float: .. das:function:: create_quad_mesh_geometry(width: float; height: float) : MeshGeometry Generates a quad mesh geometry :Arguments: * **width** : float - The width of the quad * **height** : float - The height of the quad :Returns: * :ref:`MeshGeometry ` - A mesh geometry (vertices, normals, uvs, triangles) representing the quad Usage example:: var quadGeometry = create_quad_mesh_geometry(2.0, 3.0) // Generate a quad with width 2.0 and height 3.0 update_mesh(quadMesh, quadGeometry) // Update the mesh with the new geometry .. _function-polygon_mesh_geometry_create_polygon_mesh_geometry_int_float: .. das:function:: create_polygon_mesh_geometry(sides: int = 24; radius: float = 0.5f) : MeshGeometry Generates a regular polygon mesh geometry with a specified number of sides and radius. It can also be used to generate geometry for a circle :Arguments: * **sides** : int - The number of sides of the polygon * **radius** : float - The radius of the polygon :Returns: * :ref:`MeshGeometry ` - A mesh geometry (vertices, normals, uvs, triangles) representing the polygon Usage example:: var polygonMesh = create_polygon_mesh_geometry(6, 1.0) // Generate a hexagon update_mesh(mesh, polygonMesh) // Update the mesh with the new geometry .. _function-sphere_mesh_geometry_create_sphere_mesh_geometry_int_float: .. das:function:: create_sphere_mesh_geometry(subdivisions: int = 64; radius: float = 0.5f) : MeshGeometry Generates a sphere mesh geometry :Arguments: * **subdivisions** : int - The number of subdivisions. The more subdivisions, the smoother the sphere. Default is 64 * **radius** : float - The radius of the sphere. Default is 0.5 :Returns: * :ref:`MeshGeometry ` - A mesh geometry (vertices, normals, uvs, triangles) representing the sphere Usage example:: var sphereGeometry = create_sphere_mesh_geometry(32, 1.0) // Generate a sphere with 32 subdivisions and radius 1.0 update_mesh(cylinderMesh, sphereGeometry) // Update the mesh with the new geometry .. _function-cube_mesh_geometry_create_cube_mesh_geometry_float_float_float: .. das:function:: create_cube_mesh_geometry(sizeX: float = 1f; sizeY: float = 1f; sizeZ: float = 1f) : MeshGeometry Generates a rectangular cuboid mesh geometry with specified dimensions. :Arguments: * **sizeX** : float - The size of the cube along the X axis * **sizeY** : float - The size of the cube along the Y axis * **sizeZ** : float - The size of the cube along the Z axis :Returns: * :ref:`MeshGeometry ` - A mesh geometry (vertices, normals, uvs, triangles) representing the cube Usage example:: var cubeGeometry = create_cube_mesh_geometry(2.0, 2.0, 2.0) // Generate a cube with dimensions 2x2x2 update_mesh(cubeMesh, cubeGeometry) // Update the mesh with the new geometry .. _function-plane_mesh_geometry_create_plane_mesh_geometry_int: .. das:function:: create_plane_mesh_geometry(cells: int) : MeshGeometry Generates a plane mesh geometry. :Arguments: * **cells** : int - The number of cells along one axis of the plane. The total number of cells will be ``cells * cells`` :Returns: * :ref:`MeshGeometry ` - A mesh geometry (vertices, normals, uvs, triangles) representing the plane. Usage example:: var planeGeometry = create_plane_mesh_geometry(10) // Generate a plane with 10x10 cells update_mesh(planeMesh, planeGeometry) // Update the mesh with the new geometry .. _function-cone_mesh_geometry_create_cone_mesh_geometry_int_float_float_float_bool_bool_string_int: .. das:function:: create_cone_mesh_geometry(subdivisions: int = 24; height: float = 1f; radius: float = 0.5f; frustumRadius: float = 0f; cap: bool = true; smoothNormals: bool = true; axis: string = "y"; tessellation: int = 1) : MeshGeometry Generates a cone mesh geometry. It can also be used to generate geometry for a truncated cone, a pyramid, a truncated pyramid, a cylinder, or a prism :Arguments: * **subdivisions** : int - The number of subdivisions. The more subdivisions, the smoother the cone * **height** : float - The height of the cone * **radius** : float - The radius of the cone at the base * **frustumRadius** : float - The radius of the cone at the top (if it is truncated). Default is 0, which means the cone is not truncated * **cap** : bool - Specifies whether to generate a cap for the cone. Default is true * **smoothNormals** : bool - Specifies whether to generate smooth normals (for a cone) or flat normals (for a pyramid). Default is true * **axis** : string - Specifies the orientation of the cone, can be "x", "y", or "z". Default is "y" * **tessellation** : int - The number of subdivisions along the height of the cone. Default is 1. Increase this value if you have problems with cone smoothness or texture stretching, but keep in mind that it will increase the number of vertices and triangles. :Returns: * :ref:`MeshGeometry ` - A mesh geometry (vertices, normals, uvs, triangles) representing the cone Usage example:: var pyramidGeometry = create_cone_mesh_geometry(3, 2., 1., 0.2, true, false, "y", 1) //Generate a truncated triangular pyramid update_mesh(sphereMesh, pyramidGeometry) //Update the mesh with the new geometry .. _function-capsule_mesh_geometry_create_capsule_mesh_geometry_int_float_float_string: .. das:function:: create_capsule_mesh_geometry(subdivisions: int = 24; height: float = 2f; radius: float = 0.5f; axis: string = "y") : MeshGeometry Generates a capsule mesh geometry :Arguments: * **subdivisions** : int - The number of subdivisions. The more subdivisions, the smoother the capsule * **height** : float - The full height of the capsule (including the spherical caps) * **radius** : float - The radius of the capsule * **axis** : string - Specifies the orientation of the capsule, can be "x", "y", or "z". Default is "y" :Returns: * :ref:`MeshGeometry ` - A mesh geometry (vertices, normals, uvs, triangles) representing the capsule Usage example:: var capsuleGeometry = create_capsule_mesh_geometry(24, 1.0, 0.5, "y") // Generate a capsule mesh update_mesh(capsuleMesh, capsuleGeometry) // Update the mesh with the new geometry .. _function-solid_of_revolution_mesh_geometry_create_solid_of_revolution_mesh_geometry_array_ls_float2_gr__int_bool: .. das:function:: create_solid_of_revolution_mesh_geometry(points: array; subdivisions: int; cap: bool = true) : MeshGeometry Generates a solid of revolution mesh geometry based on a set of 2D points :Arguments: * **points** : array - An array of 2D points (float2) that define the profile of the solid of revolution * **subdivisions** : int - The number of subdivisions around the axis of revolution. The more subdivisions, the smoother the mesh * **cap** : bool - Specifies whether to generate caps for the solid of revolution. Default is true :Returns: * :ref:`MeshGeometry ` - A mesh geometry (vertices, normals, uvs, triangles) representing the solid of revolution Usage example:: var profile = [float2(0., 0.), float2(1., 1.), float2(0., 2.)] var solidMesh = create_solid_of_revolution_mesh_geometry(profile, 24, true) update_mesh(solidMesh) .. _function-extruder_mesh_geometry_create_extruder_mesh_geometry_array_ls_float2_gr__array_ls_float3_gr__int_float_bool_bool_bool: .. das:function:: create_extruder_mesh_geometry(polygonPoints: array; points: array; subdivisions: int; bendRadius: float; cap: bool = true; closed: bool = false; smoothNormals: bool = false) : MeshGeometry Generates a mesh geometry by extruding a polygon along a given path with optional bending and capping. :Arguments: * **polygonPoints** : array - Represents the profile of the extruder. Clockwise order of the polygon points makes the normals point outwards making the extruder visible from the outside, counterclockwise order makes the normals point inwards making the extruder visible from the inside like a corridor * **points** : array - Represents the path of the extruder * **subdivisions** : int - The number of subdivisions. The more subdivisions, the smoother the extruder * **bendRadius** : float - The radius of all bends in the extruder * **cap** : bool - Specifies whether to generate caps at the ends of the extruded mesh. Default is true. * **closed** : bool - Specifies whether the path is closed, forming a loop. Default is false * **smoothNormals** : bool - Specifies whether the extruder profile is smoothed or not. Default is false :Returns: * :ref:`MeshGeometry ` - A mesh geometry (vertices, normals, uvs, triangles) representing the extruded polygon along the given path Usage example:: var polygon = [float2(0, 0), float2(1, 0), float2(1, 1), float2(0, 1)] var path = [float3(0, 0, 0), float3(0, 1, 0), float3(1, 1, 0)] var extrudedMesh = create_extruder_mesh_geometry(polygon, path, 10, 0.5, true, false, true) update_mesh(mesh, extrudedMesh) // Update the mesh with the new geometry .. _function-pipe_mesh_geometry_create_pipe_mesh_geometry_array_ls_float3_gr__int_float_float_bool_bool: .. das:function:: create_pipe_mesh_geometry(points: array; subdivisions: int; radius: float; bendRadius: float; cap: bool = true; closed: bool = false) : MeshGeometry Generates a pipe mesh geometry along a given path defined by points. :Arguments: * **points** : array - Represents the path of the pipe * **subdivisions** : int - The number of subdivisions. The more subdivisions, the smoother the pipe * **radius** : float - The radius of the pipe * **bendRadius** : float - The radius of all bends in the pipe * **cap** : bool - Specifies whether to generate caps at the ends of the pipe. Default is true * **closed** : bool - Specifies whether the pipe should be closed, forming a loop. Default is false :Returns: * :ref:`MeshGeometry ` - A mesh geometry (vertices, normals, uvs, triangles) representing the pipe Usage example:: var pipeGeometry = create_pipe_mesh_geometry([float3(0, 0, 0), float3(1, 0, 0), float3(1, 1, 0)], 16, 0.1, 0.2, true, false) update_mesh(pipeMesh, pipeGeometry) // Update the mesh with the new geometry