Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ShapeBuilder

Class containing static functions to help procedurally build meshes

Hierarchy

  • ShapeBuilder

Index

Methods

Static ExtrudeShapeSearch playground for ExtrudeShape

  • ExtrudeShape(name: string, options: { backUVs?: Vector4; cap?: number; frontUVs?: Vector4; instance?: Mesh; invertUV?: boolean; path: Vector3[]; rotation?: number; scale?: number; shape: Vector3[]; sideOrientation?: number; updatable?: boolean }, scene?: Nullable<Scene>): Mesh
  • Creates an extruded shape mesh. The extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.

    • The parameter shape is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis.
    • The parameter path is a required array of successive Vector3. This is the axis curve the shape is extruded along.
    • The parameter rotation (float, default 0 radians) is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve.
    • The parameter scale (float, default 1) is the value to scale the shape.
    • The parameter cap sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
    • The optional parameter instance is an instance of an existing ExtrudedShape object to be updated with the passed shape, path, scale or rotation parameters : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#extruded-shape
    • Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
    • You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
    • If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters frontUVs and backUVs (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation
    • The optional parameter invertUV (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
    • The mesh can be set to updatable with the boolean parameter updatable (default false) if its internal geometry is supposed to change once created.
    see

    https://doc.babylonjs.com/how_to/parametric_shapes

    see

    https://doc.babylonjs.com/how_to/parametric_shapes#extruded-shapes

    Parameters

    • name: string

      defines the name of the mesh

    • options: { backUVs?: Vector4; cap?: number; frontUVs?: Vector4; instance?: Mesh; invertUV?: boolean; path: Vector3[]; rotation?: number; scale?: number; shape: Vector3[]; sideOrientation?: number; updatable?: boolean }

      defines the options used to create the mesh

      • Optional backUVs?: Vector4
      • Optional cap?: number
      • Optional frontUVs?: Vector4
      • Optional instance?: Mesh
      • Optional invertUV?: boolean
      • path: Vector3[]
      • Optional rotation?: number
      • Optional scale?: number
      • shape: Vector3[]
      • Optional sideOrientation?: number
      • Optional updatable?: boolean
    • Optional scene: Nullable<Scene>

      defines the hosting scene

    Returns Mesh

    the extruded shape mesh

Static ExtrudeShapeCustomSearch playground for ExtrudeShapeCustom

  • ExtrudeShapeCustom(name: string, options: { backUVs?: Vector4; cap?: number; frontUVs?: Vector4; instance?: Mesh; invertUV?: boolean; path: Vector3[]; ribbonCloseArray?: boolean; ribbonClosePath?: boolean; rotationFunction?: any; scaleFunction?: any; shape: Vector3[]; sideOrientation?: number; updatable?: boolean }, scene?: Nullable<Scene>): Mesh
  • Creates an custom extruded shape mesh. The custom extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.

    • The parameter shape is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis.
    • The parameter path is a required array of successive Vector3. This is the axis curve the shape is extruded along.
    • The parameter rotationFunction (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path and the distance of this point from the begining of the path
    • It must returns a float value that will be the rotation in radians applied to the shape on each path point.
    • The parameter scaleFunction (JS function) is a custom Javascript function called on each path point. This function is passed the position i of the point in the path and the distance of this point from the begining of the path
    • It must returns a float value that will be the scale value applied to the shape on each path point
    • The parameter ribbonClosePath (boolean, default false) forces the extrusion underlying ribbon to close all the paths in its pathArray
    • The parameter ribbonCloseArray (boolean, default false) forces the extrusion underlying ribbon to close its pathArray
    • The parameter cap sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
    • The optional parameter instance is an instance of an existing ExtrudedShape object to be updated with the passed shape, path, scale or rotation parameters : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#extruded-shape
    • Remember you can only change the shape or path point positions, not their number when updating an extruded shape
    • You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
    • If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters frontUVs and backUVs (Vector4). Detail here : https://doc.babylonjs.com/babylon101/discover_basic_elements#side-orientation
    • The optional parameter invertUV (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture
    • The mesh can be set to updatable with the boolean parameter updatable (default false) if its internal geometry is supposed to change once created
    see

    https://doc.babylonjs.com/how_to/parametric_shapes#custom-extruded-shapes

    see

    https://doc.babylonjs.com/how_to/parametric_shapes

    see

    https://doc.babylonjs.com/how_to/parametric_shapes#extruded-shapes

    Parameters

    • name: string

      defines the name of the mesh

    • options: { backUVs?: Vector4; cap?: number; frontUVs?: Vector4; instance?: Mesh; invertUV?: boolean; path: Vector3[]; ribbonCloseArray?: boolean; ribbonClosePath?: boolean; rotationFunction?: any; scaleFunction?: any; shape: Vector3[]; sideOrientation?: number; updatable?: boolean }

      defines the options used to create the mesh

      • Optional backUVs?: Vector4
      • Optional cap?: number
      • Optional frontUVs?: Vector4
      • Optional instance?: Mesh
      • Optional invertUV?: boolean
      • path: Vector3[]
      • Optional ribbonCloseArray?: boolean
      • Optional ribbonClosePath?: boolean
      • Optional rotationFunction?: any
      • Optional scaleFunction?: any
      • shape: Vector3[]
      • Optional sideOrientation?: number
      • Optional updatable?: boolean
    • Optional scene: Nullable<Scene>

      defines the hosting scene

    Returns Mesh

    the custom extruded shape mesh

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method