Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace BABYLON

Index

Namespaces

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Type aliases

BabylonFileParser

BabylonFileParser: (parsedData: any, scene: Scene, container: AssetContainer, rootUrl: string) => void

Defines how the parser contract is defined. These parsers are used to parse a list of specific assets (like particle systems, etc..)

Type declaration

CameraStageAction

CameraStageAction: (camera: Camera) => void

Strong typing of a Camera related stage step action

Type declaration

    • Parameters

      Returns void

CameraStageFrameBufferAction

CameraStageFrameBufferAction: (camera: Camera) => boolean

Strong typing of a Camera Frame buffer related stage step action

Type declaration

    • Parameters

      Returns boolean

ComputeBindingLocation

ComputeBindingLocation: { binding: number; group: number }

Type used to locate a resource in a compute shader. TODO: remove this when browsers support reflection for wgsl shaders

Type declaration

  • binding: number
  • group: number

ComputeBindingMapping

ComputeBindingMapping: {}

Type used to lookup a resource and retrieve its binding location TODO: remove this when browsers support reflection for wgsl shaders

Type declaration

DataArray

DataArray: number[] | ArrayBuffer | ArrayBufferView

Alias for types that can be used by a Buffer or VertexBuffer.

DeepImmutable

DeepImmutable<T>: T extends Primitive ? T : T extends Array<infer U> ? DeepImmutableArray<U> : DeepImmutableObject<T>

Type modifier to make all the properties of an object Readonly recursively

Type parameters

  • T

DeepImmutableObject

DeepImmutableObject<T>: {}

Type modifier to make object properties readonly.

Type parameters

  • T

Type declaration

DeviceInput

DeviceInput<T>: T extends Keyboard | Generic ? number : T extends Mouse | Touch ? PointerInput : T extends DualShock ? DualShockInput : T extends Xbox ? XboxInput : T extends Switch ? SwitchInput : never

Type to handle enforcement of inputs

Type parameters

EnvironmentTextureInfo

Raw texture data and descriptor sufficient for WebGL texture upload

EvaluateSubMeshStageAction

EvaluateSubMeshStageAction: (mesh: AbstractMesh, subMesh: SubMesh) => void

Strong typing of a Evaluate Sub Mesh related stage step action

Type declaration

FloatArray

FloatArray: number[] | Float32Array

Alias type for number array or Float32Array

IFresnelParametersCreationOptions

IFresnelParametersCreationOptions: { bias?: number; isEnabled?: boolean; leftColor?: Color3; power?: number; rightColor?: Color3 }

Options to be used when creating a FresnelParameters.

Type declaration

  • Optional bias?: number

    Define bias applied to computed fresnel term

  • Optional isEnabled?: boolean

    Define if the fresnel effect is enable or not.

  • Optional leftColor?: Color3

    Define the color used on edges (grazing angle)

  • Optional power?: number

    Defined the power exponent applied to fresnel term

  • Optional rightColor?: Color3

    Define the color used on center

IFresnelParametersSerialized

IFresnelParametersSerialized: { bias: number; isEnabled: boolean; leftColor: number[]; power?: number; rightColor: number[] }

Serialized format for FresnelParameters.

Type declaration

  • bias: number

    Define bias applied to computed fresnel term

  • isEnabled: boolean

    Define if the fresnel effect is enable or not.

  • leftColor: number[]

    Define the color used on edges (grazing angle) [as an array]

  • Optional power?: number

    Defined the power exponent applied to fresnel term

  • rightColor: number[]

    Define the color used on center [as an array]

Immutable

Immutable<T>: T extends Primitive ? T : T extends Array<infer U> ? ReadonlyArray<U> : DeepImmutable<T>

Type modifier to make all the properties of an object Readonly

Type parameters

  • T

IndicesArray

IndicesArray: number[] | Int32Array | Uint32Array | Uint16Array

Alias type for number array or Float32Array or Int32Array or Uint32Array or Uint16Array

IndividualBabylonFileParser

IndividualBabylonFileParser: (parsedData: any, scene: Scene, rootUrl: string) => any

Defines how the individual parser contract is defined. These parser can parse an individual asset

Type declaration

    • (parsedData: any, scene: Scene, rootUrl: string): any
    • Parameters

      • parsedData: any
      • scene: Scene
      • rootUrl: string

      Returns any

MeshStageAction

MeshStageAction: (mesh: AbstractMesh, hardwareInstancedRendering: boolean) => boolean

Strong typing of a Mesh related stage step action

Type declaration

    • (mesh: AbstractMesh, hardwareInstancedRendering: boolean): boolean
    • Parameters

      Returns boolean

MotionControllerComponentStateType

MotionControllerComponentStateType: "default" | "touched" | "pressed"

The state of a controller component

MotionControllerComponentType

MotionControllerComponentType: "trigger" | "squeeze" | "touchpad" | "thumbstick" | "button"

The type of components available in motion controllers. This is not the name of the component.

MotionControllerConstructor

MotionControllerConstructor: (xrInput: XRInputSource, scene: Scene) => WebXRAbstractMotionController

A construction function type to create a new controller based on an xrInput object

Type declaration

MotionControllerHandedness

MotionControllerHandedness: "none" | "left" | "right"

Handedness type in xrInput profiles. These can be used to define layouts in the Layout Map.

NodeConstructor

NodeConstructor: (name: string, scene: Scene, options?: any) => () => Node

Defines how a node can be built from a string name.

Type declaration

    • (name: string, scene: Scene, options?: any): () => Node
    • Parameters

      • name: string
      • scene: Scene
      • Optional options: any

      Returns () => Node

Nullable

Nullable<T>: T | null

Alias type for value that can be null

Type parameters

  • T

OBJLoadingOptions

OBJLoadingOptions: { UVScaling: Vector2; computeNormals: boolean; importVertexColors: boolean; invertTextureY: boolean; invertY: boolean; materialLoadingFailsSilently: boolean; optimizeNormals: boolean; optimizeWithUV: boolean; skipMaterials: boolean }

Options for loading OBJ/MTL files

Type declaration

  • UVScaling: Vector2

    Defines custom scaling of UV coordinates of loaded meshes.

  • computeNormals: boolean

    Compute the normals for the model, even if normals are present in the file.

  • importVertexColors: boolean

    Include in meshes the vertex colors available in some OBJ files. This is not part of OBJ standard.

  • invertTextureY: boolean

    Invert Y-Axis of referenced textures on load

  • invertY: boolean

    Invert model on y-axis (does a model scaling inversion)

  • materialLoadingFailsSilently: boolean

    When a material fails to load OBJ loader will silently fail and onSuccess() callback will be triggered.

  • optimizeNormals: boolean

    Optimize the normals for the model. Lighting can be uneven if you use OptimizeWithUV = true because new vertices can be created for the same location if they pertain to different faces. Using OptimizehNormals = true will help smoothing the lighting by averaging the normals of those vertices.

  • optimizeWithUV: boolean

    Defines if UVs are optimized by default during load.

  • skipMaterials: boolean

    Skip loading the materials even if defined in the OBJ file (materials are ignored).

PerfStrategyInitialization

PerfStrategyInitialization: (scene: Scene) => IPerfViewerCollectionStrategy

Initializer callback for a strategy

Type declaration

PointerMoveStageAction

PointerMoveStageAction: (unTranslatedPointerX: number, unTranslatedPointerY: number, pickResult: Nullable<PickingInfo>, isMeshPicked: boolean, element: Nullable<HTMLElement>) => Nullable<PickingInfo>

Strong typing of a pointer move action.

Type declaration

PointerUpDownStageAction

PointerUpDownStageAction: (unTranslatedPointerX: number, unTranslatedPointerY: number, pickResult: Nullable<PickingInfo>, evt: IPointerEvent) => Nullable<PickingInfo>

Strong typing of a pointer up/down action.

Type declaration

PostProcessOptions

PostProcessOptions: { height: number; width: number }

Size options for a post process

Type declaration

  • height: number
  • width: number

PreActiveMeshStageAction

PreActiveMeshStageAction: (mesh: AbstractMesh) => void

Strong typing of a pre active Mesh related stage step action

Type declaration

Primitive

Primitive: undefined | null | boolean | string | number | Function

Alias type for primitive types

ignorenaming

RenderTargetStageAction

RenderTargetStageAction: (renderTarget: RenderTargetTexture, faceIndex?: number, layer?: number) => void

Strong typing of a Render Target related stage step action

Type declaration

RenderTargetTextureSize

RenderTargetTextureSize: number | { height: number; layers?: number; width: number }

Type used to define a render target texture size (either with a number or with a rect width and height)

RenderTargetsStageAction

RenderTargetsStageAction: (renderTargets: SmartArrayNoDuplicate<RenderTargetTexture>) => void

Strong typing of a render target action.

Type declaration

RenderingGroupStageAction

RenderingGroupStageAction: (renderingGroupId: number) => void

Strong typing of a RenderingGroup related stage step action

Type declaration

    • (renderingGroupId: number): void
    • Parameters

      • renderingGroupId: number

      Returns void

RenderingMeshStageAction

RenderingMeshStageAction: (mesh: Mesh, subMesh: SubMesh, batch: any, effect: Nullable<Effect>) => void

Strong typing of a Mesh Render related stage step action

Type declaration

SceneLoaderSuccessCallback

SceneLoaderSuccessCallback: (meshes: AbstractMesh[], particleSystems: IParticleSystem[], skeletons: Skeleton[], animationGroups: AnimationGroup[], transformNodes: TransformNode[], geometries: Geometry[], lights: Light[]) => void

Type used for the success callback of ImportMesh

Type declaration

SimpleStageAction

SimpleStageAction: () => void

Strong typing of a simple stage step action

Type declaration

    • (): void
    • Returns void

TrianglePickingPredicate

TrianglePickingPredicate: (p0: Vector3, p1: Vector3, p2: Vector3, ray: Ray) => boolean

Type used to define predicate used to select faces when a mesh intersection is detected

Type declaration

VirtualMeshInfo

VirtualMeshInfo: { dragMesh: AbstractMesh; dragging: boolean; lastDragPosition: Vector3; lastOriginPosition: Vector3; moving: boolean; originMesh: AbstractMesh; pivotMesh: AbstractMesh; startingOrientation: Quaternion; startingPivotOrientation: Quaternion; startingPivotPosition: Vector3; startingPosition: Vector3 }

Data store to track virtual pointers movement

Type declaration

WebXRControllerMovementFeatureContext

WebXRControllerMovementFeatureContext: { movementEnabled: boolean; movementOrientationFollowsViewerPose: boolean; movementSpeed: number; movementThreshold: number; rotationEnabled: boolean; rotationSpeed: number; rotationThreshold: number }

Feature context is used in handlers and on each XR frame to control the camera movement/direction.

Type declaration

  • movementEnabled: boolean
  • movementOrientationFollowsViewerPose: boolean
  • movementSpeed: number
  • movementThreshold: number
  • rotationEnabled: boolean
  • rotationSpeed: number
  • rotationThreshold: number

WebXRControllerMovementRegistrationConfiguration

WebXRControllerMovementRegistrationConfiguration: { allowedComponentTypes?: MotionControllerComponentType[]; componentSelectionPredicate?: (xrController: WebXRInputSource) => Nullable<WebXRControllerComponent>; forceHandedness?: XRHandedness; mainComponentOnly?: boolean } & { axisChangedHandler: (axes: IWebXRMotionControllerAxesValue, movementState: WebXRControllerMovementState, featureContext: WebXRControllerMovementFeatureContext, xrInput: WebXRInput) => void } | { buttonChangedhandler: (pressed: IWebXRMotionControllerComponentChangesValues<boolean>, movementState: WebXRControllerMovementState, featureContext: WebXRControllerMovementFeatureContext, xrInput: WebXRInput) => void }

Button of Axis Handler must be specified.

WebXRControllerMovementState

WebXRControllerMovementState: { moveX: number; moveY: number; rotateX: number; rotateY: number }

Current state of Movements shared across components and handlers.

Type declaration

  • moveX: number
  • moveY: number
  • rotateX: number
  • rotateY: number

WebXRDomOverlayType

WebXRDomOverlayType: "screen" | "floating" | "head-locked"

Type of DOM overlay provided by UA.

WebXRFeatureConstructor

WebXRFeatureConstructor: (xrSessionManager: WebXRSessionManager, options?: any) => () => IWebXRFeature

Defining the constructor of a feature. Used to register the modules.

Type declaration

XRHandMeshRigMapping

XRHandMeshRigMapping: {}

A type encapsulating a dictionary mapping WebXR joints to bone names in a rigged hand mesh.

Type declaration

double

double: number

Alias type for number that are doubles.

ignorenaming

float

float: number

Alias type for number that are floats

ignorenaming

int

int: number

Alias type for number that are integer

ignorenaming

Variables

Const BRDFTextureTools

BRDFTextureTools: { GetEnvironmentBRDFTexture: (scene: Scene) => BaseTexture }

Class used to host texture specific utilities

Type declaration

  • GetEnvironmentBRDFTexture: (scene: Scene) => BaseTexture

    Gets a default environment BRDF for MS-BRDF Height Correlated BRDF

    param

    defines the hosting scene

    returns

    the environment BRDF texture

Const BasisTools

BasisTools: { GetInternalFormatFromBasisFormat: (basisFormat: number) => number; JSModuleURL: string; LoadTextureFromTranscodeResult: (texture: InternalTexture, transcodeResult: TranscodeResult) => void; TranscodeAsync: (data: ArrayBuffer | ArrayBufferView, config: BasisTranscodeConfiguration) => Promise<TranscodeResult>; WasmModuleURL: string }

Type declaration

  • GetInternalFormatFromBasisFormat: (basisFormat: number) => number

    Get the internal format to be passed to texImage2D corresponding to the .basis format value

    param

    format chosen from GetSupportedTranscodeFormat

    returns

    internal format corresponding to the Basis format

      • (basisFormat: number): number
      • Parameters

        • basisFormat: number

        Returns number

  • JSModuleURL: string

    URL to use when loading the basis transcoder

  • LoadTextureFromTranscodeResult: (texture: InternalTexture, transcodeResult: TranscodeResult) => void

    Loads a texture from the transcode result

    param

    texture load to

    param

    the result of transcoding the basis file to load from

  • TranscodeAsync: (data: ArrayBuffer | ArrayBufferView, config: BasisTranscodeConfiguration) => Promise<TranscodeResult>

    Transcodes a loaded image file to compressed pixel data

    param

    image data to transcode

    param

    configuration options for the transcoding

    returns

    a promise resulting in the transcoded image

  • WasmModuleURL: string

    URL to use when loading the wasm module for the transcoder

Const BasisToolsOptions

BasisToolsOptions: { JSModuleURL: string; WasmModuleURL: string }

Type declaration

  • JSModuleURL: string

    URL to use when loading the basis transcoder

  • WasmModuleURL: string

    URL to use when loading the wasm module for the transcoder

Const BoxBuilder

BoxBuilder: { CreateBox: typeof CreateBox }

Class containing static functions to help procedurally build meshes

deprecated

please use CreateBox directly

Type declaration

Const CapsuleBuilder

CapsuleBuilder: { CreateCapsule: typeof CreateCapsule }

Class containing static functions to help procedurally build meshes

deprecated

please use CreateCapsule directly

Type declaration

Const CopyTools

CopyTools: { GenerateBase64StringFromPixelData: typeof GenerateBase64StringFromPixelData; GenerateBase64StringFromTexture: typeof GenerateBase64StringFromTexture; GenerateBase64StringFromTextureAsync: typeof GenerateBase64StringFromTextureAsync }

