goldbergMesh.d.ts 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. import type { Scene } from "../scene";
  2. import type { Vector2 } from "../Maths/math.vector";
  3. import { Vector3 } from "../Maths/math.vector";
  4. import { Mesh } from "../Meshes/mesh";
  5. import { Color4 } from "../Maths/math.color";
  6. /**
  7. * Defines the set of goldberg data used to create the polygon
  8. */
  9. export type GoldbergData = {
  10. /**
  11. * The list of Goldberg faces colors
  12. */
  13. faceColors: Color4[];
  14. /**
  15. * The list of Goldberg faces centers
  16. */
  17. faceCenters: Vector3[];
  18. /**
  19. * The list of Goldberg faces Z axis
  20. */
  21. faceZaxis: Vector3[];
  22. /**
  23. * The list of Goldberg faces Y axis
  24. */
  25. faceXaxis: Vector3[];
  26. /**
  27. * The list of Goldberg faces X axis
  28. */
  29. faceYaxis: Vector3[];
  30. /**
  31. * Defines the number of shared faces
  32. */
  33. nbSharedFaces: number;
  34. /**
  35. * Defines the number of unshared faces
  36. */
  37. nbUnsharedFaces: number;
  38. /**
  39. * Defines the total number of goldberg faces
  40. */
  41. nbFaces: number;
  42. /**
  43. * Defines the number of goldberg faces at the pole
  44. */
  45. nbFacesAtPole: number;
  46. /**
  47. * Defines the number of adjacent faces per goldberg faces
  48. */
  49. adjacentFaces: number[][];
  50. };
  51. /**
  52. * Mesh for a Goldberg Polyhedron which is made from 12 pentagonal and the rest hexagonal faces
  53. * @see https://en.wikipedia.org/wiki/Goldberg_polyhedron
  54. */
  55. export declare class GoldbergMesh extends Mesh {
  56. /**
  57. * Defines the specific Goldberg data used in this mesh construction.
  58. */
  59. goldbergData: GoldbergData;
  60. /**
  61. * Gets the related Goldberg face from pole infos
  62. * @param poleOrShared Defines the pole index or the shared face index if the fromPole parameter is passed in
  63. * @param fromPole Defines an optional pole index to find the related info from
  64. * @returns the goldberg face number
  65. */
  66. relatedGoldbergFace(poleOrShared: number, fromPole?: number): number;
  67. private _changeGoldbergFaceColors;
  68. /**
  69. * Set new goldberg face colors
  70. * @param colorRange the new color to apply to the mesh
  71. */
  72. setGoldbergFaceColors(colorRange: (number | Color4)[][]): void;
  73. /**
  74. * Updates new goldberg face colors
  75. * @param colorRange the new color to apply to the mesh
  76. */
  77. updateGoldbergFaceColors(colorRange: (number | Color4)[][]): void;
  78. private _changeGoldbergFaceUVs;
  79. /**
  80. * set new goldberg face UVs
  81. * @param uvRange the new UVs to apply to the mesh
  82. */
  83. setGoldbergFaceUVs(uvRange: (number | Vector2)[][]): void;
  84. /**
  85. * Updates new goldberg face UVs
  86. * @param uvRange the new UVs to apply to the mesh
  87. */
  88. updateGoldbergFaceUVs(uvRange: (number | Vector2)[][]): void;
  89. /**
  90. * Places a mesh on a particular face of the goldberg polygon
  91. * @param mesh Defines the mesh to position
  92. * @param face Defines the face to position onto
  93. * @param position Defines the position relative to the face we are positioning the mesh onto
  94. */
  95. placeOnGoldbergFaceAt(mesh: Mesh, face: number, position: Vector3): void;
  96. /**
  97. * Serialize current mesh
  98. * @param serializationObject defines the object which will receive the serialization data
  99. */
  100. serialize(serializationObject: any): void;
  101. /**
  102. * Parses a serialized goldberg mesh
  103. * @param parsedMesh the serialized mesh
  104. * @param scene the scene to create the goldberg mesh in
  105. * @returns the created goldberg mesh
  106. */
  107. static Parse(parsedMesh: any, scene: Scene): GoldbergMesh;
  108. }