Package-level declarations

Types

Link copied to clipboard
class CompoundMeshData(val vertexData: VertexData, val compounds: Map<String, MeshData>) : ICompoundMeshData

Represents a compound mesh data structure containing multiple named sub-meshes and their associated shared vertex data. This class allows manipulation of grouped meshes as a single entity and provides methods for operations like triangulation and converting the meshes to a single data structure.

Link copied to clipboard

Represents a compound mesh data structure that combines multiple meshes and their associated vertex data.

Link copied to clipboard
interface IIndexedPolygon

Represents an indexed polygon in 3D space. The polygon is defined using indices referencing the various attributes (e.g., position, texture coordinates, normals) provided in an external vertex data.

Link copied to clipboard
interface IMeshData

Interface representing mesh data in 3D space.

Link copied to clipboard
data class IndexedPolygon(val positions: List<Int>, val textureCoords: List<Int>, val colors: List<Int>, val normals: List<Int>, val tangents: List<Int>, val bitangents: List<Int>) : IIndexedPolygon

Represents a polygon defined by indices corresponding to vertex data such as positions, texture coordinates, colors, normals, tangents, and bitangents. It can be used to describe a geometric shape for rendering or processing in 3D graphics or geometry applications.

Link copied to clipboard
interface IPolygon

Represents a polygon in 3D space, defined by a collection of attributes such as positions, texture coordinates, colors, normals, tangents, and bitangents.

Link copied to clipboard
interface IVertexData

Interface representing vertex data for 3D graphics. This includes attributes such as positions, texture coordinates, colors, normals, tangents, and bitangents. It provides methods to convert the data to either immutable or mutable vertex data representations.

Link copied to clipboard
data class MeshData(val vertexData: VertexData, val polygons: List<IndexedPolygon>) : IMeshData

Represents data for a 3D mesh. Implements the IMeshData interface and provides additional methods for manipulating and combining mesh data. This class is immutable and includes operations for triangulation, conversion to polygons, and joining multiple meshes.

Link copied to clipboard

A mutable implementation of a compound mesh data structure, combining vertex data and a set of named mesh compounds.

Link copied to clipboard
data class MutableIndexedPolygon(val positions: MutableList<Int>, val textureCoords: MutableList<Int>, val normals: MutableList<Int>, val colors: MutableList<Int>, val tangents: MutableList<Int>, val bitangents: MutableList<Int>) : IIndexedPolygon

Represents a mutable 3D indexed polygon. This class allows modifications to its indices and provides functionality to transform vertex references into a corresponding polygon representation.

Link copied to clipboard
data class MutableMeshData(val vertexData: MutableVertexData, val polygons: MutableList<IndexedPolygon>) : IMeshData

Represents mutable mesh data with modifiable vertex data and polygonal structure.

Link copied to clipboard
class MutablePolygon(val positions: MutableList<Vector3> = mutableListOf(), val textureCoords: MutableList<Vector2> = mutableListOf(), val colors: MutableList<ColorRGBa> = mutableListOf(), val normals: MutableList<Vector3> = mutableListOf(), val tangents: MutableList<Vector3> = mutableListOf(), val bitangents: MutableList<Vector3> = mutableListOf()) : IPolygon

A mutable implementation of the IPolygon interface that represents a polygon in 3D space. This class allows modification of the polygon's attributes such as vertex positions, texture coordinates, colors, normals, tangents, and bitangents.

Link copied to clipboard
class MutableVertexData(val positions: MutableList<Vector3> = mutableListOf(), val textureCoords: MutableList<Vector2> = mutableListOf(), val colors: MutableList<ColorRGBa> = mutableListOf(), val normals: MutableList<Vector3> = mutableListOf(), val tangents: MutableList<Vector3> = mutableListOf(), val bitangents: MutableList<Vector3> = mutableListOf()) : IVertexData

Mutable implementation of vertex data for 3D graphics. This class provides a container for vertex attributes such as positions, texture coordinates, colors, normals, tangents, and bitangents with mutable backing lists. It allows modification of vertex data.

Link copied to clipboard
data class Point(val position: Vector3, val textureCoord: Vector2? = null, val color: ColorRGBa? = null, val normal: Vector3? = null, val tangent: Vector3? = null, val bitangent: Vector3? = null)

Represents a 3D point with optional attributes for texture coordinates, color, normal vector, tangent vector, and bitangent vector.