Class used to host copy specific utilities (Back-compat)

Type declaration

  • GenerateBase64StringFromPixelData: typeof GenerateBase64StringFromPixelData

    Transform some pixel data to a base64 string

    param

    defines the pixel data to transform to base64

    param

    defines the width and height of the (texture) data

    param

    true if the data must be inverted for the Y coordinate during the conversion

    returns

    The base64 encoded string or null

  • GenerateBase64StringFromTexture: typeof GenerateBase64StringFromTexture

    Reads the pixels stored in the webgl texture and returns them as a base64 string

    param

    defines the texture to read pixels from

    param

    defines the face of the texture to read (in case of cube texture)

    param

    defines the LOD level of the texture to read (in case of Mip Maps)

    returns

    The base64 encoded string or null

  • GenerateBase64StringFromTextureAsync: typeof GenerateBase64StringFromTextureAsync

    Reads the pixels stored in the webgl texture and returns them as a base64 string

    param

    defines the texture to read pixels from

    param

    defines the face of the texture to read (in case of cube texture)

    param

    defines the LOD level of the texture to read (in case of Mip Maps)

    returns

    The base64 encoded string or null wrapped in a promise

Const CylinderBuilder

CylinderBuilder: { CreateCylinder: typeof CreateCylinder }

Class containing static functions to help procedurally build meshes

deprecated

Please use CreateCylinder directly

Type declaration

Const DecalBuilder

DecalBuilder: { CreateDecal: typeof CreateDecal }

Class containing static functions to help procedurally build meshes

deprecated

use the function directly from the module

Type declaration

Const Decode

Decode: (buffer: Uint8Array | Uint16Array) => string

Decodes a buffer into a string

param

The buffer to decode

returns

The decoded string

Type declaration

    • (buffer: Uint8Array | Uint16Array): string
    • Parameters

      • buffer: Uint8Array | Uint16Array

      Returns string

Const DecodeBase64ToBinary

DecodeBase64ToBinary: (base64Data: string) => ArrayBuffer

Converts a given base64 string into an ArrayBuffer of raw byte data

param

The base64 encoded string to decode

returns

ArrayBuffer of byte data

Type declaration

    • (base64Data: string): ArrayBuffer
    • Parameters

      • base64Data: string

      Returns ArrayBuffer

Const DecodeBase64ToString

DecodeBase64ToString: (base64Data: string) => string

Converts a given base64 string as an ASCII encoded stream of data

param

The base64 encoded string to decode

returns

Decoded ASCII string

Type declaration

    • (base64Data: string): string
    • Parameters

      • base64Data: string

      Returns string

Const DiscBuilder

DiscBuilder: { CreateDisc: typeof CreateDisc }

Class containing static functions to help procedurally build meshes

deprecated

please use CreateDisc directly

Type declaration

Const DomManagement

DomManagement: { GetDOMTextContent: typeof GetDOMTextContent; IsDocumentAvailable: typeof IsDocumentAvailable; IsNavigatorAvailable: typeof IsNavigatorAvailable; IsWindowObjectExist: typeof IsWindowObjectExist }

Sets of helpers dealing with the DOM and some of the recurrent functions needed in Babylon.js

Type declaration

  • GetDOMTextContent: typeof GetDOMTextContent

    Extracts text content from a DOM element hierarchy

    param

    defines the root element

    returns

    a string

  • IsDocumentAvailable: typeof IsDocumentAvailable

    Check if the document object exists

    returns

    true if the document object exists

  • IsNavigatorAvailable: typeof IsNavigatorAvailable

    Checks if the navigator object exists

    returns

    true if the navigator object exists

  • IsWindowObjectExist: typeof IsWindowObjectExist

    Checks if the window object exists

    returns

    true if the window object exists

Const EncodeArrayBufferToBase64

EncodeArrayBufferToBase64: (buffer: ArrayBuffer | ArrayBufferView) => string

Encode a buffer to a base64 string

param

defines the buffer to encode

returns

the encoded string

Type declaration

    • (buffer: ArrayBuffer | ArrayBufferView): string
    • Parameters

      • buffer: ArrayBuffer | ArrayBufferView

      Returns string

Const EndsWith

EndsWith: (str: string, suffix: string) => boolean

Checks for a matching suffix at the end of a string (for ES5 and lower)

param

Source string

param

Suffix to search for in the source string

returns

Boolean indicating whether the suffix was found (true) or not (false)

Type declaration

    • (str: string, suffix: string): boolean
    • Parameters

      • str: string
      • suffix: string

      Returns boolean

Const EnvironmentTextureTools

EnvironmentTextureTools: { CreateEnvTextureAsync: typeof CreateEnvTextureAsync; CreateImageDataArrayBufferViews: typeof CreateImageDataArrayBufferViews; GetEnvInfo: typeof GetEnvInfo; UploadEnvLevelsAsync: typeof UploadEnvLevelsAsync; UploadEnvSpherical: typeof UploadEnvSpherical; UploadLevelsAsync: typeof UploadLevelsAsync }

Sets of helpers addressing the serialization and deserialization of environment texture stored in a BabylonJS env file. Those files are usually stored as .env files.

Type declaration

  • CreateEnvTextureAsync: typeof CreateEnvTextureAsync

    Creates an environment texture from a loaded cube texture.

    param

    defines the cube texture to convert in env file

    param

    options for the conversion process

    param

    the mime type for the encoded images, with support for "image/png" (default) and "image/webp"

    param

    the image quality of encoded WebP images.

    returns

    a promise containing the environment data if successful.

  • CreateImageDataArrayBufferViews: typeof CreateImageDataArrayBufferViews

    Creates the ArrayBufferViews used for initializing environment texture image data.

    param

    the image data

    param

    parameters that determine what views will be created for accessing the underlying buffer

    returns

    the views described by info providing access to the underlying buffer

  • GetEnvInfo: typeof GetEnvInfo

    Gets the environment info from an env file.

    param

    The array buffer containing the .env bytes.

    returns

    the environment file info (the json header) if successfully parsed, normalized to the latest supported version.

  • UploadEnvLevelsAsync: typeof UploadEnvLevelsAsync

    Uploads the texture info contained in the env file to the GPU.

    param

    defines the internal texture to upload to

    param

    defines the data to load

    param

    defines the texture info retrieved through the GetEnvInfo method

    returns

    a promise

  • UploadEnvSpherical: typeof UploadEnvSpherical

    Uploads spherical polynomials information to the texture.

    param

    defines the texture we are trying to upload the information to

    param

    defines the environment texture info retrieved through the GetEnvInfo method

  • UploadLevelsAsync: typeof UploadLevelsAsync

    Uploads the levels of image data to the GPU.

    param

    defines the internal texture to upload to

    param

    defines the array buffer views of image data [mipmap][face]

    param

    the mime type of the image data

    returns

    a promise

Let Epsilon

Epsilon: number

Constant used to define the minimal number value in Babylon.js

ignorenaming

Const ExtendMeshToGoldberg

ExtendMeshToGoldberg: (mesh: Mesh) => Mesh

Function to use when extending the mesh class to a Goldberg class

Type declaration

Const GUID

GUID: { RandomId: typeof RandomGUID }

Class used to manipulate GUIDs

Type declaration

Const GetEnvironmentBRDFTexture

GetEnvironmentBRDFTexture: (scene: Scene) => BaseTexture

Gets a default environment BRDF for MS-BRDF Height Correlated BRDF

param

defines the hosting scene

returns

the environment BRDF texture

Type declaration

Const GetInternalFormatFromBasisFormat

GetInternalFormatFromBasisFormat: (basisFormat: number) => number

Get the internal format to be passed to texImage2D corresponding to the .basis format value

param

format chosen from GetSupportedTranscodeFormat

returns

internal format corresponding to the Basis format

Type declaration

    • (basisFormat: number): number
    • Parameters

      • basisFormat: number

      Returns number

Const GroundBuilder

GroundBuilder: { CreateGround: typeof CreateGround; CreateGroundFromHeightMap: typeof CreateGroundFromHeightMap; CreateTiledGround: typeof CreateTiledGround }

Class containing static functions to help procedurally build meshes

deprecated

use the functions directly from the module

Type declaration

Const HemisphereBuilder

HemisphereBuilder: { CreateHemisphere: typeof CreateHemisphere }

Class containing static functions to help procedurally build meshes

deprecated

use the function directly from the module

Type declaration

Const IcoSphereBuilder

IcoSphereBuilder: { CreateIcoSphere: typeof CreateIcoSphere }

Class containing static functions to help procedurally build meshes

deprecated

use the function directly from the module

Type declaration

Const LatheBuilder

LatheBuilder: { CreateLathe: typeof CreateLathe }

Class containing static functions to help procedurally build meshes

deprecated

use the function direction from the module

Type declaration

Const LinesBuilder

LinesBuilder: { CreateDashedLines: typeof CreateDashedLines; CreateLineSystem: typeof CreateLineSystem; CreateLines: typeof CreateLines }

Class containing static functions to help procedurally build meshes

deprecated

use the functions directly from the module

Type declaration

Const LoadTextureFromTranscodeResult

LoadTextureFromTranscodeResult: (texture: InternalTexture, transcodeResult: TranscodeResult) => void

Loads a texture from the transcode result

param

texture load to

param

the result of transcoding the basis file to load from

Type declaration

Const MeshBuilder

MeshBuilder: { CreateBox: typeof CreateBox; CreateCapsule: typeof CreateCapsule; CreateCylinder: typeof CreateCylinder; CreateDashedLines: typeof CreateDashedLines; CreateDecal: typeof CreateDecal; CreateDisc: typeof CreateDisc; CreateGeodesic: typeof CreateGeodesic; CreateGoldberg: typeof CreateGoldberg; CreateGround: typeof CreateGround; CreateGroundFromHeightMap: typeof CreateGroundFromHeightMap; CreateIcoSphere: typeof CreateIcoSphere; CreateLathe: typeof CreateLathe; CreateLineSystem: typeof CreateLineSystem; CreateLines: typeof CreateLines; CreatePlane: typeof CreatePlane; CreatePolygon: typeof CreatePolygon; CreatePolyhedron: typeof CreatePolyhedron; CreateRibbon: typeof CreateRibbon; CreateSphere: typeof CreateSphere; CreateTiledBox: typeof CreateTiledBox; CreateTiledGround: typeof CreateTiledGround; CreateTiledPlane: typeof CreateTiledPlane; CreateTorus: typeof CreateTorus; CreateTorusKnot: typeof CreateTorusKnot; CreateTube: typeof CreateTube; ExtrudePolygon: typeof ExtrudePolygon; ExtrudeShape: typeof ExtrudeShape; ExtrudeShapeCustom: typeof ExtrudeShapeCustom }

Class containing static functions to help procedurally build meshes

Type declaration

Const PHI

PHI: number

Constant Golden Ratio value in Babylon.js

ignorenaming

Const PadNumber

PadNumber: (num: number, length: number) => string

Converts a number to string and pads with preceding zeroes until it is of specified length.

param

the number to convert and pad

param

the expected length of the string

returns

the padded string

Type declaration

    • (num: number, length: number): string
    • Parameters

      • num: number
      • length: number

      Returns string

Const PlaneBuilder

PlaneBuilder: { CreatePlane: typeof CreatePlane }

Class containing static functions to help procedurally build meshes

deprecated

use the function directly from the module

Type declaration

Const PolygonBuilder

PolygonBuilder: { CreatePolygon: typeof CreatePolygon; ExtrudePolygon: typeof ExtrudePolygon }

Class containing static functions to help procedurally build meshes

deprecated

use the functions directly from the module

Type declaration

Const PolyhedronBuilder

PolyhedronBuilder: { CreatePolyhedron: typeof CreatePolyhedron }

Class containing static functions to help procedurally build meshes

deprecated

use the function directly from the module

Type declaration

Const RibbonBuilder

RibbonBuilder: { CreateRibbon: typeof CreateRibbon }

Class containing static functions to help procedurally build meshes

deprecated

use CreateRibbon directly

Type declaration

Const ScreenshotTools

ScreenshotTools: { CreateScreenshot: typeof CreateScreenshot; CreateScreenshotAsync: typeof CreateScreenshotAsync; CreateScreenshotUsingRenderTarget: typeof CreateScreenshotUsingRenderTarget; CreateScreenshotUsingRenderTargetAsync: typeof CreateScreenshotUsingRenderTargetAsync; CreateScreenshotWithResizeAsync: typeof CreateScreenshotWithResizeAsync }

Class containing a set of static utilities functions for screenshots

Type declaration

  • CreateScreenshot: typeof CreateScreenshot

    Captures a screenshot of the current rendering

    see

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

    param

    defines the rendering engine

    param

    defines the source camera

    param

    This parameter can be set to a single number or to an object with the following (optional) properties: precision, width, height. If a single number is passed, it will be used for both width and height. If an object is passed, the screenshot size will be derived from the parameters. The precision property is a multiplier allowing rendering at a higher or lower resolution

    param

    defines the callback receives a single parameter which contains the screenshot as a string of base64-encoded characters. This string can be assigned to the src parameter of an to display it

    param

    defines the MIME type of the screenshot image (default: image/png). Check your browser for supported MIME types

    param

    force the system to download the image even if a successCallback is provided

  • CreateScreenshotAsync: typeof CreateScreenshotAsync

    Captures a screenshot of the current rendering

    see

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

    param

    defines the rendering engine

    param

    defines the source camera

    param

    This parameter can be set to a single number or to an object with the following (optional) properties: precision, width, height. If a single number is passed, it will be used for both width and height. If an object is passed, the screenshot size will be derived from the parameters. The precision property is a multiplier allowing rendering at a higher or lower resolution

    param

    defines the MIME type of the screenshot image (default: image/png). Check your browser for supported MIME types

    returns

    screenshot as a string of base64-encoded characters. This string can be assigned to the src parameter of an to display it

  • CreateScreenshotUsingRenderTarget: typeof CreateScreenshotUsingRenderTarget

    Generates an image screenshot from the specified camera.

    see

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

    param

    The engine to use for rendering

    param

    The camera to use for rendering

    param

    This parameter can be set to a single number or to an object with the following (optional) properties: precision, width, height. If a single number is passed, it will be used for both width and height. If an object is passed, the screenshot size will be derived from the parameters. The precision property is a multiplier allowing rendering at a higher or lower resolution

    param

    The callback receives a single parameter which contains the screenshot as a string of base64-encoded characters. This string can be assigned to the src parameter of an to display it

    param

    The MIME type of the screenshot image (default: image/png). Check your browser for supported MIME types

    param

    Texture samples (default: 1)

    param

    Whether antialiasing should be turned on or not (default: false)

    param

    A name for for the downloaded file.

    param

    Whether the sprites should be rendered or not (default: false)

    param

    Whether the stencil buffer should be enabled or not (default: false)

  • CreateScreenshotUsingRenderTargetAsync: typeof CreateScreenshotUsingRenderTargetAsync

    Generates an image screenshot from the specified camera.

    see

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

    param

    The engine to use for rendering

    param

    The camera to use for rendering

    param

    This parameter can be set to a single number or to an object with the following (optional) properties: precision, width, height. If a single number is passed, it will be used for both width and height. If an object is passed, the screenshot size will be derived from the parameters. The precision property is a multiplier allowing rendering at a higher or lower resolution

    param

    The MIME type of the screenshot image (default: image/png). Check your browser for supported MIME types

    param

    Texture samples (default: 1)

    param

    Whether antialiasing should be turned on or not (default: false)

    param

    A name for for the downloaded file.

    param

    Whether the sprites should be rendered or not (default: false)

    returns

    screenshot as a string of base64-encoded characters. This string can be assigned to the src parameter of an to display it

  • CreateScreenshotWithResizeAsync: typeof CreateScreenshotWithResizeAsync

    Captures a screenshot of the current rendering for a specific size. This will render the entire canvas but will generate a blink (due to canvas resize)

    see

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

    param

    defines the rendering engine

    param

    defines the source camera

    param

    defines the expected width

    param

    defines the expected height

    param

    defines the MIME type of the screenshot image (default: image/png). Check your browser for supported MIME types

    returns

    screenshot as a string of base64-encoded characters. This string can be assigned to the src parameter of an to display it

