webani - v1.0.0
    Preparing search index...

    Represents a polygon in 3D space. This class extends WebaniPrimitiveObject and supports complex polygon shapes with holes, triangulation, and animation.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _filledPoints: Vector3[]

    The filled points defining the outer shape of the polygon.

    _holes: Vector3[][]

    The holes within the polygon, each hole defined by a set of points.

    animationClass: typeof WebaniPolygonAnimation = WebaniPolygonAnimation

    The class used for animating the polygon.

    extraTransforms: WorldTransform[] = []

    An array of additional world transforms that modify the object.

    material: WebaniMaterial

    The material applied to this object.

    The parent transformable object, if any.

    performSkinningTransformation: boolean = false

    A flag indicating whether skinning transformations should be applied.

    scaleCompensation: boolean = false

    Flag indicating whether to apply scale compensation for the parent object.

    transform: WorldTransform = ...

    The world transform of the object, including position, rotation, and scale.

    useOriginAsCenter: boolean = false

    Flag indicating whether to use the origin as the center of rotation.

    Accessors

    • get extraTransformsMatrixWithoutScale(): Matrix4

      The combined matrix of all extra transforms without scale compensation.

      Returns Matrix4

      A Matrix4 object representing the combined matrix of all extra transforms.

    • get inverseBindMatrices(): Float32Array

      Gets the inverse bind matrices for skinning.

      Returns Float32Array

      The inverse bind matrices as a Float32Array.

    Methods

    • Computes the normals for the polygon. For simplicity, it assigns 1 to every third element of the normal array.

      Returns Float32Array<ArrayBuffer>

      An array of normals.

    • Computes the triangulation for the polygon using the filled points and holes. This method uses the triangulate utility function.

      Returns Float32Array

      A Float32Array representing the triangulated points of the polygon.

    • Fills the arrays required for the object's geometry (triangulation, normals, UVs, joint weights, etc.). This method ensures that the arrays are allocated with the correct size.

      Parameters

      • vertexCount: number = 0

        The number of vertices in the object.

      • jointCount: number = 0

        The number of joints for skinning.

      Returns void