abstractMesh.d.ts 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080
  1. import { Observable } from "../Misc/observable";
  2. import type { Nullable, FloatArray, IndicesArray, DeepImmutable } from "../types";
  3. import type { Camera } from "../Cameras/camera";
  4. import type { Scene, IDisposable } from "../scene";
  5. import type { Vector2 } from "../Maths/math.vector";
  6. import { Matrix, Vector3 } from "../Maths/math.vector";
  7. import type { Node } from "../node";
  8. import type { IGetSetVerticesData } from "../Meshes/mesh.vertexData";
  9. import { TransformNode } from "../Meshes/transformNode";
  10. import type { SubMesh } from "../Meshes/subMesh";
  11. import { PickingInfo } from "../Collisions/pickingInfo";
  12. import type { ICullable } from "../Culling/boundingInfo";
  13. import { BoundingInfo } from "../Culling/boundingInfo";
  14. import type { Material } from "../Materials/material";
  15. import type { Light } from "../Lights/light";
  16. import type { Skeleton } from "../Bones/skeleton";
  17. import type { MorphTargetManager } from "../Morph/morphTargetManager";
  18. import type { IBakedVertexAnimationManager } from "../BakedVertexAnimation/bakedVertexAnimationManager";
  19. import type { IEdgesRenderer } from "../Rendering/edgesRenderer";
  20. import type { SolidParticle } from "../Particles/solidParticle";
  21. import type { AbstractActionManager } from "../Actions/abstractActionManager";
  22. import { UniformBuffer } from "../Materials/uniformBuffer";
  23. import { _MeshCollisionData } from "../Collisions/meshCollisionData";
  24. import type { RawTexture } from "../Materials/Textures/rawTexture";
  25. import { Color3, Color4 } from "../Maths/math.color";
  26. import type { Plane } from "../Maths/math.plane";
  27. import type { IParticleSystem } from "../Particles/IParticleSystem";
  28. import type { Ray } from "../Culling/ray";
  29. import type { Collider } from "../Collisions/collider";
  30. import type { TrianglePickingPredicate } from "../Culling/ray";
  31. import type { RenderingGroup } from "../Rendering/renderingGroup";
  32. import type { IEdgesRendererOptions } from "../Rendering/edgesRenderer";
  33. /** @internal */
  34. declare class _FacetDataStorage {
  35. facetPositions: Vector3[];
  36. facetNormals: Vector3[];
  37. facetPartitioning: number[][];
  38. facetNb: number;
  39. partitioningSubdivisions: number;
  40. partitioningBBoxRatio: number;
  41. facetDataEnabled: boolean;
  42. facetParameters: any;
  43. bbSize: Vector3;
  44. subDiv: {
  45. max: number;
  46. X: number;
  47. Y: number;
  48. Z: number;
  49. };
  50. facetDepthSort: boolean;
  51. facetDepthSortEnabled: boolean;
  52. depthSortedIndices: IndicesArray;
  53. depthSortedFacets: {
  54. ind: number;
  55. sqDistance: number;
  56. }[];
  57. facetDepthSortFunction: (f1: {
  58. ind: number;
  59. sqDistance: number;
  60. }, f2: {
  61. ind: number;
  62. sqDistance: number;
  63. }) => number;
  64. facetDepthSortFrom: Vector3;
  65. facetDepthSortOrigin: Vector3;
  66. invertedMatrix: Matrix;
  67. }
  68. /**
  69. * @internal
  70. **/
  71. declare class _InternalAbstractMeshDataInfo {
  72. _hasVertexAlpha: boolean;
  73. _useVertexColors: boolean;
  74. _numBoneInfluencers: number;
  75. _applyFog: boolean;
  76. _receiveShadows: boolean;
  77. _facetData: _FacetDataStorage;
  78. _visibility: number;
  79. _skeleton: Nullable<Skeleton>;
  80. _layerMask: number;
  81. _computeBonesUsingShaders: boolean;
  82. _isActive: boolean;
  83. _onlyForInstances: boolean;
  84. _isActiveIntermediate: boolean;
  85. _onlyForInstancesIntermediate: boolean;
  86. _actAsRegularMesh: boolean;
  87. _currentLOD: Nullable<AbstractMesh>;
  88. _currentLODIsUpToDate: boolean;
  89. _collisionRetryCount: number;
  90. _morphTargetManager: Nullable<MorphTargetManager>;
  91. _renderingGroupId: number;
  92. _bakedVertexAnimationManager: Nullable<IBakedVertexAnimationManager>;
  93. _material: Nullable<Material>;
  94. _materialForRenderPass: Array<Material | undefined>;
  95. _positions: Nullable<Vector3[]>;
  96. _pointerOverDisableMeshTesting: boolean;
  97. _meshCollisionData: _MeshCollisionData;
  98. _enableDistantPicking: boolean;
  99. /** @internal
  100. * Bounding info that is unnafected by the addition of thin instances
  101. */
  102. _rawBoundingInfo: Nullable<BoundingInfo>;
  103. }
  104. /**
  105. * Class used to store all common mesh properties
  106. */
  107. export declare class AbstractMesh extends TransformNode implements IDisposable, ICullable, IGetSetVerticesData {
  108. /** No occlusion */
  109. static OCCLUSION_TYPE_NONE: number;
  110. /** Occlusion set to optimistic */
  111. static OCCLUSION_TYPE_OPTIMISTIC: number;
  112. /** Occlusion set to strict */
  113. static OCCLUSION_TYPE_STRICT: number;
  114. /** Use an accurate occlusion algorithm */
  115. static OCCLUSION_ALGORITHM_TYPE_ACCURATE: number;
  116. /** Use a conservative occlusion algorithm */
  117. static OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE: number;
  118. /** Default culling strategy : this is an exclusion test and it's the more accurate.
  119. * Test order :
  120. * Is the bounding sphere outside the frustum ?
  121. * If not, are the bounding box vertices outside the frustum ?
  122. * It not, then the cullable object is in the frustum.
  123. */
  124. static readonly CULLINGSTRATEGY_STANDARD = 0;
  125. /** Culling strategy : Bounding Sphere Only.
  126. * This is an exclusion test. It's faster than the standard strategy because the bounding box is not tested.
  127. * It's also less accurate than the standard because some not visible objects can still be selected.
  128. * Test : is the bounding sphere outside the frustum ?
  129. * If not, then the cullable object is in the frustum.
  130. */
  131. static readonly CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY = 1;
  132. /** Culling strategy : Optimistic Inclusion.
  133. * This in an inclusion test first, then the standard exclusion test.
  134. * This can be faster when a cullable object is expected to be almost always in the camera frustum.
  135. * This could also be a little slower than the standard test when the tested object center is not the frustum but one of its bounding box vertex is still inside.
  136. * Anyway, it's as accurate as the standard strategy.
  137. * Test :
  138. * Is the cullable object bounding sphere center in the frustum ?
  139. * If not, apply the default culling strategy.
  140. */
  141. static readonly CULLINGSTRATEGY_OPTIMISTIC_INCLUSION = 2;
  142. /** Culling strategy : Optimistic Inclusion then Bounding Sphere Only.
  143. * This in an inclusion test first, then the bounding sphere only exclusion test.
  144. * This can be the fastest test when a cullable object is expected to be almost always in the camera frustum.
  145. * This could also be a little slower than the BoundingSphereOnly strategy when the tested object center is not in the frustum but its bounding sphere still intersects it.
  146. * It's less accurate than the standard strategy and as accurate as the BoundingSphereOnly strategy.
  147. * Test :
  148. * Is the cullable object bounding sphere center in the frustum ?
  149. * If not, apply the Bounding Sphere Only strategy. No Bounding Box is tested here.
  150. */
  151. static readonly CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY = 3;
  152. /**
  153. * No billboard
  154. */
  155. static get BILLBOARDMODE_NONE(): number;
  156. /** Billboard on X axis */
  157. static get BILLBOARDMODE_X(): number;
  158. /** Billboard on Y axis */
  159. static get BILLBOARDMODE_Y(): number;
  160. /** Billboard on Z axis */
  161. static get BILLBOARDMODE_Z(): number;
  162. /** Billboard on all axes */
  163. static get BILLBOARDMODE_ALL(): number;
  164. /** Billboard on using position instead of orientation */
  165. static get BILLBOARDMODE_USE_POSITION(): number;
  166. /** @internal */
  167. _internalAbstractMeshDataInfo: _InternalAbstractMeshDataInfo;
  168. /** @internal */
  169. _waitingMaterialId: Nullable<string>;
  170. /**
  171. * The culling strategy to use to check whether the mesh must be rendered or not.
  172. * This value can be changed at any time and will be used on the next render mesh selection.
  173. * The possible values are :
  174. * - AbstractMesh.CULLINGSTRATEGY_STANDARD
  175. * - AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY
  176. * - AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION
  177. * - AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY
  178. * Please read each static variable documentation to get details about the culling process.
  179. * */
  180. cullingStrategy: number;
  181. /**
  182. * Gets the number of facets in the mesh
  183. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData#what-is-a-mesh-facet
  184. */
  185. get facetNb(): number;
  186. /**
  187. * Gets or set the number (integer) of subdivisions per axis in the partitioning space
  188. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData#tweaking-the-partitioning
  189. */
  190. get partitioningSubdivisions(): number;
  191. set partitioningSubdivisions(nb: number);
  192. /**
  193. * The ratio (float) to apply to the bounding box size to set to the partitioning space.
  194. * Ex : 1.01 (default) the partitioning space is 1% bigger than the bounding box
  195. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData#tweaking-the-partitioning
  196. */
  197. get partitioningBBoxRatio(): number;
  198. set partitioningBBoxRatio(ratio: number);
  199. /**
  200. * Gets or sets a boolean indicating that the facets must be depth sorted on next call to `updateFacetData()`.
  201. * Works only for updatable meshes.
  202. * Doesn't work with multi-materials
  203. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData#facet-depth-sort
  204. */
  205. get mustDepthSortFacets(): boolean;
  206. set mustDepthSortFacets(sort: boolean);
  207. /**
  208. * The location (Vector3) where the facet depth sort must be computed from.
  209. * By default, the active camera position.
  210. * Used only when facet depth sort is enabled
  211. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData#facet-depth-sort
  212. */
  213. get facetDepthSortFrom(): Vector3;
  214. set facetDepthSortFrom(location: Vector3);
  215. /** number of collision detection tries. Change this value if not all collisions are detected and handled properly */
  216. get collisionRetryCount(): number;
  217. set collisionRetryCount(retryCount: number);
  218. /**
  219. * gets a boolean indicating if facetData is enabled
  220. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData#what-is-a-mesh-facet
  221. */
  222. get isFacetDataEnabled(): boolean;
  223. /**
  224. * Gets or sets the morph target manager
  225. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/morphTargets
  226. */
  227. get morphTargetManager(): Nullable<MorphTargetManager>;
  228. set morphTargetManager(value: Nullable<MorphTargetManager>);
  229. /**
  230. * Gets or sets the baked vertex animation manager
  231. * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/baked_texture_animations
  232. */
  233. get bakedVertexAnimationManager(): Nullable<IBakedVertexAnimationManager>;
  234. set bakedVertexAnimationManager(value: Nullable<IBakedVertexAnimationManager>);
  235. /** @internal */
  236. _syncGeometryWithMorphTargetManager(): void;
  237. /**
  238. * @internal
  239. */
  240. _updateNonUniformScalingState(value: boolean): boolean;
  241. /** @internal */
  242. get rawBoundingInfo(): Nullable<BoundingInfo>;
  243. set rawBoundingInfo(boundingInfo: Nullable<BoundingInfo>);
  244. /**
  245. * An event triggered when this mesh collides with another one
  246. */
  247. onCollideObservable: Observable<AbstractMesh>;
  248. /** Set a function to call when this mesh collides with another one */
  249. set onCollide(callback: (collidedMesh?: AbstractMesh) => void);
  250. /**
  251. * An event triggered when the collision's position changes
  252. */
  253. onCollisionPositionChangeObservable: Observable<Vector3>;
  254. /** Set a function to call when the collision's position changes */
  255. set onCollisionPositionChange(callback: () => void);
  256. /**
  257. * An event triggered when material is changed
  258. */
  259. onMaterialChangedObservable: Observable<AbstractMesh>;
  260. /**
  261. * Gets or sets the orientation for POV movement & rotation
  262. */
  263. definedFacingForward: boolean;
  264. /** @internal */
  265. _occlusionQuery: Nullable<WebGLQuery | number>;
  266. /** @internal */
  267. _renderingGroup: Nullable<RenderingGroup>;
  268. /**
  269. * Gets or sets mesh visibility between 0 and 1 (default is 1)
  270. */
  271. get visibility(): number;
  272. /**
  273. * Gets or sets mesh visibility between 0 and 1 (default is 1)
  274. */
  275. set visibility(value: number);
  276. /** Gets or sets the alpha index used to sort transparent meshes
  277. * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/advanced/transparent_rendering#alpha-index
  278. */
  279. alphaIndex: number;
  280. /**
  281. * Gets or sets a boolean indicating if the mesh is visible (renderable). Default is true
  282. */
  283. isVisible: boolean;
  284. /**
  285. * Gets or sets a boolean indicating if the mesh can be picked (by scene.pick for instance or through actions). Default is true
  286. */
  287. isPickable: boolean;
  288. /**
  289. * Gets or sets a boolean indicating if the mesh can be near picked (touched by the XR controller or hands). Default is false
  290. */
  291. isNearPickable: boolean;
  292. /**
  293. * Gets or sets a boolean indicating if the mesh can be grabbed. Default is false.
  294. * Setting this to true, while using the XR near interaction feature, will trigger a pointer event when the mesh is grabbed.
  295. * Grabbing means that the controller is using the squeeze or main trigger button to grab the mesh.
  296. * This is different from nearPickable which only triggers the event when the mesh is touched by the controller
  297. */
  298. isNearGrabbable: boolean;
  299. /** Gets or sets a boolean indicating that bounding boxes of subMeshes must be rendered as well (false by default) */
  300. showSubMeshesBoundingBox: boolean;
  301. /** Gets or sets a boolean indicating if the mesh must be considered as a ray blocker for lens flares (false by default)
  302. * @see https://doc.babylonjs.com/features/featuresDeepDive/environment/lenseFlare
  303. */
  304. isBlocker: boolean;
  305. /**
  306. * Gets or sets a boolean indicating that pointer move events must be supported on this mesh (false by default)
  307. */
  308. enablePointerMoveEvents: boolean;
  309. /**
  310. * Gets or sets the property which disables the test that is checking that the mesh under the pointer is the same than the previous time we tested for it (default: false).
  311. * Set this property to true if you want thin instances picking to be reported accurately when moving over the mesh.
  312. * Note that setting this property to true will incur some performance penalties when dealing with pointer events for this mesh so use it sparingly.
  313. */
  314. get pointerOverDisableMeshTesting(): boolean;
  315. set pointerOverDisableMeshTesting(disable: boolean);
  316. /**
  317. * Specifies the rendering group id for this mesh (0 by default)
  318. * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/advanced/transparent_rendering#rendering-groups
  319. */
  320. get renderingGroupId(): number;
  321. set renderingGroupId(value: number);
  322. /** Gets or sets current material */
  323. get material(): Nullable<Material>;
  324. set material(value: Nullable<Material>);
  325. /**
  326. * Gets the material used to render the mesh in a specific render pass
  327. * @param renderPassId render pass id
  328. * @returns material used for the render pass. If no specific material is used for this render pass, undefined is returned (meaning mesh.material is used for this pass)
  329. */
  330. getMaterialForRenderPass(renderPassId: number): Material | undefined;
  331. /**
  332. * Sets the material to be used to render the mesh in a specific render pass
  333. * @param renderPassId render pass id
  334. * @param material material to use for this render pass. If undefined is passed, no specific material will be used for this render pass but the regular material will be used instead (mesh.material)
  335. */
  336. setMaterialForRenderPass(renderPassId: number, material?: Material): void;
  337. /**
  338. * Gets or sets a boolean indicating that this mesh can receive realtime shadows
  339. * @see https://doc.babylonjs.com/features/featuresDeepDive/lights/shadows
  340. */
  341. get receiveShadows(): boolean;
  342. set receiveShadows(value: boolean);
  343. /** Defines color to use when rendering outline */
  344. outlineColor: Color3;
  345. /** Define width to use when rendering outline */
  346. outlineWidth: number;
  347. /** Defines color to use when rendering overlay */
  348. overlayColor: Color3;
  349. /** Defines alpha to use when rendering overlay */
  350. overlayAlpha: number;
  351. /** Gets or sets a boolean indicating that this mesh contains vertex color data with alpha values */
  352. get hasVertexAlpha(): boolean;
  353. set hasVertexAlpha(value: boolean);
  354. /** Gets or sets a boolean indicating that this mesh needs to use vertex color data to render (if this kind of vertex data is available in the geometry) */
  355. get useVertexColors(): boolean;
  356. set useVertexColors(value: boolean);
  357. /**
  358. * Gets or sets a boolean indicating that bone animations must be computed by the GPU (true by default)
  359. */
  360. get computeBonesUsingShaders(): boolean;
  361. set computeBonesUsingShaders(value: boolean);
  362. /** Gets or sets the number of allowed bone influences per vertex (4 by default) */
  363. get numBoneInfluencers(): number;
  364. set numBoneInfluencers(value: number);
  365. /** Gets or sets a boolean indicating that this mesh will allow fog to be rendered on it (true by default) */
  366. get applyFog(): boolean;
  367. set applyFog(value: boolean);
  368. /** When enabled, decompose picking matrices for better precision with large values for mesh position and scling */
  369. get enableDistantPicking(): boolean;
  370. set enableDistantPicking(value: boolean);
  371. /** Gets or sets a boolean indicating that internal octree (if available) can be used to boost submeshes selection (true by default) */
  372. useOctreeForRenderingSelection: boolean;
  373. /** Gets or sets a boolean indicating that internal octree (if available) can be used to boost submeshes picking (true by default) */
  374. useOctreeForPicking: boolean;
  375. /** Gets or sets a boolean indicating that internal octree (if available) can be used to boost submeshes collision (true by default) */
  376. useOctreeForCollisions: boolean;
  377. /**
  378. * Gets or sets the current layer mask (default is 0x0FFFFFFF)
  379. * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/layerMasksAndMultiCam
  380. */
  381. get layerMask(): number;
  382. set layerMask(value: number);
  383. /**
  384. * True if the mesh must be rendered in any case (this will shortcut the frustum clipping phase)
  385. */
  386. alwaysSelectAsActiveMesh: boolean;
  387. /**
  388. * Gets or sets a boolean indicating that the bounding info does not need to be kept in sync (for performance reason)
  389. */
  390. doNotSyncBoundingInfo: boolean;
  391. /**
  392. * Gets or sets the current action manager
  393. * @see https://doc.babylonjs.com/features/featuresDeepDive/events/actions
  394. */
  395. actionManager: Nullable<AbstractActionManager>;
  396. /**
  397. * Gets or sets the ellipsoid used to impersonate this mesh when using collision engine (default is (0.5, 1, 0.5))
  398. * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_collisions
  399. */
  400. ellipsoid: Vector3;
  401. /**
  402. * Gets or sets the ellipsoid offset used to impersonate this mesh when using collision engine (default is (0, 0, 0))
  403. * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_collisions
  404. */
  405. ellipsoidOffset: Vector3;
  406. /**
  407. * Gets or sets a collision mask used to mask collisions (default is -1).
  408. * A collision between A and B will happen if A.collisionGroup & b.collisionMask !== 0
  409. */
  410. get collisionMask(): number;
  411. set collisionMask(mask: number);
  412. /**
  413. * Gets or sets a collision response flag (default is true).
  414. * when collisionResponse is false, events are still triggered but colliding entity has no response
  415. * This helps creating trigger volume when user wants collision feedback events but not position/velocity
  416. * to respond to the collision.
  417. */
  418. get collisionResponse(): boolean;
  419. set collisionResponse(response: boolean);
  420. /**
  421. * Gets or sets the current collision group mask (-1 by default).
  422. * A collision between A and B will happen if A.collisionGroup & b.collisionMask !== 0
  423. */
  424. get collisionGroup(): number;
  425. set collisionGroup(mask: number);
  426. /**
  427. * Gets or sets current surrounding meshes (null by default).
  428. *
  429. * By default collision detection is tested against every mesh in the scene.
  430. * It is possible to set surroundingMeshes to a defined list of meshes and then only these specified
  431. * meshes will be tested for the collision.
  432. *
  433. * Note: if set to an empty array no collision will happen when this mesh is moved.
  434. */
  435. get surroundingMeshes(): Nullable<AbstractMesh[]>;
  436. set surroundingMeshes(meshes: Nullable<AbstractMesh[]>);
  437. /**
  438. * Defines edge width used when edgesRenderer is enabled
  439. * @see https://www.babylonjs-playground.com/#10OJSG#13
  440. */
  441. edgesWidth: number;
  442. /**
  443. * Defines edge color used when edgesRenderer is enabled
  444. * @see https://www.babylonjs-playground.com/#10OJSG#13
  445. */
  446. edgesColor: Color4;
  447. /** @internal */
  448. _edgesRenderer: Nullable<IEdgesRenderer>;
  449. /** @internal */
  450. _masterMesh: Nullable<AbstractMesh>;
  451. protected _boundingInfo: Nullable<BoundingInfo>;
  452. protected _boundingInfoIsDirty: boolean;
  453. /** @internal */
  454. _renderId: number;
  455. /**
  456. * Gets or sets the list of subMeshes
  457. * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/multiMaterials
  458. */
  459. subMeshes: SubMesh[];
  460. /** @internal */
  461. _intersectionsInProgress: AbstractMesh[];
  462. /** @internal */
  463. _unIndexed: boolean;
  464. /** @internal */
  465. _lightSources: Light[];
  466. /** Gets the list of lights affecting that mesh */
  467. get lightSources(): Light[];
  468. /** @internal */
  469. get _positions(): Nullable<Vector3[]>;
  470. /** @internal */
  471. _waitingData: {
  472. lods: Nullable<any>;
  473. actions: Nullable<any>;
  474. freezeWorldMatrix: Nullable<boolean>;
  475. };
  476. /** @internal */
  477. _bonesTransformMatrices: Nullable<Float32Array>;
  478. /** @internal */
  479. _transformMatrixTexture: Nullable<RawTexture>;
  480. /**
  481. * Gets or sets a skeleton to apply skinning transformations
  482. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons
  483. */
  484. set skeleton(value: Nullable<Skeleton>);
  485. get skeleton(): Nullable<Skeleton>;
  486. /**
  487. * An event triggered when the mesh is rebuilt.
  488. */
  489. onRebuildObservable: Observable<AbstractMesh>;
  490. /**
  491. * The current mesh uniform buffer.
  492. * @internal Internal use only.
  493. */
  494. _uniformBuffer: UniformBuffer;
  495. /**
  496. * Creates a new AbstractMesh
  497. * @param name defines the name of the mesh
  498. * @param scene defines the hosting scene
  499. */
  500. constructor(name: string, scene?: Nullable<Scene>);
  501. protected _buildUniformLayout(): void;
  502. /**
  503. * Transfer the mesh values to its UBO.
  504. * @param world The world matrix associated with the mesh
  505. */
  506. transferToEffect(world: Matrix): void;
  507. /**
  508. * Gets the mesh uniform buffer.
  509. * @returns the uniform buffer of the mesh.
  510. */
  511. getMeshUniformBuffer(): UniformBuffer;
  512. /**
  513. * Returns the string "AbstractMesh"
  514. * @returns "AbstractMesh"
  515. */
  516. getClassName(): string;
  517. /**
  518. * Gets a string representation of the current mesh
  519. * @param fullDetails defines a boolean indicating if full details must be included
  520. * @returns a string representation of the current mesh
  521. */
  522. toString(fullDetails?: boolean): string;
  523. /**
  524. * @internal
  525. */
  526. protected _getEffectiveParent(): Nullable<Node>;
  527. /**
  528. * @internal
  529. */
  530. _getActionManagerForTrigger(trigger?: number, initialCall?: boolean): Nullable<AbstractActionManager>;
  531. /**
  532. * @internal
  533. */
  534. _rebuild(dispose?: boolean): void;
  535. /** @internal */
  536. _resyncLightSources(): void;
  537. /**
  538. * @internal
  539. */
  540. _resyncLightSource(light: Light): void;
  541. /** @internal */
  542. _unBindEffect(): void;
  543. /**
  544. * @internal
  545. */
  546. _removeLightSource(light: Light, dispose: boolean): void;
  547. private _markSubMeshesAsDirty;
  548. /**
  549. * @internal
  550. */
  551. _markSubMeshesAsLightDirty(dispose?: boolean): void;
  552. /** @internal */
  553. _markSubMeshesAsAttributesDirty(): void;
  554. /** @internal */
  555. _markSubMeshesAsMiscDirty(): void;
  556. /**
  557. * Flag the AbstractMesh as dirty (Forcing it to update everything)
  558. * @param property if set to "rotation" the objects rotationQuaternion will be set to null
  559. * @returns this AbstractMesh
  560. */
  561. markAsDirty(property?: string): AbstractMesh;
  562. /**
  563. * Resets the draw wrappers cache for all submeshes of this abstract mesh
  564. * @param passId If provided, releases only the draw wrapper corresponding to this render pass id
  565. */
  566. resetDrawCache(passId?: number): void;
  567. /**
  568. * Returns true if the mesh is blocked. Implemented by child classes
  569. */
  570. get isBlocked(): boolean;
  571. /**
  572. * Returns the mesh itself by default. Implemented by child classes
  573. * @param camera defines the camera to use to pick the right LOD level
  574. * @returns the currentAbstractMesh
  575. */
  576. getLOD(camera: Camera): Nullable<AbstractMesh>;
  577. /**
  578. * Returns 0 by default. Implemented by child classes
  579. * @returns an integer
  580. */
  581. getTotalVertices(): number;
  582. /**
  583. * Returns a positive integer : the total number of indices in this mesh geometry.
  584. * @returns the number of indices or zero if the mesh has no geometry.
  585. */
  586. getTotalIndices(): number;
  587. /**
  588. * Returns null by default. Implemented by child classes
  589. * @returns null
  590. */
  591. getIndices(): Nullable<IndicesArray>;
  592. /**
  593. * Returns the array of the requested vertex data kind. Implemented by child classes
  594. * @param kind defines the vertex data kind to use
  595. * @returns null
  596. */
  597. getVerticesData(kind: string): Nullable<FloatArray>;
  598. /**
  599. * Sets the vertex data of the mesh geometry for the requested `kind`.
  600. * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.
  601. * Note that a new underlying VertexBuffer object is created each call.
  602. * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
  603. * @param kind defines vertex data kind:
  604. * * VertexBuffer.PositionKind
  605. * * VertexBuffer.UVKind
  606. * * VertexBuffer.UV2Kind
  607. * * VertexBuffer.UV3Kind
  608. * * VertexBuffer.UV4Kind
  609. * * VertexBuffer.UV5Kind
  610. * * VertexBuffer.UV6Kind
  611. * * VertexBuffer.ColorKind
  612. * * VertexBuffer.MatricesIndicesKind
  613. * * VertexBuffer.MatricesIndicesExtraKind
  614. * * VertexBuffer.MatricesWeightsKind
  615. * * VertexBuffer.MatricesWeightsExtraKind
  616. * @param data defines the data source
  617. * @param updatable defines if the data must be flagged as updatable (or static)
  618. * @param stride defines the vertex stride (size of an entire vertex). Can be null and in this case will be deduced from vertex data kind
  619. * @returns the current mesh
  620. */
  621. setVerticesData(kind: string, data: FloatArray, updatable?: boolean, stride?: number): AbstractMesh;
  622. /**
  623. * Updates the existing vertex data of the mesh geometry for the requested `kind`.
  624. * If the mesh has no geometry, it is simply returned as it is.
  625. * @param kind defines vertex data kind:
  626. * * VertexBuffer.PositionKind
  627. * * VertexBuffer.UVKind
  628. * * VertexBuffer.UV2Kind
  629. * * VertexBuffer.UV3Kind
  630. * * VertexBuffer.UV4Kind
  631. * * VertexBuffer.UV5Kind
  632. * * VertexBuffer.UV6Kind
  633. * * VertexBuffer.ColorKind
  634. * * VertexBuffer.MatricesIndicesKind
  635. * * VertexBuffer.MatricesIndicesExtraKind
  636. * * VertexBuffer.MatricesWeightsKind
  637. * * VertexBuffer.MatricesWeightsExtraKind
  638. * @param data defines the data source
  639. * @param updateExtends If `kind` is `PositionKind` and if `updateExtends` is true, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed
  640. * @param makeItUnique If true, a new global geometry is created from this data and is set to the mesh
  641. * @returns the current mesh
  642. */
  643. updateVerticesData(kind: string, data: FloatArray, updateExtends?: boolean, makeItUnique?: boolean): AbstractMesh;
  644. /**
  645. * Sets the mesh indices,
  646. * If the mesh has no geometry, a new Geometry object is created and set to the mesh.
  647. * @param indices Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array)
  648. * @param totalVertices Defines the total number of vertices
  649. * @returns the current mesh
  650. */
  651. setIndices(indices: IndicesArray, totalVertices: Nullable<number>): AbstractMesh;
  652. /**
  653. * Gets a boolean indicating if specific vertex data is present
  654. * @param kind defines the vertex data kind to use
  655. * @returns true is data kind is present
  656. */
  657. isVerticesDataPresent(kind: string): boolean;
  658. /**
  659. * Returns the mesh BoundingInfo object or creates a new one and returns if it was undefined.
  660. * Note that it returns a shallow bounding of the mesh (i.e. it does not include children).
  661. * However, if the mesh contains thin instances, it will be expanded to include them. If you want the "raw" bounding data instead, then use `getRawBoundingInfo()`.
  662. * To get the full bounding of all children, call `getHierarchyBoundingVectors` instead.
  663. * @returns a BoundingInfo
  664. */
  665. getBoundingInfo(): BoundingInfo;
  666. /**
  667. * Returns the bounding info unnafected by instance data.
  668. * @returns the bounding info of the mesh unaffected by instance data.
  669. */
  670. getRawBoundingInfo(): BoundingInfo;
  671. /**
  672. * Overwrite the current bounding info
  673. * @param boundingInfo defines the new bounding info
  674. * @returns the current mesh
  675. */
  676. setBoundingInfo(boundingInfo: BoundingInfo): AbstractMesh;
  677. /**
  678. * Returns true if there is already a bounding info
  679. */
  680. get hasBoundingInfo(): boolean;
  681. /**
  682. * Creates a new bounding info for the mesh
  683. * @param minimum min vector of the bounding box/sphere
  684. * @param maximum max vector of the bounding box/sphere
  685. * @param worldMatrix defines the new world matrix
  686. * @returns the new bounding info
  687. */
  688. buildBoundingInfo(minimum: DeepImmutable<Vector3>, maximum: DeepImmutable<Vector3>, worldMatrix?: DeepImmutable<Matrix>): BoundingInfo;
  689. /**
  690. * Uniformly scales the mesh to fit inside of a unit cube (1 X 1 X 1 units)
  691. * @param includeDescendants Use the hierarchy's bounding box instead of the mesh's bounding box. Default is false
  692. * @param ignoreRotation ignore rotation when computing the scale (ie. object will be axis aligned). Default is false
  693. * @param predicate predicate that is passed in to getHierarchyBoundingVectors when selecting which object should be included when scaling
  694. * @returns the current mesh
  695. */
  696. normalizeToUnitCube(includeDescendants?: boolean, ignoreRotation?: boolean, predicate?: Nullable<(node: AbstractMesh) => boolean>): AbstractMesh;
  697. /** Gets a boolean indicating if this mesh has skinning data and an attached skeleton */
  698. get useBones(): boolean;
  699. /** @internal */
  700. _preActivate(): void;
  701. /**
  702. * @internal
  703. */
  704. _preActivateForIntermediateRendering(renderId: number): void;
  705. /**
  706. * @internal
  707. */
  708. _activate(renderId: number, intermediateRendering: boolean): boolean;
  709. /** @internal */
  710. _postActivate(): void;
  711. /** @internal */
  712. _freeze(): void;
  713. /** @internal */
  714. _unFreeze(): void;
  715. /**
  716. * Gets the current world matrix
  717. * @returns a Matrix
  718. */
  719. getWorldMatrix(): Matrix;
  720. /** @internal */
  721. _getWorldMatrixDeterminant(): number;
  722. /**
  723. * Gets a boolean indicating if this mesh is an instance or a regular mesh
  724. */
  725. get isAnInstance(): boolean;
  726. /**
  727. * Gets a boolean indicating if this mesh has instances
  728. */
  729. get hasInstances(): boolean;
  730. /**
  731. * Gets a boolean indicating if this mesh has thin instances
  732. */
  733. get hasThinInstances(): boolean;
  734. /**
  735. * Perform relative position change from the point of view of behind the front of the mesh.
  736. * This is performed taking into account the meshes current rotation, so you do not have to care.
  737. * Supports definition of mesh facing forward or backward {@link definedFacingForwardSearch | See definedFacingForwardSearch }.
  738. * @param amountRight defines the distance on the right axis
  739. * @param amountUp defines the distance on the up axis
  740. * @param amountForward defines the distance on the forward axis
  741. * @returns the current mesh
  742. */
  743. movePOV(amountRight: number, amountUp: number, amountForward: number): AbstractMesh;
  744. /**
  745. * Calculate relative position change from the point of view of behind the front of the mesh.
  746. * This is performed taking into account the meshes current rotation, so you do not have to care.
  747. * Supports definition of mesh facing forward or backward {@link definedFacingForwardSearch | See definedFacingForwardSearch }.
  748. * @param amountRight defines the distance on the right axis
  749. * @param amountUp defines the distance on the up axis
  750. * @param amountForward defines the distance on the forward axis
  751. * @returns the new displacement vector
  752. */
  753. calcMovePOV(amountRight: number, amountUp: number, amountForward: number): Vector3;
  754. /**
  755. * Perform relative rotation change from the point of view of behind the front of the mesh.
  756. * Supports definition of mesh facing forward or backward {@link definedFacingForwardSearch | See definedFacingForwardSearch }.
  757. * @param flipBack defines the flip
  758. * @param twirlClockwise defines the twirl
  759. * @param tiltRight defines the tilt
  760. * @returns the current mesh
  761. */
  762. rotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): AbstractMesh;
  763. /**
  764. * Calculate relative rotation change from the point of view of behind the front of the mesh.
  765. * Supports definition of mesh facing forward or backward {@link definedFacingForwardSearch | See definedFacingForwardSearch }.
  766. * @param flipBack defines the flip
  767. * @param twirlClockwise defines the twirl
  768. * @param tiltRight defines the tilt
  769. * @returns the new rotation vector
  770. */
  771. calcRotatePOV(flipBack: number, twirlClockwise: number, tiltRight: number): Vector3;
  772. /**
  773. * This method recomputes and sets a new BoundingInfo to the mesh unless it is locked.
  774. * This means the mesh underlying bounding box and sphere are recomputed.
  775. * @param applySkeleton defines whether to apply the skeleton before computing the bounding info
  776. * @param applyMorph defines whether to apply the morph target before computing the bounding info
  777. * @returns the current mesh
  778. */
  779. refreshBoundingInfo(applySkeleton?: boolean, applyMorph?: boolean): AbstractMesh;
  780. /**
  781. * @internal
  782. */
  783. _refreshBoundingInfo(data: Nullable<FloatArray>, bias: Nullable<Vector2>): void;
  784. /**
  785. * Internal function to get buffer data and possibly apply morphs and normals
  786. * @param applySkeleton
  787. * @param applyMorph
  788. * @param data
  789. * @param kind the kind of data you want. Can be Normal or Position
  790. * @returns a FloatArray of the vertex data
  791. */
  792. private _getData;
  793. /**
  794. * Get the normals vertex data and optionally apply skeleton and morphing.
  795. * @param applySkeleton defines whether to apply the skeleton
  796. * @param applyMorph defines whether to apply the morph target
  797. * @returns the normals data
  798. */
  799. getNormalsData(applySkeleton?: boolean, applyMorph?: boolean): Nullable<FloatArray>;
  800. /**
  801. * Get the position vertex data and optionally apply skeleton and morphing.
  802. * @param applySkeleton defines whether to apply the skeleton
  803. * @param applyMorph defines whether to apply the morph target
  804. * @param data defines the position data to apply the skeleton and morph to
  805. * @returns the position data
  806. */
  807. getPositionData(applySkeleton?: boolean, applyMorph?: boolean, data?: Nullable<FloatArray>): Nullable<FloatArray>;
  808. /**
  809. * @internal
  810. */
  811. _getPositionData(applySkeleton: boolean, applyMorph: boolean): Nullable<FloatArray>;
  812. /** @internal */
  813. _updateBoundingInfo(): AbstractMesh;
  814. /**
  815. * @internal
  816. */
  817. _updateSubMeshesBoundingInfo(matrix: DeepImmutable<Matrix>): AbstractMesh;
  818. /** @internal */
  819. protected _afterComputeWorldMatrix(): void;
  820. /**
  821. * Returns `true` if the mesh is within the frustum defined by the passed array of planes.
  822. * A mesh is in the frustum if its bounding box intersects the frustum
  823. * @param frustumPlanes defines the frustum to test
  824. * @returns true if the mesh is in the frustum planes
  825. */
  826. isInFrustum(frustumPlanes: Plane[]): boolean;
  827. /**
  828. * Returns `true` if the mesh is completely in the frustum defined be the passed array of planes.
  829. * A mesh is completely in the frustum if its bounding box it completely inside the frustum.
  830. * @param frustumPlanes defines the frustum to test
  831. * @returns true if the mesh is completely in the frustum planes
  832. */
  833. isCompletelyInFrustum(frustumPlanes: Plane[]): boolean;
  834. /**
  835. * True if the mesh intersects another mesh or a SolidParticle object
  836. * @param mesh defines a target mesh or SolidParticle to test
  837. * @param precise Unless the parameter `precise` is set to `true` the intersection is computed according to Axis Aligned Bounding Boxes (AABB), else according to OBB (Oriented BBoxes)
  838. * @param includeDescendants Can be set to true to test if the mesh defined in parameters intersects with the current mesh or any child meshes
  839. * @returns true if there is an intersection
  840. */
  841. intersectsMesh(mesh: AbstractMesh | SolidParticle, precise?: boolean, includeDescendants?: boolean): boolean;
  842. /**
  843. * Returns true if the passed point (Vector3) is inside the mesh bounding box
  844. * @param point defines the point to test
  845. * @returns true if there is an intersection
  846. */
  847. intersectsPoint(point: Vector3): boolean;
  848. /**
  849. * Gets or sets a boolean indicating that this mesh can be used in the collision engine
  850. * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_collisions
  851. */
  852. get checkCollisions(): boolean;
  853. set checkCollisions(collisionEnabled: boolean);
  854. /**
  855. * Gets Collider object used to compute collisions (not physics)
  856. * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_collisions
  857. */
  858. get collider(): Nullable<Collider>;
  859. /**
  860. * Move the mesh using collision engine
  861. * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras/camera_collisions
  862. * @param displacement defines the requested displacement vector
  863. * @returns the current mesh
  864. */
  865. moveWithCollisions(displacement: Vector3): AbstractMesh;
  866. private _onCollisionPositionChange;
  867. /**
  868. * @internal
  869. */
  870. _collideForSubMesh(subMesh: SubMesh, transformMatrix: Matrix, collider: Collider): AbstractMesh;
  871. /**
  872. * @internal
  873. */
  874. _processCollisionsForSubMeshes(collider: Collider, transformMatrix: Matrix): AbstractMesh;
  875. /** @internal */
  876. _shouldConvertRHS(): boolean;
  877. /**
  878. * @internal
  879. */
  880. _checkCollision(collider: Collider): AbstractMesh;
  881. /** @internal */
  882. _generatePointsArray(): boolean;
  883. /**
  884. * Checks if the passed Ray intersects with the mesh. A mesh triangle can be picked both from its front and back sides,
  885. * irrespective of orientation.
  886. * @param ray defines the ray to use. It should be in the mesh's LOCAL coordinate space.
  887. * @param fastCheck defines if fast mode (but less precise) must be used (false by default)
  888. * @param trianglePredicate defines an optional predicate used to select faces when a mesh intersection is detected
  889. * @param onlyBoundingInfo defines a boolean indicating if picking should only happen using bounding info (false by default)
  890. * @param worldToUse defines the world matrix to use to get the world coordinate of the intersection point
  891. * @param skipBoundingInfo a boolean indicating if we should skip the bounding info check
  892. * @returns the picking info
  893. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/interactions/mesh_intersect
  894. */
  895. intersects(ray: Ray, fastCheck?: boolean, trianglePredicate?: TrianglePickingPredicate, onlyBoundingInfo?: boolean, worldToUse?: Matrix, skipBoundingInfo?: boolean): PickingInfo;
  896. /**
  897. * Clones the current mesh
  898. * @param name defines the mesh name
  899. * @param newParent defines the new mesh parent
  900. * @param doNotCloneChildren defines a boolean indicating that children must not be cloned (false by default)
  901. * @returns the new mesh
  902. */
  903. clone(name: string, newParent: Nullable<Node>, doNotCloneChildren?: boolean): Nullable<AbstractMesh>;
  904. /**
  905. * Disposes all the submeshes of the current meshnp
  906. * @returns the current mesh
  907. */
  908. releaseSubMeshes(): AbstractMesh;
  909. /**
  910. * Releases resources associated with this abstract mesh.
  911. * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)
  912. * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)
  913. */
  914. dispose(doNotRecurse?: boolean, disposeMaterialAndTextures?: boolean): void;
  915. /**
  916. * Adds the passed mesh as a child to the current mesh
  917. * @param mesh defines the child mesh
  918. * @param preserveScalingSign if true, keep scaling sign of child. Otherwise, scaling sign might change.
  919. * @returns the current mesh
  920. */
  921. addChild(mesh: AbstractMesh, preserveScalingSign?: boolean): AbstractMesh;
  922. /**
  923. * Removes the passed mesh from the current mesh children list
  924. * @param mesh defines the child mesh
  925. * @param preserveScalingSign if true, keep scaling sign of child. Otherwise, scaling sign might change.
  926. * @returns the current mesh
  927. */
  928. removeChild(mesh: AbstractMesh, preserveScalingSign?: boolean): AbstractMesh;
  929. /** @internal */
  930. private _initFacetData;
  931. /**
  932. * Updates the mesh facetData arrays and the internal partitioning when the mesh is morphed or updated.
  933. * This method can be called within the render loop.
  934. * You don't need to call this method by yourself in the render loop when you update/morph a mesh with the methods CreateXXX() as they automatically manage this computation
  935. * @returns the current mesh
  936. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData
  937. */
  938. updateFacetData(): AbstractMesh;
  939. /**
  940. * Returns the facetLocalNormals array.
  941. * The normals are expressed in the mesh local spac
  942. * @returns an array of Vector3
  943. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData
  944. */
  945. getFacetLocalNormals(): Vector3[];
  946. /**
  947. * Returns the facetLocalPositions array.
  948. * The facet positions are expressed in the mesh local space
  949. * @returns an array of Vector3
  950. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData
  951. */
  952. getFacetLocalPositions(): Vector3[];
  953. /**
  954. * Returns the facetLocalPartitioning array
  955. * @returns an array of array of numbers
  956. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData
  957. */
  958. getFacetLocalPartitioning(): number[][];
  959. /**
  960. * Returns the i-th facet position in the world system.
  961. * This method allocates a new Vector3 per call
  962. * @param i defines the facet index
  963. * @returns a new Vector3
  964. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData
  965. */
  966. getFacetPosition(i: number): Vector3;
  967. /**
  968. * Sets the reference Vector3 with the i-th facet position in the world system
  969. * @param i defines the facet index
  970. * @param ref defines the target vector
  971. * @returns the current mesh
  972. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData
  973. */
  974. getFacetPositionToRef(i: number, ref: Vector3): AbstractMesh;
  975. /**
  976. * Returns the i-th facet normal in the world system.
  977. * This method allocates a new Vector3 per call
  978. * @param i defines the facet index
  979. * @returns a new Vector3
  980. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData
  981. */
  982. getFacetNormal(i: number): Vector3;
  983. /**
  984. * Sets the reference Vector3 with the i-th facet normal in the world system
  985. * @param i defines the facet index
  986. * @param ref defines the target vector
  987. * @returns the current mesh
  988. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData
  989. */
  990. getFacetNormalToRef(i: number, ref: Vector3): this;
  991. /**
  992. * Returns the facets (in an array) in the same partitioning block than the one the passed coordinates are located (expressed in the mesh local system)
  993. * @param x defines x coordinate
  994. * @param y defines y coordinate
  995. * @param z defines z coordinate
  996. * @returns the array of facet indexes
  997. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData
  998. */
  999. getFacetsAtLocalCoordinates(x: number, y: number, z: number): Nullable<number[]>;
  1000. /**
  1001. * Returns the closest mesh facet index at (x,y,z) World coordinates, null if not found
  1002. * @param x defines x coordinate
  1003. * @param y defines y coordinate
  1004. * @param z defines z coordinate
  1005. * @param projected sets as the (x,y,z) world projection on the facet
  1006. * @param checkFace if true (default false), only the facet "facing" to (x,y,z) or only the ones "turning their backs", according to the parameter "facing" are returned
  1007. * @param facing if facing and checkFace are true, only the facet "facing" to (x, y, z) are returned : positive dot (x, y, z) * facet position. If facing si false and checkFace is true, only the facet "turning their backs" to (x, y, z) are returned : negative dot (x, y, z) * facet position
  1008. * @returns the face index if found (or null instead)
  1009. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData
  1010. */
  1011. getClosestFacetAtCoordinates(x: number, y: number, z: number, projected?: Vector3, checkFace?: boolean, facing?: boolean): Nullable<number>;
  1012. /**
  1013. * Returns the closest mesh facet index at (x,y,z) local coordinates, null if not found
  1014. * @param x defines x coordinate
  1015. * @param y defines y coordinate
  1016. * @param z defines z coordinate
  1017. * @param projected sets as the (x,y,z) local projection on the facet
  1018. * @param checkFace if true (default false), only the facet "facing" to (x,y,z) or only the ones "turning their backs", according to the parameter "facing" are returned
  1019. * @param facing if facing and checkFace are true, only the facet "facing" to (x, y, z) are returned : positive dot (x, y, z) * facet position. If facing si false and checkFace is true, only the facet "turning their backs" to (x, y, z) are returned : negative dot (x, y, z) * facet position
  1020. * @returns the face index if found (or null instead)
  1021. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData
  1022. */
  1023. getClosestFacetAtLocalCoordinates(x: number, y: number, z: number, projected?: Vector3, checkFace?: boolean, facing?: boolean): Nullable<number>;
  1024. /**
  1025. * Returns the object "parameter" set with all the expected parameters for facetData computation by ComputeNormals()
  1026. * @returns the parameters
  1027. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData
  1028. */
  1029. getFacetDataParameters(): any;
  1030. /**
  1031. * Disables the feature FacetData and frees the related memory
  1032. * @returns the current mesh
  1033. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/facetData
  1034. */
  1035. disableFacetData(): AbstractMesh;
  1036. /**
  1037. * Updates the AbstractMesh indices array
  1038. * @param indices defines the data source
  1039. * @param offset defines the offset in the index buffer where to store the new data (can be null)
  1040. * @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)
  1041. * @returns the current mesh
  1042. */
  1043. updateIndices(indices: IndicesArray, offset?: number, gpuMemoryOnly?: boolean): AbstractMesh;
  1044. /**
  1045. * Creates new normals data for the mesh
  1046. * @param updatable defines if the normal vertex buffer must be flagged as updatable
  1047. * @returns the current mesh
  1048. */
  1049. createNormals(updatable: boolean): AbstractMesh;
  1050. /**
  1051. * Align the mesh with a normal
  1052. * @param normal defines the normal to use
  1053. * @param upDirection can be used to redefined the up vector to use (will use the (0, 1, 0) by default)
  1054. * @returns the current mesh
  1055. */
  1056. alignWithNormal(normal: Vector3, upDirection?: Vector3): AbstractMesh;
  1057. /** @internal */
  1058. _checkOcclusionQuery(): boolean;
  1059. /**
  1060. * Disables the mesh edge rendering mode
  1061. * @returns the currentAbstractMesh
  1062. */
  1063. disableEdgesRendering(): AbstractMesh;
  1064. /**
  1065. * Enables the edge rendering mode on the mesh.
  1066. * This mode makes the mesh edges visible
  1067. * @param epsilon defines the maximal distance between two angles to detect a face
  1068. * @param checkVerticesInsteadOfIndices indicates that we should check vertex list directly instead of faces
  1069. * @param options options to the edge renderer
  1070. * @returns the currentAbstractMesh
  1071. * @see https://www.babylonjs-playground.com/#19O9TU#0
  1072. */
  1073. enableEdgesRendering(epsilon?: number, checkVerticesInsteadOfIndices?: boolean, options?: IEdgesRendererOptions): AbstractMesh;
  1074. /**
  1075. * This function returns all of the particle systems in the scene that use the mesh as an emitter.
  1076. * @returns an array of particle systems in the scene that use the mesh as an emitter
  1077. */
  1078. getConnectedParticleSystems(): IParticleSystem[];
  1079. }
  1080. export {};