stlFileLoader.d.ts 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import type { Nullable } from "@babylonjs/core/types.js";
  2. import type { AbstractMesh } from "@babylonjs/core/Meshes/abstractMesh.js";
  3. import type { ISceneLoaderPlugin, ISceneLoaderPluginExtensions } from "@babylonjs/core/Loading/sceneLoader.js";
  4. import { AssetContainer } from "@babylonjs/core/assetContainer.js";
  5. import type { Scene } from "@babylonjs/core/scene.js";
  6. /**
  7. * STL file type loader.
  8. * This is a babylon scene loader plugin.
  9. */
  10. export declare class STLFileLoader implements ISceneLoaderPlugin {
  11. /** @internal */
  12. solidPattern: RegExp;
  13. /** @internal */
  14. facetsPattern: RegExp;
  15. /** @internal */
  16. normalPattern: RegExp;
  17. /** @internal */
  18. vertexPattern: RegExp;
  19. /**
  20. * Defines the name of the plugin.
  21. */
  22. name: string;
  23. /**
  24. * Defines the extensions the stl loader is able to load.
  25. * force data to come in as an ArrayBuffer
  26. * we'll convert to string if it looks like it's an ASCII .stl
  27. */
  28. extensions: ISceneLoaderPluginExtensions;
  29. /**
  30. * Defines if Y and Z axes are swapped or not when loading an STL file.
  31. * The default is false to maintain backward compatibility. When set to
  32. * true, coordinates from the STL file are used without change.
  33. */
  34. static DO_NOT_ALTER_FILE_COORDINATES: boolean;
  35. /**
  36. * Import meshes into a scene.
  37. * @param meshesNames An array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported
  38. * @param scene The scene to import into
  39. * @param data The data to import
  40. * @param rootUrl The root url for scene and resources
  41. * @param meshes The meshes array to import into
  42. * @returns True if successful or false otherwise
  43. */
  44. importMesh(meshesNames: any, scene: Scene, data: any, rootUrl: string, meshes: Nullable<AbstractMesh[]>): boolean;
  45. /**
  46. * Load into a scene.
  47. * @param scene The scene to load into
  48. * @param data The data to import
  49. * @param rootUrl The root url for scene and resources
  50. * @returns true if successful or false otherwise
  51. */
  52. load(scene: Scene, data: any, rootUrl: string): boolean;
  53. /**
  54. * Load into an asset container.
  55. * @param scene The scene to load into
  56. * @param data The data to import
  57. * @param rootUrl The root url for scene and resources
  58. * @returns The loaded asset container
  59. */
  60. loadAssetContainer(scene: Scene, data: string, rootUrl: string): AssetContainer;
  61. private _isBinary;
  62. private _parseBinary;
  63. private _parseASCII;
  64. }