cloudPoint.d.ts 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. import type { Nullable } from "../types";
  2. import type { Matrix } from "../Maths/math";
  3. import { Color4, Vector2, Vector3, Quaternion } from "../Maths/math";
  4. import type { Mesh } from "../Meshes/mesh";
  5. import type { BoundingInfo } from "../Culling/boundingInfo";
  6. import type { PointsCloudSystem } from "./pointsCloudSystem";
  7. /**
  8. * Represents one particle of a points cloud system.
  9. */
  10. export declare class CloudPoint {
  11. /**
  12. * particle global index
  13. */
  14. idx: number;
  15. /**
  16. * The color of the particle
  17. */
  18. color: Nullable<Color4>;
  19. /**
  20. * The world space position of the particle.
  21. */
  22. position: Vector3;
  23. /**
  24. * The world space rotation of the particle. (Not use if rotationQuaternion is set)
  25. */
  26. rotation: Vector3;
  27. /**
  28. * The world space rotation quaternion of the particle.
  29. */
  30. rotationQuaternion: Nullable<Quaternion>;
  31. /**
  32. * The uv of the particle.
  33. */
  34. uv: Nullable<Vector2>;
  35. /**
  36. * The current speed of the particle.
  37. */
  38. velocity: Vector3;
  39. /**
  40. * The pivot point in the particle local space.
  41. */
  42. pivot: Vector3;
  43. /**
  44. * Must the particle be translated from its pivot point in its local space ?
  45. * In this case, the pivot point is set at the origin of the particle local space and the particle is translated.
  46. * Default : false
  47. */
  48. translateFromPivot: boolean;
  49. /**
  50. * Index of this particle in the global "positions" array (Internal use)
  51. * @internal
  52. */
  53. _pos: number;
  54. /**
  55. * @internal Index of this particle in the global "indices" array (Internal use)
  56. */
  57. _ind: number;
  58. /**
  59. * Group this particle belongs to
  60. */
  61. _group: PointsGroup;
  62. /**
  63. * Group id of this particle
  64. */
  65. groupId: number;
  66. /**
  67. * Index of the particle in its group id (Internal use)
  68. */
  69. idxInGroup: number;
  70. /**
  71. * @internal Particle BoundingInfo object (Internal use)
  72. */
  73. _boundingInfo: BoundingInfo;
  74. /**
  75. * @internal Reference to the PCS that the particle belongs to (Internal use)
  76. */
  77. _pcs: PointsCloudSystem;
  78. /**
  79. * @internal Still set as invisible in order to skip useless computations (Internal use)
  80. */
  81. _stillInvisible: boolean;
  82. /**
  83. * @internal Last computed particle rotation matrix
  84. */
  85. _rotationMatrix: number[];
  86. /**
  87. * Parent particle Id, if any.
  88. * Default null.
  89. */
  90. parentId: Nullable<number>;
  91. /**
  92. * @internal Internal global position in the PCS.
  93. */
  94. _globalPosition: Vector3;
  95. /**
  96. * Creates a Point Cloud object.
  97. * Don't create particles manually, use instead the PCS internal tools like _addParticle()
  98. * @param particleIndex (integer) is the particle index in the PCS pool. It's also the particle identifier.
  99. * @param group (PointsGroup) is the group the particle belongs to
  100. * @param groupId (integer) is the group identifier in the PCS.
  101. * @param idxInGroup (integer) is the index of the particle in the current point group (ex: the 10th point of addPoints(30))
  102. * @param pcs defines the PCS it is associated to
  103. */
  104. constructor(particleIndex: number, group: PointsGroup, groupId: number, idxInGroup: number, pcs: PointsCloudSystem);
  105. /**
  106. * get point size
  107. */
  108. get size(): Vector3;
  109. /**
  110. * Set point size
  111. */
  112. set size(scale: Vector3);
  113. /**
  114. * Legacy support, changed quaternion to rotationQuaternion
  115. */
  116. get quaternion(): Nullable<Quaternion>;
  117. /**
  118. * Legacy support, changed quaternion to rotationQuaternion
  119. */
  120. set quaternion(q: Nullable<Quaternion>);
  121. /**
  122. * Returns a boolean. True if the particle intersects a mesh, else false
  123. * The intersection is computed on the particle position and Axis Aligned Bounding Box (AABB) or Sphere
  124. * @param target is the object (point or mesh) what the intersection is computed against
  125. * @param isSphere is boolean flag when false (default) bounding box of mesh is used, when true the bounding sphere is used
  126. * @returns true if it intersects
  127. */
  128. intersectsMesh(target: Mesh, isSphere: boolean): boolean;
  129. /**
  130. * get the rotation matrix of the particle
  131. * @internal
  132. */
  133. getRotationMatrix(m: Matrix): void;
  134. }
  135. /**
  136. * Represents a group of points in a points cloud system
  137. * * PCS internal tool, don't use it manually.
  138. */
  139. export declare class PointsGroup {
  140. /**
  141. * Get or set the groupId
  142. * @deprecated Please use groupId instead
  143. */
  144. get groupID(): number;
  145. set groupID(groupID: number);
  146. /**
  147. * The group id
  148. * @internal
  149. */
  150. groupId: number;
  151. /**
  152. * image data for group (internal use)
  153. * @internal
  154. */
  155. _groupImageData: Nullable<ArrayBufferView>;
  156. /**
  157. * Image Width (internal use)
  158. * @internal
  159. */
  160. _groupImgWidth: number;
  161. /**
  162. * Image Height (internal use)
  163. * @internal
  164. */
  165. _groupImgHeight: number;
  166. /**
  167. * Custom position function (internal use)
  168. * @internal
  169. */
  170. _positionFunction: Nullable<(particle: CloudPoint, i?: number, s?: number) => void>;
  171. /**
  172. * density per facet for surface points
  173. * @internal
  174. */
  175. _groupDensity: number[];
  176. /**
  177. * Only when points are colored by texture carries pointer to texture list array
  178. * @internal
  179. */
  180. _textureNb: number;
  181. /**
  182. * Creates a points group object. This is an internal reference to produce particles for the PCS.
  183. * PCS internal tool, don't use it manually.
  184. * @internal
  185. */
  186. constructor(id: number, posFunction: Nullable<(particle: CloudPoint, i?: number, s?: number) => void>);
  187. }