Const ShapeBuilder

ShapeBuilder: { ExtrudeShape: typeof ExtrudeShape; ExtrudeShapeCustom: typeof ExtrudeShapeCustom }

Class containing static functions to help procedurally build meshes

deprecated

please use the functions directly from the module

Type declaration

Const SphereBuilder

SphereBuilder: { CreateSphere: typeof CreateSphere }

Class containing static functions to help procedurally build meshes

deprecated

use CreateSphere directly

Type declaration

Const StartsWith

StartsWith: (str: string, suffix: string) => boolean

Checks for a matching suffix at the beginning of a string (for ES5 and lower)

param

Source string

param

Suffix to search for in the source string

returns

Boolean indicating whether the suffix was found (true) or not (false)

Type declaration

    • (str: string, suffix: string): boolean
    • Parameters

      • str: string
      • suffix: string

      Returns boolean

Const StringTools

StringTools: { Decode: (buffer: Uint8Array | Uint16Array) => string; DecodeBase64ToBinary: (base64Data: string) => ArrayBuffer; DecodeBase64ToString: (base64Data: string) => string; EncodeArrayBufferToBase64: (buffer: ArrayBuffer | ArrayBufferView) => string; EndsWith: (str: string, suffix: string) => boolean; PadNumber: (num: number, length: number) => string; StartsWith: (str: string, suffix: string) => boolean }

Helper to manipulate strings

Type declaration

  • Decode: (buffer: Uint8Array | Uint16Array) => string
      • (buffer: Uint8Array | Uint16Array): string
      • Parameters

        • buffer: Uint8Array | Uint16Array

        Returns string

  • DecodeBase64ToBinary: (base64Data: string) => ArrayBuffer
      • (base64Data: string): ArrayBuffer
      • Parameters

        • base64Data: string

        Returns ArrayBuffer

  • DecodeBase64ToString: (base64Data: string) => string
      • (base64Data: string): string
      • Parameters

        • base64Data: string

        Returns string

  • EncodeArrayBufferToBase64: (buffer: ArrayBuffer | ArrayBufferView) => string
      • (buffer: ArrayBuffer | ArrayBufferView): string
      • Parameters

        • buffer: ArrayBuffer | ArrayBufferView

        Returns string

  • EndsWith: (str: string, suffix: string) => boolean
      • (str: string, suffix: string): boolean
      • Parameters

        • str: string
        • suffix: string

        Returns boolean

  • PadNumber: (num: number, length: number) => string
      • (num: number, length: number): string
      • Parameters

        • num: number
        • length: number

        Returns string

  • StartsWith: (str: string, suffix: string) => boolean
      • (str: string, suffix: string): boolean
      • Parameters

        • str: string
        • suffix: string

        Returns boolean

Const TGATools

TGATools: { GetTGAHeader: typeof GetTGAHeader }

Based on jsTGALoader - Javascript loader for TGA file By Vincent Thibault

see

http://blog.robrowser.com/javascript-tga-loader.html

Type declaration

  • GetTGAHeader: typeof GetTGAHeader

    Gets the header of a TGA file

    param

    defines the TGA data

    returns

    the header

Const TextureTools

TextureTools: { ApplyPostProcess: typeof ApplyPostProcess; CreateResizedCopy: typeof CreateResizedCopy; FromHalfFloat: typeof FromHalfFloat; ToHalfFloat: typeof ToHalfFloat }

Class used to host texture specific utilities

Type declaration

  • ApplyPostProcess: typeof ApplyPostProcess

    Apply a post process to a texture

    param

    name of the fragment post process

    param

    the texture to encode

    param

    the scene hosting the texture

    param

    type of the output texture. If not provided, use the one from internalTexture

    param

    sampling mode to use to sample the source texture. If not provided, use the one from internalTexture

    param

    format of the output texture. If not provided, use the one from internalTexture

    returns

    a promise with the internalTexture having its texture replaced by the result of the processing

  • CreateResizedCopy: typeof CreateResizedCopy

    Uses the GPU to create a copy texture rescaled at a given size

    param

    Texture to copy from

    param

    defines the desired width

    param

    defines the desired height

    param

    defines if bilinear mode has to be used

    returns

    the generated texture

  • FromHalfFloat: typeof FromHalfFloat

    Converts a half float to a number

    param

    half float to convert

    returns

    converted half float

  • ToHalfFloat: typeof ToHalfFloat

    Converts a number to half float

    param

    number to convert

    returns

    converted number

Const TiledBoxBuilder

TiledBoxBuilder: { CreateTiledBox: typeof CreateTiledBox }

Class containing static functions to help procedurally build meshes

deprecated

use CreateTildeBox instead

Type declaration

Const TiledPlaneBuilder

TiledPlaneBuilder: { CreateTiledPlane: typeof CreateTiledPlane }

Class containing static functions to help procedurally build meshes

deprecated

use CreateTiledPlane instead

Type declaration

Const ToGammaSpace

ToGammaSpace: number

Constant used to convert a value to gamma space

ignorenaming

Const ToLinearSpace

ToLinearSpace: 2.2 = 2.2

Constant used to convert a value to linear space

ignorenaming

Const TorusBuilder

TorusBuilder: { CreateTorus: typeof CreateTorus }

Class containing static functions to help procedurally build meshes

deprecated

use CreateTorus instead

Type declaration

Const TorusKnotBuilder

TorusKnotBuilder: { CreateTorusKnot: typeof CreateTorusKnot }

Class containing static functions to help procedurally build meshes

deprecated

use CreateTorusKnot instead

Type declaration

Const TranscodeAsync

TranscodeAsync: (data: ArrayBuffer | ArrayBufferView, config: BasisTranscodeConfiguration) => Promise<TranscodeResult>

Transcodes a loaded image file to compressed pixel data

param

image data to transcode

param

configuration options for the transcoding

returns

a promise resulting in the transcoded image

Type declaration

Const TubeBuilder

TubeBuilder: { CreateTube: typeof CreateTube }

Class containing static functions to help procedurally build meshes

deprecated

use CreateTube directly

Type declaration

Functions

ApplyPostProcess

  • Apply a post process to a texture

    Parameters

    • postProcessName: string

      name of the fragment post process

    • internalTexture: InternalTexture

      the texture to encode

    • scene: Scene

      the scene hosting the texture

    • Optional type: number

      type of the output texture. If not provided, use the one from internalTexture

    • Optional samplingMode: number

      sampling mode to use to sample the source texture. If not provided, use the one from internalTexture

    • Optional format: number

      format of the output texture. If not provided, use the one from internalTexture

    Returns Promise<InternalTexture>

    a promise with the internalTexture having its texture replaced by the result of the processing

CreateBox

  • CreateBox(name: string, options: { backUVs?: Vector4; bottomBaseAt?: number; depth?: number; faceColors?: Color4[]; faceUV?: Vector4[]; frontUVs?: Vector4; height?: number; sideOrientation?: number; size?: number; topBaseAt?: number; updatable?: boolean; width?: number; wrap?: boolean }, scene?: Nullable<Scene>): Mesh
  • Creates a box mesh

    • The parameter size sets the size (float) of each box side (default 1)
    • You can set some different box dimensions by using the parameters width, height and depth (all by default have the same value of size)
    • You can set different colors and different images to each box side by using the parameters faceColors (an array of 6 Color3 elements) and faceUV (an array of 6 Vector4 elements)
    • Please read this tutorial : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors
    • 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 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/set_shapes#box

    Parameters

    • name: string

      defines the name of the mesh

    • options: { backUVs?: Vector4; bottomBaseAt?: number; depth?: number; faceColors?: Color4[]; faceUV?: Vector4[]; frontUVs?: Vector4; height?: number; sideOrientation?: number; size?: number; topBaseAt?: number; updatable?: boolean; width?: number; wrap?: boolean }

      defines the options used to create the mesh

      • Optional backUVs?: Vector4
      • Optional bottomBaseAt?: number
      • Optional depth?: number
      • Optional faceColors?: Color4[]
      • Optional faceUV?: Vector4[]
      • Optional frontUVs?: Vector4
      • Optional height?: number
      • Optional sideOrientation?: number
      • Optional size?: number
      • Optional topBaseAt?: number
      • Optional updatable?: boolean
      • Optional width?: number
      • Optional wrap?: boolean
    • Optional scene: Nullable<Scene>

      defines the hosting scene

    Returns Mesh

    the box mesh

CreateBoxVertexData

  • CreateBoxVertexData(options: { backUVs?: Vector4; bottomBaseAt?: number; depth?: number; faceColors?: Color4[]; faceUV?: Vector4[]; frontUVs?: Vector4; height?: number; sideOrientation?: number; size?: number; topBaseAt?: number; width?: number; wrap?: boolean }): VertexData
  • Creates the VertexData for a box

    Parameters

    • options: { backUVs?: Vector4; bottomBaseAt?: number; depth?: number; faceColors?: Color4[]; faceUV?: Vector4[]; frontUVs?: Vector4; height?: number; sideOrientation?: number; size?: number; topBaseAt?: number; width?: number; wrap?: boolean }

      an object used to set the following optional parameters for the box, required but can be empty

      • size sets the width, height and depth of the box to the value of size, optional default 1
      • width sets the width (x direction) of the box, overwrites the width set by size, optional, default size
      • height sets the height (y direction) of the box, overwrites the height set by size, optional, default size
      • depth sets the depth (z direction) of the box, overwrites the depth set by size, optional, default size
      • faceUV an array of 6 Vector4 elements used to set different images to each box side
      • faceColors an array of 6 Color3 elements used to set different colors to each box side
      • sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
      • frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)
      • backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)
      • Optional backUVs?: Vector4
      • Optional bottomBaseAt?: number
      • Optional depth?: number
      • Optional faceColors?: Color4[]
      • Optional faceUV?: Vector4[]
      • Optional frontUVs?: Vector4
      • Optional height?: number
      • Optional sideOrientation?: number
      • Optional size?: number
      • Optional topBaseAt?: number
      • Optional width?: number
      • Optional wrap?: boolean

    Returns VertexData

    the VertexData of the box

CreateCapsule

  • Creates a capsule or a pill mesh

    Parameters

    • name: string

      defines the name of the mesh

    • Optional options: ICreateCapsuleOptions

      The constructors options.

    • Optional scene: Nullable<Scene>

      The scene the mesh is scoped to.

    Returns Mesh

    Capsule Mesh

CreateCapsuleVertexData

CreateCylinder

  • CreateCylinder(name: string, options: { arc?: number; backUVs?: Vector4; cap?: number; diameter?: number; diameterBottom?: number; diameterTop?: number; enclose?: boolean; faceColors?: Color4[]; faceUV?: Vector4[]; frontUVs?: Vector4; hasRings?: boolean; height?: number; sideOrientation?: number; subdivisions?: number; tessellation?: number; updatable?: boolean }, scene: any): Mesh
  • Creates a cylinder or a cone mesh

    • The parameter height sets the height size (float) of the cylinder/cone (float, default 2).
    • The parameter diameter sets the diameter of the top and bottom cap at once (float, default 1).
    • The parameters diameterTop and diameterBottom overwrite the parameter diameter and set respectively the top cap and bottom cap diameter (floats, default 1). The parameter "diameterBottom" can't be zero.
    • The parameter tessellation sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance.
    • The parameter subdivisions sets the number of rings along the cylinder height (positive integer, default 1).
    • The parameter hasRings (boolean, default false) makes the subdivisions independent from each other, so they become different faces.
    • The parameter enclose (boolean, default false) adds two extra faces per subdivision to a sliced cylinder to close it around its height axis.
    • The parameter cap sets the way the cylinder is capped. Possible values : BABYLON.Mesh.NO_CAP, BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL (default).
    • The parameter arc (float, default 1) is the ratio (max 1) to apply to the circumference to slice the cylinder.
    • You can set different colors and different images to each box side by using the parameters faceColors (an array of n Color3 elements) and faceUV (an array of n Vector4 elements).
    • The value of n is the number of cylinder faces. If the cylinder has only 1 subdivisions, n equals : top face + cylinder surface + bottom face = 3
    • Now, if the cylinder has 5 independent subdivisions (hasRings = true), n equals : top face + 5 stripe surfaces + bottom face = 2 + 5 = 7
    • Finally, if the cylinder has 5 independent subdivisions and is enclose, n equals : top face + 5 x (stripe surface + 2 closing faces) + bottom face = 2 + 5 * 3 = 17
    • Each array (color or UVs) is always ordered the same way : the first element is the bottom cap, the last element is the top cap. The other elements are each a ring surface.
    • If enclose is false, a ring surface is one element.
    • If enclose is true, a ring surface is 3 successive elements in the array : the tubular surface, then the two closing faces.
    • Example how to set colors and textures on a sliced cylinder : https://www.html5gamedevs.com/topic/17945-creating-a-closed-slice-of-a-cylinder/#comment-106379
    • 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 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/set_shapes#cylinder-or-cone

    Parameters

    • name: string

      defines the name of the mesh

    • options: { arc?: number; backUVs?: Vector4; cap?: number; diameter?: number; diameterBottom?: number; diameterTop?: number; enclose?: boolean; faceColors?: Color4[]; faceUV?: Vector4[]; frontUVs?: Vector4; hasRings?: boolean; height?: number; sideOrientation?: number; subdivisions?: number; tessellation?: number; updatable?: boolean }

      defines the options used to create the mesh

      • Optional arc?: number
      • Optional backUVs?: Vector4
      • Optional cap?: number
      • Optional diameter?: number
      • Optional diameterBottom?: number
      • Optional diameterTop?: number
      • Optional enclose?: boolean
      • Optional faceColors?: Color4[]
      • Optional faceUV?: Vector4[]
      • Optional frontUVs?: Vector4
      • Optional hasRings?: boolean
      • Optional height?: number
      • Optional sideOrientation?: number
      • Optional subdivisions?: number
      • Optional tessellation?: number
      • Optional updatable?: boolean
    • scene: any

      defines the hosting scene

    Returns Mesh

    the cylinder mesh

