gaussianSplattingMesh.d.ts 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. import type { Scene } from "../../scene.js";
  2. import type { Nullable } from "../../types.js";
  3. import type { BaseTexture } from "../../Materials/Textures/baseTexture.js";
  4. import { SubMesh } from "../subMesh";
  5. import type { AbstractMesh } from "../abstractMesh";
  6. import { Mesh } from "../mesh";
  7. /**
  8. * Class used to render a gaussian splatting mesh
  9. */
  10. export declare class GaussianSplattingMesh extends Mesh {
  11. private _vertexCount;
  12. private _worker;
  13. private _frameIdLastUpdate;
  14. private _modelViewMatrix;
  15. private _material;
  16. private _depthMix;
  17. private _canPostToWorker;
  18. private _lastProj;
  19. private _covariancesATexture;
  20. private _covariancesBTexture;
  21. private _centersTexture;
  22. private _colorsTexture;
  23. /**
  24. * Gets the covariancesA texture
  25. */
  26. get covariancesATexture(): Nullable<BaseTexture>;
  27. /**
  28. * Gets the covariancesB texture
  29. */
  30. get covariancesBTexture(): Nullable<BaseTexture>;
  31. /**
  32. * Gets the centers texture
  33. */
  34. get centersTexture(): Nullable<BaseTexture>;
  35. /**
  36. * Gets the colors texture
  37. */
  38. get colorsTexture(): Nullable<BaseTexture>;
  39. /**
  40. * Creates a new gaussian splatting mesh
  41. * @param name defines the name of the mesh
  42. * @param url defines the url to load from (optional)
  43. * @param scene defines the hosting scene (optional)
  44. */
  45. constructor(name: string, url?: Nullable<string>, scene?: Nullable<Scene>);
  46. /**
  47. * Returns the class name
  48. * @returns "GaussianSplattingMesh"
  49. */
  50. getClassName(): string;
  51. /**
  52. * Returns the total number of vertices (splats) within the mesh
  53. * @returns the total number of vertices
  54. */
  55. getTotalVertices(): number;
  56. /**
  57. * 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
  58. * @param subMesh defines the subMesh to render
  59. * @param enableAlphaMode defines if alpha mode can be changed
  60. * @param effectiveMeshReplacement defines an optional mesh used to provide info for the rendering
  61. * @returns the current mesh
  62. */
  63. render(subMesh: SubMesh, enableAlphaMode: boolean, effectiveMeshReplacement?: AbstractMesh): Mesh;
  64. /**
  65. * Code from https://github.com/dylanebert/gsplat.js/blob/main/src/loaders/PLYLoader.ts Under MIT license
  66. * Converts a .ply data array buffer to splat
  67. * if data array buffer is not ply, returns the original buffer
  68. * @param data the .ply data to load
  69. * @returns the loaded splat buffer
  70. */
  71. static ConvertPLYToSplat(data: ArrayBuffer): ArrayBuffer;
  72. /**
  73. * Loads a .splat Gaussian Splatting array buffer asynchronously
  74. * @param data arraybuffer containing splat file
  75. * @returns a promise that resolves when the operation is complete
  76. */
  77. loadDataAsync(data: ArrayBuffer): Promise<void>;
  78. /**
  79. * Loads a .splat Gaussian or .ply Splatting file asynchronously
  80. * @param url path to the splat file to load
  81. * @returns a promise that resolves when the operation is complete
  82. */
  83. loadFileAsync(url: string): Promise<void>;
  84. /**
  85. * Releases resources associated with this mesh.
  86. * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)
  87. */
  88. dispose(doNotRecurse?: boolean): void;
  89. private static _CreateWorker;
  90. private _loadData;
  91. private _getTextureSize;
  92. }