Link copied to clipboard
class Polygon(val positions: List<Vector3> = emptyList(), val textureCoords: List<Vector2> = emptyList(), val colors: List<ColorRGBa> = emptyList(), val normals: List<Vector3> = emptyList(), val tangents: List<Vector3> = emptyList(), val bitangents: List<Vector3> = emptyList()) : IPolygon

Represents a polygon in 3D space with immutable attributes such as positions, texture coordinates, colors, normals, tangents, and bitangents. Provides methods to transform the polygon and convert it to a mutable version.

Link copied to clipboard
class VertexData(val positions: List<Vector3> = emptyList(), val textureCoords: List<Vector2> = emptyList(), val colors: List<ColorRGBa> = emptyList(), val normals: List<Vector3> = emptyList(), val tangents: List<Vector3> = emptyList(), val bitangents: List<Vector3> = emptyList()) : IVertexData

Immutable implementation of vertex data for 3D graphics. This class provides a container for vertex attributes such as positions, texture coordinates, colors, normals, tangents, and bitangents.

Properties

Link copied to clipboard
val IMeshData.bounds: Box

Provides the bounding box of the mesh based on its polygons and associated vertex data.

Functions

Link copied to clipboard

Adds a Point to the vertex data by updating the corresponding mutable lists of vertex attributes. Each optional attribute of the point is only added if it is not null.

Link copied to clipboard
fun bounds(polygons: List<IPolygon>): Box

Calculate the 3D bounding box of a list of IPolygon.

Link copied to clipboard
fun List<IIndexedPolygon>.bounds(vertexData: IVertexData): Box

Calculates the bounding box of a list of indexed polygons using the specified vertex data.

Link copied to clipboard
operator fun IVertexData.get(index: Int, textureCoordsIndex: Int = index, colorsIndex: Int = index, normalsIndex: Int = index, tangentsIndex: Int = index, bitangentsIndex: Int = index): Point

Retrieves a Point instance from the vertex data at the specified indices. The indices allow access to positions, texture coordinates, colors, normals, tangents, and bitangents.

Link copied to clipboard

Checks if all polygons in the mesh are triangular.

Link copied to clipboard
fun IIndexedPolygon.point(vertexData: IVertexData, barycentric: Vector3): Point

Computes a Point by interpolating vertex attributes from a 3D polygon using barycentric coordinates.

Link copied to clipboard
fun IIndexedPolygon.position(vertexData: IVertexData, barycentric: Vector3): Vector3

Computes the 3D position of a point in a polygon using barycentric coordinates.

Link copied to clipboard

Convert list of polygons to MeshData

Converts the vertex data into a MeshData representation by constructing the indexed polygons based on the vertex data attributes such as positions, texture coordinates, colors, normals, tangents, and bitangents.

Link copied to clipboard

Converts the compound mesh data into a map of polygons grouped by their compound names.

fun VertexBuffer.toPolygons(vertexCount: Int = this.vertexCount): List<Polygon>

Converts the vertex buffer into a list of polygons based on the provided vertex count. Each polygon is formed by grouping vertices into triangles.

Link copied to clipboard
fun ICompoundMeshData.toVertexBuffer(): VertexBuffer

Converts the compound mesh data into a single VertexBuffer for rendering.

fun IMeshData.toVertexBuffer(elementOffset: Int = 0, vertexBuffer: VertexBuffer? = null): VertexBuffer

Converts the current mesh data into a VertexBuffer representation, preparing geometry for rendering.

fun IVertexData.toVertexBuffer(elementOffset: Int = 0, vertexBuffer: VertexBuffer? = null): VertexBuffer

Converts the vertex data stored in the IVertexData instance to a VertexBuffer. The method iterates through the vertex attributes such as positions, normals, texture coordinates, and colors, and writes them sequentially into the provided or newly created VertexBuffer. Missing attributes are substituted with default values.

Link copied to clipboard
fun IMeshData.weld(positionFractBits: Int, textureCoordFractBits: Int = -1, colorFractBits: Int = -1, normalFractBits: Int = -1, tangentFractBits: Int = -1, bitangentFractBits: Int = -1): MeshData

Welds the mesh data by consolidating vertices based on specified fractional bit precision for attributes such as positions, texture coordinates, colors, normals, tangents, and bitangents. This reduces redundant vertices and optimizes the mesh structure.

Link copied to clipboard

Generates a wireframe representation of the compound mesh data.

fun IMeshData.wireframe(): List<List<Vector3>>

Generates a wireframe representation of the mesh.