Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Namespaces

Enumerations

Classes

Interfaces

Type Aliases

Variables

Functions

Type Aliases

AcceptedARIA: "aria-autocomplete" | "aria-checked" | "aria-disabled" | "aria-errormessage" | "aria-expanded" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-label" | "aria-level" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-placeholder" | "aria-pressed" | "aria-readonly" | "aria-required" | "aria-selected" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "aria-busy" | "aria-live" | "aria-relevant" | "aria-atomic" | "aria-dropeffect" | "aria-grabbed" | "aria-activedescendant" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-describedby" | "aria-description" | "aria-details" | "aria-errormessage" | "aria-flowto" | "aria-labelledby" | "aria-owns" | "aria-posinset" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-setsize"
AcceptedRole: "toolbar" | "tooltip" | "feed" | "math" | "presentation" | "none" | "note" | "application" | "article" | "cell" | "columnheader" | "definition" | "directory" | "document" | "figure" | "group" | "heading" | "img" | "list" | "listitem" | "meter" | "row" | "rowgroup" | "rowheader" | "separator" | "table" | "term" | "scrollbar" | "searchbox" | "separator" | "slider" | "spinbutton" | "switch" | "tab" | "tabpanel" | "treeitem" | "combobox" | "menu" | "menubar" | "tablist" | "tree" | "treegrid" | "banner" | "complementary" | "contentinfo" | "form" | "main" | "navigation" | "region" | "search" | "alert" | "log" | "marquee" | "status" | "timer" | "alertdialog" | "dialog"
BabylonFileParser: ((parsedData: any, scene: Scene, container: AssetContainer, rootUrl: string) => void)

Type declaration

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

      Parameters

      Returns void

CameraStageAction: ((camera: Camera) => void)

Type declaration

    • Strong typing of a Camera related stage step action

      Parameters

      Returns void

CameraStageFrameBufferAction: ((camera: Camera) => boolean)

Type declaration

    • Strong typing of a Camera Frame buffer related stage step action

      Parameters

      Returns boolean

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: {}

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

Type declaration

CoroutineBase<TStep, TReturn>: Iterator<TStep, TReturn, void> & IterableIterator<TStep>
A Coroutine is the intersection of:
  1. An Iterator that yields void, returns a T, and is not passed values with calls to next.
  2. An IterableIterator of void (since it only yields void).

Type Parameters

  • TStep

  • TReturn

DataArray: number[] | ArrayBuffer | ArrayBufferView

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

DeepImmutable<T>: T extends Primitive ? T : T extends (infer U)[] ? DeepImmutableArray<U> : DeepImmutableObject<T>

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

Type Parameters

  • T

DeepImmutableObject<T>: { readonly [ K in keyof T]: DeepImmutable<T[K]> }

Type modifier to make object properties readonly.

Type Parameters

  • T

DeviceInput<T>: T extends Keyboard | Generic ? number : T extends Mouse | Touch ? Exclude<PointerInput, Move | MouseWheelX | MouseWheelY | MouseWheelZ> : T extends DualShock ? DualShockInput : T extends Xbox ? XboxInput : T extends Switch ? SwitchInput : T extends DualSense ? DualSenseInput : never

Type to handle enforcement of inputs

Type Parameters

DeviceSourceEvent<T>: T extends Keyboard ? IKeyboardEvent : T extends Mouse ? IWheelEvent | IPointerEvent : T extends Touch ? IPointerEvent : never

Subset of DeviceInput that only handles pointers and keyboard

Type Parameters

DeviceSourceType: Distribute<DeviceType>
Distribute<T>: T extends DeviceType ? DeviceSource<T> : never

Type Parameters

  • T

Raw texture data and descriptor sufficient for WebGL texture upload

ErrorCodesType: typeof ErrorCodes[keyof typeof ErrorCodes]

Error code type

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

Type declaration

FloatArray: number[] | Float32Array

Alias type for number array or Float32Array

GoldbergCreationOption: { m?: number; n?: number; updatable?: boolean } & GoldbergVertexDataOption

Defines the set of data required to create a goldberg mesh.

GoldbergData: { adjacentFaces: number[][]; faceCenters: Vector3[]; faceColors: Color4[]; faceXaxis: Vector3[]; faceYaxis: Vector3[]; faceZaxis: Vector3[]; nbFaces: number; nbFacesAtPole: number; nbSharedFaces: number; nbUnsharedFaces: number }

Defines the set of goldberg data used to create the polygon

