DiscGeometry

Hierarchy

  • _PrimitiveGeometry
    • DiscGeometry

Implements

Index

Constructors

constructor

Find examples in Playground
  • new DiscGeometry(id: string, scene: Scene, radius: number, tessellation: number, canBeRegenerated?: boolean, mesh?: Nullable<Mesh>, side?: number): DiscGeometry
  • Creates a new disc geometry

    Parameters

    • id: string

      defines the unique ID of the geometry

    • scene: Scene

      defines the hosting scene

    • radius: number

      defines the radius of the disc

    • tessellation: number

      defines the tesselation factor to apply to the disc

    • Optional canBeRegenerated: boolean

      defines if the geometry supports being regenerated with new parameters (false by default)

    • Optional mesh: Nullable<Mesh>

      defines the hosting mesh (can be null)

    • Optional side: number

      defines if the created geometry is double sided or not (default is BABYLON.Mesh.DEFAULTSIDE)

    Returns DiscGeometry

Properties

boundingBias

Find examples in Playground
boundingBias: Vector2

Gets or sets the Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y

delayLoadState

Find examples in Playground
delayLoadState: number

Gets the delay loading state of the geometry (none by default which means not delayed)

delayLoadingFile

Find examples in Playground
delayLoadingFile: Nullable<string>

Gets the file containing the data to load when running in delay load state

doNotSerialize

Find examples in Playground
doNotSerialize: boolean

Gets a value indicating that the geometry should not be serialized

extend

Find examples in Playground
extend: object

Gets the current extend of the geometry

Type declaration

id

Find examples in Playground
id: string

Gets or sets the ID of the geometry

onGeometryUpdated

Find examples in Playground
onGeometryUpdated: function

Callback called when the geometry is updated

Type declaration

    • (geometry: Geometry, kind?: string): void
    • Parameters

      • geometry: Geometry
      • Optional kind: string

      Returns void

radius

Find examples in Playground
radius: number

Defines the radius of the disc

side

Find examples in Playground
side: number

Defines if the created geometry is double sided or not (default is BABYLON.Mesh.DEFAULTSIDE)

tessellation

Find examples in Playground
tessellation: number

Defines the tesselation factor to apply to the disc

uniqueId

Find examples in Playground
uniqueId: number

Gets or sets the unique ID of the geometry

Methods

applyToMesh

Find examples in Playground
  • applyToMesh(mesh: Mesh): void
  • Apply current geometry to a given mesh

    Parameters

    • mesh: Mesh

      defines the mesh to apply geometry to

    Returns void

asNewGeometry

Find examples in Playground
  • Clone the geometry

    Parameters

    • id: string

      defines the unique ID of the new geometry

    Returns Geometry

    the new geometry

canBeRegenerated

Find examples in Playground
  • canBeRegenerated(): boolean
  • Gets a value indicating if the geometry supports being regenerated with new parameters (false by default)

    Returns boolean

    true if the geometry can be regenerated

dispose

Find examples in Playground
  • dispose(): void
  • Free all associated resources

    Returns void

getEngine

Find examples in Playground

getIndexBuffer

Find examples in Playground
  • getIndexBuffer(): Nullable<WebGLBuffer>

getIndices

Find examples in Playground
  • Gets the index buffer array

    Parameters

    • Optional copyWhenShared: boolean

      defines if the returned array must be cloned upon returning it if the current geometry is shared between multiple meshes

    • Optional forceCopy: boolean

      defines a boolean indicating that the returned array must be cloned upon returning it

    Returns Nullable<IndicesArray>

    the index buffer array

getScene

Find examples in Playground

getTotalIndices

Find examples in Playground
  • getTotalIndices(): number
  • Return the total number of indices

    Returns number

    the total number of indices

getTotalVertices

Find examples in Playground
  • getTotalVertices(): number

getVertexBuffer

Find examples in Playground

getVertexBuffers

Find examples in Playground

getVerticesData

Find examples in Playground
  • getVerticesData(kind: string, copyWhenShared?: boolean, forceCopy?: boolean): Nullable<FloatArray>
  • Gets a specific vertex data attached to this geometry. Float data is constructed if the vertex buffer data cannot be returned directly.

    Parameters

    • kind: string

      defines the data kind (Position, normal, etc...)

    • Optional copyWhenShared: boolean

      defines if the returned array must be cloned upon returning it if the current geometry is shared between multiple meshes

    • Optional forceCopy: boolean

      defines a boolean indicating that the returned array must be cloned upon returning it

    Returns Nullable<FloatArray>

    a float array containing vertex data

getVerticesDataKinds

Find examples in Playground
  • getVerticesDataKinds(): string[]
  • Gets a list of all attached data kinds (Position, normal, etc...)

    Returns string[]

    a list of string containing all kinds

isDisposed

Find examples in Playground
  • isDisposed(): boolean
  • Gets a value indicating if the geometry is disposed

    Returns boolean

    true if the geometry was disposed

isReady

Find examples in Playground
  • isReady(): boolean
  • Defines if the geometry is ready to use

    Returns boolean

    true if the geometry is ready to be used

isVertexBufferUpdatable

Find examples in Playground
  • isVertexBufferUpdatable(kind: string): boolean
  • Returns a boolean defining if the vertex data for the requested kind is updatable

    Parameters

    • kind: string

      defines the data kind (Position, normal, etc...)

    Returns boolean

    true if the vertex buffer with the specified kind is updatable

isVerticesDataPresent

Find examples in Playground
  • isVerticesDataPresent(kind: string): boolean

load

Find examples in Playground
  • load(scene: Scene, onLoaded?: function): void
  • Load the geometry if it was flagged as delay loaded

    Parameters

    • scene: Scene

      defines the hosting scene

    • Optional onLoaded: function

      defines a callback called when the geometry is loaded

        • (): void
        • Returns void

    Returns void

regenerate

Find examples in Playground
  • regenerate(): void
  • If the geometry supports regeneration, the function will recreates the geometry with updated parameter values

    Returns void

releaseForMesh

Find examples in Playground
  • releaseForMesh(mesh: Mesh, shouldDispose?: boolean): void
  • Release the associated resources for a specific mesh

    Parameters

    • mesh: Mesh

      defines the source mesh

    • Optional shouldDispose: boolean

      defines if the geometry must be disposed if there is no more mesh pointing to it

    Returns void

removeVerticesData

Find examples in Playground
  • removeVerticesData(kind: string): void
  • Removes a specific vertex data

    Parameters

    • kind: string

      defines the data kind (Position, normal, etc...)

    Returns void

serialize

Find examples in Playground
  • serialize(): any
  • Returns any

serializeVerticeData

Find examples in Playground
  • serializeVerticeData(): any
  • Serialize all vertices data into a JSON oject

    Returns any

    a JSON representation of the current geometry data

setAllVerticesData

Find examples in Playground
  • setAllVerticesData(vertexData: VertexData, updatable?: boolean): void

setIndices

Find examples in Playground
  • Creates a new index buffer

    Parameters

    • indices: IndicesArray

      defines the indices to store in the index buffer

    • Optional totalVertices: Nullable<number>

      defines the total number of vertices (could be null)

    • Optional updatable: boolean

      defines if the index buffer must be flagged as updatable (false by default)

    Returns void

setVerticesBuffer

Find examples in Playground
  • Affect a vertex buffer to the geometry. the vertexBuffer.getKind() function is used to determine where to store the data

    Parameters

    • buffer: VertexBuffer

      defines the vertex buffer to use

    • Optional totalVertices: Nullable<number>

      defines the total number of vertices for position kind (could be null)

    Returns void

setVerticesData

Find examples in Playground
  • setVerticesData(kind: string, data: FloatArray, updatable?: boolean): void

toLeftHanded

Find examples in Playground
  • toLeftHanded(): void
  • Invert the geometry to move from a right handed system to a left handed one.

    Returns void

updateIndices

Find examples in Playground
  • updateIndices(indices: IndicesArray, offset?: number): void
  • Update index buffer

    Parameters

    • indices: IndicesArray

      defines the indices to store in the index buffer

    • Optional offset: number

      defines the offset in the target buffer where to store the data

    Returns void

updateVerticesData

Find examples in Playground
  • updateVerticesData(kind: string, data: FloatArray, updateExtends?: boolean): void
  • Update a specific vertex buffer This function will create a new buffer if the current one is not updatable

    Parameters

    • kind: string

      defines the data kind (Position, normal, etc...)

    • data: FloatArray

      defines the data to use

    • Optional updateExtends: boolean

      defines if the geometry extends must be recomputed (false by default)

    Returns void

updateVerticesDataDirectly

Find examples in Playground
  • updateVerticesDataDirectly(kind: string, data: DataArray, offset: number, useBytes?: boolean): void
  • Update a specific vertex buffer This function will directly update the underlying WebGLBuffer according to the passed numeric array or Float32Array It will do nothing if the buffer is not updatable

    Parameters

    • kind: string

      defines the data kind (Position, normal, etc...)

    • data: DataArray

      defines the data to use

    • offset: number

      defines the offset in the target buffer where to store the data

    • Optional useBytes: boolean

      set to true if the offset is in bytes

    Returns void

Static CreateGeometryForMesh

Find examples in Playground
  • Static function used to attach a new empty geometry to a mesh

    Parameters

    • mesh: Mesh

      defines the mesh to attach the geometry to

    Returns Geometry

    the new Geometry

Static ExtractFromMesh

Find examples in Playground
  • Extracts a clone of a mesh geometry

    Parameters

    • mesh: Mesh

      defines the source mesh

    • id: string

      defines the unique ID of the new geometry object

    Returns Nullable<Geometry>

    the new geometry object

Static Parse

Find examples in Playground
  • Create a new geometry from persisted data (Using .babylon file format)

    Parameters

    • parsedVertexData: any

      defines the persisted data

    • scene: Scene

      defines the hosting scene

    • rootUrl: string

      defines the root url to use to load assets (like delayed data)

    Returns Nullable<Geometry>

    the new geometry object

Static RandomId

Find examples in Playground
  • RandomId(): string

Generated using TypeDoc