mesh.d.ts 78 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453
  1. import { Observable } from "../Misc/observable";
  2. import type { IAnimatable } from "../Animations/animatable.interface";
  3. import type { Nullable, FloatArray, IndicesArray } from "../types";
  4. import { Camera } from "../Cameras/camera";
  5. import type { Scene } from "../scene";
  6. import type { Vector4 } from "../Maths/math.vector";
  7. import { Matrix, Vector3, Vector2 } from "../Maths/math.vector";
  8. import type { Color4 } from "../Maths/math.color";
  9. import { Node } from "../node";
  10. import { VertexBuffer, Buffer } from "../Buffers/buffer";
  11. import type { IGetSetVerticesData } from "./mesh.vertexData";
  12. import { Geometry } from "./geometry";
  13. import { AbstractMesh } from "./abstractMesh";
  14. import { SubMesh } from "./subMesh";
  15. import type { BoundingSphere } from "../Culling/boundingSphere";
  16. import type { Effect } from "../Materials/effect";
  17. import { Material } from "../Materials/material";
  18. import type { Skeleton } from "../Bones/skeleton";
  19. import { MeshLODLevel } from "./meshLODLevel";
  20. import type { Path3D } from "../Maths/math.path";
  21. import type { Plane } from "../Maths/math.plane";
  22. import type { TransformNode } from "./transformNode";
  23. import type { GoldbergMesh } from "./goldbergMesh";
  24. import type { InstancedMesh } from "./instancedMesh";
  25. import type { IPhysicsEnabledObject, PhysicsImpostor } from "../Physics/v1/physicsImpostor";
  26. import type { ICreateCapsuleOptions } from "./Builders/capsuleBuilder";
  27. import type { LinesMesh } from "./linesMesh";
  28. import type { GroundMesh } from "./groundMesh";
  29. import type { DataBuffer } from "../Buffers/dataBuffer.js";
  30. import type { AbstractEngine } from "../Engines/abstractEngine.js";
  31. /**
  32. * @internal
  33. **/
  34. export declare class _CreationDataStorage {
  35. closePath?: boolean;
  36. closeArray?: boolean;
  37. idx: number[];
  38. dashSize: number;
  39. gapSize: number;
  40. path3D: Path3D;
  41. pathArray: Vector3[][];
  42. arc: number;
  43. radius: number;
  44. cap: number;
  45. tessellation: number;
  46. }
  47. /**
  48. * @internal
  49. **/
  50. declare class _InstanceDataStorage {
  51. visibleInstances: any;
  52. batchCache: _InstancesBatch;
  53. batchCacheReplacementModeInFrozenMode: _InstancesBatch;
  54. instancesBufferSize: number;
  55. instancesBuffer: Nullable<Buffer>;
  56. instancesPreviousBuffer: Nullable<Buffer>;
  57. instancesData: Float32Array;
  58. instancesPreviousData: Float32Array;
  59. overridenInstanceCount: number;
  60. isFrozen: boolean;
  61. forceMatrixUpdates: boolean;
  62. previousBatch: Nullable<_InstancesBatch>;
  63. hardwareInstancedRendering: boolean;
  64. sideOrientation: number;
  65. manualUpdate: boolean;
  66. previousManualUpdate: boolean;
  67. previousRenderId: number;
  68. masterMeshPreviousWorldMatrix: Nullable<Matrix>;
  69. }
  70. /**
  71. * @internal
  72. **/
  73. export declare class _InstancesBatch {
  74. mustReturn: boolean;
  75. visibleInstances: Nullable<InstancedMesh[]>[];
  76. renderSelf: boolean[];
  77. hardwareInstancedRendering: boolean[];
  78. }
  79. /**
  80. * @internal
  81. **/
  82. declare class _ThinInstanceDataStorage {
  83. instancesCount: number;
  84. matrixBuffer: Nullable<Buffer>;
  85. previousMatrixBuffer: Nullable<Buffer>;
  86. matrixBufferSize: number;
  87. matrixData: Nullable<Float32Array>;
  88. previousMatrixData: Nullable<Float32Array>;
  89. boundingVectors: Array<Vector3>;
  90. worldMatrices: Nullable<Matrix[]>;
  91. masterMeshPreviousWorldMatrix: Nullable<Matrix>;
  92. }
  93. /**
  94. * Class used to represent renderable models
  95. */
  96. export declare class Mesh extends AbstractMesh implements IGetSetVerticesData {
  97. /**
  98. * Mesh side orientation : usually the external or front surface
  99. */
  100. static readonly FRONTSIDE = 0;
  101. /**
  102. * Mesh side orientation : usually the internal or back surface
  103. */
  104. static readonly BACKSIDE = 1;
  105. /**
  106. * Mesh side orientation : both internal and external or front and back surfaces
  107. */
  108. static readonly DOUBLESIDE = 2;
  109. /**
  110. * Mesh side orientation : by default, `FRONTSIDE`
  111. */
  112. static readonly DEFAULTSIDE = 0;
  113. /**
  114. * Mesh cap setting : no cap
  115. */
  116. static readonly NO_CAP = 0;
  117. /**
  118. * Mesh cap setting : one cap at the beginning of the mesh
  119. */
  120. static readonly CAP_START = 1;
  121. /**
  122. * Mesh cap setting : one cap at the end of the mesh
  123. */
  124. static readonly CAP_END = 2;
  125. /**
  126. * Mesh cap setting : two caps, one at the beginning and one at the end of the mesh
  127. */
  128. static readonly CAP_ALL = 3;
  129. /**
  130. * Mesh pattern setting : no flip or rotate
  131. */
  132. static readonly NO_FLIP = 0;
  133. /**
  134. * Mesh pattern setting : flip (reflect in y axis) alternate tiles on each row or column
  135. */
  136. static readonly FLIP_TILE = 1;
  137. /**
  138. * Mesh pattern setting : rotate (180degs) alternate tiles on each row or column
  139. */
  140. static readonly ROTATE_TILE = 2;
  141. /**
  142. * Mesh pattern setting : flip (reflect in y axis) all tiles on alternate rows
  143. */
  144. static readonly FLIP_ROW = 3;
  145. /**
  146. * Mesh pattern setting : rotate (180degs) all tiles on alternate rows
  147. */
  148. static readonly ROTATE_ROW = 4;
  149. /**
  150. * Mesh pattern setting : flip and rotate alternate tiles on each row or column
  151. */
  152. static readonly FLIP_N_ROTATE_TILE = 5;
  153. /**
  154. * Mesh pattern setting : rotate pattern and rotate
  155. */
  156. static readonly FLIP_N_ROTATE_ROW = 6;
  157. /**
  158. * Mesh tile positioning : part tiles same on left/right or top/bottom
  159. */
  160. static readonly CENTER = 0;
  161. /**
  162. * Mesh tile positioning : part tiles on left
  163. */
  164. static readonly LEFT = 1;
  165. /**
  166. * Mesh tile positioning : part tiles on right
  167. */
  168. static readonly RIGHT = 2;
  169. /**
  170. * Mesh tile positioning : part tiles on top
  171. */
  172. static readonly TOP = 3;
  173. /**
  174. * Mesh tile positioning : part tiles on bottom
  175. */
  176. static readonly BOTTOM = 4;
  177. /**
  178. * Indicates that the instanced meshes should be sorted from back to front before rendering if their material is transparent
  179. */
  180. static INSTANCEDMESH_SORT_TRANSPARENT: boolean;
  181. /**
  182. * Gets the default side orientation.
  183. * @param orientation the orientation to value to attempt to get
  184. * @returns the default orientation
  185. * @internal
  186. */
  187. static _GetDefaultSideOrientation(orientation?: number): number;
  188. private _internalMeshDataInfo;
  189. /**
  190. * Determines if the LOD levels are intended to be calculated using screen coverage (surface area ratio) instead of distance.
  191. */
  192. get useLODScreenCoverage(): boolean;
  193. set useLODScreenCoverage(value: boolean);
  194. /**
  195. * Will notify when the mesh is completely ready, including materials.
  196. * Observers added to this observable will be removed once triggered
  197. */
  198. onMeshReadyObservable: Observable<Mesh>;
  199. get computeBonesUsingShaders(): boolean;
  200. set computeBonesUsingShaders(value: boolean);
  201. /**
  202. * An event triggered before rendering the mesh
  203. */
  204. get onBeforeRenderObservable(): Observable<Mesh>;
  205. /**
  206. * An event triggered before binding the mesh
  207. */
  208. get onBeforeBindObservable(): Observable<Mesh>;
  209. /**
  210. * An event triggered after rendering the mesh
  211. */
  212. get onAfterRenderObservable(): Observable<Mesh>;
  213. /**
  214. * An event triggeredbetween rendering pass when using separateCullingPass = true
  215. */
  216. get onBetweenPassObservable(): Observable<SubMesh>;
  217. /**
  218. * An event triggered before drawing the mesh
  219. */
  220. get onBeforeDrawObservable(): Observable<Mesh>;
  221. private _onBeforeDrawObserver;
  222. /**
  223. * Sets a callback to call before drawing the mesh. It is recommended to use onBeforeDrawObservable instead
  224. */
  225. set onBeforeDraw(callback: () => void);
  226. get hasInstances(): boolean;
  227. get hasThinInstances(): boolean;
  228. /**
  229. * Gets the delay loading state of the mesh (when delay loading is turned on)
  230. * @see https://doc.babylonjs.com/features/featuresDeepDive/importers/incrementalLoading
  231. */
  232. delayLoadState: number;
  233. /**
  234. * Gets the list of instances created from this mesh
  235. * it is not supposed to be modified manually.
  236. * Note also that the order of the InstancedMesh wihin the array is not significant and might change.
  237. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/copies/instances
  238. */
  239. instances: InstancedMesh[];
  240. /**
  241. * Gets the file containing delay loading data for this mesh
  242. */
  243. delayLoadingFile: string;
  244. /** @internal */
  245. _binaryInfo: any;
  246. /**
  247. * User defined function used to change how LOD level selection is done
  248. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/LOD
  249. */
  250. onLODLevelSelection: (distance: number, mesh: Mesh, selectedLevel: Nullable<Mesh>) => void;
  251. /** @internal */
  252. _creationDataStorage: Nullable<_CreationDataStorage>;
  253. /** @internal */
  254. _geometry: Nullable<Geometry>;
  255. /** @internal */
  256. _delayInfo: Array<string>;
  257. /** @internal */
  258. _delayLoadingFunction: (any: any, mesh: Mesh) => void;
  259. /**
  260. * Gets or sets the forced number of instances to display.
  261. * If 0 (default value), the number of instances is not forced and depends on the draw type
  262. * (regular / instance / thin instances mesh)
  263. */
  264. get forcedInstanceCount(): number;
  265. set forcedInstanceCount(count: number);
  266. /** @internal */
  267. _instanceDataStorage: _InstanceDataStorage;
  268. /** @internal */
  269. _thinInstanceDataStorage: _ThinInstanceDataStorage;
  270. /** @internal */
  271. _shouldGenerateFlatShading: boolean;
  272. /** @internal */
  273. _originalBuilderSideOrientation: number;
  274. /**
  275. * Use this property to change the original side orientation defined at construction time
  276. */
  277. overrideMaterialSideOrientation: Nullable<number>;
  278. /**
  279. * Use this property to override the Material's fillMode value
  280. */
  281. get overrideRenderingFillMode(): Nullable<number>;
  282. set overrideRenderingFillMode(fillMode: Nullable<number>);
  283. /**
  284. * Gets or sets a boolean indicating whether to render ignoring the active camera's max z setting. (false by default)
  285. * You should not mix meshes that have this property set to true with meshes that have it set to false if they all write
  286. * to the depth buffer, because the z-values are not comparable in the two cases and you will get rendering artifacts if you do.
  287. * You can set the property to true for meshes that do not write to the depth buffer, or set the same value (either false or true) otherwise.
  288. * Note this will reduce performance when set to true.
  289. */
  290. ignoreCameraMaxZ: boolean;
  291. /**
  292. * Gets the source mesh (the one used to clone this one from)
  293. */
  294. get source(): Nullable<Mesh>;
  295. /**
  296. * Gets the list of clones of this mesh
  297. * The scene must have been constructed with useClonedMeshMap=true for this to work!
  298. * Note that useClonedMeshMap=true is the default setting
  299. */
  300. get cloneMeshMap(): Nullable<{
  301. [id: string]: Mesh | undefined;
  302. }>;
  303. /**
  304. * Gets or sets a boolean indicating that this mesh does not use index buffer
  305. */
  306. get isUnIndexed(): boolean;
  307. set isUnIndexed(value: boolean);
  308. /** Gets the array buffer used to store the instanced buffer used for instances' world matrices */
  309. get worldMatrixInstancedBuffer(): Float32Array;
  310. /** Gets the array buffer used to store the instanced buffer used for instances' previous world matrices */
  311. get previousWorldMatrixInstancedBuffer(): Float32Array;
  312. /** Gets or sets a boolean indicating that the update of the instance buffer of the world matrices is manual */
  313. get manualUpdateOfWorldMatrixInstancedBuffer(): boolean;
  314. set manualUpdateOfWorldMatrixInstancedBuffer(value: boolean);
  315. /** Gets or sets a boolean indicating that the update of the instance buffer of the world matrices is manual */
  316. get manualUpdateOfPreviousWorldMatrixInstancedBuffer(): boolean;
  317. set manualUpdateOfPreviousWorldMatrixInstancedBuffer(value: boolean);
  318. /** Gets or sets a boolean indicating that the update of the instance buffer of the world matrices must be performed in all cases (and notably even in frozen mode) */
  319. get forceWorldMatrixInstancedBufferUpdate(): boolean;
  320. set forceWorldMatrixInstancedBufferUpdate(value: boolean);
  321. /**
  322. * @constructor
  323. * @param name The value used by scene.getMeshByName() to do a lookup.
  324. * @param scene The scene to add this mesh to.
  325. * @param parent The parent of this mesh, if it has one
  326. * @param source An optional Mesh from which geometry is shared, cloned.
  327. * @param doNotCloneChildren When cloning, skip cloning child meshes of source, default False.
  328. * When false, achieved by calling a clone(), also passing False.
  329. * This will make creation of children, recursive.
  330. * @param clonePhysicsImpostor When cloning, include cloning mesh physics impostor, default True.
  331. */
  332. constructor(name: string, scene?: Nullable<Scene>, parent?: Nullable<Node>, source?: Nullable<Mesh>, doNotCloneChildren?: boolean, clonePhysicsImpostor?: boolean);
  333. instantiateHierarchy(newParent?: Nullable<TransformNode>, options?: {
  334. doNotInstantiate: boolean | ((node: TransformNode) => boolean);
  335. }, onNewNodeCreated?: (source: TransformNode, clone: TransformNode) => void): Nullable<TransformNode>;
  336. /**
  337. * Gets the class name
  338. * @returns the string "Mesh".
  339. */
  340. getClassName(): string;
  341. /** @internal */
  342. get _isMesh(): boolean;
  343. /**
  344. * Returns a description of this mesh
  345. * @param fullDetails define if full details about this mesh must be used
  346. * @returns a descriptive string representing this mesh
  347. */
  348. toString(fullDetails?: boolean): string;
  349. /** @internal */
  350. _unBindEffect(): void;
  351. /**
  352. * Gets a boolean indicating if this mesh has LOD
  353. */
  354. get hasLODLevels(): boolean;
  355. /**
  356. * Gets the list of MeshLODLevel associated with the current mesh
  357. * @returns an array of MeshLODLevel
  358. */
  359. getLODLevels(): MeshLODLevel[];
  360. private _sortLODLevels;
  361. /**
  362. * Add a mesh as LOD level triggered at the given distance.
  363. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/LOD
  364. * @param distanceOrScreenCoverage Either distance from the center of the object to show this level or the screen coverage if `useScreenCoverage` is set to `true`.
  365. * If screen coverage, value is a fraction of the screen's total surface, between 0 and 1.
  366. * Example Playground for distance https://playground.babylonjs.com/#QE7KM#197
  367. * Example Playground for screen coverage https://playground.babylonjs.com/#QE7KM#196
  368. * @param mesh The mesh to be added as LOD level (can be null)
  369. * @returns This mesh (for chaining)
  370. */
  371. addLODLevel(distanceOrScreenCoverage: number, mesh: Nullable<Mesh>): Mesh;
  372. /**
  373. * Returns the LOD level mesh at the passed distance or null if not found.
  374. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/LOD
  375. * @param distance The distance from the center of the object to show this level
  376. * @returns a Mesh or `null`
  377. */
  378. getLODLevelAtDistance(distance: number): Nullable<Mesh>;
  379. /**
  380. * Remove a mesh from the LOD array
  381. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/LOD
  382. * @param mesh defines the mesh to be removed
  383. * @returns This mesh (for chaining)
  384. */
  385. removeLODLevel(mesh: Nullable<Mesh>): Mesh;
  386. /**
  387. * Returns the registered LOD mesh distant from the parameter `camera` position if any, else returns the current mesh.
  388. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/LOD
  389. * @param camera defines the camera to use to compute distance
  390. * @param boundingSphere defines a custom bounding sphere to use instead of the one from this mesh
  391. * @returns This mesh (for chaining)
  392. */
  393. getLOD(camera: Camera, boundingSphere?: BoundingSphere): Nullable<AbstractMesh>;
  394. /**
  395. * Gets the mesh internal Geometry object
  396. */
  397. get geometry(): Nullable<Geometry>;
  398. /**
  399. * Returns the total number of vertices within the mesh geometry or zero if the mesh has no geometry.
  400. * @returns the total number of vertices
  401. */
  402. getTotalVertices(): number;
  403. /**
  404. * Returns the content of an associated vertex buffer
  405. * @param kind defines which buffer to read from (positions, indices, normals, etc). Possible `kind` values :
  406. * - VertexBuffer.PositionKind
  407. * - VertexBuffer.UVKind
  408. * - VertexBuffer.UV2Kind
  409. * - VertexBuffer.UV3Kind
  410. * - VertexBuffer.UV4Kind
  411. * - VertexBuffer.UV5Kind
  412. * - VertexBuffer.UV6Kind
  413. * - VertexBuffer.ColorKind
  414. * - VertexBuffer.MatricesIndicesKind
  415. * - VertexBuffer.MatricesIndicesExtraKind
  416. * - VertexBuffer.MatricesWeightsKind
  417. * - VertexBuffer.MatricesWeightsExtraKind
  418. * @param copyWhenShared defines a boolean indicating that if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one
  419. * @param forceCopy defines a boolean forcing the copy of the buffer no matter what the value of copyWhenShared is
  420. * @param bypassInstanceData defines a boolean indicating that the function should not take into account the instance data (applies only if the mesh has instances). Default: false
  421. * @returns a FloatArray or null if the mesh has no geometry or no vertex buffer for this kind.
  422. */
  423. getVerticesData(kind: string, copyWhenShared?: boolean, forceCopy?: boolean, bypassInstanceData?: boolean): Nullable<FloatArray>;
  424. /**
  425. * Returns the mesh VertexBuffer object from the requested `kind`
  426. * @param kind defines which buffer to read from (positions, indices, normals, etc). Possible `kind` values :
  427. * - VertexBuffer.PositionKind
  428. * - VertexBuffer.NormalKind
  429. * - VertexBuffer.UVKind
  430. * - VertexBuffer.UV2Kind
  431. * - VertexBuffer.UV3Kind
  432. * - VertexBuffer.UV4Kind
  433. * - VertexBuffer.UV5Kind
  434. * - VertexBuffer.UV6Kind
  435. * - VertexBuffer.ColorKind
  436. * - VertexBuffer.MatricesIndicesKind
  437. * - VertexBuffer.MatricesIndicesExtraKind
  438. * - VertexBuffer.MatricesWeightsKind
  439. * - VertexBuffer.MatricesWeightsExtraKind
  440. * @param bypassInstanceData defines a boolean indicating that the function should not take into account the instance data (applies only if the mesh has instances). Default: false
  441. * @returns a FloatArray or null if the mesh has no vertex buffer for this kind.
  442. */
  443. getVertexBuffer(kind: string, bypassInstanceData?: boolean): Nullable<VertexBuffer>;
  444. /**
  445. * Tests if a specific vertex buffer is associated with this mesh
  446. * @param kind defines which buffer to check (positions, indices, normals, etc). Possible `kind` values :
  447. * - VertexBuffer.PositionKind
  448. * - VertexBuffer.NormalKind
  449. * - VertexBuffer.UVKind
  450. * - VertexBuffer.UV2Kind
  451. * - VertexBuffer.UV3Kind
  452. * - VertexBuffer.UV4Kind
  453. * - VertexBuffer.UV5Kind
  454. * - VertexBuffer.UV6Kind
  455. * - VertexBuffer.ColorKind
  456. * - VertexBuffer.MatricesIndicesKind
  457. * - VertexBuffer.MatricesIndicesExtraKind
  458. * - VertexBuffer.MatricesWeightsKind
  459. * - VertexBuffer.MatricesWeightsExtraKind
  460. * @param bypassInstanceData defines a boolean indicating that the function should not take into account the instance data (applies only if the mesh has instances). Default: false
  461. * @returns a boolean
  462. */
  463. isVerticesDataPresent(kind: string, bypassInstanceData?: boolean): boolean;
  464. /**
  465. * Returns a boolean defining if the vertex data for the requested `kind` is updatable.
  466. * @param kind defines which buffer to check (positions, indices, normals, etc). Possible `kind` values :
  467. * - VertexBuffer.PositionKind
  468. * - VertexBuffer.UVKind
  469. * - VertexBuffer.UV2Kind
  470. * - VertexBuffer.UV3Kind
  471. * - VertexBuffer.UV4Kind
  472. * - VertexBuffer.UV5Kind
  473. * - VertexBuffer.UV6Kind
  474. * - VertexBuffer.ColorKind
  475. * - VertexBuffer.MatricesIndicesKind
  476. * - VertexBuffer.MatricesIndicesExtraKind
  477. * - VertexBuffer.MatricesWeightsKind
  478. * - VertexBuffer.MatricesWeightsExtraKind
  479. * @param bypassInstanceData defines a boolean indicating that the function should not take into account the instance data (applies only if the mesh has instances). Default: false
  480. * @returns a boolean
  481. */
  482. isVertexBufferUpdatable(kind: string, bypassInstanceData?: boolean): boolean;
  483. /**
  484. * Returns a string which contains the list of existing `kinds` of Vertex Data associated with this mesh.
  485. * @param bypassInstanceData defines a boolean indicating that the function should not take into account the instance data (applies only if the mesh has instances). Default: false
  486. * @returns an array of strings
  487. */
  488. getVerticesDataKinds(bypassInstanceData?: boolean): string[];
  489. /**
  490. * Returns a positive integer : the total number of indices in this mesh geometry.
  491. * @returns the numner of indices or zero if the mesh has no geometry.
  492. */
  493. getTotalIndices(): number;
  494. /**
  495. * Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array) populated with the mesh indices.
  496. * @param copyWhenShared If true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.
  497. * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it
  498. * @returns the indices array or an empty array if the mesh has no geometry
  499. */
  500. getIndices(copyWhenShared?: boolean, forceCopy?: boolean): Nullable<IndicesArray>;
  501. get isBlocked(): boolean;
  502. /**
  503. * Determine if the current mesh is ready to be rendered
  504. * @param completeCheck defines if a complete check (including materials and lights) has to be done (false by default)
  505. * @param forceInstanceSupport will check if the mesh will be ready when used with instances (false by default)
  506. * @returns true if all associated assets are ready (material, textures, shaders)
  507. */
  508. isReady(completeCheck?: boolean, forceInstanceSupport?: boolean): boolean;
  509. /**
  510. * Gets a boolean indicating if the normals aren't to be recomputed on next mesh `positions` array update. This property is pertinent only for updatable parametric shapes.
  511. */
  512. get areNormalsFrozen(): boolean;
  513. /**
  514. * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc. It has no effect at all on other shapes. It prevents the mesh normals from being recomputed on next `positions` array update.
  515. * @returns the current mesh
  516. */
  517. freezeNormals(): Mesh;
  518. /**
  519. * This function affects parametric shapes on vertex position update only : ribbons, tubes, etc. It has no effect at all on other shapes. It reactivates the mesh normals computation if it was previously frozen
  520. * @returns the current mesh
  521. */
  522. unfreezeNormals(): Mesh;
  523. /**
  524. * Sets a value overriding the instance count. Only applicable when custom instanced InterleavedVertexBuffer are used rather than InstancedMeshs
  525. */
  526. set overridenInstanceCount(count: number);
  527. /** @internal */
  528. _preActivate(): Mesh;
  529. /**
  530. * @internal
  531. */
  532. _preActivateForIntermediateRendering(renderId: number): Mesh;
  533. /**
  534. * @internal
  535. */
  536. _registerInstanceForRenderId(instance: InstancedMesh, renderId: number): Mesh;
  537. protected _afterComputeWorldMatrix(): void;
  538. /** @internal */
  539. _postActivate(): void;
  540. /**
  541. * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.
  542. * This means the mesh underlying bounding box and sphere are recomputed.
  543. * @param applySkeleton defines whether to apply the skeleton before computing the bounding info
  544. * @param applyMorph defines whether to apply the morph target before computing the bounding info
  545. * @returns the current mesh
  546. */
  547. refreshBoundingInfo(applySkeleton?: boolean, applyMorph?: boolean): Mesh;
  548. /**
  549. * @internal
  550. */
  551. _createGlobalSubMesh(force: boolean): Nullable<SubMesh>;
  552. /**
  553. * This function will subdivide the mesh into multiple submeshes
  554. * @param count defines the expected number of submeshes
  555. */
  556. subdivide(count: number): void;
  557. /**
  558. * Copy a FloatArray into a specific associated vertex buffer
  559. * @param kind defines which buffer to write to (positions, indices, normals, etc). Possible `kind` values :
  560. * - VertexBuffer.PositionKind
  561. * - VertexBuffer.UVKind
  562. * - VertexBuffer.UV2Kind
  563. * - VertexBuffer.UV3Kind
  564. * - VertexBuffer.UV4Kind
  565. * - VertexBuffer.UV5Kind
  566. * - VertexBuffer.UV6Kind
  567. * - VertexBuffer.ColorKind
  568. * - VertexBuffer.MatricesIndicesKind
  569. * - VertexBuffer.MatricesIndicesExtraKind
  570. * - VertexBuffer.MatricesWeightsKind
  571. * - VertexBuffer.MatricesWeightsExtraKind
  572. * @param data defines the data source
  573. * @param updatable defines if the updated vertex buffer must be flagged as updatable
  574. * @param stride defines the data stride size (can be null)
  575. * @returns the current mesh
  576. */
  577. setVerticesData(kind: string, data: FloatArray, updatable?: boolean, stride?: number): AbstractMesh;
  578. /**
  579. * Delete a vertex buffer associated with this mesh
  580. * @param kind defines which buffer to delete (positions, indices, normals, etc). Possible `kind` values :
  581. * - VertexBuffer.PositionKind
  582. * - VertexBuffer.UVKind
  583. * - VertexBuffer.UV2Kind
  584. * - VertexBuffer.UV3Kind
  585. * - VertexBuffer.UV4Kind
  586. * - VertexBuffer.UV5Kind
  587. * - VertexBuffer.UV6Kind
  588. * - VertexBuffer.ColorKind
  589. * - VertexBuffer.MatricesIndicesKind
  590. * - VertexBuffer.MatricesIndicesExtraKind
  591. * - VertexBuffer.MatricesWeightsKind
  592. * - VertexBuffer.MatricesWeightsExtraKind
  593. */
  594. removeVerticesData(kind: string): void;
  595. /**
  596. * Flags an associated vertex buffer as updatable
  597. * @param kind defines which buffer to use (positions, indices, normals, etc). Possible `kind` values :
  598. * - VertexBuffer.PositionKind
  599. * - VertexBuffer.UVKind
  600. * - VertexBuffer.UV2Kind
  601. * - VertexBuffer.UV3Kind
  602. * - VertexBuffer.UV4Kind
  603. * - VertexBuffer.UV5Kind
  604. * - VertexBuffer.UV6Kind
  605. * - VertexBuffer.ColorKind
  606. * - VertexBuffer.MatricesIndicesKind
  607. * - VertexBuffer.MatricesIndicesExtraKind
  608. * - VertexBuffer.MatricesWeightsKind
  609. * - VertexBuffer.MatricesWeightsExtraKind
  610. * @param updatable defines if the updated vertex buffer must be flagged as updatable
  611. */
  612. markVerticesDataAsUpdatable(kind: string, updatable?: boolean): void;
  613. /**
  614. * Sets the mesh global Vertex Buffer
  615. * @param buffer defines the buffer to use
  616. * @param disposeExistingBuffer disposes the existing buffer, if any (default: true)
  617. * @returns the current mesh
  618. */
  619. setVerticesBuffer(buffer: VertexBuffer, disposeExistingBuffer?: boolean): Mesh;
  620. /**
  621. * Update a specific associated vertex buffer
  622. * @param kind defines which buffer to write to (positions, indices, normals, etc). Possible `kind` values :
  623. * - VertexBuffer.PositionKind
  624. * - VertexBuffer.UVKind
  625. * - VertexBuffer.UV2Kind
  626. * - VertexBuffer.UV3Kind
  627. * - VertexBuffer.UV4Kind
  628. * - VertexBuffer.UV5Kind
  629. * - VertexBuffer.UV6Kind
  630. * - VertexBuffer.ColorKind
  631. * - VertexBuffer.MatricesIndicesKind
  632. * - VertexBuffer.MatricesIndicesExtraKind
  633. * - VertexBuffer.MatricesWeightsKind
  634. * - VertexBuffer.MatricesWeightsExtraKind
  635. * @param data defines the data source
  636. * @param updateExtends defines if extends info of the mesh must be updated (can be null). This is mostly useful for "position" kind
  637. * @param makeItUnique defines if the geometry associated with the mesh must be cloned to make the change only for this mesh (and not all meshes associated with the same geometry)
  638. * @returns the current mesh
  639. */
  640. updateVerticesData(kind: string, data: FloatArray, updateExtends?: boolean, makeItUnique?: boolean): AbstractMesh;
  641. /**
  642. * This method updates the vertex positions of an updatable mesh according to the `positionFunction` returned values.
  643. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#other-shapes-updatemeshpositions
  644. * @param positionFunction is a simple JS function what is passed the mesh `positions` array. It doesn't need to return anything
  645. * @param computeNormals is a boolean (default true) to enable/disable the mesh normal recomputation after the vertex position update
  646. * @returns the current mesh
  647. */
  648. updateMeshPositions(positionFunction: (data: FloatArray) => void, computeNormals?: boolean): Mesh;
  649. /**
  650. * Creates a un-shared specific occurence of the geometry for the mesh.
  651. * @returns the current mesh
  652. */
  653. makeGeometryUnique(): Mesh;
  654. /**
  655. * Sets the index buffer of this mesh.
  656. * @param indexBuffer Defines the index buffer to use for this mesh
  657. * @param totalVertices Defines the total number of vertices used by the buffer
  658. * @param totalIndices Defines the total number of indices in the index buffer
  659. */
  660. setIndexBuffer(indexBuffer: DataBuffer, totalVertices: number, totalIndices: number): void;
  661. /**
  662. * Set the index buffer of this mesh
  663. * @param indices defines the source data
  664. * @param totalVertices defines the total number of vertices referenced by this index data (can be null)
  665. * @param updatable defines if the updated index buffer must be flagged as updatable (default is false)
  666. * @returns the current mesh
  667. */
  668. setIndices(indices: IndicesArray, totalVertices?: Nullable<number>, updatable?: boolean): AbstractMesh;
  669. /**
  670. * Update the current index buffer
  671. * @param indices defines the source data
  672. * @param offset defines the offset in the index buffer where to store the new data (can be null)
  673. * @param gpuMemoryOnly defines a boolean indicating that only the GPU memory must be updated leaving the CPU version of the indices unchanged (false by default)
  674. * @returns the current mesh
  675. */
  676. updateIndices(indices: IndicesArray, offset?: number, gpuMemoryOnly?: boolean): AbstractMesh;
  677. /**
  678. * Invert the geometry to move from a right handed system to a left handed one.
  679. * @returns the current mesh
  680. */
  681. toLeftHanded(): Mesh;
  682. /**
  683. * @internal
  684. */
  685. _bind(subMesh: SubMesh, effect: Effect, fillMode: number, allowInstancedRendering?: boolean): Mesh;
  686. /**
  687. * @internal
  688. */
  689. _draw(subMesh: SubMesh, fillMode: number, instancesCount?: number): Mesh;
  690. /**
  691. * Registers for this mesh a javascript function called just before the rendering process
  692. * @param func defines the function to call before rendering this mesh
  693. * @returns the current mesh
  694. */
  695. registerBeforeRender(func: (mesh: AbstractMesh) => void): Mesh;
  696. /**
  697. * Disposes a previously registered javascript function called before the rendering
  698. * @param func defines the function to remove
  699. * @returns the current mesh
  700. */
  701. unregisterBeforeRender(func: (mesh: AbstractMesh) => void): Mesh;
  702. /**
  703. * Registers for this mesh a javascript function called just after the rendering is complete
  704. * @param func defines the function to call after rendering this mesh
  705. * @returns the current mesh
  706. */
  707. registerAfterRender(func: (mesh: AbstractMesh) => void): Mesh;
  708. /**
  709. * Disposes a previously registered javascript function called after the rendering.
  710. * @param func defines the function to remove
  711. * @returns the current mesh
  712. */
  713. unregisterAfterRender(func: (mesh: AbstractMesh) => void): Mesh;
  714. /**
  715. * @internal
  716. */
  717. _getInstancesRenderList(subMeshId: number, isReplacementMode?: boolean): _InstancesBatch;
  718. /**
  719. * @internal
  720. */
  721. _renderWithInstances(subMesh: SubMesh, fillMode: number, batch: _InstancesBatch, effect: Effect, engine: AbstractEngine): Mesh;
  722. /**
  723. * @internal
  724. */
  725. _renderWithThinInstances(subMesh: SubMesh, fillMode: number, effect: Effect, engine: AbstractEngine): void;
  726. /**
  727. * @internal
  728. */
  729. _processInstancedBuffers(visibleInstances: Nullable<InstancedMesh[]>, renderSelf: boolean): void;
  730. /**
  731. * @internal
  732. */
  733. _processRendering(renderingMesh: AbstractMesh, subMesh: SubMesh, effect: Effect, fillMode: number, batch: _InstancesBatch, hardwareInstancedRendering: boolean, onBeforeDraw: (isInstance: boolean, world: Matrix, effectiveMaterial?: Material) => void, effectiveMaterial?: Material): Mesh;
  734. /**
  735. * @internal
  736. */
  737. _rebuild(dispose?: boolean): void;
  738. /** @internal */
  739. _freeze(): void;
  740. /** @internal */
  741. _unFreeze(): void;
  742. /**
  743. * Triggers the draw call for the mesh (or a submesh), for a specific render pass id
  744. * @param renderPassId defines the render pass id to use to draw the mesh / submesh. If not provided, use the current renderPassId of the engine.
  745. * @param enableAlphaMode defines if alpha mode can be changed (default: false)
  746. * @param effectiveMeshReplacement defines an optional mesh used to provide info for the rendering (default: undefined)
  747. * @param subMesh defines the subMesh to render. If not provided, draw all mesh submeshes (default: undefined)
  748. * @param checkFrustumCulling defines if frustum culling must be checked (default: true). If you know the mesh is in the frustum (or if you don't care!), you can pass false to optimize.
  749. * @returns the current mesh
  750. */
  751. renderWithRenderPassId(renderPassId?: number, enableAlphaMode?: boolean, effectiveMeshReplacement?: AbstractMesh, subMesh?: SubMesh, checkFrustumCulling?: boolean): this;
  752. /**
  753. * Triggers the draw call for the mesh. Usually, you don't need to call this method by your own because the mesh rendering is handled by the scene rendering manager
  754. * @param subMesh defines the subMesh to render
  755. * @param enableAlphaMode defines if alpha mode can be changed
  756. * @param effectiveMeshReplacement defines an optional mesh used to provide info for the rendering
  757. * @returns the current mesh
  758. */
  759. render(subMesh: SubMesh, enableAlphaMode: boolean, effectiveMeshReplacement?: AbstractMesh): Mesh;
  760. private _onBeforeDraw;
  761. /**
  762. * Renormalize the mesh and patch it up if there are no weights
  763. * Similar to normalization by adding the weights compute the reciprocal and multiply all elements, this wil ensure that everything adds to 1.
  764. * However in the case of zero weights then we set just a single influence to 1.
  765. * We check in the function for extra's present and if so we use the normalizeSkinWeightsWithExtras rather than the FourWeights version.
  766. */
  767. cleanMatrixWeights(): void;
  768. private _normalizeSkinFourWeights;
  769. private _normalizeSkinWeightsAndExtra;
  770. /**
  771. * ValidateSkinning is used to determine that a mesh has valid skinning data along with skin metrics, if missing weights,
  772. * or not normalized it is returned as invalid mesh the string can be used for console logs, or on screen messages to let
  773. * the user know there was an issue with importing the mesh
  774. * @returns a validation object with skinned, valid and report string
  775. */
  776. validateSkinning(): {
  777. skinned: boolean;
  778. valid: boolean;
  779. report: string;
  780. };
  781. /** @internal */
  782. _checkDelayState(): Mesh;
  783. private _queueLoad;
  784. /**
  785. * Returns `true` if the mesh is within the frustum defined by the passed array of planes.
  786. * A mesh is in the frustum if its bounding box intersects the frustum
  787. * @param frustumPlanes defines the frustum to test
  788. * @returns true if the mesh is in the frustum planes
  789. */
  790. isInFrustum(frustumPlanes: Plane[]): boolean;
  791. /**
  792. * Sets the mesh material by the material or multiMaterial `id` property
  793. * @param id is a string identifying the material or the multiMaterial
  794. * @returns the current mesh
  795. */
  796. setMaterialById(id: string): Mesh;
  797. /**
  798. * Returns as a new array populated with the mesh material and/or skeleton, if any.
  799. * @returns an array of IAnimatable
  800. */
  801. getAnimatables(): IAnimatable[];
  802. /**
  803. * Modifies the mesh geometry according to the passed transformation matrix.
  804. * This method returns nothing, but it really modifies the mesh even if it's originally not set as updatable.
  805. * The mesh normals are modified using the same transformation.
  806. * Note that, under the hood, this method sets a new VertexBuffer each call.
  807. * @param transform defines the transform matrix to use
  808. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/center_origin/bakingTransforms
  809. * @returns the current mesh
  810. */
  811. bakeTransformIntoVertices(transform: Matrix): Mesh;
  812. /**
  813. * Modifies the mesh geometry according to its own current World Matrix.
  814. * The mesh World Matrix is then reset.
  815. * This method returns nothing but really modifies the mesh even if it's originally not set as updatable.
  816. * Note that, under the hood, this method sets a new VertexBuffer each call.
  817. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/center_origin/bakingTransforms
  818. * @param bakeIndependentlyOfChildren indicates whether to preserve all child nodes' World Matrix during baking
  819. * @returns the current mesh
  820. */
  821. bakeCurrentTransformIntoVertices(bakeIndependentlyOfChildren?: boolean): Mesh;
  822. /** @internal */
  823. get _positions(): Nullable<Vector3[]>;
  824. /** @internal */
  825. _resetPointsArrayCache(): Mesh;
  826. /** @internal */
  827. _generatePointsArray(): boolean;
  828. /**
  829. * Returns a new Mesh object generated from the current mesh properties.
  830. * This method must not get confused with createInstance()
  831. * @param name is a string, the name given to the new mesh
  832. * @param newParent can be any Node object (default `null`)
  833. * @param doNotCloneChildren allows/denies the recursive cloning of the original mesh children if any (default `false`)
  834. * @param clonePhysicsImpostor allows/denies the cloning in the same time of the original mesh `body` used by the physics engine, if any (default `true`)
  835. * @returns a new mesh
  836. */
  837. clone(name?: string, newParent?: Nullable<Node>, doNotCloneChildren?: boolean, clonePhysicsImpostor?: boolean): Mesh;
  838. /**
  839. * Releases resources associated with this mesh.
  840. * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)
  841. * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)
  842. */
  843. dispose(doNotRecurse?: boolean, disposeMaterialAndTextures?: boolean): void;
  844. /** @internal */
  845. _disposeInstanceSpecificData(): void;
  846. /** @internal */
  847. _disposeThinInstanceSpecificData(): void;
  848. /**
  849. * Modifies the mesh geometry according to a displacement map.
  850. * A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex.
  851. * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.
  852. * @param url is a string, the URL from the image file is to be downloaded.
  853. * @param minHeight is the lower limit of the displacement.
  854. * @param maxHeight is the upper limit of the displacement.
  855. * @param onSuccess is an optional Javascript function to be called just after the mesh is modified. It is passed the modified mesh and must return nothing.
  856. * @param uvOffset is an optional vector2 used to offset UV.
  857. * @param uvScale is an optional vector2 used to scale UV.
  858. * @param forceUpdate defines whether or not to force an update of the generated buffers. This is useful to apply on a deserialized model for instance.
  859. * @param onError defines a callback called when an error occurs during the processing of the request.
  860. * @returns the Mesh.
  861. */
  862. applyDisplacementMap(url: string, minHeight: number, maxHeight: number, onSuccess?: (mesh: Mesh) => void, uvOffset?: Vector2, uvScale?: Vector2, forceUpdate?: boolean, onError?: (message?: string, exception?: any) => void): Mesh;
  863. /**
  864. * Modifies the mesh geometry according to a displacementMap buffer.
  865. * A displacement map is a colored image. Each pixel color value (actually a gradient computed from red, green, blue values) will give the displacement to apply to each mesh vertex.
  866. * The mesh must be set as updatable. Its internal geometry is directly modified, no new buffer are allocated.
  867. * @param buffer is a `Uint8Array` buffer containing series of `Uint8` lower than 255, the red, green, blue and alpha values of each successive pixel.
  868. * @param heightMapWidth is the width of the buffer image.
  869. * @param heightMapHeight is the height of the buffer image.
  870. * @param minHeight is the lower limit of the displacement.
  871. * @param maxHeight is the upper limit of the displacement.
  872. * @param uvOffset is an optional vector2 used to offset UV.
  873. * @param uvScale is an optional vector2 used to scale UV.
  874. * @param forceUpdate defines whether or not to force an update of the generated buffers. This is useful to apply on a deserialized model for instance.
  875. * @returns the Mesh.
  876. */
  877. applyDisplacementMapFromBuffer(buffer: Uint8Array, heightMapWidth: number, heightMapHeight: number, minHeight: number, maxHeight: number, uvOffset?: Vector2, uvScale?: Vector2, forceUpdate?: boolean): Mesh;
  878. private _getFlattenedNormals;
  879. private _convertToUnIndexedMesh;
  880. /**
  881. * Modify the mesh to get a flat shading rendering.
  882. * This means each mesh facet will then have its own normals. Usually new vertices are added in the mesh geometry to get this result.
  883. * Warning : the mesh is really modified even if not set originally as updatable and, under the hood, a new VertexBuffer is allocated.
  884. * @returns current mesh
  885. */
  886. convertToFlatShadedMesh(): Mesh;
  887. /**
  888. * This method removes all the mesh indices and add new vertices (duplication) in order to unfold facets into buffers.
  889. * In other words, more vertices, no more indices and a single bigger VBO.
  890. * The mesh is really modified even if not set originally as updatable. Under the hood, a new VertexBuffer is allocated.
  891. * @returns current mesh
  892. */
  893. convertToUnIndexedMesh(): Mesh;
  894. /**
  895. * Inverses facet orientations.
  896. * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.
  897. * @param flipNormals will also inverts the normals
  898. * @returns current mesh
  899. */
  900. flipFaces(flipNormals?: boolean): Mesh;
  901. /**
  902. * Increase the number of facets and hence vertices in a mesh
  903. * Vertex normals are interpolated from existing vertex normals
  904. * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.
  905. * @param numberPerEdge the number of new vertices to add to each edge of a facet, optional default 1
  906. */
  907. increaseVertices(numberPerEdge?: number): void;
  908. /**
  909. * Force adjacent facets to share vertices and remove any facets that have all vertices in a line
  910. * This will undo any application of covertToFlatShadedMesh
  911. * Warning : the mesh is really modified even if not set originally as updatable. A new VertexBuffer is created under the hood each call.
  912. */
  913. forceSharedVertices(): void;
  914. /**
  915. * @internal
  916. */
  917. static _instancedMeshFactory(name: string, mesh: Mesh): InstancedMesh;
  918. /**
  919. * @internal
  920. */
  921. static _PhysicsImpostorParser(scene: Scene, physicObject: IPhysicsEnabledObject, jsonObject: any): PhysicsImpostor;
  922. /**
  923. * Creates a new InstancedMesh object from the mesh model.
  924. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/copies/instances
  925. * @param name defines the name of the new instance
  926. * @returns a new InstancedMesh
  927. */
  928. createInstance(name: string): InstancedMesh;
  929. /**
  930. * Synchronises all the mesh instance submeshes to the current mesh submeshes, if any.
  931. * After this call, all the mesh instances have the same submeshes than the current mesh.
  932. * @returns the current mesh
  933. */
  934. synchronizeInstances(): Mesh;
  935. /**
  936. * Optimization of the mesh's indices, in case a mesh has duplicated vertices.
  937. * The function will only reorder the indices and will not remove unused vertices to avoid problems with submeshes.
  938. * This should be used together with the simplification to avoid disappearing triangles.
  939. * @param successCallback an optional success callback to be called after the optimization finished.
  940. * @returns the current mesh
  941. */
  942. optimizeIndices(successCallback?: (mesh?: Mesh) => void): Mesh;
  943. /**
  944. * Serialize current mesh
  945. * @param serializationObject defines the object which will receive the serialization data
  946. * @returns the serialized object
  947. */
  948. serialize(serializationObject?: any): any;
  949. /** @internal */
  950. _syncGeometryWithMorphTargetManager(): void;
  951. /**
  952. * @internal
  953. */
  954. static _GroundMeshParser: (parsedMesh: any, scene: Scene) => Mesh;
  955. /**
  956. * @internal
  957. */
  958. static _GoldbergMeshParser: (parsedMesh: any, scene: Scene) => GoldbergMesh;
  959. /**
  960. * @internal
  961. */
  962. static _LinesMeshParser: (parsedMesh: any, scene: Scene) => Mesh;
  963. /**
  964. * @internal
  965. */
  966. static _GreasedLineMeshParser: (parsedMesh: any, scene: Scene) => Mesh;
  967. /**
  968. * @internal
  969. */
  970. static _GreasedLineRibbonMeshParser: (parsedMesh: any, scene: Scene) => Mesh;
  971. /**
  972. * @internal
  973. */
  974. static _TrailMeshParser: (parsedMesh: any, scene: Scene) => Mesh;
  975. /**
  976. * Returns a new Mesh object parsed from the source provided.
  977. * @param parsedMesh is the source
  978. * @param scene defines the hosting scene
  979. * @param rootUrl is the root URL to prefix the `delayLoadingFile` property with
  980. * @returns a new Mesh
  981. */
  982. static Parse(parsedMesh: any, scene: Scene, rootUrl: string): Mesh;
  983. /**
  984. * Prepare internal position array for software CPU skinning
  985. * @returns original positions used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh
  986. */
  987. setPositionsForCPUSkinning(): Nullable<Float32Array>;
  988. /**
  989. * Prepare internal normal array for software CPU skinning
  990. * @returns original normals used for CPU skinning. Useful for integrating Morphing with skeletons in same mesh.
  991. */
  992. setNormalsForCPUSkinning(): Nullable<Float32Array>;
  993. /**
  994. * Updates the vertex buffer by applying transformation from the bones
  995. * @param skeleton defines the skeleton to apply to current mesh
  996. * @returns the current mesh
  997. */
  998. applySkeleton(skeleton: Skeleton): Mesh;
  999. /**
  1000. * Returns an object containing a min and max Vector3 which are the minimum and maximum vectors of each mesh bounding box from the passed array, in the world coordinates
  1001. * @param meshes defines the list of meshes to scan
  1002. * @returns an object `{min:` Vector3`, max:` Vector3`}`
  1003. */
  1004. static MinMax(meshes: AbstractMesh[]): {
  1005. min: Vector3;
  1006. max: Vector3;
  1007. };
  1008. /**
  1009. * Returns the center of the `{min:` Vector3`, max:` Vector3`}` or the center of MinMax vector3 computed from a mesh array
  1010. * @param meshesOrMinMaxVector could be an array of meshes or a `{min:` Vector3`, max:` Vector3`}` object
  1011. * @returns a vector3
  1012. */
  1013. static Center(meshesOrMinMaxVector: {
  1014. min: Vector3;
  1015. max: Vector3;
  1016. } | AbstractMesh[]): Vector3;
  1017. /**
  1018. * Merge the array of meshes into a single mesh for performance reasons.
  1019. * @param meshes array of meshes with the vertices to merge. Entries cannot be empty meshes.
  1020. * @param disposeSource when true (default), dispose of the vertices from the source meshes.
  1021. * @param allow32BitsIndices when the sum of the vertices > 64k, this must be set to true.
  1022. * @param meshSubclass (optional) can be set to a Mesh where the merged vertices will be inserted.
  1023. * @param subdivideWithSubMeshes when true (false default), subdivide mesh into subMeshes.
  1024. * @param multiMultiMaterials when true (false default), subdivide mesh into subMeshes with multiple materials, ignores subdivideWithSubMeshes.
  1025. * @returns a new mesh
  1026. */
  1027. static MergeMeshes(meshes: Array<Mesh>, disposeSource?: boolean, allow32BitsIndices?: boolean, meshSubclass?: Mesh, subdivideWithSubMeshes?: boolean, multiMultiMaterials?: boolean): Nullable<Mesh>;
  1028. /**
  1029. * Merge the array of meshes into a single mesh for performance reasons.
  1030. * @param meshes array of meshes with the vertices to merge. Entries cannot be empty meshes.
  1031. * @param disposeSource when true (default), dispose of the vertices from the source meshes.
  1032. * @param allow32BitsIndices when the sum of the vertices > 64k, this must be set to true.
  1033. * @param meshSubclass (optional) can be set to a Mesh where the merged vertices will be inserted.
  1034. * @param subdivideWithSubMeshes when true (false default), subdivide mesh into subMeshes.
  1035. * @param multiMultiMaterials when true (false default), subdivide mesh into subMeshes with multiple materials, ignores subdivideWithSubMeshes.
  1036. * @returns a new mesh
  1037. */
  1038. static MergeMeshesAsync(meshes: Array<Mesh>, disposeSource?: boolean, allow32BitsIndices?: boolean, meshSubclass?: Mesh, subdivideWithSubMeshes?: boolean, multiMultiMaterials?: boolean): Promise<any>;
  1039. private static _MergeMeshesCoroutine;
  1040. /**
  1041. * @internal
  1042. */
  1043. addInstance(instance: InstancedMesh): void;
  1044. /**
  1045. * @internal
  1046. */
  1047. removeInstance(instance: InstancedMesh): void;
  1048. /** @internal */
  1049. _shouldConvertRHS(): boolean;
  1050. /** @internal */
  1051. _getRenderingFillMode(fillMode: number): number;
  1052. /**
  1053. * Sets the mesh material by the material or multiMaterial `id` property
  1054. * @param id is a string identifying the material or the multiMaterial
  1055. * @returns the current mesh
  1056. * @deprecated Please use MeshBuilder instead Please use setMaterialById instead
  1057. */
  1058. setMaterialByID(id: string): Mesh;
  1059. /**
  1060. * Creates a ribbon mesh.
  1061. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param
  1062. * @param name defines the name of the mesh to create
  1063. * @param pathArray is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry.
  1064. * @param closeArray creates a seam between the first and the last paths of the path array (default is false)
  1065. * @param closePath creates a seam between the first and the last points of each path of the path array
  1066. * @param offset is taken in account only if the `pathArray` is containing a single path
  1067. * @param scene defines the hosting scene
  1068. * @param updatable defines if the mesh must be flagged as updatable
  1069. * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)
  1070. * @param instance defines an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#ribbon)
  1071. * @returns a new Mesh
  1072. * @deprecated Please use MeshBuilder instead
  1073. */
  1074. static CreateRibbon(name: string, pathArray: Vector3[][], closeArray: boolean, closePath: boolean, offset: number, scene?: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  1075. /**
  1076. * Creates a plane polygonal mesh. By default, this is a disc.
  1077. * @param name defines the name of the mesh to create
  1078. * @param radius sets the radius size (float) of the polygon (default 0.5)
  1079. * @param 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
  1080. * @param scene defines the hosting scene
  1081. * @param updatable defines if the mesh must be flagged as updatable
  1082. * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)
  1083. * @returns a new Mesh
  1084. * @deprecated Please use MeshBuilder instead
  1085. */
  1086. static CreateDisc(name: string, radius: number, tessellation: number, scene: Nullable<Scene>, updatable?: boolean, sideOrientation?: number): Mesh;
  1087. /**
  1088. * Creates a box mesh.
  1089. * @param name defines the name of the mesh to create
  1090. * @param size sets the size (float) of each box side (default 1)
  1091. * @param scene defines the hosting scene
  1092. * @param updatable defines if the mesh must be flagged as updatable
  1093. * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)
  1094. * @returns a new Mesh
  1095. * @deprecated Please use MeshBuilder instead
  1096. */
  1097. static CreateBox(name: string, size: number, scene: Nullable<Scene>, updatable?: boolean, sideOrientation?: number): Mesh;
  1098. /**
  1099. * Creates a sphere mesh.
  1100. * @param name defines the name of the mesh to create
  1101. * @param segments sets the sphere number of horizontal stripes (positive integer, default 32)
  1102. * @param diameter sets the diameter size (float) of the sphere (default 1)
  1103. * @param scene defines the hosting scene
  1104. * @param updatable defines if the mesh must be flagged as updatable
  1105. * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)
  1106. * @returns a new Mesh
  1107. * @deprecated Please use MeshBuilder instead
  1108. */
  1109. static CreateSphere(name: string, segments: number, diameter: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  1110. /**
  1111. * Creates a hemisphere mesh.
  1112. * @param name defines the name of the mesh to create
  1113. * @param segments sets the sphere number of horizontal stripes (positive integer, default 32)
  1114. * @param diameter sets the diameter size (float) of the sphere (default 1)
  1115. * @param scene defines the hosting scene
  1116. * @returns a new Mesh
  1117. * @deprecated Please use MeshBuilder instead
  1118. */
  1119. static CreateHemisphere(name: string, segments: number, diameter: number, scene?: Scene): Mesh;
  1120. /**
  1121. * Creates a cylinder or a cone mesh.
  1122. * @param name defines the name of the mesh to create
  1123. * @param height sets the height size (float) of the cylinder/cone (float, default 2)
  1124. * @param diameterTop set the top cap diameter (floats, default 1)
  1125. * @param diameterBottom set the bottom cap diameter (floats, default 1). This value can't be zero
  1126. * @param tessellation sets the number of cylinder sides (positive integer, default 24). Set it to 3 to get a prism for instance
  1127. * @param subdivisions sets the number of rings along the cylinder height (positive integer, default 1)
  1128. * @param scene defines the hosting scene
  1129. * @param updatable defines if the mesh must be flagged as updatable
  1130. * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)
  1131. * @returns a new Mesh
  1132. * @deprecated Please use MeshBuilder instead
  1133. */
  1134. static CreateCylinder(name: string, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions: any, scene?: Scene, updatable?: any, sideOrientation?: number): Mesh;
  1135. /**
  1136. * Creates a torus mesh.
  1137. * @param name defines the name of the mesh to create
  1138. * @param diameter sets the diameter size (float) of the torus (default 1)
  1139. * @param thickness sets the diameter size of the tube of the torus (float, default 0.5)
  1140. * @param tessellation sets the number of torus sides (positive integer, default 16)
  1141. * @param scene defines the hosting scene
  1142. * @param updatable defines if the mesh must be flagged as updatable
  1143. * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)
  1144. * @returns a new Mesh
  1145. * @deprecated Please use MeshBuilder instead
  1146. */
  1147. static CreateTorus(name: string, diameter: number, thickness: number, tessellation: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  1148. /**
  1149. * Creates a torus knot mesh.
  1150. * @param name defines the name of the mesh to create
  1151. * @param radius sets the global radius size (float) of the torus knot (default 2)
  1152. * @param tube sets the diameter size of the tube of the torus (float, default 0.5)
  1153. * @param radialSegments sets the number of sides on each tube segments (positive integer, default 32)
  1154. * @param tubularSegments sets the number of tubes to decompose the knot into (positive integer, default 32)
  1155. * @param p the number of windings on X axis (positive integers, default 2)
  1156. * @param q the number of windings on Y axis (positive integers, default 3)
  1157. * @param scene defines the hosting scene
  1158. * @param updatable defines if the mesh must be flagged as updatable
  1159. * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)
  1160. * @returns a new Mesh
  1161. * @deprecated Please use MeshBuilder instead
  1162. */
  1163. static CreateTorusKnot(name: string, radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, scene?: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  1164. /**
  1165. * Creates a line mesh..
  1166. * @param name defines the name of the mesh to create
  1167. * @param points is an array successive Vector3
  1168. * @param scene defines the hosting scene
  1169. * @param updatable defines if the mesh must be flagged as updatable
  1170. * @param instance is an instance of an existing LineMesh object to be updated with the passed `points` parameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#lines-and-dashedlines).
  1171. * @returns a new Mesh
  1172. * @deprecated Please use MeshBuilder instead
  1173. */
  1174. static CreateLines(name: string, points: Vector3[], scene: Nullable<Scene>, updatable: boolean, instance?: Nullable<LinesMesh>): LinesMesh;
  1175. /**
  1176. * Creates a dashed line mesh.
  1177. * @param name defines the name of the mesh to create
  1178. * @param points is an array successive Vector3
  1179. * @param dashSize is the size of the dashes relatively the dash number (positive float, default 3)
  1180. * @param gapSize is the size of the gap between two successive dashes relatively the dash number (positive float, default 1)
  1181. * @param dashNb is the intended total number of dashes (positive integer, default 200)
  1182. * @param scene defines the hosting scene
  1183. * @param updatable defines if the mesh must be flagged as updatable
  1184. * @param instance is an instance of an existing LineMesh object to be updated with the passed `points` parameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#lines-and-dashedlines)
  1185. * @returns a new Mesh
  1186. * @deprecated Please use MeshBuilder instead
  1187. */
  1188. static CreateDashedLines(name: string, points: Vector3[], dashSize: number, gapSize: number, dashNb: number, scene: Nullable<Scene>, updatable?: boolean, instance?: LinesMesh): LinesMesh;
  1189. /**
  1190. * Creates a polygon mesh.Please consider using the same method from the MeshBuilder class instead
  1191. * The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh.
  1192. * 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.
  1193. * You can set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
  1194. * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
  1195. * Remember you can only change the shape positions, not their number when updating a polygon.
  1196. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#non-regular-polygon
  1197. * @param name defines the name of the mesh to create
  1198. * @param 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
  1199. * @param scene defines the hosting scene
  1200. * @param holes is a required array of arrays of successive Vector3 used to defines holes in the polygon
  1201. * @param updatable defines if the mesh must be flagged as updatable
  1202. * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)
  1203. * @param earcutInjection can be used to inject your own earcut reference
  1204. * @returns a new Mesh
  1205. * @deprecated Please use MeshBuilder instead
  1206. */
  1207. static CreatePolygon(name: string, shape: Vector3[], scene: Scene, holes?: Vector3[][], updatable?: boolean, sideOrientation?: number, earcutInjection?: any): Mesh;
  1208. /**
  1209. * Creates an extruded polygon mesh, with depth in the Y direction..
  1210. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#extruded-non-regular-polygon
  1211. * @param name defines the name of the mesh to create
  1212. * @param 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
  1213. * @param depth defines the height of extrusion
  1214. * @param scene defines the hosting scene
  1215. * @param holes is a required array of arrays of successive Vector3 used to defines holes in the polygon
  1216. * @param updatable defines if the mesh must be flagged as updatable
  1217. * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)
  1218. * @param earcutInjection can be used to inject your own earcut reference
  1219. * @returns a new Mesh
  1220. * @deprecated Please use MeshBuilder instead
  1221. */
  1222. static ExtrudePolygon(name: string, shape: Vector3[], depth: number, scene: Scene, holes?: Vector3[][], updatable?: boolean, sideOrientation?: number, earcutInjection?: any): Mesh;
  1223. /**
  1224. * Creates an extruded shape mesh.
  1225. * The extrusion is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters.
  1226. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param
  1227. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#extruded-shapes
  1228. * @param name defines the name of the mesh to create
  1229. * @param shape is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis
  1230. * @param path is a required array of successive Vector3. This is the axis curve the shape is extruded along
  1231. * @param scale is the value to scale the shape
  1232. * @param rotation is the angle value to rotate the shape each step (each path point), from the former step (so rotation added each step) along the curve
  1233. * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL
  1234. * @param scene defines the hosting scene
  1235. * @param updatable defines if the mesh must be flagged as updatable
  1236. * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)
  1237. * @param instance is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#extruded-shape)
  1238. * @returns a new Mesh
  1239. * @deprecated Please use MeshBuilder instead
  1240. */
  1241. static ExtrudeShape(name: string, shape: Vector3[], path: Vector3[], scale: number, rotation: number, cap: number, scene: Nullable<Scene>, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  1242. /**
  1243. * Creates an custom extruded shape mesh.
  1244. * The custom extrusion is a parametric shape.
  1245. * It has no predefined shape. Its final shape will depend on the input parameters.
  1246. *
  1247. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#extruded-shapes
  1248. * @param name defines the name of the mesh to create
  1249. * @param shape is a required array of successive Vector3. This array depicts the shape to be extruded in its local space : the shape must be designed in the xOy plane and will be extruded along the Z axis
  1250. * @param path is a required array of successive Vector3. This is the axis curve the shape is extruded along
  1251. * @param scaleFunction is a custom Javascript function called on each path point
  1252. * @param rotationFunction is a custom Javascript function called on each path point
  1253. * @param ribbonCloseArray forces the extrusion underlying ribbon to close all the paths in its `pathArray`
  1254. * @param ribbonClosePath forces the extrusion underlying ribbon to close its `pathArray`
  1255. * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL
  1256. * @param scene defines the hosting scene
  1257. * @param updatable defines if the mesh must be flagged as updatable
  1258. * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)
  1259. * @param instance is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters (https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph#extruded-shape)
  1260. * @returns a new Mesh
  1261. * @deprecated Please use MeshBuilder instead
  1262. */
  1263. static ExtrudeShapeCustom(name: string, shape: Vector3[], path: Vector3[], scaleFunction: Nullable<{
  1264. (i: number, distance: number): number;
  1265. }>, rotationFunction: Nullable<{
  1266. (i: number, distance: number): number;
  1267. }>, ribbonCloseArray: boolean, ribbonClosePath: boolean, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  1268. /**
  1269. * Creates lathe mesh.
  1270. * The lathe is a shape with a symmetry axis : a 2D model shape is rotated around this axis to design the lathe.
  1271. * @param name defines the name of the mesh to create
  1272. * @param 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
  1273. * @param radius is the radius value of the lathe
  1274. * @param tessellation is the side number of the lathe.
  1275. * @param scene defines the hosting scene
  1276. * @param updatable defines if the mesh must be flagged as updatable
  1277. * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)
  1278. * @returns a new Mesh
  1279. * @deprecated Please use MeshBuilder instead
  1280. */
  1281. static CreateLathe(name: string, shape: Vector3[], radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  1282. /**
  1283. * Creates a plane mesh.
  1284. * @param name defines the name of the mesh to create
  1285. * @param size sets the size (float) of both sides of the plane at once (default 1)
  1286. * @param scene defines the hosting scene
  1287. * @param updatable defines if the mesh must be flagged as updatable
  1288. * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)
  1289. * @returns a new Mesh
  1290. * @deprecated Please use MeshBuilder instead
  1291. */
  1292. static CreatePlane(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
  1293. /**
  1294. * Creates a ground mesh.
  1295. * @param name defines the name of the mesh to create
  1296. * @param width set the width of the ground
  1297. * @param height set the height of the ground
  1298. * @param subdivisions sets the number of subdivisions per side
  1299. * @param scene defines the hosting scene
  1300. * @param updatable defines if the mesh must be flagged as updatable
  1301. * @returns a new Mesh
  1302. * @deprecated Please use MeshBuilder instead
  1303. */
  1304. static CreateGround(name: string, width: number, height: number, subdivisions: number, scene?: Scene, updatable?: boolean): Mesh;
  1305. /**
  1306. * Creates a tiled ground mesh.
  1307. * @param name defines the name of the mesh to create
  1308. * @param xmin set the ground minimum X coordinate
  1309. * @param zmin set the ground minimum Y coordinate
  1310. * @param xmax set the ground maximum X coordinate
  1311. * @param zmax set the ground maximum Z coordinate
  1312. * @param subdivisions is an 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
  1313. * @param precision is an 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
  1314. * @param scene defines the hosting scene
  1315. * @param updatable defines if the mesh must be flagged as updatable
  1316. * @returns a new Mesh
  1317. * @deprecated Please use MeshBuilder instead
  1318. */
  1319. static CreateTiledGround(name: string, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: {
  1320. w: number;
  1321. h: number;
  1322. }, precision: {
  1323. w: number;
  1324. h: number;
  1325. }, scene: Scene, updatable?: boolean): Mesh;
  1326. /**
  1327. * Creates a ground mesh from a height map.
  1328. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set/height_map
  1329. * @param name defines the name of the mesh to create
  1330. * @param url sets the URL of the height map image resource
  1331. * @param width set the ground width size
  1332. * @param height set the ground height size
  1333. * @param subdivisions sets the number of subdivision per side
  1334. * @param minHeight is the minimum altitude on the ground
  1335. * @param maxHeight is the maximum altitude on the ground
  1336. * @param scene defines the hosting scene
  1337. * @param updatable defines if the mesh must be flagged as updatable
  1338. * @param onReady is a callback function that will be called once the mesh is built (the height map download can last some time)
  1339. * @param alphaFilter will filter any data where the alpha channel is below this value, defaults 0 (all data visible)
  1340. * @returns a new Mesh
  1341. * @deprecated Please use MeshBuilder instead
  1342. */
  1343. static CreateGroundFromHeightMap(name: string, url: string, width: number, height: number, subdivisions: number, minHeight: number, maxHeight: number, scene: Scene, updatable?: boolean, onReady?: (mesh: GroundMesh) => void, alphaFilter?: number): GroundMesh;
  1344. /**
  1345. * Creates a tube mesh.
  1346. * The tube is a parametric shape.
  1347. * It has no predefined shape. Its final shape will depend on the input parameters.
  1348. *
  1349. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param
  1350. * @param name defines the name of the mesh to create
  1351. * @param path is a required array of successive Vector3. It is the curve used as the axis of the tube
  1352. * @param radius sets the tube radius size
  1353. * @param tessellation is the number of sides on the tubular surface
  1354. * @param radiusFunction is a custom 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
  1355. * @param cap sets the way the extruded shape is capped. Possible values : Mesh.NO_CAP (default), Mesh.CAP_START, Mesh.CAP_END, Mesh.CAP_ALL
  1356. * @param scene defines the hosting scene
  1357. * @param updatable defines if the mesh must be flagged as updatable
  1358. * @param sideOrientation defines the mesh side orientation (https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/set#side-orientation)
  1359. * @param instance is an instance of an existing Tube object to be updated with the passed `pathArray` parameter (https://doc.babylonjs.com/how_to/How_to_dynamically_morph_a_mesh#tube)
  1360. * @returns a new Mesh
  1361. * @deprecated Please use MeshBuilder instead
  1362. */
  1363. static CreateTube(name: string, path: Vector3[], radius: number, tessellation: number, radiusFunction: {
  1364. (i: number, distance: number): number;
  1365. }, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, instance?: Mesh): Mesh;
  1366. /**
  1367. * Creates a polyhedron mesh.
  1368. *.
  1369. * * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embedded types. Please refer to the type sheet in the tutorial to choose the wanted type
  1370. * * The parameter `size` (positive float, default 1) sets the polygon size
  1371. * * You can overwrite the `size` on each dimension bu using the parameters `sizeX`, `sizeY` or `sizeZ` (positive floats, default to `size` value)
  1372. * * 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 overwrittes the parameter `type`
  1373. * * 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
  1374. * * 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)`)
  1375. * * 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
  1376. * * 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
  1377. * * You can also set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
  1378. * * 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
  1379. * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created
  1380. * @param name defines the name of the mesh to create
  1381. * @param options defines the options used to create the mesh
  1382. * @param scene defines the hosting scene
  1383. * @returns a new Mesh
  1384. * @deprecated Please use MeshBuilder instead
  1385. */
  1386. static CreatePolyhedron(name: string, options: {
  1387. type?: number;
  1388. size?: number;
  1389. sizeX?: number;
  1390. sizeY?: number;
  1391. sizeZ?: number;
  1392. custom?: any;
  1393. faceUV?: Vector4[];
  1394. faceColors?: Color4[];
  1395. updatable?: boolean;
  1396. sideOrientation?: number;
  1397. }, scene: Scene): Mesh;
  1398. /**
  1399. * Creates a sphere based upon an icosahedron with 20 triangular faces which can be subdivided
  1400. * * The parameter `radius` sets the radius size (float) of the icosphere (default 1)
  1401. * * 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 than `radius`)
  1402. * * The parameter `subdivisions` sets the number of subdivisions (positive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size
  1403. * * 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
  1404. * * You can also set the mesh side orientation with the values : Mesh.FRONTSIDE (default), Mesh.BACKSIDE or Mesh.DOUBLESIDE
  1405. * * 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
  1406. * * The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created
  1407. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/polyhedra#icosphere
  1408. * @param name defines the name of the mesh
  1409. * @param options defines the options used to create the mesh
  1410. * @param scene defines the hosting scene
  1411. * @returns a new Mesh
  1412. * @deprecated Please use MeshBuilder instead
  1413. */
  1414. static CreateIcoSphere(name: string, options: {
  1415. radius?: number;
  1416. flat?: boolean;
  1417. subdivisions?: number;
  1418. sideOrientation?: number;
  1419. updatable?: boolean;
  1420. }, scene: Scene): Mesh;
  1421. /**
  1422. * Creates a decal mesh.
  1423. *.
  1424. * A decal is a mesh usually applied as a model onto the surface of another mesh
  1425. * @param name defines the name of the mesh
  1426. * @param sourceMesh defines the mesh receiving the decal
  1427. * @param position sets the position of the decal in world coordinates
  1428. * @param normal sets the normal of the mesh where the decal is applied onto in world coordinates
  1429. * @param size sets the decal scaling
  1430. * @param angle sets the angle to rotate the decal
  1431. * @returns a new Mesh
  1432. * @deprecated Please use MeshBuilder instead
  1433. */
  1434. static CreateDecal(name: string, sourceMesh: AbstractMesh, position: Vector3, normal: Vector3, size: Vector3, angle: number): Mesh;
  1435. /** Creates a Capsule Mesh
  1436. * @param name defines the name of the mesh.
  1437. * @param options the constructors options used to shape the mesh.
  1438. * @param scene defines the scene the mesh is scoped to.
  1439. * @returns the capsule mesh
  1440. * @see https://doc.babylonjs.com/how_to/capsule_shape
  1441. * @deprecated Please use MeshBuilder instead
  1442. */
  1443. static CreateCapsule(name: string, options: ICreateCapsuleOptions, scene: Scene): Mesh;
  1444. /**
  1445. * Extends a mesh to a Goldberg mesh
  1446. * Warning the mesh to convert MUST be an import of a perviously exported Goldberg mesh
  1447. * @param mesh the mesh to convert
  1448. * @returns the extended mesh
  1449. * @deprecated Please use ExtendMeshToGoldberg instead
  1450. */
  1451. static ExtendToGoldberg(mesh: Mesh): Mesh;
  1452. }
  1453. export {};