123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- import type { Scene } from "../../scene";
- import { Color3 } from "../../Maths/math.color";
- import { Mesh } from "../mesh";
- import { VertexData } from "../mesh.vertexData";
- import { GroundMesh } from "../groundMesh";
- import type { Nullable } from "../../types";
- /**
- * Creates the VertexData for a Ground
- * @param options an object used to set the following optional parameters for the Ground, required but can be empty
- * @param options.width the width (x direction) of the ground, optional, default 1
- * @param options.height the height (z direction) of the ground, optional, default 1
- * @param options.subdivisions the number of subdivisions per side, optional, default 1
- * @param options.subdivisionsX the number of subdivisions in the x direction, overrides options.subdivisions, optional, default undefined
- * @param options.subdivisionsY the number of subdivisions in the y direction, overrides options.subdivisions, optional, default undefined
- * @returns the VertexData of the Ground
- */
- export declare function CreateGroundVertexData(options: {
- width?: number;
- height?: number;
- subdivisions?: number;
- subdivisionsX?: number;
- subdivisionsY?: number;
- }): VertexData;
- /**
- * Creates the VertexData for a TiledGround by subdividing the ground into tiles
- * @param options an object used to set the following optional parameters for the Ground
- * @param options.xmin ground minimum X coordinate, default -1
- * @param options.zmin ground minimum Z coordinate, default -1
- * @param options.xmax ground maximum X coordinate, default 1
- * @param options.zmax ground maximum Z coordinate, default 1
- * @param options.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}
- * @param options.subdivisions.w positive integer, default 6
- * @param options.subdivisions.h positive integer, default 6
- * @param options.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}
- * @param options.precision.w positive integer, default 2
- * @param options.precision.h positive integer, default 2
- * @returns the VertexData of the TiledGround
- */
- export declare function CreateTiledGroundVertexData(options: {
- xmin: number;
- zmin: number;
- xmax: number;
- zmax: number;
- subdivisions?: {
- w: number;
- h: number;
- };
- precision?: {
- w: number;
- h: number;
- };
- }): VertexData;
- /**
- * Creates the VertexData of the Ground designed from a heightmap
- * @param options an object used to set the following parameters for the Ground, required and provided by CreateGroundFromHeightMap
- * @param options.width the width (x direction) of the ground
- * @param options.height the height (z direction) of the ground
- * @param options.subdivisions the number of subdivisions per side
- * @param options.minHeight the minimum altitude on the ground, optional, default 0
- * @param options.maxHeight the maximum altitude on the ground, optional default 1
- * @param options.colorFilter the filter to apply to the image pixel colors to compute the height, optional Color3, default (0.3, 0.59, 0.11)
- * @param options.buffer the array holding the image color data
- * @param options.bufferWidth the width of image
- * @param options.bufferHeight the height of image
- * @param options.alphaFilter Remove any data where the alpha channel is below this value, defaults 0 (all data visible)
- * @param options.heightBuffer a array of floats where the height data can be saved, if its length is greater than zero.
- * @returns the VertexData of the Ground designed from a heightmap
- */
- export declare function CreateGroundFromHeightMapVertexData(options: {
- width: number;
- height: number;
- subdivisions: number;
- minHeight: number;
- maxHeight: number;
- colorFilter: Color3;
- buffer: Uint8Array;
- bufferWidth: number;
- bufferHeight: number;
- alphaFilter: number;
- heightBuffer?: Float32Array;
- }): VertexData;
- /**
- * Creates a ground mesh
- * @param name defines the name of the mesh
- * @param options defines the options used to create the mesh
- * @param options.width set the width size (float, default 1)
- * @param options.height set the height size (float, default 1)
- * @param options.subdivisions sets the number of subdivision per side (default 1)
- * @param options.subdivisionsX sets the number of subdivision on the X axis (overrides subdivisions)
- * @param options.subdivisionsY sets the number of subdivision on the Y axis (overrides subdivisions)
- * @param options.updatable defines if the mesh must be flagged as updatable (default false)
- * @param scene defines the hosting scene
- * @returns the ground mesh
- * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#ground
- */
- export declare function CreateGround(name: string, options?: {
- width?: number;
- height?: number;
- subdivisions?: number;
- subdivisionsX?: number;
- subdivisionsY?: number;
- updatable?: boolean;
- }, scene?: Scene): GroundMesh;
- /**
- * Creates a tiled ground mesh
- * @param name defines the name of the mesh
- * @param options defines the options used to create the mesh
- * @param options.xmin ground minimum X coordinate (float, default -1)
- * @param options.zmin ground minimum Z coordinate (float, default -1)
- * @param options.xmax ground maximum X coordinate (float, default 1)
- * @param options.zmax ground maximum Z coordinate (float, default 1)
- * @param options.subdivisions 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
- * @param options.subdivisions.w positive integer, default 6
- * @param options.subdivisions.h positive integer, default 6
- * @param options.precision 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
- * @param options.precision.w positive integer, default 2
- * @param options.precision.h positive integer, default 2
- * @param options.updatable boolean, default false, true if the mesh must be flagged as updatable
- * @param scene defines the hosting scene
- * @returns the tiled ground mesh
- * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#tiled-ground
- */
- export declare function CreateTiledGround(name: string, options: {
- xmin: number;
- zmin: number;
- xmax: number;
- zmax: number;
- subdivisions?: {
- w: number;
- h: number;
- };
- precision?: {
- w: number;
- h: number;
- };
- updatable?: boolean;
- }, scene?: Nullable<Scene>): Mesh;
- /**
- * Creates a ground mesh from a height map. The height map download can take some frames,
- * so the mesh is not immediately ready. To wait for the mesh to be completely built,
- * you should use the `onReady` callback option.
- * @param name defines the name of the mesh
- * @param url sets the URL of the height map image resource.
- * @param options defines the options used to create the mesh
- * @param options.width sets the ground width size (positive float, default 10)
- * @param options.height sets the ground height size (positive float, default 10)
- * @param options.subdivisions sets the number of subdivision per side (positive integer, default 1)
- * @param options.minHeight is the minimum altitude on the ground (float, default 0)
- * @param options.maxHeight is the maximum altitude on the ground (float, default 1)
- * @param options.colorFilter is the filter to apply to the image pixel colors to compute the height (optional Color3, default (0.3, 0.59, 0.11) )
- * @param options.alphaFilter will filter any data where the alpha channel is below this value, defaults 0 (all data visible)
- * @param options.updatable defines if the mesh must be flagged as updatable
- * @param options.onReady is a javascript callback function that will be called once the mesh is just built (the height map download can last some time)
- * @param options.onError is a javascript callback function that will be called if there is an error
- * @param options.passHeightBufferInCallback a boolean that indicates if the calculated height data will be passed in the onReady callback. Useful if you need the height data for physics, for example.
- * @param scene defines the hosting scene
- * @returns the ground mesh
- * @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
- */
- export declare function CreateGroundFromHeightMap(name: string, url: string | {
- data: Uint8Array;
- width: number;
- height: number;
- }, options?: {
- width?: number;
- height?: number;
- subdivisions?: number;
- minHeight?: number;
- maxHeight?: number;
- colorFilter?: Color3;
- alphaFilter?: number;
- updatable?: boolean;
- onReady?: (mesh: GroundMesh, heightBuffer?: Float32Array) => void;
- onError?: (message?: string, exception?: any) => void;
- passHeightBufferInCallback?: boolean;
- }, scene?: Nullable<Scene>): GroundMesh;
- /**
- * Class containing static functions to help procedurally build meshes
- * @deprecated use the functions directly from the module
- */
- export declare const GroundBuilder: {
- CreateGround: typeof CreateGround;
- CreateGroundFromHeightMap: typeof CreateGroundFromHeightMap;
- CreateTiledGround: typeof CreateTiledGround;
- };
|