Type declaration

  • adjacentFaces: number[][]

    Defines the number of adjacent faces per goldberg faces

  • faceCenters: Vector3[]

    The list of Goldberg faces centers

  • faceColors: Color4[]

    The list of Goldberg faces colors

  • faceXaxis: Vector3[]

    The list of Goldberg faces Y axis

  • faceYaxis: Vector3[]

    The list of Goldberg faces X axis

  • faceZaxis: Vector3[]

    The list of Goldberg faces Z axis

  • nbFaces: number

    Defines the total number of goldberg faces

  • nbFacesAtPole: number

    Defines the number of goldberg faces at the pole

  • nbSharedFaces: number

    Defines the number of shared faces

  • nbUnsharedFaces: number

    Defines the number of unshared faces

GoldbergVertexDataOption: { sideOrientation?: number; size?: number; sizeX?: number; sizeY?: number; sizeZ?: number }

Defines the set of data required to create goldberg vertex data.

Type declaration

  • Optional sideOrientation?: number

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

  • Optional size?: number

    the size of the Goldberg, optional default 1

  • Optional sizeX?: number

    allows stretching in the x direction, optional, default size

  • Optional sizeY?: number

    allows stretching in the y direction, optional, default size

  • Optional sizeZ?: number

    allows stretching in the z direction, optional, default size

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: { 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<T>: T extends Primitive ? T : T extends (infer U)[] ? ReadonlyArray<U> : DeepImmutable<T>

Type modifier to make all the properties of an object Readonly

Type Parameters

  • T

IndicesArray: number[] | Int32Array | Uint32Array | Uint16Array

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

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

Type declaration

    • (parsedData: any, scene: Scene, rootUrl: string): any
    • Defines how the individual parser contract is defined. These parser can parse an individual asset

      Parameters

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

      Returns any

MatrixConstructor<T>: (new () => T)

Type Parameters

Type declaration

    • new (): T
    • Returns T

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

Type declaration

    • (mesh: AbstractMesh, hardwareInstancedRendering: boolean): boolean
    • Strong typing of a Mesh related stage step action

      Parameters

      Returns boolean

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

The state of a controller component

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

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

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

Type declaration

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

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

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

Type declaration

    • (name: string, scene: Scene, options?: any): (() => Node)
    • Defines how a node can be built from a string name.

      Parameters

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

      Returns (() => Node)

Nullable<T>: T | null

Alias type for value that can be null

Type Parameters

  • T

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: ((scene: Scene) => IPerfViewerCollectionStrategy)

Type declaration

PluginMaterialFactory: ((material: Material) => Nullable<MaterialPluginBase>)

Type declaration

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

Type declaration

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

Type declaration

PostProcessCustomShaderCodeProcessing: { bindCustomBindings?: any; defineCustomBindings?: any; processCodeAfterIncludes?: any; processFinalCode?: any }

Allows for custom processing of the shader code used by a post process

Type declaration

  • bindCustomBindings?:function
    • bindCustomBindings(postProcessName: string, effect: Effect): void
    • If provided, will be called when binding inputs to the shader code to allow the user to add custom bindings

      Parameters

      • postProcessName: string
      • effect: Effect

      Returns void

  • defineCustomBindings?:function
    • defineCustomBindings(postProcessName: string, defines: Nullable<string>, uniforms: string[], samplers: string[]): Nullable<string>
    • If provided, will be called before creating the effect to collect additional custom bindings (defines, uniforms, samplers)

      Parameters

      • postProcessName: string
      • defines: Nullable<string>
      • uniforms: string[]
      • samplers: string[]

      Returns Nullable<string>

  • processCodeAfterIncludes?:function
    • processCodeAfterIncludes(postProcessName: string, shaderType: string, code: string): string
    • If provided, will be called two times with the vertex and fragment code so that this code can be updated after the #include have been processed

      Parameters

      • postProcessName: string
      • shaderType: string
      • code: string

      Returns string

  • processFinalCode?:function
    • processFinalCode(postProcessName: string, shaderType: string, code: string): string
    • If provided, will be called two times with the vertex and fragment code so that this code can be updated before it is compiled by the GPU

      Parameters

      • postProcessName: string
      • shaderType: string
      • code: string

      Returns string

PostProcessOptions: { height: number; width: number }

Size options for a post process

Type declaration

  • height: number
  • width: number
PreActiveMeshStageAction: ((mesh: AbstractMesh) => void)

Type declaration

    • Strong typing of a pre active Mesh related stage step action

      Parameters

      Returns void

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

Alias type for primitive types

ignorenaming
QuaternionConstructor<T>: (new (...args: ConstructorParameters<typeof Quaternion>) => T)

Type Parameters

Type declaration

    • new (...args: ConstructorParameters<typeof Quaternion>): T
    • Parameters

      • Rest ...args: ConstructorParameters<typeof Quaternion>

      Returns T

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

Type declaration

    • Strong typing of a Render Target related stage step action

      Parameters

      Returns void

RenderTargetTextureSize: TextureSize

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

deprecated

please use TextureSize instead

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

Type declaration

RenderingGroupStageAction: ((renderingGroupId: number) => void)

Type declaration

    • (renderingGroupId: number): void
    • Strong typing of a RenderingGroup related stage step action

      Parameters

      • renderingGroupId: number

      Returns void

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

Type declaration

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

Type declaration

ShaderCustomProcessingFunction: ((shaderType: string, code: string) => string)

Type declaration

    • (shaderType: string, code: string): string
    • Function for custom code generation

      Parameters

      • shaderType: string
      • code: string

      Returns string

SimpleStageAction: (() => void)

Type declaration

    • (): void
    • Strong typing of a simple stage step action

      Returns void

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

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

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

Type declaration

Vector2Constructor<T>: (new (...args: ConstructorParameters<typeof Vector2>) => T)

Type Parameters

Type declaration

    • new (...args: ConstructorParameters<typeof Vector2>): T
    • Parameters

      • Rest ...args: ConstructorParameters<typeof Vector2>

      Returns T

Vector3Constructor<T>: (new (...args: ConstructorParameters<typeof Vector3>) => T)

Type Parameters

Type declaration

    • new (...args: ConstructorParameters<typeof Vector3>): T
    • Parameters

      • Rest ...args: ConstructorParameters<typeof Vector3>

      Returns T

Vector4Constructor<T>: (new (...args: ConstructorParameters<typeof Vector4>) => T)

Type Parameters

Type declaration

    • new (...args: ConstructorParameters<typeof Vector4>): T
    • Parameters

      • Rest ...args: ConstructorParameters<typeof Vector4>

      Returns T

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

WebXRCompositionLayerType: "XRProjectionLayer"

Covers all supported subclasses of WebXR's XRCompositionLayer

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: { allowedComponentTypes?: MotionControllerComponentType[]; forceHandedness?: XRHandedness; mainComponentOnly?: boolean; componentSelectionPredicate?: any } & ({ axisChangedHandler: any } | { buttonChangedhandler: any })

Button of Axis Handler must be specified.

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: "screen" | "floating" | "head-locked"

Type of DOM overlay provided by UA.

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

Type declaration

WebXRLayerType: "XRWebGLLayer" | WebXRCompositionLayerType

Covers all supported subclasses of WebXR's XRLayer

XRHandMeshRigMapping: { [ webXRJointName in WebXRHandJoint]: string }

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

double: number

Alias type for number that are doubles.

ignorenaming
float: number

Alias type for number that are floats

ignorenaming
int: number

Alias type for number that are integer

ignorenaming

Variables

BRDFTextureTools: { GetEnvironmentBRDFTexture: any }

Class used to host texture specific utilities

Type declaration

  • GetEnvironmentBRDFTexture:function
    • Gets a default environment BRDF for MS-BRDF Height Correlated BRDF

      Parameters

      • scene: Scene

        defines the hosting scene

      Returns BaseTexture

      the environment BRDF texture

BasisTools: { JSModuleURL: string; WasmModuleURL: string; GetInternalFormatFromBasisFormat: any; LoadTextureFromTranscodeResult: any; TranscodeAsync: any }

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

  • GetInternalFormatFromBasisFormat:function
    • GetInternalFormatFromBasisFormat(basisFormat: number, engine: Engine): number
    • Get the internal format to be passed to texImage2D corresponding to the .basis format value

      Parameters

      • basisFormat: number

        format chosen from GetSupportedTranscodeFormat

      • engine: Engine

      Returns number

      internal format corresponding to the Basis format

  • LoadTextureFromTranscodeResult:function
    • Loads a texture from the transcode result

      Parameters

      Returns void

  • TranscodeAsync:function
    • Transcodes a loaded image file to compressed pixel data

      Parameters

      • data: ArrayBufferView | ArrayBuffer

        image data to transcode

      • config: BasisTranscodeConfiguration

        configuration options for the transcoding

      Returns Promise<TranscodeResult>

      a promise resulting in the transcoded image

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

BoxBuilder: { CreateBox: typeof BABYLON.CreateBox }

Class containing static functions to help procedurally build meshes

deprecated

please use CreateBox directly

Type declaration

CapsuleBuilder: { CreateCapsule: typeof BABYLON.CreateCapsule }

Class containing static functions to help procedurally build meshes

deprecated

please use CreateCapsule directly

Type declaration

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 pixels

    defines the pixel data to transform to base64

    param size

    defines the width and height of the (texture) data

    param invertY

    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 texture

    defines the texture to read pixels from

    param faceIndex

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

    param level

    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 texture

    defines the texture to read pixels from

    param faceIndex

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

    param level

    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

CylinderBuilder: { CreateCylinder: typeof BABYLON.CreateCylinder }

Class containing static functions to help procedurally build meshes

deprecated

Please use CreateCylinder directly

Type declaration

DecalBuilder: { CreateDecal: typeof BABYLON.CreateDecal }

Class containing static functions to help procedurally build meshes

deprecated

use the function directly from the module

Type declaration

DiscBuilder: { CreateDisc: typeof BABYLON.CreateDisc }

Class containing static functions to help procedurally build meshes

deprecated

please use CreateDisc directly

Type declaration

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 element

    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

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 texture

    defines the cube texture to convert in env file

    param options

    options for the conversion process

    param options.imageType

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

    param options.imageQuality

    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 data

    the image data

    param info

    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 data

    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 texture

    defines the internal texture to upload to

    param data

    defines the data to load

    param info

    defines the texture info retrieved through the GetEnvInfo method

    returns

    a promise

  • UploadEnvSpherical: typeof UploadEnvSpherical

    Uploads spherical polynomials information to the texture.

    param texture

    defines the texture we are trying to upload the information to

    param info

    defines the environment texture info retrieved through the GetEnvInfo method

  • UploadLevelsAsync: typeof UploadLevelsAsync

    Uploads the levels of image data to the GPU.

    param texture

    defines the internal texture to upload to

    param imageData

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

    param imageType

    the mime type of the image data

    returns

    a promise

Epsilon: 0.001 = 0.001

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

ignorenaming
ErrorCodes: { GLTFLoaderUnexpectedMagicError: 2000; LoadFileError: 4000; MeshInvalidPositionsError: 0; ReadFileError: 4002; RequestFileError: 4001; SceneLoaderError: 3000; UnsupportedTextureError: 1000 }

Error codes for BaseError

Type declaration

  • Readonly GLTFLoaderUnexpectedMagicError: 2000

    Unexpected magic number found in GLTF file header.

  • Readonly LoadFileError: 4000

    Load file error

  • Readonly MeshInvalidPositionsError: 0

    Invalid or empty mesh vertex positions.

  • Readonly ReadFileError: 4002

    Read file error

  • Readonly RequestFileError: 4001

    Request file error

  • Readonly SceneLoaderError: 3000

    SceneLoader generic error code. Ideally wraps the inner exception.

  • Readonly UnsupportedTextureError: 1000

    Unsupported texture found.

GUID: { RandomId: typeof RandomGUID }

Class used to manipulate GUIDs

Type declaration

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

Class containing static functions to help procedurally build meshes

deprecated

use the functions directly from the module

Type declaration

HemisphereBuilder: { CreateHemisphere: typeof BABYLON.CreateHemisphere }

Class containing static functions to help procedurally build meshes

deprecated

use the function directly from the module

Type declaration

IcoSphereBuilder: { CreateIcoSphere: typeof BABYLON.CreateIcoSphere }

Class containing static functions to help procedurally build meshes

deprecated

use the function directly from the module

Type declaration

LatheBuilder: { CreateLathe: typeof BABYLON.CreateLathe }

Class containing static functions to help procedurally build meshes

deprecated

use the function direction from the module

Type declaration

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

Class containing static functions to help procedurally build meshes

deprecated

use the functions directly from the module

Type declaration

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

Class containing static functions to help procedurally build meshes

Type declaration

PHI: number

Constant Golden Ratio value in Babylon.js

ignorenaming
PlaneBuilder: { CreatePlane: typeof BABYLON.CreatePlane }

Class containing static functions to help procedurally build meshes

deprecated

use the function directly from the module

Type declaration

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

Class containing static functions to help procedurally build meshes

deprecated

use the functions directly from the module

Type declaration

PolyhedronBuilder: { CreatePolyhedron: typeof BABYLON.CreatePolyhedron }

Class containing static functions to help procedurally build meshes

deprecated

use the function directly from the module

Type declaration

RibbonBuilder: { CreateRibbon: typeof BABYLON.CreateRibbon }

Class containing static functions to help procedurally build meshes

deprecated

use CreateRibbon directly

Type declaration

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/features/featuresDeepDive/scene/renderToPNG

    param engine

    defines the rendering engine

    param camera

    defines the source camera

    param size

    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 successCallback

    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 mimeType

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

    param forceDownload

    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/features/featuresDeepDive/scene/renderToPNG

    param engine

    defines the rendering engine

    param camera

    defines the source camera

    param size

    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 mimeType

    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/features/featuresDeepDive/scene/renderToPNG

    param engine

    The engine to use for rendering

    param camera

    The camera to use for rendering

    param size

    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 successCallback

    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 mimeType

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

    param samples

    Texture samples (default: 1)

    param antialiasing

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

    param fileName

    A name for for the downloaded file.

    param renderSprites

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

    param enableStencilBuffer

    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/features/featuresDeepDive/scene/renderToPNG

    param engine

    The engine to use for rendering

    param camera

    The camera to use for rendering

    param size

    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 mimeType

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

    param samples

    Texture samples (default: 1)

    param antialiasing

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

    param fileName

    A name for for the downloaded file.

    param renderSprites

    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/features/featuresDeepDive/scene/renderToPNG

    param engine

    defines the rendering engine

    param camera

    defines the source camera

    param width

    defines the expected width

    param height

    defines the expected height

    param mimeType

    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

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

Class containing static functions to help procedurally build meshes

deprecated

please use the functions directly from the module

Type declaration

SphereBuilder: { CreateSphere: typeof BABYLON.CreateSphere }

Class containing static functions to help procedurally build meshes

deprecated

use CreateSphere directly

Type declaration

StringTools: { Decode: any; DecodeBase64ToBinary: any; DecodeBase64ToString: any; EncodeArrayBufferToBase64: any; EndsWith: any; PadNumber: any; StartsWith: any }

Helper to manipulate strings

Type declaration

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

      • buffer: Uint8Array | Uint16Array

      Returns string

  • DecodeBase64ToBinary:function
    • DecodeBase64ToBinary(base64Data: string): ArrayBuffer
    • Parameters

      • base64Data: string

      Returns ArrayBuffer

  • DecodeBase64ToString:function
    • DecodeBase64ToString(base64Data: string): string
    • Parameters

      • base64Data: string

      Returns string

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

      • buffer: ArrayBufferView | ArrayBuffer

      Returns string

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

      • str: string
      • suffix: string

      Returns boolean

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

      • num: number
      • length: number

      Returns string

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

      • str: string
      • suffix: string

      Returns boolean

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 data

    defines the TGA data

    returns

    the header

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 postProcessName

    name of the fragment post process

    param internalTexture

    the texture to encode

    param scene

    the scene hosting the texture

    param type

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

    param samplingMode

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

    param format

    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

    Texture to copy from

    param width

    defines the desired width

    param height

    defines the desired height

    param useBilinearMode

    defines if bilinear mode has to be used

    returns

    the generated texture

  • FromHalfFloat: typeof FromHalfFloat

    Converts a half float to a number

    param value

    half float to convert

    returns

    converted half float

  • ToHalfFloat: typeof ToHalfFloat

    Converts a number to half float

    param value

    number to convert

    returns

    converted number

TiledBoxBuilder: { CreateTiledBox: typeof CreateTiledBox }

Class containing static functions to help procedurally build meshes

deprecated

use CreateTiledBox instead

Type declaration

TiledPlaneBuilder: { CreateTiledPlane: typeof CreateTiledPlane }

Class containing static functions to help procedurally build meshes

deprecated

use CreateTiledPlane instead

Type declaration

ToGammaSpace: number

Constant used to convert a value to gamma space

ignorenaming
ToLinearSpace: 2.2 = 2.2

Constant used to convert a value to linear space

ignorenaming
TorusBuilder: { CreateTorus: typeof BABYLON.CreateTorus }

Class containing static functions to help procedurally build meshes

deprecated

use CreateTorus instead

Type declaration

TorusKnotBuilder: { CreateTorusKnot: typeof BABYLON.CreateTorusKnot }

Class containing static functions to help procedurally build meshes

deprecated

use CreateTorusKnot instead

Type declaration

TubeBuilder: { CreateTube: typeof BABYLON.CreateTube }

Class containing static functions to help procedurally build meshes

deprecated

use CreateTube directly

Type declaration

renderableTextureFormatToIndex: {}

Map a (renderable) texture format (GPUTextureFormat) to an index for fast lookup (in caches for eg)

Type declaration

  • [name: string]: number

Functions

  • 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(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/features/featuresDeepDive/materials/using/texturePerBoxFace
    • 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/features/featuresDeepDive/mesh/creation/set#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/features/featuresDeepDive/mesh/creation/set#box

    Parameters

    • name: string

      defines the name of the mesh

    • Optional 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(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

  • 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

  • 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?: Nullable<Scene>): 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/features/featuresDeepDive/mesh/creation/set#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/features/featuresDeepDive/mesh/creation/set#cylinder-or-cone

    Parameters

    • name: string

      defines the name of the mesh

    • Optional 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
    • Optional scene: Nullable<Scene>

      defines the hosting scene

    Returns Mesh

    the cylinder mesh

  • 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 independently 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(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/features/featuresDeepDive/mesh/dynamicMeshMorph#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/features/featuresDeepDive/mesh/creation/param#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(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(name: string, sourceMesh: AbstractMesh, options: { angle?: number; captureUVS?: boolean; cullBackFaces?: boolean; localMode?: boolean; normal?: Vector3; position?: Vector3; size?: Vector3 }): Mesh
  • 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
    • The parameter cullBackFaces defines if the back faces should be removed from the decal mesh
    • The parameter localMode defines that the computations should be done with the local mesh coordinates instead of the world space coordinates.
    • Use this mode if you want the decal to be parented to the sourceMesh and move/rotate with it. Note: Meshes with morph targets are not supported!
    see

    https://doc.babylonjs.com/features/featuresDeepDive/mesh/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; cullBackFaces?: boolean; localMode?: boolean; normal?: Vector3; position?: Vector3; size?: Vector3 }

      defines the options used to create the mesh

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

    Returns Mesh

    the decal mesh

  • 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/features/featuresDeepDive/mesh/creation/set#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/features/featuresDeepDive/mesh/creation/set#disc-or-regular-polygon

    Parameters

    • name: string

      defines the name of the mesh

    • Optional 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

  • CreateDiscVertexData(options: { arc?: number; backUVs?: Vector4; frontUVs?: Vector4; radius?: number; sideOrientation?: number; tessellation?: number }): VertexData
  • Creates the VertexData of the Disc or regular Polygon

    Parameters

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

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

      • radius the radius of the disc, optional default 0.5
      • tessellation the number of polygon sides, optional, default 64
      • arc a number from 0 to 1, to create an unclosed polygon based on the fraction of the circumference 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 frontUVs?: Vector4
      • Optional radius?: number
      • Optional sideOrientation?: number
      • Optional tessellation?: number

    Returns VertexData

    the VertexData of the box

  • Creates an environment texture from a loaded cube texture.

    Parameters

    Returns Promise<ArrayBuffer>

    a promise containing the environment data if successful.

  • 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
  • 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

  • Creates the Mesh for a Goldberg Polyhedron

    Parameters

    • options: GoldbergVertexDataOption

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

    • goldbergData: PolyhedronData

      polyhedronData defining the Goldberg polyhedron

    Returns VertexData

    GoldbergSphere mesh

  • CreateGround(name: string, options?: { height?: number; subdivisions?: number; subdivisionsX?: number; subdivisionsY?: number; updatable?: boolean; width?: number }, scene?: Scene): GroundMesh
  • 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/features/featuresDeepDive/mesh/creation/set#ground

    Parameters

    • name: string

      defines the name of the mesh

    • Optional 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
    • Optional scene: Scene

      defines the hosting scene

    Returns GroundMesh

    the ground mesh

  • CreateGroundFromHeightMap(name: string, url: string, options?: { alphaFilter?: number; colorFilter?: Color3; height?: number; maxHeight?: number; minHeight?: number; subdivisions?: number; updatable?: boolean; width?: number; onReady?: any }, 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/features/featuresDeepDive/mesh/creation/set/height_map

    see

    https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#ground-from-a-height-map

    Parameters

    • name: string

      defines the name of the mesh

    • url: string

      defines the url to the height map

    • Optional options: { alphaFilter?: number; colorFilter?: Color3; height?: number; maxHeight?: number; minHeight?: number; subdivisions?: number; updatable?: boolean; width?: number; onReady?: any }

      defines the options used to create the mesh

      • Optional alphaFilter?: number
      • Optional colorFilter?: Color3
      • Optional height?: number
      • Optional maxHeight?: number
      • Optional minHeight?: number
      • Optional subdivisions?: number
      • Optional updatable?: boolean
      • Optional width?: number
      • onReady?:function
        • Parameters

          Returns void

    • Optional scene: Nullable<Scene>

      defines the hosting scene

    Returns GroundMesh

    the ground mesh

  • 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(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(name: string, options?: { diameter?: number; segments?: number; sideOrientation?: number }, scene?: Scene): Mesh
  • Creates a hemisphere mesh

    Parameters

    • name: string

      defines the name of the mesh

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

      defines the options used to create the mesh

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

      defines the hosting scene

    Returns Mesh

    the hemisphere mesh

  • 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/features/featuresDeepDive/mesh/creation/set#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/features/featuresDeepDive/mesh/creation/polyhedra#icosphere

    Parameters

    • name: string

      defines the name of the mesh

    • Optional 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(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

  • 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 ArrayBufferView[][]

    the views described by info providing access to the underlying buffer

  • 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/features/featuresDeepDive/mesh/creation/set#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/features/featuresDeepDive/mesh/creation/param#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

  • 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/features/featuresDeepDive/mesh/dynamicMeshMorph#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/features/featuresDeepDive/mesh/creation/param#line-system

    Parameters

    Returns LinesMesh

    a new line system mesh

  • 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

  • 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/features/featuresDeepDive/mesh/dynamicMeshMorph#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/features/featuresDeepDive/mesh/creation/param#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(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/features/featuresDeepDive/mesh/creation/set#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/features/featuresDeepDive/mesh/creation/set#plane

    Parameters

    • name: string

      defines the name of the mesh

    • Optional 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(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(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

  • 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

      a boolean, default false, when true and fUVs used texture is wrapped around all sides, when false texture is applied side

    Returns VertexData

    the VertexData of the Polygon

  • 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/features/featuresDeepDive/materials/using/texturePerBoxFace
    • 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/features/featuresDeepDive/mesh/creation/set#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/features/featuresDeepDive/mesh/creation/polyhedra

    Parameters

    • name: string

      defines the name of the mesh

    • Optional 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(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(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(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/features/featuresDeepDive/mesh/dynamicMeshMorph#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/features/featuresDeepDive/mesh/creation/set#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/features/featuresDeepDive/mesh/creation/param/ribbon_extra

    see

    https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param

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

    see

    https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG

    Parameters

    • engine: Engine

      defines the rendering engine

    • camera: Camera

      defines the source camera

    • size: number | IScreenshotSize

      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

  • Captures a screenshot of the current rendering

    see

    https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToPNG

    Parameters

    • engine: Engine

      defines the rendering engine

    • camera: Camera

      defines the source camera

    • size: number | IScreenshotSize

      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(engine: Engine, camera: Camera, size: number | IScreenshotSize, 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/features/featuresDeepDive/scene/renderToPNG

    Parameters

    • engine: Engine

      The engine to use for rendering

    • camera: Camera

      The camera to use for rendering

    • size: number | IScreenshotSize

      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(engine: Engine, camera: Camera, size: number | IScreenshotSize, 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/features/featuresDeepDive/scene/renderToPNG

    Parameters

    • engine: Engine

      The engine to use for rendering

    • camera: Camera

      The camera to use for rendering

    • size: number | IScreenshotSize

      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(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/features/featuresDeepDive/scene/renderToPNG

    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(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/features/featuresDeepDive/mesh/creation/set#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/features/featuresDeepDive/mesh/creation/set#sphere

    Parameters

    • name: string

      defines the name of the mesh

    • Optional 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(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(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
  • 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 }

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

      • pattern sets the rotation or reflection pattern for the tiles,
      • size of the box
      • width of the box, overwrites size
      • height of the box, overwrites size
      • depth of the box, overwrites size
      • tileSize sets the size of a tile
      • tileWidth sets the tile width and overwrites tileSize
      • tileHeight sets the tile width and overwrites tileSize
      • 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
      • alignHorizontal places whole tiles aligned to the center, left or right of a row
      • alignVertical places whole tiles aligned to the center, left or right of a column
      • 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 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(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
  • 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 tiled box, required but can be empty

      • pattern sets the rotation or reflection pattern for the tiles,
      • size of the box
      • width of the box, overwrites size
      • height of the box, overwrites size
      • depth of the box, overwrites size
      • tileSize sets the size of a tile
      • tileWidth sets the tile width and overwrites tileSize
      • tileHeight sets the tile width and overwrites tileSize
      • 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
      • alignHorizontal places whole tiles aligned to the center, left or right of a row
      • alignVertical places whole tiles aligned to the center, left or right of a column
      • Optional alignHorizontal?: number
      • Optional alignVertical?: number
      • Optional depth?: number
      • Optional faceColors?: Color4[]
      • Optional faceUV?: Vector4[]
      • Optional height?: number
      • Optional pattern?: number
      • Optional sideOrientation?: number
        • sideOrientation optional and takes the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
      • Optional size?: number
      • Optional tileHeight?: number
      • Optional tileSize?: number
      • Optional tileWidth?: number
      • Optional width?: number

    Returns VertexData

    the VertexData of the TiledBox

  • 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/features/featuresDeepDive/mesh/creation/set#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(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(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
  • 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 }

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

      • pattern a limited pattern arrangement depending on the number
      • size of the box
      • width of the box, overwrites size
      • height of the box, overwrites size
      • 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
      • alignHorizontal places whole tiles aligned to the center, left or right of a row
      • alignVertical places whole tiles aligned to the center, left or right of a column
      • 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 updatable?: boolean
      • Optional width?: number
    • Optional scene: Nullable<Scene>

      defines the hosting scene

    Returns Mesh

    the box mesh

  • 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
  • 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 tiled plane, required but can be empty

      • pattern a limited pattern arrangement depending on the number
      • size of the box
      • width of the box, overwrites size
      • height of the box, overwrites size
      • 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
      • alignHorizontal places whole tiles aligned to the center, left or right of a row
      • alignVertical places whole tiles aligned to the center, left or right of a column
      • 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)
      • Optional alignHorizontal?: number
      • Optional alignVertical?: number
      • Optional backUVs?: Vector4
        • 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 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(name: string, options?: { backUVs?: Vector4; diameter?: number; frontUVs?: Vector4; sideOrientation?: number; tessellation?: number; thickness?: number; updatable?: boolean }, scene?: Scene): 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/features/featuresDeepDive/mesh/creation/set#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/features/featuresDeepDive/mesh/creation/set#torus

    Parameters

    • name: string

      defines the name of the mesh

    • Optional 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
    • Optional scene: Scene

      defines the hosting scene

    Returns Mesh

    the torus mesh

  • 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?: Scene): 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/features/featuresDeepDive/mesh/creation/set#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/features/featuresDeepDive/mesh/creation/set#torus-knot

    Parameters

    • name: string

      defines the name of the mesh

    • Optional 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
    • Optional scene: Scene

      defines the hosting scene

    Returns Mesh

    the torus knot mesh

  • 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(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(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. The pathArray HAS to have the SAME number of points as the previous one: https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#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/features/featuresDeepDive/mesh/creation/set#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. The NUMBER of points CAN'T CHANGE, only their positions.
    see

    https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param

    see

    https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#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

  • Decode(buffer: Uint8Array | Uint16Array): string
  • Decodes a buffer into a string

    Parameters

    • buffer: Uint8Array | Uint16Array

      The buffer to decode

    Returns string

    The decoded string

  • DecodeBase64ToBinary(base64Data: string): ArrayBuffer
  • Converts a given base64 string into an ArrayBuffer of raw byte data

    Parameters

    • base64Data: string

      The base64 encoded string to decode

    Returns ArrayBuffer

    ArrayBuffer of byte data

  • DecodeBase64ToString(base64Data: string): string
  • Converts a given base64 string as an ASCII encoded stream of data

    Parameters

    • base64Data: string

      The base64 encoded string to decode

    Returns string

    Decoded ASCII string

  • EncodeArrayBufferToBase64(buffer: ArrayBufferView | ArrayBuffer): string
  • Encode a buffer to a base64 string

    Parameters

    • buffer: ArrayBufferView | ArrayBuffer

      defines the buffer to encode

    Returns string

    the encoded string

  • EndsWith(str: string, suffix: string): boolean
  • Checks for a matching suffix at the end of a string (for ES5 and lower)

    deprecated

    Please use native string function instead

    Parameters

    • str: string

      Source string

    • suffix: string

      Suffix to search for in the source string

    Returns boolean

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

  • 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(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(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/features/featuresDeepDive/materials/using/texturePerBoxFace

    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(name: string, options: { adjustFrame?: boolean; backUVs?: