Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GroundBuilder

Class containing static functions to help procedurally build meshes

Hierarchy

  • GroundBuilder

Index

Methods

Static CreateGroundSearch playground for CreateGround

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

    • The parameters width and height (floats, default 1) set the width and height sizes of the ground
    • The parameter subdivisions (positive integer) sets the number of subdivisions per side
    • The mesh can be set to updatable with the boolean parameter updatable (default false) if its internal geometry is supposed to change once created
    see

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

    Parameters

    • name: string

      defines the name of the mesh

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

      defines the options used to create the mesh

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

      defines the hosting scene

    Returns Mesh

    the ground mesh

Static CreateGroundFromHeightMapSearch playground for CreateGroundFromHeightMap

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

    • The parameter url sets the URL of the height map image resource.
    • The parameters width and height (positive floats, default 10) set the ground width and height sizes.
    • The parameter subdivisions (positive integer, default 1) sets the number of subdivision per side.
    • The parameter minHeight (float, default 0) is the minimum altitude on the ground.
    • The parameter maxHeight (float, default 1) is the maximum altitude on the ground.
    • The parameter colorFilter (optional Color3, default (0.3, 0.59, 0.11) ) is the filter to apply to the image pixel colors to compute the height.
    • The parameter onReady is a javascript callback function that will be called once the mesh is just built (the height map download can last some time).
    • The parameter alphaFilter will filter any data where the alpha channel is below this value, defaults 0 (all data visible)
    • The mesh can be set to updatable with the boolean parameter updatable (default false) if its internal geometry is supposed to change once created.
    see

    https://doc.babylonjs.com/babylon101/height_map

    see

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

    Parameters

    • name: string

      defines the name of the mesh

    • url: string

      defines the url to the height map

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

      defines the options used to create the mesh

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

      defines the hosting scene

    Returns GroundMesh

    the ground mesh

Static CreateTiledGroundSearch playground for CreateTiledGround

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

    • The parameters xmin and xmax (floats, default -1 and 1) set the ground minimum and maximum X coordinates
    • The parameters zmin and zmax (floats, default -1 and 1) set the ground minimum and maximum Z coordinates
    • The parameter subdivisions is a javascript object {w: positive integer, h: positive integer} (default {w: 6, h: 6}). w and h are the numbers of subdivisions on the ground width and height. Each subdivision is called a tile
    • The parameter precision is a javascript object {w: positive integer, h: positive integer} (default {w: 2, h: 2}). w and h are the numbers of subdivisions on the ground width and height of each tile
    • The mesh can be set to updatable with the boolean parameter updatable (default false) if its internal geometry is supposed to change once created.
    see

    https://doc.babylonjs.com/how_to/set_shapes#tiled-ground

    Parameters

    • name: string

      defines the name of the mesh

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

      defines the options used to create the mesh

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

      defines the hosting scene

    Returns Mesh

    the tiled ground mesh

Legend

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