CreateCylinderVertexData

  • CreateCylinderVertexData(options: { arc?: number; backUVs?: Vector4; cap?: number; diameter?: number; diameterBottom?: number; diameterTop?: number; enclose?: boolean; faceColors?: Color4[]; faceUV?: Vector4[]; frontUVs?: Vector4; hasRings?: boolean; height?: number; sideOrientation?: number; subdivisions?: number; tessellation?: number }): VertexData
  • Creates the VertexData for a cylinder, cone or prism

    Parameters

    • options: { arc?: number; backUVs?: Vector4; cap?: number; diameter?: number; diameterBottom?: number; diameterTop?: number; enclose?: boolean; faceColors?: Color4[]; faceUV?: Vector4[]; frontUVs?: Vector4; hasRings?: boolean; height?: number; sideOrientation?: number; subdivisions?: number; tessellation?: number }

      an object used to set the following optional parameters for the box, required but can be empty

      • height sets the height (y direction) of the cylinder, optional, default 2
      • diameterTop sets the diameter of the top of the cone, overwrites diameter, optional, default diameter
      • diameterBottom sets the diameter of the bottom of the cone, overwrites diameter, optional, default diameter
      • diameter sets the diameter of the top and bottom of the cone, optional default 1
      • tessellation the number of prism sides, 3 for a triangular prism, optional, default 24
      • subdivisions` the number of rings along the cylinder height, optional, default 1
      • arc a number from 0 to 1, to create an unclosed cylinder based on the fraction of the circumference given by the arc value, optional, default 1
      • faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively
      • faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively
      • hasRings when true makes each subdivision independantly treated as a face for faceUV and faceColors, optional, default false
      • enclose when true closes an open cylinder by adding extra flat faces between the height axis and vertical edges, think cut cake
      • sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
      • frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)
      • backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)
      • Optional arc?: number
      • Optional backUVs?: Vector4
      • Optional cap?: number
      • Optional diameter?: number
      • Optional diameterBottom?: number
      • Optional diameterTop?: number
      • Optional enclose?: boolean
      • Optional faceColors?: Color4[]
      • Optional faceUV?: Vector4[]
      • Optional frontUVs?: Vector4
      • Optional hasRings?: boolean
      • Optional height?: number
      • Optional sideOrientation?: number
      • Optional subdivisions?: number
      • Optional tessellation?: number

    Returns VertexData

    the VertexData of the cylinder, cone or prism

CreateDashedLines

  • CreateDashedLines(name: string, options: { dashNb?: number; dashSize?: number; gapSize?: number; instance?: LinesMesh; material?: Material; points: Vector3[]; updatable?: boolean; useVertexAlpha?: boolean }, scene?: Nullable<Scene>): LinesMesh
  • Creates a dashed line mesh

    • A dashed line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter
    • Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function
    • The parameter points is an array successive Vector3
    • The parameter dashNb is the intended total number of dashes (positive integer, default 200)
    • The parameter dashSize is the size of the dashes relatively the dash number (positive float, default 3)
    • The parameter gapSize is the size of the gap between two successive dashes relatively the dash number (positive float, default 1)
    • The optional parameter instance is an instance of an existing LineMesh object to be updated with the passed points parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines
    • The optional parameter useVertexAlpha is to be set to false (default true) when you don't need the alpha blending (faster)
    • The optional parameter material is the material to use to draw the lines if provided. If not, a default material will be created
    • When updating an instance, remember that only point positions can change, not the number of points
    • 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#dashed-lines

    Parameters

    • name: string

      defines the name of the mesh

    • options: { dashNb?: number; dashSize?: number; gapSize?: number; instance?: LinesMesh; material?: Material; points: Vector3[]; updatable?: boolean; useVertexAlpha?: boolean }

      defines the options used to create the mesh

      • Optional dashNb?: number
      • Optional dashSize?: number
      • Optional gapSize?: number
      • Optional instance?: LinesMesh
      • Optional material?: Material
      • points: Vector3[]
      • Optional updatable?: boolean
      • Optional useVertexAlpha?: boolean
    • Optional scene: Nullable<Scene>

      defines the hosting scene

    Returns LinesMesh

    the dashed line mesh

CreateDashedLinesVertexData

  • CreateDashedLinesVertexData(options: { dashNb?: number; dashSize?: number; gapSize?: number; points: Vector3[] }): VertexData
  • Create the VertexData for a DashedLines

    Parameters

    • options: { dashNb?: number; dashSize?: number; gapSize?: number; points: Vector3[] }

      an object used to set the following optional parameters for the DashedLines, required but can be empty

      • points an array successive Vector3
      • dashSize the size of the dashes relative to the dash number, optional, default 3
      • gapSize the size of the gap between two successive dashes relative to the dash number, optional, default 1
      • dashNb the intended total number of dashes, optional, default 200
      • Optional dashNb?: number
      • Optional dashSize?: number
      • Optional gapSize?: number
      • points: Vector3[]

    Returns VertexData

    the VertexData for the DashedLines

CreateDecal

  • Creates a decal mesh. A decal is a mesh usually applied as a model onto the surface of another mesh. So don't forget the parameter sourceMesh depicting the decal

    • The parameter position (Vector3, default (0, 0, 0)) sets the position of the decal in World coordinates
    • The parameter normal (Vector3, default Vector3.Up) sets the normal of the mesh where the decal is applied onto in World coordinates
    • The parameter size (Vector3, default (1, 1, 1)) sets the decal scaling
    • The parameter angle (float in radian, default 0) sets the angle to rotate the decal
    • The parameter captureUVS defines if we need to capture the uvs or compute them
    see

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

    Parameters

    • name: string

      defines the name of the mesh

    • sourceMesh: AbstractMesh

      defines the mesh where the decal must be applied

    • options: { angle?: number; captureUVS?: boolean; normal?: Vector3; position?: Vector3; size?: Vector3 }

      defines the options used to create the mesh

      • Optional angle?: number
      • Optional captureUVS?: boolean
      • Optional normal?: Vector3
      • Optional position?: Vector3
      • Optional size?: Vector3

    Returns Mesh

    the decal mesh

CreateDisc

  • CreateDisc(name: string, options: { arc?: number; backUVs?: Vector4; frontUVs?: Vector4; radius?: number; sideOrientation?: number; tessellation?: number; updatable?: boolean }, scene?: Nullable<Scene>): Mesh
  • Creates a plane polygonal mesh. By default, this is a disc

    • The parameter radius sets the radius size (float) of the polygon (default 0.5)
    • The parameter tessellation sets the number of polygon sides (positive integer, default 64). So a tessellation valued to 3 will build a triangle, to 4 a square, etc
    • You can create an unclosed polygon with the parameter arc (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference : 2 x PI x ratio
    • 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 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/set_shapes#disc-or-regular-polygon

    Parameters

    • name: string

      defines the name of the mesh

    • options: { arc?: number; backUVs?: Vector4; frontUVs?: Vector4; radius?: number; sideOrientation?: number; tessellation?: number; updatable?: boolean }

      defines the options used to create the mesh

      • Optional arc?: number
      • Optional backUVs?: Vector4
      • Optional frontUVs?: Vector4
      • Optional radius?: number
      • Optional sideOrientation?: number
      • Optional tessellation?: number
      • Optional updatable?: boolean
    • Optional scene: Nullable<Scene>

      defines the hosting scene

    Returns Mesh

    the plane polygonal mesh

CreateEnvTextureAsync

  • Creates an environment texture from a loaded cube texture.

    Parameters

    Returns Promise<ArrayBuffer>

    a promise containing the environment data if successful.

CreateGeodesic

  • CreateGeodesic(name: string, options: { backUVs?: Vector4; faceColors?: Color4[]; faceUV?: Vector4[]; flat?: boolean; frontUVs?: Vector4; m?: number; n?: number; sideOrientation?: number; size?: number; sizeX?: number; sizeY?: number; sizeZ?: number; updatable?: boolean }, scene?: Nullable<Scene>): Mesh
  • Creates the Mesh for a Geodesic Polyhedron

    see

    https://en.wikipedia.org/wiki/Geodesic_polyhedron

    Parameters

    • name: string

      defines the name of the mesh

    • options: { backUVs?: Vector4; faceColors?: Color4[]; faceUV?: Vector4[]; flat?: boolean; frontUVs?: Vector4; m?: number; n?: number; sideOrientation?: number; size?: number; sizeX?: number; sizeY?: number; sizeZ?: number; updatable?: boolean }

      an object used to set the following optional parameters for the polyhedron, required but can be empty

      • m number of horizontal steps along an isogrid
      • n number of angled steps along an isogrid
      • size the size of the Geodesic, optional default 1
      • sizeX allows stretching in the x direction, optional, default size
      • sizeY allows stretching in the y direction, optional, default size
      • sizeZ allows stretching in the z direction, optional, default size
      • faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively
      • faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively
      • flat when true creates a flat shaded mesh, optional, default true
      • subdivisions increasing the subdivisions increases the number of faces, optional, default 4
      • sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
      • frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)
      • backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)
      • Optional backUVs?: Vector4
      • Optional faceColors?: Color4[]
      • Optional faceUV?: Vector4[]
      • Optional flat?: boolean
      • Optional frontUVs?: Vector4
      • Optional m?: number
      • Optional n?: number
      • Optional sideOrientation?: number
      • Optional size?: number
      • Optional sizeX?: number
      • Optional sizeY?: number
      • Optional sizeZ?: number
      • Optional updatable?: boolean
    • Optional scene: Nullable<Scene>

      defines the hosting scene

    Returns Mesh

    Geodesic mesh

CreateGoldberg

  • CreateGoldberg(name: string, options: { m?: number; n?: number; sideOrientation?: number; size?: number; sizeX?: number; sizeY?: number; sizeZ?: number; updatable?: boolean }, scene?: Nullable<Scene>): Mesh
  • Creates the Mesh for a Goldberg Polyhedron which is made from 12 pentagonal and the rest hexagonal faces

    see

    https://en.wikipedia.org/wiki/Goldberg_polyhedron

    Parameters

    • name: string

      defines the name of the mesh

    • options: { m?: number; n?: number; sideOrientation?: number; size?: number; sizeX?: number; sizeY?: number; sizeZ?: number; updatable?: boolean }

      an object used to set the following optional parameters for the polyhedron, required but can be empty

      • m number of horizontal steps along an isogrid
      • n number of angled steps along an isogrid
      • size the size of the Goldberg, optional default 1
      • sizeX allows stretching in the x direction, optional, default size
      • sizeY allows stretching in the y direction, optional, default size
      • sizeZ allows stretching in the z direction, optional, default size
      • updatable defines if the mesh must be flagged as updatable
      • sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
      • Optional m?: number
      • Optional n?: number
      • Optional sideOrientation?: number
      • Optional size?: number
      • Optional sizeX?: number
      • Optional sizeY?: number
      • Optional sizeZ?: number
      • Optional updatable?: boolean
    • Optional scene: Nullable<Scene>

      defines the hosting scene

    Returns Mesh

    Goldberg mesh

CreateGoldbergVertexData

  • CreateGoldbergVertexData(options: { sideOrientation?: number; size?: number; sizeX?: number; sizeY?: number; sizeZ?: number }, goldbergData: PolyhedronData): VertexData
  • Creates the Mesh for a Goldberg Polyhedron

    Parameters

    • options: { sideOrientation?: number; size?: number; sizeX?: number; sizeY?: number; sizeZ?: number }

      an object used to set the following optional parameters for the polyhedron, required but can be empty

      • m number of horizontal steps along an isogrid
      • n number of angled steps along an isogrid
      • size the size of the Goldberg, optional default 1
      • sizeX allows stretching in the x direction, optional, default size
      • sizeY allows stretching in the y direction, optional, default size
      • sizeZ allows stretching in the z direction, optional, default size
      • faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively
      • faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively
      • subdivisions increasing the subdivisions increases the number of faces, optional, default 4
      • sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
      • frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)
      • backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)
      • Optional sideOrientation?: number
      • Optional size?: number
      • Optional sizeX?: number
      • Optional sizeY?: number
      • Optional sizeZ?: number
    • goldbergData: PolyhedronData

    Returns VertexData

    GoldbergSphere mesh

CreateGround

  • CreateGround(name: string, options: { height?: number; subdivisions?: number; subdivisionsX?: number; subdivisionsY?: number; updatable?: boolean; width?: number }, scene: any): Mesh
  • Creates a ground mesh

    • The parameters width and height (floats, default 1) set the width and height sizes of the ground
    • The parameter subdivisions (positive integer) sets the number of subdivisions per side
    • 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/set_shapes#ground

    Parameters

    • name: string

      defines the name of the mesh

    • options: { height?: number; subdivisions?: number; subdivisionsX?: number; subdivisionsY?: number; updatable?: boolean; width?: number }

      defines the options used to create the mesh

      • Optional height?: number
      • Optional subdivisions?: number
      • Optional subdivisionsX?: number
      • Optional subdivisionsY?: number
      • Optional updatable?: boolean
      • Optional width?: number
    • scene: any

      defines the hosting scene

    Returns Mesh

    the ground mesh

CreateGroundFromHeightMap

  • CreateGroundFromHeightMap(name: string, url: string, options: { alphaFilter?: number; colorFilter?: Color3; height?: number; maxHeight?: number; minHeight?: number; onReady?: (mesh: GroundMesh) => void; subdivisions?: number; updatable?: boolean; width?: number }, scene?: Nullable<Scene>): GroundMesh
  • Creates a ground mesh from a height map

    • The parameter url sets the URL of the height map image resource.
    • The parameters width and height (positive floats, default 10) set the ground width and height sizes.
    • The parameter subdivisions (positive integer, default 1) sets the number of subdivision per side.
    • The parameter minHeight (float, default 0) is the minimum altitude on the ground.
    • The parameter maxHeight (float, default 1) is the maximum altitude on the ground.
    • The parameter colorFilter (optional Color3, default (0.3, 0.59, 0.11) ) is the filter to apply to the image pixel colors to compute the height.
    • The parameter onReady is a javascript callback function that will be called once the mesh is just built (the height map download can last some time).
    • The parameter alphaFilter will filter any data where the alpha channel is below this value, defaults 0 (all data visible)
    • 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/babylon101/height_map

    see

    https://doc.babylonjs.com/how_to/set_shapes#ground-from-a-height-map

    Parameters

    • name: string

      defines the name of the mesh

    • url: string

      defines the url to the height map

    • options: { alphaFilter?: number; colorFilter?: Color3; height?: number; maxHeight?: number; minHeight?: number; onReady?: (mesh: GroundMesh) => void; subdivisions?: number; updatable?: boolean; width?: number }

      defines the options used to create the mesh

      • Optional alphaFilter?: number
      • Optional colorFilter?: Color3
      • Optional height?: number
      • Optional maxHeight?: number
      • Optional minHeight?: number
      • Optional onReady?: (mesh: GroundMesh) => void
      • Optional subdivisions?: number
      • Optional updatable?: boolean
      • Optional width?: number
    • Optional scene: Nullable<Scene>

      defines the hosting scene

    Returns GroundMesh

    the ground mesh

CreateGroundFromHeightMapVertexData

  • CreateGroundFromHeightMapVertexData(options: { alphaFilter: number; buffer: Uint8Array; bufferHeight: number; bufferWidth: number; colorFilter: Color3; height: number; maxHeight: number; minHeight: number; subdivisions: number; width: number }): VertexData
  • Creates the VertexData of the Ground designed from a heightmap

    Parameters

    • options: { alphaFilter: number; buffer: Uint8Array; bufferHeight: number; bufferWidth: number; colorFilter: Color3; height: number; maxHeight: number; minHeight: number; subdivisions: number; width: number }

      an object used to set the following parameters for the Ground, required and provided by CreateGroundFromHeightMap

      • width the width (x direction) of the ground
      • height the height (z direction) of the ground
      • subdivisions the number of subdivisions per side
      • minHeight the minimum altitude on the ground, optional, default 0
      • maxHeight the maximum altitude on the ground, optional default 1
      • colorFilter the filter to apply to the image pixel colors to compute the height, optional Color3, default (0.3, 0.59, 0.11)
      • buffer the array holding the image color data
      • bufferWidth the width of image
      • bufferHeight the height of image
      • alphaFilter Remove any data where the alpha channel is below this value, defaults 0 (all data visible)
      • alphaFilter: number
      • buffer: Uint8Array
      • bufferHeight: number
      • bufferWidth: number
      • colorFilter: Color3
      • height: number
      • maxHeight: number
      • minHeight: number
      • subdivisions: number
      • width: number

    Returns VertexData

    the VertexData of the Ground designed from a heightmap

CreateGroundVertexData

  • CreateGroundVertexData(options: { height?: number; subdivisions?: number; subdivisionsX?: number; subdivisionsY?: number; width?: number }): VertexData
  • Creates the VertexData for a Ground

    Parameters

    • options: { height?: number; subdivisions?: number; subdivisionsX?: number; subdivisionsY?: number; width?: number }

      an object used to set the following optional parameters for the Ground, required but can be empty

      • width the width (x direction) of the ground, optional, default 1
      • height the height (z direction) of the ground, optional, default 1
      • subdivisions the number of subdivisions per side, optional, default 1
      • Optional height?: number
      • Optional subdivisions?: number
      • Optional subdivisionsX?: number
      • Optional subdivisionsY?: number
      • Optional width?: number

    Returns VertexData

    the VertexData of the Ground

CreateHemisphere

  • CreateHemisphere(name: string, options: { diameter?: number; segments?: number; sideOrientation?: number }, scene: any): Mesh
  • Creates a hemisphere mesh

    Parameters

    • name: string

      defines the name of the mesh

    • options: { diameter?: number; segments?: number; sideOrientation?: number }

      defines the options used to create the mesh

      • Optional diameter?: number
      • Optional segments?: number
      • Optional sideOrientation?: number
    • scene: any

      defines the hosting scene

    Returns Mesh

    the hemisphere mesh

CreateIcoSphere

  • CreateIcoSphere(name: string, options: { backUVs?: Vector4; flat?: boolean; frontUVs?: Vector4; radius?: number; radiusX?: number; radiusY?: number; radiusZ?: number; sideOrientation?: number; subdivisions?: number; updatable?: boolean }, scene?: Nullable<Scene>): Mesh
  • Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided

    • The parameter radius sets the radius size (float) of the icosphere (default 1)
    • You can set some different icosphere dimensions, for instance to build an ellipsoid, by using the parameters radiusX, radiusY and radiusZ (all by default have the same value of radius)
    • The parameter subdivisions sets the number of subdivisions (positive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size
    • The parameter flat (boolean, default true) gives each side its own normals. Set it to false to get a smooth continuous light reflection on the surface
    • 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 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/polyhedra_shapes#icosphere

    Parameters

    • name: string

      defines the name of the mesh

    • options: { backUVs?: Vector4; flat?: boolean; frontUVs?: Vector4; radius?: number; radiusX?: number; radiusY?: number; radiusZ?: number; sideOrientation?: number; subdivisions?: number; updatable?: boolean }

      defines the options used to create the mesh

      • Optional backUVs?: Vector4
      • Optional flat?: boolean
      • Optional frontUVs?: Vector4
      • Optional radius?: number
      • Optional radiusX?: number
      • Optional radiusY?: number
      • Optional radiusZ?: number
      • Optional sideOrientation?: number
      • Optional subdivisions?: number
      • Optional updatable?: boolean
    • Optional scene: Nullable<Scene>

      defines the hosting scene

    Returns Mesh

    the icosahedron mesh

CreateIcoSphereVertexData

  • CreateIcoSphereVertexData(options: { backUVs?: Vector4; flat?: boolean; frontUVs?: Vector4; radius?: number; radiusX?: number; radiusY?: number; radiusZ?: number; sideOrientation?: number; subdivisions?: number }): VertexData
  • Creates the VertexData of the IcoSphere

    Parameters

    • options: { backUVs?: Vector4; flat?: boolean; frontUVs?: Vector4; radius?: number; radiusX?: number; radiusY?: number; radiusZ?: number; sideOrientation?: number; subdivisions?: number }

      an object used to set the following optional parameters for the IcoSphere, required but can be empty

      • radius the radius of the IcoSphere, optional default 1
      • radiusX allows stretching in the x direction, optional, default radius
      • radiusY allows stretching in the y direction, optional, default radius
      • radiusZ allows stretching in the z direction, optional, default radius
      • flat when true creates a flat shaded mesh, optional, default true
      • subdivisions increasing the subdivisions increases the number of faces, optional, default 4
      • sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
      • frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)
      • backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)
      • Optional backUVs?: Vector4
      • Optional flat?: boolean
      • Optional frontUVs?: Vector4
      • Optional radius?: number
      • Optional radiusX?: number
      • Optional radiusY?: number
      • Optional radiusZ?: number
      • Optional sideOrientation?: number
      • Optional subdivisions?: number

    Returns VertexData

    the VertexData of the IcoSphere

CreateImageDataArrayBufferViews

  • CreateImageDataArrayBufferViews(data: ArrayBufferView, info: EnvironmentTextureInfo): Array<Array<ArrayBufferView>>
  • Creates the ArrayBufferViews used for initializing environment texture image data.

    Parameters

    • data: ArrayBufferView

      the image data

    • info: EnvironmentTextureInfo

      parameters that determine what views will be created for accessing the underlying buffer

    Returns Array<Array<ArrayBufferView>>

    the views described by info providing access to the underlying buffer

CreateLathe

  • CreateLathe(name: string, options: { arc?: number; backUVs?: Vector4; cap?: number; clip?: number; closed?: boolean; frontUVs?: Vector4; invertUV?: boolean; radius?: number; shape: Vector3[]; sideOrientation?: number; tessellation?: number; updatable?: boolean }, scene?: Nullable<Scene>): Mesh
  • Creates lathe mesh. The lathe is a shape with a symmetry axis : a 2D model shape is rotated around this axis to design the lathe

    • The parameter shape is a required array of successive Vector3. This array depicts the shape to be rotated in its local space : the shape must be designed in the xOy plane and will be rotated around the Y axis. It's usually a 2D shape, so the Vector3 z coordinates are often set to zero
    • The parameter radius (positive float, default 1) is the radius value of the lathe
    • The parameter tessellation (positive integer, default 64) is the side number of the lathe
    • The parameter clip (positive integer, default 0) is the number of sides to not create without effecting the general shape of the sides
    • The parameter arc (positive float, default 1) is the ratio of the lathe. 0.5 builds for instance half a lathe, so an opened shape
    • The parameter closed (boolean, default true) opens/closes the lathe circumference. This should be set to false when used with the parameter "arc"
    • 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
    • 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#lathe

    Parameters

    • name: string

      defines the name of the mesh

    • options: { arc?: number; backUVs?: Vector4; cap?: number; clip?: number; closed?: boolean; frontUVs?: Vector4; invertUV?: boolean; radius?: number; shape: Vector3[]; sideOrientation?: number; tessellation?: number; updatable?: boolean }

      defines the options used to create the mesh

      • Optional arc?: number
      • Optional backUVs?: Vector4
      • Optional cap?: number
      • Optional clip?: number
      • Optional closed?: boolean
      • Optional frontUVs?: Vector4
      • Optional invertUV?: boolean
      • Optional radius?: number
      • shape: Vector3[]
      • Optional sideOrientation?: number
      • Optional tessellation?: number
      • Optional updatable?: boolean
    • Optional scene: Nullable<Scene>

      defines the hosting scene

    Returns Mesh

    the lathe mesh

CreateLineSystem

  • Creates a line system mesh. A line system is a pool of many lines gathered in a single mesh

    • A line system mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of lines as an input parameter
    • Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineSystem to this static function
    • The parameter lines is an array of lines, each line being an array of successive Vector3
    • The optional parameter instance is an instance of an existing LineSystem object to be updated with the passed lines parameter
    • The optional parameter colors is an array of line colors, each line colors being an array of successive Color4, one per line point
    • The optional parameter useVertexAlpha is to be set to false (default true) when you don't need the alpha blending (faster)
    • The optional parameter material is the material to use to draw the lines if provided. If not, a default material will be created
    • Updating a simple Line mesh, you just need to update every line in the lines array : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines
    • When updating an instance, remember that only line point positions can change, not the number of points, neither the number of lines
    • 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#line-system

    Parameters

    Returns LinesMesh

    a new line system mesh

CreateLineSystemVertexData

  • Creates the VertexData of the LineSystem

    Parameters

    • options: { colors?: Nullable<Color4[][]>; lines: Vector3[][] }

      an object used to set the following optional parameters for the LineSystem, required but can be empty

      • lines an array of lines, each line being an array of successive Vector3
      • colors an array of line colors, each of the line colors being an array of successive Color4, one per line point

    Returns VertexData

    the VertexData of the LineSystem

CreateLines

  • Creates a line mesh A line mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of points as an input parameter

    • Like every other parametric shape, it is dynamically updatable by passing an existing instance of LineMesh to this static function
    • The parameter points is an array successive Vector3
    • The optional parameter instance is an instance of an existing LineMesh object to be updated with the passed points parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#lines-and-dashedlines
    • The optional parameter colors is an array of successive Color4, one per line point
    • The optional parameter useVertexAlpha is to be set to false (default true) when you don't need alpha blending (faster)
    • The optional parameter material is the material to use to draw the lines if provided. If not, a default material will be created
    • When updating an instance, remember that only point positions can change, not the number of points
    • 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#lines

    Parameters

    • name: string

      defines the name of the new line system

    • options: { colors?: Color4[]; instance?: Nullable<LinesMesh>; material?: Material; points: Vector3[]; updatable?: boolean; useVertexAlpha?: boolean }

      defines the options used to create the line system

    • Optional scene: Nullable<Scene>

      defines the hosting scene

    Returns LinesMesh

    a new line mesh

CreatePlane

  • CreatePlane(name: string, options: { backUVs?: Vector4; frontUVs?: Vector4; height?: number; sideOrientation?: number; size?: number; sourcePlane?: Plane; updatable?: boolean; width?: number }, scene?: Nullable<Scene>): Mesh
  • Creates a plane mesh

    • The parameter size sets the size (float) of both sides of the plane at once (default 1)
    • You can set some different plane dimensions by using the parameters width and height (both by default have the same value of size)
    • The parameter sourcePlane is a Plane instance. It builds a mesh plane from a Math plane
    • 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 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/set_shapes#plane

    Parameters

    • name: string

      defines the name of the mesh

    • options: { backUVs?: Vector4; frontUVs?: Vector4; height?: number; sideOrientation?: number; size?: number; sourcePlane?: Plane; updatable?: boolean; width?: number }

      defines the options used to create the mesh

      • Optional backUVs?: Vector4
      • Optional frontUVs?: Vector4
      • Optional height?: number
      • Optional sideOrientation?: number
      • Optional size?: number
      • Optional sourcePlane?: Plane
      • Optional updatable?: boolean
      • Optional width?: number
    • Optional scene: Nullable<Scene>

      defines the hosting scene

    Returns Mesh

    the plane mesh

CreatePlaneVertexData

  • CreatePlaneVertexData(options: { backUVs?: Vector4; frontUVs?: Vector4; height?: number; sideOrientation?: number; size?: number; width?: number }): VertexData
  • Creates the VertexData for a Plane

    Parameters

    • options: { backUVs?: Vector4; frontUVs?: Vector4; height?: number; sideOrientation?: number; size?: number; width?: number }

      an object used to set the following optional parameters for the plane, required but can be empty

      • size sets the width and height of the plane to the value of size, optional default 1
      • width sets the width (x direction) of the plane, overwrites the width set by size, optional, default size
      • height sets the height (y direction) of the plane, overwrites the height set by size, optional, default size
      • sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
      • frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)
      • backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)
      • Optional backUVs?: Vector4
      • Optional frontUVs?: Vector4
      • Optional height?: number
      • Optional sideOrientation?: number
      • Optional size?: number
      • Optional width?: number

    Returns VertexData

    the VertexData of the box

CreatePolygon

  • CreatePolygon(name: string, options: { backUVs?: Vector4; depth?: number; faceColors?: Color4[]; faceUV?: Vector4[]; frontUVs?: Vector4; holes?: Vector3[][]; shape: Vector3[]; sideOrientation?: number; smoothingThreshold?: number; updatable?: boolean; wrap?: boolean }, scene?: Nullable<Scene>, earcutInjection?: any): Mesh
  • Creates a polygon mesh The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh

    • The parameter shape is a required array of successive Vector3 representing the corners of the polygon in th XoZ plane, that is y = 0 for all vectors
    • You can set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
    • The mesh can be set to updatable with the boolean parameter updatable (default false) if its internal geometry is supposed to change once created
    • 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)
    • Remember you can only change the shape positions, not their number when updating a polygon

    Parameters

    • name: string

      defines the name of the mesh

    • options: { backUVs?: Vector4; depth?: number; faceColors?: Color4[]; faceUV?: Vector4[]; frontUVs?: Vector4; holes?: Vector3[][]; shape: Vector3[]; sideOrientation?: number; smoothingThreshold?: number; updatable?: boolean; wrap?: boolean }

      defines the options used to create the mesh

      • Optional backUVs?: Vector4
      • Optional depth?: number
      • Optional faceColors?: Color4[]
      • Optional faceUV?: Vector4[]
      • Optional frontUVs?: Vector4
      • Optional holes?: Vector3[][]
      • shape: Vector3[]
      • Optional sideOrientation?: number
      • Optional smoothingThreshold?: number
      • Optional updatable?: boolean
      • Optional wrap?: boolean
    • Optional scene: Nullable<Scene>

      defines the hosting scene

    • Optional earcutInjection: any

      can be used to inject your own earcut reference

    Returns Mesh

    the polygon mesh

CreatePolygonVertexData

  • Creates the VertexData for an irregular Polygon in the XoZ plane using a mesh built by polygonTriangulation.build() All parameters are provided by CreatePolygon as needed

    Parameters

    • polygon: Mesh

      a mesh built from polygonTriangulation.build()

    • sideOrientation: number

      takes the values Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE

    • Optional fUV: Vector4[]

      an array of Vector4 elements used to set different images to the top, rings and bottom respectively

    • Optional fColors: Color4[]

      an array of Color3 elements used to set different colors to the top, rings and bottom respectively

    • Optional frontUVs: Vector4

      only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)

    • Optional backUVs: Vector4

      only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)

    • Optional wrp: boolean

    Returns VertexData

    the VertexData of the Polygon

CreatePolyhedron

  • CreatePolyhedron(name: string, options: { backUVs?: Vector4; custom?: any; faceColors?: Color4[]; faceUV?: Vector4[]; flat?: boolean; frontUVs?: Vector4; sideOrientation?: number; size?: number; sizeX?: number; sizeY?: number; sizeZ?: number; type?: number; updatable?: boolean }, scene?: Nullable<Scene>): Mesh
  • Creates a polyhedron mesh

    • The parameter type (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embbeded types. Please refer to the type sheet in the tutorial to choose the wanted type
    • The parameter size (positive float, default 1) sets the polygon size
    • You can overwrite the size on each dimension bu using the parameters sizeX, sizeY or sizeZ (positive floats, default to size value)
    • You can build other polyhedron types than the 15 embbeded ones by setting the parameter custom (polyhedronObject, default null). If you set the parameter custom, this overrides the parameter type
    • A polyhedronObject is a formatted javascript object. You'll find a full file with pre-set polyhedra here : https://github.com/BabylonJS/Extensions/tree/master/Polyhedron
    • You can set the color and the UV of each side of the polyhedron with the parameters faceColors (Color4, default (1, 1, 1, 1)) and faceUV (Vector4, default (0, 0, 1, 1))
    • To understand how to set faceUV or faceColors, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : https://doc.babylonjs.com/how_to/createbox_per_face_textures_and_colors
    • The parameter flat (boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case, faceColors and faceUV are ignored
    • 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 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/polyhedra_shapes

    Parameters

    • name: string

      defines the name of the mesh

    • options: { backUVs?: Vector4; custom?: any; faceColors?: Color4[]; faceUV?: Vector4[]; flat?: boolean; frontUVs?: Vector4; sideOrientation?: number; size?: number; sizeX?: number; sizeY?: number; sizeZ?: number; type?: number; updatable?: boolean }

      defines the options used to create the mesh

      • Optional backUVs?: Vector4
      • Optional custom?: any
      • Optional faceColors?: Color4[]
      • Optional faceUV?: Vector4[]
      • Optional flat?: boolean
      • Optional frontUVs?: Vector4
      • Optional sideOrientation?: number
      • Optional size?: number
      • Optional sizeX?: number
      • Optional sizeY?: number
      • Optional sizeZ?: number
      • Optional type?: number
      • Optional updatable?: boolean
    • Optional scene: Nullable<Scene>

      defines the hosting scene

    Returns Mesh

    the polyhedron mesh

CreatePolyhedronVertexData

  • CreatePolyhedronVertexData(options: { backUVs?: Vector4; custom?: any; faceColors?: Color4[]; faceUV?: Vector4[]; flat?: boolean; frontUVs?: Vector4; sideOrientation?: number; size?: number; sizeX?: number; sizeY?: number; sizeZ?: number; type?: number }): VertexData
  • Creates the VertexData for a Polyhedron

    Parameters

    • options: { backUVs?: Vector4; custom?: any; faceColors?: Color4[]; faceUV?: Vector4[]; flat?: boolean; frontUVs?: Vector4; sideOrientation?: number; size?: number; sizeX?: number; sizeY?: number; sizeZ?: number; type?: number }

      an object used to set the following optional parameters for the polyhedron, required but can be empty

      • type provided types are:
      • 0 : Tetrahedron, 1 : Octahedron, 2 : Dodecahedron, 3 : Icosahedron, 4 : Rhombicuboctahedron, 5 : Triangular Prism, 6 : Pentagonal Prism, 7 : Hexagonal Prism, 8 : Square Pyramid (J1)
      • 9 : Pentagonal Pyramid (J2), 10 : Triangular Dipyramid (J12), 11 : Pentagonal Dipyramid (J13), 12 : Elongated Square Dipyramid (J15), 13 : Elongated Pentagonal Dipyramid (J16), 14 : Elongated Pentagonal Cupola (J20)
      • size the size of the IcoSphere, optional default 1
      • sizeX allows stretching in the x direction, optional, default size
      • sizeY allows stretching in the y direction, optional, default size
      • sizeZ allows stretching in the z direction, optional, default size
      • custom a number that overwrites the type to create from an extended set of polyhedron from https://www.babylonjs-playground.com/#21QRSK#15 with minimised editor
      • faceUV an array of Vector4 elements used to set different images to the top, rings and bottom respectively
      • faceColors an array of Color3 elements used to set different colors to the top, rings and bottom respectively
      • flat when true creates a flat shaded mesh, optional, default true
      • subdivisions increasing the subdivisions increases the number of faces, optional, default 4
      • sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
      • frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)
      • backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)
      • Optional backUVs?: Vector4
      • Optional custom?: any
      • Optional faceColors?: Color4[]
      • Optional faceUV?: Vector4[]
      • Optional flat?: boolean
      • Optional frontUVs?: Vector4
      • Optional sideOrientation?: number
      • Optional size?: number
      • Optional sizeX?: number
      • Optional sizeY?: number
      • Optional sizeZ?: number
      • Optional type?: number

    Returns VertexData

    the VertexData of the Polyhedron

CreateResizedCopy

  • CreateResizedCopy(texture: Texture, width: number, height: number, useBilinearMode?: boolean): Texture
  • Uses the GPU to create a copy texture rescaled at a given size

    Parameters

    • texture: Texture

      Texture to copy from

    • width: number

      defines the desired width

    • height: number

      defines the desired height

    • Optional useBilinearMode: boolean

      defines if bilinear mode has to be used

    Returns Texture

    the generated texture

CreateRibbon

  • CreateRibbon(name: string, options: { backUVs?: Vector4; closeArray?: boolean; closePath?: boolean; colors?: Color4[]; frontUVs?: Vector4; instance?: Mesh; invertUV?: boolean; offset?: number; pathArray: Vector3[][]; sideOrientation?: number; updatable?: boolean; uvs?: Vector2[] }, scene?: Nullable<Scene>): Mesh
  • Creates a ribbon mesh. The ribbon is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters

    • The parameter pathArray is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry
    • The parameter closeArray (boolean, default false) creates a seam between the first and the last paths of the path array
    • The parameter closePath (boolean, default false) creates a seam between the first and the last points of each path of the path array
    • The parameter offset (positive integer, default : rounded half size of the pathArray length), is taken in account only if the pathArray is containing a single path
    • It's the offset to join the points from the same path. Ex : offset = 10 means the point 1 is joined to the point 11
    • The optional parameter instance is an instance of an existing Ribbon object to be updated with the passed pathArray parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#ribbon
    • 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 parameter uvs is an optional flat array of Vector2 to update/set each ribbon vertex with its own custom UV values instead of the computed ones
    • The parameters colors is an optional flat array of Color4 to set/update each ribbon vertex with its own custom color values
    • Note that if you use the parameters uvs or colors, the passed arrays must be populated with the right number of elements, it is to say the number of ribbon vertices. Remember that if you set closePath to true, there's one extra vertex per path in the geometry
    • Moreover, you can use the parameter color with instance (to update the ribbon), only if you previously used it at creation time
    • 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/ribbon_tutorial

    see

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

    Parameters

    • name: string

      defines the name of the mesh

    • options: { backUVs?: Vector4; closeArray?: boolean; closePath?: boolean; colors?: Color4[]; frontUVs?: Vector4; instance?: Mesh; invertUV?: boolean; offset?: number; pathArray: Vector3[][]; sideOrientation?: number; updatable?: boolean; uvs?: Vector2[] }

      defines the options used to create the mesh

      • Optional backUVs?: Vector4
      • Optional closeArray?: boolean
      • Optional closePath?: boolean
      • Optional colors?: Color4[]
      • Optional frontUVs?: Vector4
      • Optional instance?: Mesh
      • Optional invertUV?: boolean
      • Optional offset?: number
      • pathArray: Vector3[][]
      • Optional sideOrientation?: number
      • Optional updatable?: boolean
      • Optional uvs?: Vector2[]
    • Optional scene: Nullable<Scene>

      defines the hosting scene

    Returns Mesh

    the ribbon mesh

CreateRibbonVertexData

  • CreateRibbonVertexData(options: { backUVs?: Vector4; closeArray?: boolean; closePath?: boolean; colors?: Color4[]; frontUVs?: Vector4; invertUV?: boolean; offset?: number; pathArray: Vector3[][]; sideOrientation?: number; uvs?: Vector2[] }): VertexData
  • Creates the VertexData for a Ribbon

    Parameters

    • options: { backUVs?: Vector4; closeArray?: boolean; closePath?: boolean; colors?: Color4[]; frontUVs?: Vector4; invertUV?: boolean; offset?: number; pathArray: Vector3[][]; sideOrientation?: number; uvs?: Vector2[] }

      an object used to set the following optional parameters for the ribbon, required but can be empty

      • pathArray array of paths, each of which an array of successive Vector3
      • closeArray creates a seam between the first and the last paths of the pathArray, optional, default false
      • closePath creates a seam between the first and the last points of each path of the path array, optional, default false
      • offset a positive integer, only used when pathArray contains a single path (offset = 10 means the point 1 is joined to the point 11), default rounded half size of the pathArray length
      • sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
      • frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)
      • backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)
      • invertUV swaps in the U and V coordinates when applying a texture, optional, default false
      • uvs a linear array, of length 2 * number of vertices, of custom UV values, optional
      • colors a linear array, of length 4 * number of vertices, of custom color values, optional
      • Optional backUVs?: Vector4
      • Optional closeArray?: boolean
      • Optional closePath?: boolean
      • Optional colors?: Color4[]
      • Optional frontUVs?: Vector4
      • Optional invertUV?: boolean
      • Optional offset?: number
      • pathArray: Vector3[][]
      • Optional sideOrientation?: number
      • Optional uvs?: Vector2[]

    Returns VertexData

    the VertexData of the ribbon

CreateScreenshot

  • CreateScreenshot(engine: Engine, camera: Camera, size: IScreenshotSize | number, successCallback?: (data: string) => void, mimeType?: string, forceDownload?: boolean): void
  • Captures a screenshot of the current rendering

    see

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

    Parameters

    • engine: Engine

      defines the rendering engine

    • camera: Camera

      defines the source camera

    • size: IScreenshotSize | number

      This parameter can be set to a single number or to an object with the following (optional) properties: precision, width, height. If a single number is passed, it will be used for both width and height. If an object is passed, the screenshot size will be derived from the parameters. The precision property is a multiplier allowing rendering at a higher or lower resolution

    • Optional successCallback: (data: string) => void

      defines the callback receives a single parameter which contains the screenshot as a string of base64-encoded characters. This string can be assigned to the src parameter of an to display it

        • (data: string): void
        • Parameters

          • data: string

          Returns void

    • Optional mimeType: string

      defines the MIME type of the screenshot image (default: image/png). Check your browser for supported MIME types

    • Optional forceDownload: boolean

      force the system to download the image even if a successCallback is provided

    Returns void

CreateScreenshotAsync

  • Captures a screenshot of the current rendering

    see

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

    Parameters

    • engine: Engine

      defines the rendering engine

    • camera: Camera

      defines the source camera

    • size: IScreenshotSize | number

      This parameter can be set to a single number or to an object with the following (optional) properties: precision, width, height. If a single number is passed, it will be used for both width and height. If an object is passed, the screenshot size will be derived from the parameters. The precision property is a multiplier allowing rendering at a higher or lower resolution

    • Optional mimeType: string

      defines the MIME type of the screenshot image (default: image/png). Check your browser for supported MIME types

    Returns Promise<string>

    screenshot as a string of base64-encoded characters. This string can be assigned to the src parameter of an to display it

CreateScreenshotUsingRenderTarget

  • CreateScreenshotUsingRenderTarget(engine: Engine, camera: Camera, size: IScreenshotSize | number, successCallback?: (data: string) => void, mimeType?: string, samples?: number, antialiasing?: boolean, fileName?: string, renderSprites?: boolean, enableStencilBuffer?: boolean): void
  • Generates an image screenshot from the specified camera.

    see

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

    Parameters

    • engine: Engine

      The engine to use for rendering

    • camera: Camera

      The camera to use for rendering

    • size: IScreenshotSize | number

      This parameter can be set to a single number or to an object with the following (optional) properties: precision, width, height. If a single number is passed, it will be used for both width and height. If an object is passed, the screenshot size will be derived from the parameters. The precision property is a multiplier allowing rendering at a higher or lower resolution

    • Optional successCallback: (data: string) => void

      The callback receives a single parameter which contains the screenshot as a string of base64-encoded characters. This string can be assigned to the src parameter of an to display it

        • (data: string): void
        • Parameters

          • data: string

          Returns void

    • Optional mimeType: string

      The MIME type of the screenshot image (default: image/png). Check your browser for supported MIME types

    • Optional samples: number

      Texture samples (default: 1)

    • Optional antialiasing: boolean

      Whether antialiasing should be turned on or not (default: false)

    • Optional fileName: string

      A name for for the downloaded file.

    • Optional renderSprites: boolean

      Whether the sprites should be rendered or not (default: false)

    • Optional enableStencilBuffer: boolean

      Whether the stencil buffer should be enabled or not (default: false)

    Returns void

CreateScreenshotUsingRenderTargetAsync

  • CreateScreenshotUsingRenderTargetAsync(engine: Engine, camera: Camera, size: IScreenshotSize | number, mimeType?: string, samples?: number, antialiasing?: boolean, fileName?: string, renderSprites?: boolean): Promise<string>
  • Generates an image screenshot from the specified camera.

    see

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

    Parameters

    • engine: Engine

      The engine to use for rendering

    • camera: Camera

      The camera to use for rendering

    • size: IScreenshotSize | number

      This parameter can be set to a single number or to an object with the following (optional) properties: precision, width, height. If a single number is passed, it will be used for both width and height. If an object is passed, the screenshot size will be derived from the parameters. The precision property is a multiplier allowing rendering at a higher or lower resolution

    • Optional mimeType: string

      The MIME type of the screenshot image (default: image/png). Check your browser for supported MIME types

    • Optional samples: number

      Texture samples (default: 1)

    • Optional antialiasing: boolean

      Whether antialiasing should be turned on or not (default: false)

    • Optional fileName: string

      A name for for the downloaded file.

    • Optional renderSprites: boolean

      Whether the sprites should be rendered or not (default: false)

    Returns Promise<string>

    screenshot as a string of base64-encoded characters. This string can be assigned to the src parameter of an to display it

CreateScreenshotWithResizeAsync

  • CreateScreenshotWithResizeAsync(engine: Engine, camera: Camera, width: number, height: number, mimeType?: string): Promise<void>
  • Captures a screenshot of the current rendering for a specific size. This will render the entire canvas but will generate a blink (due to canvas resize)

    see

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

    Parameters

    • engine: Engine

      defines the rendering engine

    • camera: Camera

      defines the source camera

    • width: number

      defines the expected width

    • height: number

      defines the expected height

    • Optional mimeType: string

      defines the MIME type of the screenshot image (default: image/png). Check your browser for supported MIME types

    Returns Promise<void>

    screenshot as a string of base64-encoded characters. This string can be assigned to the src parameter of an to display it

CreateSphere

  • CreateSphere(name: string, options: { arc?: number; backUVs?: Vector4; diameter?: number; diameterX?: number; diameterY?: number; diameterZ?: number; frontUVs?: Vector4; segments?: number; sideOrientation?: number; slice?: number; updatable?: boolean }, scene?: Nullable<Scene>): Mesh
  • Creates a sphere mesh

    • The parameter diameter sets the diameter size (float) of the sphere (default 1)
    • You can set some different sphere dimensions, for instance to build an ellipsoid, by using the parameters diameterX, diameterY and diameterZ (all by default have the same value of diameter)
    • The parameter segments sets the sphere number of horizontal stripes (positive integer, default 32)
    • You can create an unclosed sphere with the parameter arc (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference (latitude) : 2 x PI x ratio
    • You can create an unclosed sphere on its height with the parameter slice (positive float, default1), valued between 0 and 1, what is the height ratio (longitude)
    • 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 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/set_shapes#sphere

    Parameters

    • name: string

      defines the name of the mesh

    • options: { arc?: number; backUVs?: Vector4; diameter?: number; diameterX?: number; diameterY?: number; diameterZ?: number; frontUVs?: Vector4; segments?: number; sideOrientation?: number; slice?: number; updatable?: boolean }

      defines the options used to create the mesh

      • Optional arc?: number
      • Optional backUVs?: Vector4
      • Optional diameter?: number
      • Optional diameterX?: number
      • Optional diameterY?: number
      • Optional diameterZ?: number
      • Optional frontUVs?: Vector4
      • Optional segments?: number
      • Optional sideOrientation?: number
      • Optional slice?: number
      • Optional updatable?: boolean
    • Optional scene: Nullable<Scene>

      defines the hosting scene

    Returns Mesh

    the sphere mesh

CreateSphereVertexData

  • CreateSphereVertexData(options: { arc?: number; backUVs?: Vector4; dedupTopBottomIndices?: boolean; diameter?: number; diameterX?: number; diameterY?: number; diameterZ?: number; frontUVs?: Vector4; segments?: number; sideOrientation?: number; slice?: number }): VertexData
  • Creates the VertexData for an ellipsoid, defaults to a sphere

    Parameters

    • options: { arc?: number; backUVs?: Vector4; dedupTopBottomIndices?: boolean; diameter?: number; diameterX?: number; diameterY?: number; diameterZ?: number; frontUVs?: Vector4; segments?: number; sideOrientation?: number; slice?: number }

      an object used to set the following optional parameters for the box, required but can be empty

      • segments sets the number of horizontal strips optional, default 32
      • diameter sets the axes dimensions, diameterX, diameterY and diameterZ to the value of diameter, optional default 1
      • diameterX sets the diameterX (x direction) of the ellipsoid, overwrites the diameterX set by diameter, optional, default diameter
      • diameterY sets the diameterY (y direction) of the ellipsoid, overwrites the diameterY set by diameter, optional, default diameter
      • diameterZ sets the diameterZ (z direction) of the ellipsoid, overwrites the diameterZ set by diameter, optional, default diameter
      • arc a number from 0 to 1, to create an unclosed ellipsoid based on the fraction of the circumference (latitude) given by the arc value, optional, default 1
      • slice a number from 0 to 1, to create an unclosed ellipsoid based on the fraction of the height (latitude) given by the arc value, optional, default 1
      • sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
      • frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)
      • backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)
      • Optional arc?: number
      • Optional backUVs?: Vector4
      • Optional dedupTopBottomIndices?: boolean
      • Optional diameter?: number
      • Optional diameterX?: number
      • Optional diameterY?: number
      • Optional diameterZ?: number
      • Optional frontUVs?: Vector4
      • Optional segments?: number
      • Optional sideOrientation?: number
      • Optional slice?: number

    Returns VertexData

    the VertexData of the ellipsoid

CreateTiledBox

  • CreateTiledBox(name: string, options: { alignHorizontal?: number; alignVertical?: number; depth?: number; faceColors?: Color4[]; faceUV?: Vector4[]; height?: number; pattern?: number; sideOrientation?: number; tileHeight?: number; tileSize?: number; tileWidth?: number; updatable?: boolean; width?: number }, scene?: Nullable<Scene>): Mesh
  • Creates a box mesh faceTiles sets the pattern, tile size and number of tiles for a face * * You can set different colors and different images to each box side by using the parameters faceColors (an array of 6 Color3 elements) and faceUV (an array of 6 Vector4 elements)

    Parameters

    • name: string

      defines the name of the mesh

    • options: { alignHorizontal?: number; alignVertical?: number; depth?: number; faceColors?: Color4[]; faceUV?: Vector4[]; height?: number; pattern?: number; sideOrientation?: number; tileHeight?: number; tileSize?: number; tileWidth?: number; updatable?: boolean; width?: number }

      defines the options used to create the mesh

      • Optional alignHorizontal?: number
      • Optional alignVertical?: number
      • Optional depth?: number
      • Optional faceColors?: Color4[]
      • Optional faceUV?: Vector4[]
      • Optional height?: number
      • Optional pattern?: number
      • Optional sideOrientation?: number
      • Optional tileHeight?: number
      • Optional tileSize?: number
      • Optional tileWidth?: number
      • Optional updatable?: boolean
      • Optional width?: number
    • Optional scene: Nullable<Scene>

      defines the hosting scene

    Returns Mesh

    the box mesh

CreateTiledBoxVertexData

  • CreateTiledBoxVertexData(options: { alignHorizontal?: number; alignVertical?: number; depth?: number; faceColors?: Color4[]; faceUV?: Vector4[]; height?: number; pattern?: number; sideOrientation?: number; size?: number; tileHeight?: number; tileSize?: number; tileWidth?: number; width?: number }): VertexData
  • Creates the VertexData for a tiled box

    Parameters

    • options: { alignHorizontal?: number; alignVertical?: number; depth?: number; faceColors?: Color4[]; faceUV?: Vector4[]; height?: number; pattern?: number; sideOrientation?: number; size?: number; tileHeight?: number; tileSize?: number; tileWidth?: number; width?: number }

      an object used to set the following optional parameters for the box, required but can be empty

      • faceTiles sets the pattern, tile size and number of tiles for a face
      • faceUV an array of 6 Vector4 elements used to set different images to each box side
      • faceColors an array of 6 Color3 elements used to set different colors to each box side
      • sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
      • Optional alignHorizontal?: number
      • Optional alignVertical?: number
      • Optional depth?: number
      • Optional faceColors?: Color4[]
      • Optional faceUV?: Vector4[]
      • Optional height?: number
      • Optional pattern?: number
      • Optional sideOrientation?: number
      • Optional size?: number
      • Optional tileHeight?: number
      • Optional tileSize?: number
      • Optional tileWidth?: number
      • Optional width?: number

    Returns VertexData

    the VertexData of the box

CreateTiledGround

  • CreateTiledGround(name: string, options: { precision?: { h: number; w: number }; subdivisions?: { h: number; w: number }; updatable?: boolean; xmax: number; xmin: number; zmax: number; zmin: number }, scene?: Nullable<Scene>): Mesh
  • Creates a tiled ground mesh

    • The parameters xmin and xmax (floats, default -1 and 1) set the ground minimum and maximum X coordinates
    • The parameters zmin and zmax (floats, default -1 and 1) set the ground minimum and maximum Z coordinates
    • The parameter subdivisions is a javascript object {w: positive integer, h: positive integer} (default {w: 6, h: 6}). w and h are the numbers of subdivisions on the ground width and height. Each subdivision is called a tile
    • The parameter precision is a javascript object {w: positive integer, h: positive integer} (default {w: 2, h: 2}). w and h are the numbers of subdivisions on the ground width and height of each tile
    • 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/set_shapes#tiled-ground

    Parameters

    • name: string

      defines the name of the mesh

    • options: { precision?: { h: number; w: number }; subdivisions?: { h: number; w: number }; updatable?: boolean; xmax: number; xmin: number; zmax: number; zmin: number }

      defines the options used to create the mesh

      • Optional precision?: { h: number; w: number }
        • h: number
        • w: number
      • Optional subdivisions?: { h: number; w: number }
        • h: number
        • w: number
      • Optional updatable?: boolean
      • xmax: number
      • xmin: number
      • zmax: number
      • zmin: number
    • Optional scene: Nullable<Scene>

      defines the hosting scene

    Returns Mesh

    the tiled ground mesh

CreateTiledGroundVertexData

  • CreateTiledGroundVertexData(options: { precision?: { h: number; w: number }; subdivisions?: { h: number; w: number }; xmax: number; xmin: number; zmax: number; zmin: number }): VertexData
  • Creates the VertexData for a TiledGround by subdividing the ground into tiles

    Parameters

    • options: { precision?: { h: number; w: number }; subdivisions?: { h: number; w: number }; xmax: number; xmin: number; zmax: number; zmin: number }

      an object used to set the following optional parameters for the Ground, required but can be empty

      • xmin the ground minimum X coordinate, optional, default -1
      • zmin the ground minimum Z coordinate, optional, default -1
      • xmax the ground maximum X coordinate, optional, default 1
      • zmax the ground maximum Z coordinate, optional, default 1
      • subdivisions a javascript object {w: positive integer, h: positive integer}, w and h are the numbers of subdivisions on the ground width and height creating 'tiles', default {w: 6, h: 6}
      • precision a javascript object {w: positive integer, h: positive integer}, w and h are the numbers of subdivisions on the tile width and height, default {w: 2, h: 2}
      • Optional precision?: { h: number; w: number }
        • h: number
        • w: number
      • Optional subdivisions?: { h: number; w: number }
        • h: number
        • w: number
      • xmax: number
      • xmin: number
      • zmax: number
      • zmin: number

    Returns VertexData

    the VertexData of the TiledGround

CreateTiledPlane

  • CreateTiledPlane(name: string, options: { alignHorizontal?: number; alignVertical?: number; backUVs?: Vector4; frontUVs?: Vector4; height?: number; pattern?: number; sideOrientation?: number; size?: number; tileHeight?: number; tileSize?: number; tileWidth?: number; updatable?: boolean; width?: number }, scene?: Nullable<Scene>): Mesh
  • Creates a tiled plane mesh

    • The parameter pattern will, depending on value, do nothing or
      • flip (reflect about central vertical) alternate tiles across and up
      • flip every tile on alternate rows
      • rotate (180 degs) alternate tiles across and up
      • rotate every tile on alternate rows
      • flip and rotate alternate tiles across and up
      • flip and rotate every tile on alternate rows
    • The parameter tileSize sets the size (float) of each tile side (default 1)
    • You can set some different tile dimensions by using the parameters tileWidth and tileHeight (both by default have the same value of tileSize)
    • 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
    • sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
    • frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)
    • backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)
    see

    https://doc.babylonjs.com/how_to/set_shapes#box

    Parameters

    • name: string

      defines the name of the mesh

    • options: { alignHorizontal?: number; alignVertical?: number; backUVs?: Vector4; frontUVs?: Vector4; height?: number; pattern?: number; sideOrientation?: number; size?: number; tileHeight?: number; tileSize?: number; tileWidth?: number; updatable?: boolean; width?: number }

      defines the options used to create the mesh

      • Optional alignHorizontal?: number
      • Optional alignVertical?: number
      • Optional backUVs?: Vector4
      • Optional frontUVs?: Vector4
      • Optional height?: number
      • Optional pattern?: number
      • Optional sideOrientation?: number
      • Optional size?: number
      • Optional tileHeight?: number
      • Optional tileSize?: number
      • Optional tileWidth?: number
      • Optional updatable?: boolean
      • Optional width?: number
    • Optional scene: Nullable<Scene>

      defines the hosting scene

    Returns Mesh

    the box mesh

CreateTiledPlaneVertexData

  • CreateTiledPlaneVertexData(options: { alignHorizontal?: number; alignVertical?: number; backUVs?: Vector4; frontUVs?: Vector4; height?: number; pattern?: number; sideOrientation?: number; size?: number; tileHeight?: number; tileSize?: number; tileWidth?: number; width?: number }): VertexData
  • Creates the VertexData for a tiled plane

    Parameters

    • options: { alignHorizontal?: number; alignVertical?: number; backUVs?: Vector4; frontUVs?: Vector4; height?: number; pattern?: number; sideOrientation?: number; size?: number; tileHeight?: number; tileSize?: number; tileWidth?: number; width?: number }

      an object used to set the following optional parameters for the box, required but can be empty

      • pattern a limited pattern arrangement depending on the number
      • tileSize sets the width, height and depth of the tile to the value of size, optional default 1
      • tileWidth sets the width (x direction) of the tile, overwrites the width set by size, optional, default size
      • tileHeight sets the height (y direction) of the tile, overwrites the height set by size, optional, default size
      • sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
      • frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)
      • backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)
      • Optional alignHorizontal?: number
      • Optional alignVertical?: number
      • Optional backUVs?: Vector4
      • Optional frontUVs?: Vector4
      • Optional height?: number
      • Optional pattern?: number
      • Optional sideOrientation?: number
      • Optional size?: number
      • Optional tileHeight?: number
      • Optional tileSize?: number
      • Optional tileWidth?: number
      • Optional width?: number

    Returns VertexData

    the VertexData of the tiled plane

CreateTorus

  • CreateTorus(name: string, options: { backUVs?: Vector4; diameter?: number; frontUVs?: Vector4; sideOrientation?: number; tessellation?: number; thickness?: number; updatable?: boolean }, scene: any): Mesh
  • Creates a torus mesh

    • The parameter diameter sets the diameter size (float) of the torus (default 1)
    • The parameter thickness sets the diameter size of the tube of the torus (float, default 0.5)
    • The parameter tessellation sets the number of torus sides (positive integer, default 16)
    • 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 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/set_shapes#torus

    Parameters

    • name: string

      defines the name of the mesh

    • options: { backUVs?: Vector4; diameter?: number; frontUVs?: Vector4; sideOrientation?: number; tessellation?: number; thickness?: number; updatable?: boolean }

      defines the options used to create the mesh

      • Optional backUVs?: Vector4
      • Optional diameter?: number
      • Optional frontUVs?: Vector4
      • Optional sideOrientation?: number
      • Optional tessellation?: number
      • Optional thickness?: number
      • Optional updatable?: boolean
    • scene: any

      defines the hosting scene

    Returns Mesh

    the torus mesh

CreateTorusKnot

  • CreateTorusKnot(name: string, options: { backUVs?: Vector4; frontUVs?: Vector4; p?: number; q?: number; radialSegments?: number; radius?: number; sideOrientation?: number; tube?: number; tubularSegments?: number; updatable?: boolean }, scene: any): Mesh
  • Creates a torus knot mesh

    • The parameter radius sets the global radius size (float) of the torus knot (default 2)
    • The parameter radialSegments sets the number of sides on each tube segments (positive integer, default 32)
    • The parameter tubularSegments sets the number of tubes to decompose the knot into (positive integer, default 32)
    • The parameters p and q are the number of windings on each axis (positive integers, default 2 and 3)
    • 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 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/set_shapes#torus-knot

    Parameters

    • name: string

      defines the name of the mesh

    • options: { backUVs?: Vector4; frontUVs?: Vector4; p?: number; q?: number; radialSegments?: number; radius?: number; sideOrientation?: number; tube?: number; tubularSegments?: number; updatable?: boolean }

      defines the options used to create the mesh

      • Optional backUVs?: Vector4
      • Optional frontUVs?: Vector4
      • Optional p?: number
      • Optional q?: number
      • Optional radialSegments?: number
      • Optional radius?: number
      • Optional sideOrientation?: number
      • Optional tube?: number
      • Optional tubularSegments?: number
      • Optional updatable?: boolean
    • scene: any

      defines the hosting scene

    Returns Mesh

    the torus knot mesh

CreateTorusKnotVertexData

  • CreateTorusKnotVertexData(options: { backUVs?: Vector4; frontUVs?: Vector4; p?: number; q?: number; radialSegments?: number; radius?: number; sideOrientation?: number; tube?: number; tubularSegments?: number }): VertexData
  • Creates the VertexData for a TorusKnot

    Parameters

    • options: { backUVs?: Vector4; frontUVs?: Vector4; p?: number; q?: number; radialSegments?: number; radius?: number; sideOrientation?: number; tube?: number; tubularSegments?: number }

      an object used to set the following optional parameters for the TorusKnot, required but can be empty

      • radius the radius of the torus knot, optional, default 2
      • tube the thickness of the tube, optional, default 0.5
      • radialSegments the number of sides on each tube segments, optional, default 32
      • tubularSegments the number of tubes to decompose the knot into, optional, default 32
      • p the number of windings around the z axis, optional, default 2
      • q the number of windings around the x axis, optional, default 3
      • sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
      • frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)
      • backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)
      • Optional backUVs?: Vector4
      • Optional frontUVs?: Vector4
      • Optional p?: number
      • Optional q?: number
      • Optional radialSegments?: number
      • Optional radius?: number
      • Optional sideOrientation?: number
      • Optional tube?: number
      • Optional tubularSegments?: number

    Returns VertexData

    the VertexData of the Torus Knot

CreateTorusVertexData

  • CreateTorusVertexData(options: { backUVs?: Vector4; diameter?: number; frontUVs?: Vector4; sideOrientation?: number; tessellation?: number; thickness?: number }): VertexData
  • Creates the VertexData for a torus

    Parameters

    • options: { backUVs?: Vector4; diameter?: number; frontUVs?: Vector4; sideOrientation?: number; tessellation?: number; thickness?: number }

      an object used to set the following optional parameters for the box, required but can be empty

      • diameter the diameter of the torus, optional default 1
      • thickness the diameter of the tube forming the torus, optional default 0.5
      • tessellation the number of prism sides, 3 for a triangular prism, optional, default 24
      • sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
      • frontUvs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the front side, optional, default vector4 (0, 0, 1, 1)
      • backUVs only usable when you create a double-sided mesh, used to choose what parts of the texture image to crop and apply on the back side, optional, default vector4 (0, 0, 1, 1)
      • Optional backUVs?: Vector4
      • Optional diameter?: number
      • Optional frontUVs?: Vector4
      • Optional sideOrientation?: number
      • Optional tessellation?: number
      • Optional thickness?: number

    Returns VertexData

    the VertexData of the torus

CreateTube

  • CreateTube(name: string, options: { arc?: number; backUVs?: Vector4; cap?: number; frontUVs?: Vector4; instance?: Mesh; invertUV?: boolean; path: Vector3[]; radius?: number; radiusFunction?: (i: number, distance: number) => number; sideOrientation?: number; tessellation?: number; updatable?: boolean }, scene?: Nullable<Scene>): Mesh
  • Creates a tube mesh. The tube is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters

    • The parameter path is a required array of successive Vector3. It is the curve used as the axis of the tube
    • The parameter radius (positive float, default 1) sets the tube radius size
    • The parameter tessellation (positive float, default 64) is the number of sides on the tubular surface
    • The parameter radiusFunction (javascript function, default null) is a vanilla javascript function. If it is not null, it overrides the parameter radius
    • This function is called on each point of the tube path and is passed the index i of the i-th point and the distance of this point from the first point of the path. It must return a radius value (positive float)
    • The parameter arc (positive float, maximum 1, default 1) is the ratio to apply to the tube circumference : 2 x PI x arc
    • 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 Tube object to be updated with the passed pathArray parameter : https://doc.babylonjs.com/how_to/how_to_dynamically_morph_a_mesh#tube
    • 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/set_shapes#tube

    Parameters

    • name: string

      defines the name of the mesh

    • options: { arc?: number; backUVs?: Vector4; cap?: number; frontUVs?: Vector4; instance?: Mesh; invertUV?: boolean; path: Vector3[]; radius?: number; radiusFunction?: (i: number, distance: number) => number; sideOrientation?: number; tessellation?: number; updatable?: boolean }

      defines the options used to create the mesh

      • Optional arc?: number
      • Optional backUVs?: Vector4
      • Optional cap?: number
      • Optional frontUVs?: Vector4
      • Optional instance?: Mesh
      • Optional invertUV?: boolean
      • path: Vector3[]
      • Optional radius?: number
      • Optional radiusFunction?: (i: number, distance: number) => number
          • (i: number, distance: number): number
          • Parameters

            • i: number
            • distance: number

            Returns number

      • Optional sideOrientation?: number
      • Optional tessellation?: number
      • Optional updatable?: boolean
    • Optional scene: Nullable<Scene>

      defines the hosting scene

    Returns Mesh

    the tube mesh

EscapeRegExp

  • EscapeRegExp(s: string): string
  • Escapes a string so that it is usable as a regular expression

    Parameters

    • s: string

      string to escape

    Returns string

    escaped string

ExtractBetweenMarkers

  • ExtractBetweenMarkers(markerOpen: string, markerClose: string, block: string, startIndex: number): number
  • Extracts the characters between two markers (for eg, between "(" and ")"). The function handles nested markers as well as markers inside strings (delimited by ", ' or `) and comments

    Parameters

    • markerOpen: string

      opening marker

    • markerClose: string

      closing marker

    • block: string

      code block to parse

    • startIndex: number

      starting index in block where the extraction must start. The character at block[startIndex] should be the markerOpen character!

    Returns number

    index of the last character for the extraction (or -1 if the string is invalid - no matching closing marker found). The string to extract (without the markers) is the string between startIndex + 1 and the returned value (exclusive)

