index.d.ts 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. declare module 'babylonjs/environmentHelper' {
  2. /**
  3. * Represents the different options available during the creation of
  4. * a Environment helper.
  5. *
  6. * This can control the default ground, skybox and image processing setup of your scene.
  7. */
  8. interface IEnvironmentHelperOptions {
  9. /**
  10. * Specifies wether or not to create a ground.
  11. * True by default.
  12. */
  13. createGround: boolean;
  14. /**
  15. * Specifies the ground size.
  16. * 15 by default.
  17. */
  18. groundSize: number;
  19. /**
  20. * The texture used on the ground for the main color.
  21. * Comes from the BabylonJS CDN by default.
  22. *
  23. * Remarks: Can be either a texture or a url.
  24. */
  25. groundTexture: string | BaseTexture;
  26. /**
  27. * The color mixed in the ground texture by default.
  28. * BabylonJS clearColor by default.
  29. */
  30. groundColor: Color3;
  31. /**
  32. * Specifies the ground opacity.
  33. * 1 by default.
  34. */
  35. groundOpacity: number;
  36. /**
  37. * Enables the ground to receive shadows.
  38. * True by default.
  39. */
  40. enableGroundShadow: boolean;
  41. /**
  42. * Helps preventing the shadow to be fully black on the ground.
  43. * 0.5 by default.
  44. */
  45. groundShadowLevel: number;
  46. /**
  47. * Creates a mirror texture attach to the ground.
  48. * false by default.
  49. */
  50. enableGroundMirror: boolean;
  51. /**
  52. * Specifies the ground mirror size ratio.
  53. * 0.3 by default as the default kernel is 64.
  54. */
  55. groundMirrorSizeRatio: number;
  56. /**
  57. * Specifies the ground mirror blur kernel size.
  58. * 64 by default.
  59. */
  60. groundMirrorBlurKernel: number;
  61. /**
  62. * Specifies the ground mirror visibility amount.
  63. * 1 by default
  64. */
  65. groundMirrorAmount: number;
  66. /**
  67. * Specifies the ground mirror reflectance weight.
  68. * This uses the standard weight of the background material to setup the fresnel effect
  69. * of the mirror.
  70. * 1 by default.
  71. */
  72. groundMirrorFresnelWeight: number;
  73. /**
  74. * Specifies the ground mirror Falloff distance.
  75. * This can helps reducing the size of the reflection.
  76. * 0 by Default.
  77. */
  78. groundMirrorFallOffDistance: number;
  79. /**
  80. * Specifies the ground mirror texture type.
  81. * Unsigned Int by Default.
  82. */
  83. groundMirrorTextureType: number;
  84. /**
  85. * Specifies a bias applied to the ground vertical position to prevent z-fighyting with
  86. * the shown objects.
  87. */
  88. groundYBias: number;
  89. /**
  90. * Specifies wether or not to create a skybox.
  91. * True by default.
  92. */
  93. createSkybox: boolean;
  94. /**
  95. * Specifies the skybox size.
  96. * 20 by default.
  97. */
  98. skyboxSize: number;
  99. /**
  100. * The texture used on the skybox for the main color.
  101. * Comes from the BabylonJS CDN by default.
  102. *
  103. * Remarks: Can be either a texture or a url.
  104. */
  105. skyboxTexture: string | BaseTexture;
  106. /**
  107. * The color mixed in the skybox texture by default.
  108. * BabylonJS clearColor by default.
  109. */
  110. skyboxColor: Color3;
  111. /**
  112. * The background rotation around the Y axis of the scene.
  113. * This helps aligning the key lights of your scene with the background.
  114. * 0 by default.
  115. */
  116. backgroundYRotation: number;
  117. /**
  118. * Compute automatically the size of the elements to best fit with the scene.
  119. */
  120. sizeAuto: boolean;
  121. /**
  122. * Default position of the rootMesh if autoSize is not true.
  123. */
  124. rootPosition: Vector3;
  125. /**
  126. * Sets up the image processing in the scene.
  127. * true by default.
  128. */
  129. setupImageProcessing: boolean;
  130. /**
  131. * The texture used as your environment texture in the scene.
  132. * Comes from the BabylonJS CDN by default and in use if setupImageProcessing is true.
  133. *
  134. * Remarks: Can be either a texture or a url.
  135. */
  136. environmentTexture: string | BaseTexture;
  137. /**
  138. * The value of the exposure to apply to the scene.
  139. * 0.6 by default if setupImageProcessing is true.
  140. */
  141. cameraExposure: number;
  142. /**
  143. * The value of the contrast to apply to the scene.
  144. * 1.6 by default if setupImageProcessing is true.
  145. */
  146. cameraContrast: number;
  147. /**
  148. * Specifies wether or not tonemapping should be enabled in the scene.
  149. * true by default if setupImageProcessing is true.
  150. */
  151. toneMappingEnabled: boolean;
  152. }
  153. /**
  154. * The Environment helper class can be used to add a fully featuread none expensive background to your scene.
  155. * It includes by default a skybox and a ground relying on the BackgroundMaterial.
  156. * It also helps with the default setup of your imageProcessing configuration.
  157. */
  158. class EnvironmentHelper {
  159. /**
  160. * Default ground texture URL.
  161. */
  162. private static _groundTextureCDNUrl;
  163. /**
  164. * Default skybox texture URL.
  165. */
  166. private static _skyboxTextureCDNUrl;
  167. /**
  168. * Default environment texture URL.
  169. */
  170. private static _environmentTextureCDNUrl;
  171. /**
  172. * Creates the default options for the helper.
  173. */
  174. private static _getDefaultOptions();
  175. private _rootMesh;
  176. /**
  177. * Gets the root mesh created by the helper.
  178. */
  179. readonly rootMesh: Mesh;
  180. private _skybox;
  181. /**
  182. * Gets the skybox created by the helper.
  183. */
  184. readonly skybox: Nullable<Mesh>;
  185. private _skyboxTexture;
  186. /**
  187. * Gets the skybox texture created by the helper.
  188. */
  189. readonly skyboxTexture: Nullable<BaseTexture>;
  190. private _skyboxMaterial;
  191. /**
  192. * Gets the skybox material created by the helper.
  193. */
  194. readonly skyboxMaterial: Nullable<BackgroundMaterial>;
  195. private _ground;
  196. /**
  197. * Gets the ground mesh created by the helper.
  198. */
  199. readonly ground: Nullable<Mesh>;
  200. private _groundTexture;
  201. /**
  202. * Gets the ground texture created by the helper.
  203. */
  204. readonly groundTexture: Nullable<BaseTexture>;
  205. private _groundMirror;
  206. /**
  207. * Gets the ground mirror created by the helper.
  208. */
  209. readonly groundMirror: Nullable<MirrorTexture>;
  210. /**
  211. * Gets the ground mirror render list to helps pushing the meshes
  212. * you wish in the ground reflection.
  213. */
  214. readonly groundMirrorRenderList: Nullable<AbstractMesh[]>;
  215. private _groundMaterial;
  216. /**
  217. * Gets the ground material created by the helper.
  218. */
  219. readonly groundMaterial: Nullable<BackgroundMaterial>;
  220. /**
  221. * Stores the creation options.
  222. */
  223. private readonly _scene;
  224. private _options;
  225. /**
  226. * constructor
  227. * @param options
  228. * @param scene The scene to add the material to
  229. */
  230. constructor(options: Partial<IEnvironmentHelperOptions>, scene: Scene);
  231. /**
  232. * Updates the background according to the new options
  233. * @param options
  234. */
  235. updateOptions(options: Partial<IEnvironmentHelperOptions>): void;
  236. /**
  237. * Sets the primary color of all the available elements.
  238. * @param color
  239. */
  240. setMainColor(color: Color3): void;
  241. /**
  242. * Setup the image processing according to the specified options.
  243. */
  244. private _setupImageProcessing();
  245. /**
  246. * Setup the environment texture according to the specified options.
  247. */
  248. private _setupEnvironmentTexture();
  249. /**
  250. * Setup the background according to the specified options.
  251. */
  252. private _setupBackground();
  253. /**
  254. * Get the scene sizes according to the setup.
  255. */
  256. private _getSceneSize();
  257. /**
  258. * Setup the ground according to the specified options.
  259. */
  260. private _setupGround(sceneSize);
  261. /**
  262. * Setup the ground material according to the specified options.
  263. */
  264. private _setupGroundMaterial();
  265. /**
  266. * Setup the ground diffuse texture according to the specified options.
  267. */
  268. private _setupGroundDiffuseTexture();
  269. /**
  270. * Setup the ground mirror texture according to the specified options.
  271. */
  272. private _setupGroundMirrorTexture(sceneSize);
  273. /**
  274. * Setup the ground to receive the mirror texture.
  275. */
  276. private _setupMirrorInGroundMaterial();
  277. /**
  278. * Setup the skybox according to the specified options.
  279. */
  280. private _setupSkybox(sceneSize);
  281. /**
  282. * Setup the skybox material according to the specified options.
  283. */
  284. private _setupSkyboxMaterial();
  285. /**
  286. * Setup the skybox reflection texture according to the specified options.
  287. */
  288. private _setupSkyboxReflectionTexture();
  289. /**
  290. * Dispose all the elements created by the Helper.
  291. */
  292. dispose(): void;
  293. }
  294. }
  295. import {EffectFallbacks,EffectCreationOptions,Effect,Nullable,float,double,int,FloatArray,IndicesArray,KeyboardEventTypes,KeyboardInfo,KeyboardInfoPre,PointerEventTypes,PointerInfoBase,PointerInfoPre,PointerInfo,ToGammaSpace,ToLinearSpace,Epsilon,Color3,Color4,Vector2,Vector3,Vector4,ISize,Size,Quaternion,Matrix,Plane,Viewport,Frustum,Space,Axis,BezierCurve,Orientation,Angle,Arc2,Path2,Path3D,Curve3,PositionNormalVertex,PositionNormalTextureVertex,Tmp,Scalar,expandToProperty,serialize,serializeAsTexture,serializeAsColor3,serializeAsFresnelParameters,serializeAsVector2,serializeAsVector3,serializeAsMeshReference,serializeAsColorCurves,serializeAsColor4,serializeAsImageProcessingConfiguration,serializeAsQuaternion,SerializationHelper,EventState,Observer,MultiObserver,Observable,SmartArray,SmartArrayNoDuplicate,IAnimatable,LoadFileError,RetryStrategy,IFileRequest,Tools,PerfCounter,className,AsyncLoop,_AlphaState,_DepthCullingState,_StencilState,InstancingAttributeInfo,RenderTargetCreationOptions,EngineCapabilities,EngineOptions,IDisplayChangedEventArgs,Engine,Node,BoundingSphere,BoundingBox,ICullable,BoundingInfo,TransformNode,AbstractMesh,Light,Camera,RenderingManager,RenderingGroup,IDisposable,IActiveMeshCandidateProvider,RenderingGroupInfo,Scene,Buffer,VertexBuffer,InternalTexture,BaseTexture,Texture,_InstancesBatch,Mesh,BaseSubMesh,SubMesh,MaterialDefines,Material,UniformBuffer,IGetSetVerticesData,VertexData,Geometry,_PrimitiveGeometry,RibbonGeometry,BoxGeometry,SphereGeometry,DiscGeometry,CylinderGeometry,TorusGeometry,GroundGeometry,TiledGroundGeometry,PlaneGeometry,TorusKnotGeometry,PostProcessManager,PerformanceMonitor,RollingAverage,IImageProcessingConfigurationDefines,ImageProcessingConfiguration,ColorGradingTexture,ColorCurves,Behavior,MaterialHelper,PushMaterial,StandardMaterialDefines,StandardMaterial} from 'babylonjs/core';
  296. import {EngineInstrumentation,SceneInstrumentation,_TimeToken} from 'babylonjs/instrumentation';
  297. import {Particle,IParticleSystem,ParticleSystem,BoxParticleEmitter,ConeParticleEmitter,SphereParticleEmitter,SphereDirectedParticleEmitter,IParticleEmitterType} from 'babylonjs/particles';
  298. import {GPUParticleSystem} from 'babylonjs/gpuParticles';
  299. import {FramingBehavior,BouncingBehavior,AutoRotationBehavior} from 'babylonjs/cameraBehaviors';
  300. import {NullEngineOptions,NullEngine} from 'babylonjs/nullEngine';
  301. import {TextureTools} from 'babylonjs/textureTools';
  302. import {SolidParticle,ModelShape,DepthSortedParticle,SolidParticleSystem} from 'babylonjs/solidParticles';
  303. import {Collider,CollisionWorker,ICollisionCoordinator,SerializedMesh,SerializedSubMesh,SerializedGeometry,BabylonMessage,SerializedColliderToWorker,WorkerTaskType,WorkerReply,CollisionReplyPayload,InitPayload,CollidePayload,UpdatePayload,WorkerReplyType,CollisionCoordinatorWorker,CollisionCoordinatorLegacy} from 'babylonjs/collisions';
  304. import {IntersectionInfo,PickingInfo,Ray} from 'babylonjs/picking';
  305. import {SpriteManager,Sprite} from 'babylonjs/sprites';
  306. import {AnimationRange,AnimationEvent,PathCursor,Animation,TargetedAnimation,AnimationGroup,RuntimeAnimation,Animatable,IEasingFunction,EasingFunction,CircleEase,BackEase,BounceEase,CubicEase,ElasticEase,ExponentialEase,PowerEase,QuadraticEase,QuarticEase,QuinticEase,SineEase,BezierCurveEase} from 'babylonjs/animations';
  307. import {Condition,ValueCondition,PredicateCondition,StateCondition,Action,ActionEvent,ActionManager,InterpolateValueAction,SwitchBooleanAction,SetStateAction,SetValueAction,IncrementValueAction,PlayAnimationAction,StopAnimationAction,DoNothingAction,CombineAction,ExecuteCodeAction,SetParentAction,PlaySoundAction,StopSoundAction} from 'babylonjs/actions';
  308. import {GroundMesh,InstancedMesh,LinesMesh} from 'babylonjs/additionalMeshes';
  309. import {ShaderMaterial} from 'babylonjs/shaderMaterial';
  310. import {MeshBuilder} from 'babylonjs/meshBuilder';
  311. import {PBRBaseMaterial,PBRBaseSimpleMaterial,PBRMaterial,PBRMetallicRoughnessMaterial,PBRSpecularGlossinessMaterial} from 'babylonjs/pbrMaterial';
  312. import {CameraInputTypes,ICameraInput,CameraInputsMap,CameraInputsManager,TargetCamera} from 'babylonjs/targetCamera';
  313. import {ArcRotateCameraKeyboardMoveInput,ArcRotateCameraMouseWheelInput,ArcRotateCameraPointersInput,ArcRotateCameraInputsManager,ArcRotateCamera} from 'babylonjs/arcRotateCamera';
  314. import {FreeCameraMouseInput,FreeCameraKeyboardMoveInput,FreeCameraInputsManager,FreeCamera} from 'babylonjs/freeCamera';
  315. import {HemisphericLight} from 'babylonjs/hemisphericLight';
  316. import {IShadowLight,ShadowLight,PointLight} from 'babylonjs/pointLight';
  317. import {DirectionalLight} from 'babylonjs/directionalLight';
  318. import {SpotLight} from 'babylonjs/spotLight';
  319. import {CubeTexture,RenderTargetTexture,IMultiRenderTargetOptions,MultiRenderTarget,MirrorTexture,RefractionTexture,DynamicTexture,VideoTexture,RawTexture} from 'babylonjs/additionalTextures';
  320. import {AudioEngine,Sound,SoundTrack,Analyser} from 'babylonjs/audio';
  321. import {ILoadingScreen,DefaultLoadingScreen,SceneLoaderProgressEvent,ISceneLoaderPluginExtensions,ISceneLoaderPluginFactory,ISceneLoaderPlugin,ISceneLoaderPluginAsync,SceneLoader,FilesInput} from 'babylonjs/loader';
  322. import {IShadowGenerator,ShadowGenerator} from 'babylonjs/shadows';
  323. import {StringDictionary} from 'babylonjs/stringDictionary';
  324. import {Tags,AndOrNotEvaluator} from 'babylonjs/userData';
  325. import {FresnelParameters} from 'babylonjs/fresnel';
  326. import {MultiMaterial} from 'babylonjs/multiMaterial';
  327. import {Database} from 'babylonjs/offline';
  328. import {FreeCameraTouchInput,TouchCamera} from 'babylonjs/touchCamera';
  329. import {ProceduralTexture,CustomProceduralTexture} from 'babylonjs/procedural';
  330. import {FreeCameraGamepadInput,ArcRotateCameraGamepadInput,GamepadManager,StickValues,GamepadButtonChanges,Gamepad,GenericPad,Xbox360Button,Xbox360Dpad,Xbox360Pad,PoseEnabledControllerType,MutableGamepadButton,ExtendedGamepadButton,PoseEnabledControllerHelper,PoseEnabledController,WebVRController,OculusTouchController,ViveController,GenericController,WindowsMotionController} from 'babylonjs/gamepad';
  331. import {FollowCamera,ArcFollowCamera,UniversalCamera,GamepadCamera} from 'babylonjs/additionalCameras';
  332. import {DepthRenderer} from 'babylonjs/depthRenderer';
  333. import {GeometryBufferRenderer} from 'babylonjs/geometryBufferRenderer';
  334. import {PostProcessOptions,PostProcess,PassPostProcess} from 'babylonjs/postProcesses';
  335. import {BlurPostProcess} from 'babylonjs/additionalPostProcess_blur';
  336. import {FxaaPostProcess} from 'babylonjs/additionalPostProcess_fxaa';
  337. import {HighlightsPostProcess} from 'babylonjs/additionalPostProcess_highlights';
  338. import {RefractionPostProcess,BlackAndWhitePostProcess,ConvolutionPostProcess,FilterPostProcess,VolumetricLightScatteringPostProcess,ColorCorrectionPostProcess,TonemappingOperator,TonemapPostProcess,DisplayPassPostProcess,ImageProcessingPostProcess} from 'babylonjs/additionalPostProcesses';
  339. import {PostProcessRenderPipelineManager,PostProcessRenderPass,PostProcessRenderEffect,PostProcessRenderPipeline} from 'babylonjs/renderingPipeline';
  340. import {SSAORenderingPipeline,SSAO2RenderingPipeline,LensRenderingPipeline,StandardRenderingPipeline} from 'babylonjs/additionalRenderingPipeline';
  341. import {DefaultRenderingPipeline} from 'babylonjs/defaultRenderingPipeline';
  342. import {Bone,BoneIKController,BoneLookController,Skeleton} from 'babylonjs/bones';
  343. import {SphericalPolynomial,SphericalHarmonics,CubeMapToSphericalPolynomialTools,CubeMapInfo,PanoramaToCubeMapTools,HDRInfo,HDRTools,HDRCubeTexture} from 'babylonjs/hdr';
  344. import {CSG} from 'babylonjs/csg';
  345. import {Polygon,PolygonMeshBuilder} from 'babylonjs/polygonMesh';
  346. import {LensFlare,LensFlareSystem} from 'babylonjs/lensFlares';
  347. import {PhysicsJointData,PhysicsJoint,DistanceJoint,MotorEnabledJoint,HingeJoint,Hinge2Joint,IMotorEnabledJoint,DistanceJointData,SpringJointData,PhysicsImpostorParameters,IPhysicsEnabledObject,PhysicsImpostor,PhysicsImpostorJoint,PhysicsEngine,IPhysicsEnginePlugin,PhysicsHelper,PhysicsRadialExplosionEvent,PhysicsGravitationalFieldEvent,PhysicsUpdraftEvent,PhysicsVortexEvent,PhysicsRadialImpulseFalloff,PhysicsUpdraftMode,PhysicsForceAndContactPoint,PhysicsRadialExplosionEventData,PhysicsGravitationalFieldEventData,PhysicsUpdraftEventData,PhysicsVortexEventData,CannonJSPlugin,OimoJSPlugin} from 'babylonjs/physics';
  348. import {TGATools,DDSInfo,DDSTools,KhronosTextureContainer} from 'babylonjs/textureFormats';
  349. import {Debug,RayHelper,DebugLayer,BoundingBoxRenderer} from 'babylonjs/debug';
  350. import {MorphTarget,MorphTargetManager} from 'babylonjs/morphTargets';
  351. import {IOctreeContainer,Octree,OctreeBlock} from 'babylonjs/octrees';
  352. import {SIMDHelper} from 'babylonjs/simd';
  353. import {VRDistortionCorrectionPostProcess,AnaglyphPostProcess,StereoscopicInterlacePostProcess,FreeCameraDeviceOrientationInput,ArcRotateCameraVRDeviceOrientationInput,VRCameraMetrics,DevicePose,PoseControlled,WebVROptions,WebVRFreeCamera,DeviceOrientationCamera,VRDeviceOrientationFreeCamera,VRDeviceOrientationGamepadCamera,VRDeviceOrientationArcRotateCamera,AnaglyphFreeCamera,AnaglyphArcRotateCamera,AnaglyphGamepadCamera,AnaglyphUniversalCamera,StereoscopicFreeCamera,StereoscopicArcRotateCamera,StereoscopicGamepadCamera,StereoscopicUniversalCamera,VRTeleportationOptions,VRExperienceHelperOptions,VRExperienceHelper} from 'babylonjs/vr';
  354. import {JoystickAxis,VirtualJoystick,VirtualJoysticksCamera,FreeCameraVirtualJoystickInput} from 'babylonjs/virtualJoystick';
  355. import {ISimplifier,ISimplificationSettings,SimplificationSettings,ISimplificationTask,SimplificationQueue,SimplificationType,DecimationTriangle,DecimationVertex,QuadraticMatrix,Reference,QuadraticErrorSimplification,MeshLODLevel,SceneOptimization,TextureOptimization,HardwareScalingOptimization,ShadowsOptimization,PostProcessesOptimization,LensFlaresOptimization,ParticlesOptimization,RenderTargetsOptimization,MergeMeshesOptimization,SceneOptimizerOptions,SceneOptimizer} from 'babylonjs/optimizations';
  356. import {OutlineRenderer,EdgesRenderer,IHighlightLayerOptions,HighlightLayer} from 'babylonjs/highlights';
  357. import {SceneSerializer} from 'babylonjs/serialization';
  358. import {AssetTaskState,AbstractAssetTask,IAssetsProgressEvent,AssetsProgressEvent,MeshAssetTask,TextFileAssetTask,BinaryFileAssetTask,ImageAssetTask,ITextureAssetTask,TextureAssetTask,CubeTextureAssetTask,HDRCubeTextureAssetTask,AssetsManager} from 'babylonjs/assetsManager';
  359. import {ReflectionProbe} from 'babylonjs/probes';
  360. import {BackgroundMaterial} from 'babylonjs/backgroundMaterial';
  361. import {Layer} from 'babylonjs/layer';