Companion

object Companion

Generates various standard 3D meshes.

When generating a mesh using these functions, the mesh data is automatically uploaded to the GPU. Therefore, there is no need to call upload manually. As a result, the generated meshes are ready for rendering immediately after creation. However, you should not call this method in the Window.lifecycle block, as it will repeatedly generate and upload the mesh on every frame, leading to performance issues. Instead, generate the mesh once outside the lifecycle block and reuse it as needed.

Functions

Link copied to clipboard
fun add(a: Mesh, b: Mesh): Mesh

Concatenates two meshes into a single mesh.

Link copied to clipboard
fun cone(radius: Float, height: Float, slices: Int = 16): Mesh

Generates a cone mesh.

Link copied to clipboard
fun cube(size: Float): Mesh

Generates a cube mesh.

Link copied to clipboard
fun cubicMap(cubicMap: Image, cubeSize: ERROR CLASS: Symbol not found for Triple<kotlin/Float, kotlin/Float, kotlin/Float>): Mesh
fun cubicMap(cubicMap: Image, cubeSize: Float): Mesh
fun cubicMap(cubicMap: Image, width: Float, height: Float, depth: Float): Mesh

Generates a cubicmap mesh from an image.

Link copied to clipboard
fun cylinder(radius: Float, height: Float, slices: Int = 16): Mesh

Generates a cylinder mesh.

Link copied to clipboard
fun heightMap(heightMap: Image, size: ERROR CLASS: Symbol not found for Triple<kotlin/Float, kotlin/Float, kotlin/Float>): Mesh
fun heightMap(heightMap: Image, width: Float = 1.0f, height: Float = 1.0f, depth: Float = 1.0f): Mesh

Generates a heightmap mesh from an image.

Link copied to clipboard
fun hemiSphere(radius: Float, rings: Int, slices: Int = 16): Mesh

Generates a hemisphere mesh.

Link copied to clipboard
fun knot(radius: Float, size: Float, radSeg: Int, sides: Int): Mesh

Generates a knot mesh.

Link copied to clipboard
fun plane(width: Float, length: Float, resX: Int, resZ: Int): Mesh

Generates a plane mesh.

Link copied to clipboard
fun poly(sides: Int, radius: Float): Mesh

Generates a polygonal mesh.

Link copied to clipboard
fun rectPrism(width: Float, height: Float, length: Float): Mesh

Generates a rectangular prism mesh.

Link copied to clipboard
fun sphere(radius: Float, rings: Int, slices: Int = 16): Mesh

Generates a sphere mesh.

Link copied to clipboard
fun torus(radius: Float, size: Float, radSeg: Int, sides: Int): Mesh

Generates a torus mesh.