ExtrudePolygon

  • ExtrudePolygon(name: string, options: { backUVs?: Vector4; depth?: number; faceColors?: Color4[]; faceUV?: Vector4[]; frontUVs?: Vector4; holes?: Vector3[][]; shape: Vector3[]; sideOrientation?: number; updatable?: boolean; wrap?: boolean }, scene?: Nullable<Scene>, earcutInjection?: any): Mesh
  • Creates an extruded polygon mesh, with depth in the Y direction.

    • You can set different colors and different images to the top, bottom and extruded side by using the parameters faceColors (an array of 3 Color3 elements) and faceUV (an array of 3 Vector4 elements)
    see

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

    Parameters

    • name: string

      defines the name of the mesh

    • options: { backUVs?: Vector4; depth?: number; faceColors?: Color4[]; faceUV?: Vector4[]; frontUVs?: Vector4; holes?: Vector3[][]; shape: Vector3[]; sideOrientation?: number; updatable?: boolean; wrap?: boolean }

      defines the options used to create the mesh

      • Optional backUVs?: Vector4
      • Optional depth?: number
      • Optional faceColors?: Color4[]
      • Optional faceUV?: Vector4[]
      • Optional frontUVs?: Vector4
      • Optional holes?: Vector3[][]
      • shape: Vector3[]
      • Optional sideOrientation?: number
      • Optional updatable?: boolean
      • Optional wrap?: boolean
    • Optional scene: Nullable<Scene>

      defines the hosting scene

    • Optional earcutInjection: any

      can be used to inject your own earcut reference

    Returns Mesh

    the polygon mesh

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

