abstractScene.d.ts 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. import type { Scene } from "./scene";
  2. import type { Nullable } from "./types";
  3. import type { AbstractMesh } from "./Meshes/abstractMesh";
  4. import type { TransformNode } from "./Meshes/transformNode";
  5. import type { Geometry } from "./Meshes/geometry";
  6. import type { Skeleton } from "./Bones/skeleton";
  7. import type { MorphTargetManager } from "./Morph/morphTargetManager";
  8. import type { AssetContainer } from "./assetContainer";
  9. import type { IParticleSystem } from "./Particles/IParticleSystem";
  10. import type { AnimationGroup } from "./Animations/animationGroup";
  11. import type { BaseTexture } from "./Materials/Textures/baseTexture";
  12. import type { Material } from "./Materials/material";
  13. import type { MultiMaterial } from "./Materials/multiMaterial";
  14. import type { AbstractActionManager } from "./Actions/abstractActionManager";
  15. import type { Camera } from "./Cameras/camera";
  16. import type { Light } from "./Lights/light";
  17. import type { Node } from "./node";
  18. import type { PostProcess } from "./PostProcesses/postProcess";
  19. import type { Animation } from "./Animations/animation";
  20. /**
  21. * Defines how the parser contract is defined.
  22. * These parsers are used to parse a list of specific assets (like particle systems, etc..)
  23. */
  24. export type BabylonFileParser = (parsedData: any, scene: Scene, container: AssetContainer, rootUrl: string) => void;
  25. /**
  26. * Defines how the individual parser contract is defined.
  27. * These parser can parse an individual asset
  28. */
  29. export type IndividualBabylonFileParser = (parsedData: any, scene: Scene, rootUrl: string) => any;
  30. /**
  31. * Base class of the scene acting as a container for the different elements composing a scene.
  32. * This class is dynamically extended by the different components of the scene increasing
  33. * flexibility and reducing coupling
  34. */
  35. export declare abstract class AbstractScene {
  36. /**
  37. * Stores the list of available parsers in the application.
  38. */
  39. private static _BabylonFileParsers;
  40. /**
  41. * Stores the list of available individual parsers in the application.
  42. */
  43. private static _IndividualBabylonFileParsers;
  44. /**
  45. * Adds a parser in the list of available ones
  46. * @param name Defines the name of the parser
  47. * @param parser Defines the parser to add
  48. */
  49. static AddParser(name: string, parser: BabylonFileParser): void;
  50. /**
  51. * Gets a general parser from the list of available ones
  52. * @param name Defines the name of the parser
  53. * @returns the requested parser or null
  54. */
  55. static GetParser(name: string): Nullable<BabylonFileParser>;
  56. /**
  57. * Adds n individual parser in the list of available ones
  58. * @param name Defines the name of the parser
  59. * @param parser Defines the parser to add
  60. */
  61. static AddIndividualParser(name: string, parser: IndividualBabylonFileParser): void;
  62. /**
  63. * Gets an individual parser from the list of available ones
  64. * @param name Defines the name of the parser
  65. * @returns the requested parser or null
  66. */
  67. static GetIndividualParser(name: string): Nullable<IndividualBabylonFileParser>;
  68. /**
  69. * Parser json data and populate both a scene and its associated container object
  70. * @param jsonData Defines the data to parse
  71. * @param scene Defines the scene to parse the data for
  72. * @param container Defines the container attached to the parsing sequence
  73. * @param rootUrl Defines the root url of the data
  74. */
  75. static Parse(jsonData: any, scene: Scene, container: AssetContainer, rootUrl: string): void;
  76. /**
  77. * Gets the list of root nodes (ie. nodes with no parent)
  78. */
  79. rootNodes: Node[];
  80. /** All of the cameras added to this scene
  81. * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras
  82. */
  83. cameras: Camera[];
  84. /**
  85. * All of the lights added to this scene
  86. * @see https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction
  87. */
  88. lights: Light[];
  89. /**
  90. * All of the (abstract) meshes added to this scene
  91. */
  92. meshes: AbstractMesh[];
  93. /**
  94. * The list of skeletons added to the scene
  95. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons
  96. */
  97. skeletons: Skeleton[];
  98. /**
  99. * All of the particle systems added to this scene
  100. * @see https://doc.babylonjs.com/features/featuresDeepDive/particles/particle_system/particle_system_intro
  101. */
  102. particleSystems: IParticleSystem[];
  103. /**
  104. * Gets a list of Animations associated with the scene
  105. */
  106. animations: Animation[];
  107. /**
  108. * All of the animation groups added to this scene
  109. * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations
  110. */
  111. animationGroups: AnimationGroup[];
  112. /**
  113. * All of the multi-materials added to this scene
  114. * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/multiMaterials
  115. */
  116. multiMaterials: MultiMaterial[];
  117. /**
  118. * All of the materials added to this scene
  119. * In the context of a Scene, it is not supposed to be modified manually.
  120. * Any addition or removal should be done using the addMaterial and removeMaterial Scene methods.
  121. * Note also that the order of the Material within the array is not significant and might change.
  122. * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction
  123. */
  124. materials: Material[];
  125. /**
  126. * The list of morph target managers added to the scene
  127. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph
  128. */
  129. morphTargetManagers: MorphTargetManager[];
  130. /**
  131. * The list of geometries used in the scene.
  132. */
  133. geometries: Geometry[];
  134. /**
  135. * All of the transform nodes added to this scene
  136. * In the context of a Scene, it is not supposed to be modified manually.
  137. * Any addition or removal should be done using the addTransformNode and removeTransformNode Scene methods.
  138. * Note also that the order of the TransformNode within the array is not significant and might change.
  139. * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/transform_node
  140. */
  141. transformNodes: TransformNode[];
  142. /**
  143. * ActionManagers available on the scene.
  144. * @deprecated
  145. */
  146. actionManagers: AbstractActionManager[];
  147. /**
  148. * Textures to keep.
  149. */
  150. textures: BaseTexture[];
  151. /** @internal */
  152. protected _environmentTexture: Nullable<BaseTexture>;
  153. /**
  154. * Texture used in all pbr material as the reflection texture.
  155. * As in the majority of the scene they are the same (exception for multi room and so on),
  156. * this is easier to reference from here than from all the materials.
  157. */
  158. get environmentTexture(): Nullable<BaseTexture>;
  159. set environmentTexture(value: Nullable<BaseTexture>);
  160. /**
  161. * The list of postprocesses added to the scene
  162. */
  163. postProcesses: PostProcess[];
  164. /**
  165. * @returns all meshes, lights, cameras, transformNodes and bones
  166. */
  167. getNodes(): Array<Node>;
  168. }