ExtrudeShapeCustom

  • ExtrudeShapeCustom(name: string, options: { backUVs?: Vector4; cap?: number; frontUVs?: Vector4; instance?: Mesh; invertUV?: boolean; path: Vector3[]; ribbonCloseArray?: boolean; ribbonClosePath?: boolean; rotationFunction?: Nullable<(i: number, distance: number) => number>; scaleFunction?: Nullable<(i: number, distance: number) => number>; 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 beginning 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 beginning 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?: Nullable<(i: number, distance: number) => number>; scaleFunction?: Nullable<(i: number, distance: number) => 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 ribbonCloseArray?: boolean
      • Optional ribbonClosePath?: boolean
      • Optional rotationFunction?: Nullable<(i: number, distance: number) => number>
      • Optional scaleFunction?: Nullable<(i: number, distance: number) => number>
      • shape: Vector3[]
      • Optional sideOrientation?: number
      • Optional updatable?: boolean
    • Optional scene: Nullable<Scene>

      defines the hosting scene

    Returns Mesh

    the custom extruded shape mesh

FindBackward

  • FindBackward(s: string, index: number, c: string): number
  • Finds the first occurrence of a character in a string going backward

    Parameters

    • s: string

      the string to parse

    • index: number

      starting index in the string

    • c: string

      the character to find

    Returns number

    the index of the character if found, else -1

FromHalfFloat

  • FromHalfFloat(value: number): number
  • Converts a half float to a number

    Parameters

    • value: number

      half float to convert

    Returns number

    converted half float

GenerateBase64StringFromPixelData

  • GenerateBase64StringFromPixelData(pixels: ArrayBufferView, size: ISize, invertY?: boolean): Nullable<string>
  • Transform some pixel data to a base64 string

    Parameters

    • pixels: ArrayBufferView

      defines the pixel data to transform to base64

    • size: ISize

      defines the width and height of the (texture) data

    • Optional invertY: boolean

      true if the data must be inverted for the Y coordinate during the conversion

    Returns Nullable<string>

    The base64 encoded string or null

GenerateBase64StringFromTexture

  • GenerateBase64StringFromTexture(texture: BaseTexture, faceIndex?: number, level?: number): Nullable<string>
  • Reads the pixels stored in the webgl texture and returns them as a base64 string

    Parameters

    • texture: BaseTexture

      defines the texture to read pixels from

    • Optional faceIndex: number

      defines the face of the texture to read (in case of cube texture)

    • Optional level: number

      defines the LOD level of the texture to read (in case of Mip Maps)

    Returns Nullable<string>

    The base64 encoded string or null

GenerateBase64StringFromTextureAsync

  • GenerateBase64StringFromTextureAsync(texture: BaseTexture, faceIndex?: number, level?: number): Promise<Nullable<string>>
  • Reads the pixels stored in the webgl texture and returns them as a base64 string

    Parameters

    • texture: BaseTexture

      defines the texture to read pixels from

    • Optional faceIndex: number

      defines the face of the texture to read (in case of cube texture)

    • Optional level: number

      defines the LOD level of the texture to read (in case of Mip Maps)

    Returns Promise<Nullable<string>>

    The base64 encoded string or null wrapped in a promise

GetDOMTextContent

  • GetDOMTextContent(element: HTMLElement): string
  • Extracts text content from a DOM element hierarchy

    Parameters

    • element: HTMLElement

      defines the root element

    Returns string

    a string

GetEnvInfo

  • Gets the environment info from an env file.

    Parameters

    • data: ArrayBufferView

      The array buffer containing the .env bytes.

    Returns Nullable<EnvironmentTextureInfoV2>

    the environment file info (the json header) if successfully parsed, normalized to the latest supported version.

GetTGAHeader

  • GetTGAHeader(data: Uint8Array): any
  • Gets the header of a TGA file

    Parameters

    • data: Uint8Array

      defines the TGA data

    Returns any

    the header

IsDocumentAvailable

  • IsDocumentAvailable(): boolean
  • Check if the document object exists

    Returns boolean

    true if the document object exists

IsIdentifierChar

  • IsIdentifierChar(c: string): boolean
  • Checks if a character is an identifier character (meaning, if it is 0-9, A-Z, a-z or _)

    Parameters

    • c: string

      character to check

    Returns boolean

    true if the character is an identifier character

IsNavigatorAvailable

  • IsNavigatorAvailable(): boolean
  • Checks if the navigator object exists

    Returns boolean

    true if the navigator object exists

IsWindowObjectExist

  • IsWindowObjectExist(): boolean
  • Checks if the window object exists

    Returns boolean

    true if the window object exists

RandomGUID

  • RandomGUID(): string

RemoveComments

  • RemoveComments(block: string): string
  • Removes the comments of a code block

    Parameters

    • block: string

      code block to parse

    Returns string

    block with the comments removed

SkipWhitespaces

  • SkipWhitespaces(s: string, index: number): number
  • Parses a string and skip whitespaces

    Parameters

    • s: string

      string to parse

    • index: number

      index where to start parsing

    Returns number

    the index after all whitespaces have been skipped

ToHalfFloat

  • ToHalfFloat(value: number): number
  • Converts a number to half float

    Parameters

    • value: number

      number to convert

    Returns number

    converted number

UploadEnvLevelsAsync

  • Uploads the texture info contained in the env file to the GPU.

    Parameters

    • texture: InternalTexture

      defines the internal texture to upload to

    • data: ArrayBufferView

      defines the data to load

    • info: EnvironmentTextureInfo

      defines the texture info retrieved through the GetEnvInfo method

    Returns Promise<void>

    a promise

UploadEnvSpherical

  • Uploads spherical polynomials information to the texture.

    Parameters

    • texture: InternalTexture

      defines the texture we are trying to upload the information to

    • info: EnvironmentTextureInfo

      defines the environment texture info retrieved through the GetEnvInfo method

    Returns void

UploadLevelsAsync

  • UploadLevelsAsync(texture: InternalTexture, imageData: ArrayBufferView[][], imageType?: string): Promise<void>
  • Uploads the levels of image data to the GPU.

    Parameters

    • texture: InternalTexture

      defines the internal texture to upload to

    • imageData: ArrayBufferView[][]

      defines the array buffer views of image data [mipmap][face]

    • Optional imageType: string

      the mime type of the image data

    Returns Promise<void>

    a promise

allocateAndCopyTypedBuffer

  • allocateAndCopyTypedBuffer(type: number, sizeOrDstBuffer: number | ArrayBuffer, sizeInBytes?: boolean, copyBuffer?: ArrayBuffer): ArrayBufferView
  • Allocate a typed array depending on a texture type. Optionally can copy existing data in the buffer.

    Parameters

    • type: number

      type of the texture

    • sizeOrDstBuffer: number | ArrayBuffer

      size of the array OR an existing buffer that will be used as the destination of the copy (if copyBuffer is provided)

    • Optional sizeInBytes: boolean

      true if the size of the array is given in bytes, false if it is the number of elements of the array

    • Optional copyBuffer: ArrayBuffer

      if provided, buffer to copy into the destination buffer (either a newly allocated buffer if sizeOrDstBuffer is a number or use sizeOrDstBuffer as the destination buffer otherwise)

    Returns ArrayBufferView

    the allocated buffer or sizeOrDstBuffer if the latter is an ArrayBuffer

className

  • className(name: string, module?: string): (target: Object) => void
  • Use this className as a decorator on a given class definition to add it a name and optionally its module. You can then use the Tools.getClassName(obj) on an instance to retrieve its class name. This method is the only way to get it done in all cases, even if the .js file declaring the class is minified

    Parameters

    • name: string

      The name of the class, case should be preserved

    • Optional module: string

      The name of the Module hosting the class, optional, but strongly recommended to specify if possible. Case should be preserved.

    Returns (target: Object) => void

      • (target: Object): void
      • Parameters

        • target: Object

        Returns void

editableInPropertyPage

  • Decorator that flags a property in a node material block as being editable

    Parameters

    Returns (target: any, propertyKey: string) => void

      • (target: any, propertyKey: string): void
      • Parameters

        • target: any
        • propertyKey: string

        Returns void

expandToProperty

  • expandToProperty(callback: string, targetKey?: Nullable<string>): (target: any, propertyKey: string) => void
  • Parameters

    • callback: string
    • Optional targetKey: Nullable<string>

    Returns (target: any, propertyKey: string) => void

      • (target: any, propertyKey: string): void
      • Parameters

        • target: any
        • propertyKey: string

        Returns void

extractMinAndMax

  • Extracts minimum and maximum values from a list of positions

    Parameters

    • positions: FloatArray

      defines the positions to use

    • start: number

      defines the start index in the positions array

    • count: number

      defines the number of positions to handle

    • Optional bias: Nullable<Vector2>

      defines bias value to add to the result

    • Optional stride: number

      defines the stride size to use (distance between two positions in the positions array)

    Returns { maximum: Vector3; minimum: Vector3 }

    minimum and maximum values

extractMinAndMaxIndexed

  • Extracts minimum and maximum values from a list of indexed positions

    Parameters

    • positions: FloatArray

      defines the positions to use

    • indices: IndicesArray

      defines the indices to the positions

    • indexStart: number

      defines the start index

    • indexCount: number

      defines the end index

    • Optional bias: Nullable<Vector2>

      defines bias value to add to the result

    Returns { maximum: Vector3; minimum: Vector3 }

    minimum and maximum values

serialize

  • serialize(sourceName?: string): (target: any, propertyKey: string | symbol) => void
  • Parameters

    • Optional sourceName: string

    Returns (target: any, propertyKey: string | symbol) => void

      • (target: any, propertyKey: string | symbol): void
      • Parameters

        • target: any
        • propertyKey: string | symbol

        Returns void

serializeAsCameraReference

  • serializeAsCameraReference(sourceName?: string): (target: any, propertyKey: string | symbol) => void