index.d.ts 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. declare module 'babylonjs/directionalLight' {
  2. interface IShadowLight extends Light {
  3. id: string;
  4. position: Vector3;
  5. direction: Vector3;
  6. transformedPosition: Vector3;
  7. transformedDirection: Vector3;
  8. name: string;
  9. shadowMinZ: number;
  10. shadowMaxZ: number;
  11. computeTransformedInformation(): boolean;
  12. getScene(): Scene;
  13. customProjectionMatrixBuilder: (viewMatrix: Matrix, renderList: Array<AbstractMesh>, result: Matrix) => void;
  14. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): IShadowLight;
  15. getDepthScale(): number;
  16. needCube(): boolean;
  17. needProjectionMatrixCompute(): boolean;
  18. forceProjectionMatrixCompute(): void;
  19. getShadowDirection(faceIndex?: number): Vector3;
  20. /**
  21. * Gets the minZ used for shadow according to both the scene and the light.
  22. * @param activeCamera
  23. */
  24. getDepthMinZ(activeCamera: Camera): number;
  25. /**
  26. * Gets the minZ used for shadow according to both the scene and the light.
  27. * @param activeCamera
  28. */
  29. getDepthMaxZ(activeCamera: Camera): number;
  30. }
  31. abstract class ShadowLight extends Light implements IShadowLight {
  32. protected abstract _setDefaultShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
  33. position: Vector3;
  34. protected _direction: Vector3;
  35. direction: Vector3;
  36. private _shadowMinZ;
  37. shadowMinZ: number;
  38. private _shadowMaxZ;
  39. shadowMaxZ: number;
  40. customProjectionMatrixBuilder: (viewMatrix: Matrix, renderList: Array<AbstractMesh>, result: Matrix) => void;
  41. transformedPosition: Vector3;
  42. transformedDirection: Vector3;
  43. private _worldMatrix;
  44. private _needProjectionMatrixCompute;
  45. /**
  46. * Computes the light transformed position/direction in case the light is parented. Returns true if parented, else false.
  47. */
  48. computeTransformedInformation(): boolean;
  49. /**
  50. * Return the depth scale used for the shadow map.
  51. */
  52. getDepthScale(): number;
  53. /**
  54. * Returns the light direction (Vector3) for any passed face index.
  55. */
  56. getShadowDirection(faceIndex?: number): Vector3;
  57. /**
  58. * Returns the DirectionalLight absolute position in the World.
  59. */
  60. getAbsolutePosition(): Vector3;
  61. /**
  62. * Sets the DirectionalLight direction toward the passed target (Vector3).
  63. * Returns the updated DirectionalLight direction (Vector3).
  64. */
  65. setDirectionToTarget(target: Vector3): Vector3;
  66. /**
  67. * Returns the light rotation (Vector3).
  68. */
  69. getRotation(): Vector3;
  70. /**
  71. * Boolean : false by default.
  72. */
  73. needCube(): boolean;
  74. /**
  75. * Specifies wether or not the projection matrix should be recomputed this frame.
  76. */
  77. needProjectionMatrixCompute(): boolean;
  78. /**
  79. * Forces the shadow generator to recompute the projection matrix even if position and direction did not changed.
  80. */
  81. forceProjectionMatrixCompute(): void;
  82. /**
  83. * Get the world matrix of the sahdow lights.
  84. */
  85. _getWorldMatrix(): Matrix;
  86. /**
  87. * Gets the minZ used for shadow according to both the scene and the light.
  88. * @param activeCamera
  89. */
  90. getDepthMinZ(activeCamera: Camera): number;
  91. /**
  92. * Gets the maxZ used for shadow according to both the scene and the light.
  93. * @param activeCamera
  94. */
  95. getDepthMaxZ(activeCamera: Camera): number;
  96. /**
  97. * Sets the projection matrix according to the type of light and custom projection matrix definition.
  98. * Returns the light.
  99. */
  100. setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): IShadowLight;
  101. }
  102. }
  103. declare module 'babylonjs/directionalLight' {
  104. class DirectionalLight extends ShadowLight {
  105. private _shadowFrustumSize;
  106. /**
  107. * Fix frustum size for the shadow generation. This is disabled if the value is 0.
  108. */
  109. /**
  110. * Specifies a fix frustum size for the shadow generation.
  111. */
  112. shadowFrustumSize: number;
  113. private _shadowOrthoScale;
  114. shadowOrthoScale: number;
  115. autoUpdateExtends: boolean;
  116. private _orthoLeft;
  117. private _orthoRight;
  118. private _orthoTop;
  119. private _orthoBottom;
  120. /**
  121. * Creates a DirectionalLight object in the scene, oriented towards the passed direction (Vector3).
  122. * The directional light is emitted from everywhere in the given direction.
  123. * It can cast shawdows.
  124. * Documentation : http://doc.babylonjs.com/tutorials/lights
  125. */
  126. constructor(name: string, direction: Vector3, scene: Scene);
  127. /**
  128. * Returns the string "DirectionalLight".
  129. */
  130. getClassName(): string;
  131. /**
  132. * Returns the integer 1.
  133. */
  134. getTypeID(): number;
  135. /**
  136. * Sets the passed matrix "matrix" as projection matrix for the shadows cast by the light according to the passed view matrix.
  137. * Returns the DirectionalLight Shadow projection matrix.
  138. */
  139. protected _setDefaultShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
  140. /**
  141. * Sets the passed matrix "matrix" as fixed frustum projection matrix for the shadows cast by the light according to the passed view matrix.
  142. * Returns the DirectionalLight Shadow projection matrix.
  143. */
  144. protected _setDefaultFixedFrustumShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix): void;
  145. /**
  146. * Sets the passed matrix "matrix" as auto extend projection matrix for the shadows cast by the light according to the passed view matrix.
  147. * Returns the DirectionalLight Shadow projection matrix.
  148. */
  149. protected _setDefaultAutoExtendShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
  150. protected _buildUniformLayout(): void;
  151. /**
  152. * Sets the passed Effect object with the DirectionalLight transformed position (or position if not parented) and the passed name.
  153. * Returns the DirectionalLight.
  154. */
  155. transferToEffect(effect: Effect, lightIndex: string): DirectionalLight;
  156. /**
  157. * Gets the minZ used for shadow according to both the scene and the light.
  158. *
  159. * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being
  160. * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.
  161. * @param activeCamera
  162. */
  163. getDepthMinZ(activeCamera: Camera): number;
  164. /**
  165. * Gets the maxZ used for shadow according to both the scene and the light.
  166. *
  167. * Values are fixed on directional lights as it relies on an ortho projection hence the need to convert being
  168. * -1 and 1 to 0 and 1 doing (depth + min) / (min + max) -> (depth + 1) / (1 + 1) -> (depth * 0.5) + 0.5.
  169. * @param activeCamera
  170. */
  171. getDepthMaxZ(activeCamera: Camera): number;
  172. }
  173. }
  174. 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';
  175. import {EngineInstrumentation,SceneInstrumentation,_TimeToken} from 'babylonjs/instrumentation';
  176. import {Particle,IParticleSystem,ParticleSystem,BoxParticleEmitter,ConeParticleEmitter,SphereParticleEmitter,SphereDirectedParticleEmitter,IParticleEmitterType} from 'babylonjs/particles';
  177. import {GPUParticleSystem} from 'babylonjs/gpuParticles';
  178. import {FramingBehavior,BouncingBehavior,AutoRotationBehavior} from 'babylonjs/cameraBehaviors';
  179. import {NullEngineOptions,NullEngine} from 'babylonjs/nullEngine';
  180. import {TextureTools} from 'babylonjs/textureTools';
  181. import {SolidParticle,ModelShape,DepthSortedParticle,SolidParticleSystem} from 'babylonjs/solidParticles';
  182. import {Collider,CollisionWorker,ICollisionCoordinator,SerializedMesh,SerializedSubMesh,SerializedGeometry,BabylonMessage,SerializedColliderToWorker,WorkerTaskType,WorkerReply,CollisionReplyPayload,InitPayload,CollidePayload,UpdatePayload,WorkerReplyType,CollisionCoordinatorWorker,CollisionCoordinatorLegacy} from 'babylonjs/collisions';
  183. import {IntersectionInfo,PickingInfo,Ray} from 'babylonjs/picking';
  184. import {SpriteManager,Sprite} from 'babylonjs/sprites';
  185. 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';
  186. import {Condition,ValueCondition,PredicateCondition,StateCondition,Action,ActionEvent,ActionManager,InterpolateValueAction,SwitchBooleanAction,SetStateAction,SetValueAction,IncrementValueAction,PlayAnimationAction,StopAnimationAction,DoNothingAction,CombineAction,ExecuteCodeAction,SetParentAction,PlaySoundAction,StopSoundAction} from 'babylonjs/actions';
  187. import {GroundMesh,InstancedMesh,LinesMesh} from 'babylonjs/additionalMeshes';
  188. import {ShaderMaterial} from 'babylonjs/shaderMaterial';
  189. import {MeshBuilder} from 'babylonjs/meshBuilder';
  190. import {PBRBaseMaterial,PBRBaseSimpleMaterial,PBRMaterial,PBRMetallicRoughnessMaterial,PBRSpecularGlossinessMaterial} from 'babylonjs/pbrMaterial';
  191. import {CameraInputTypes,ICameraInput,CameraInputsMap,CameraInputsManager,TargetCamera} from 'babylonjs/targetCamera';
  192. import {ArcRotateCameraKeyboardMoveInput,ArcRotateCameraMouseWheelInput,ArcRotateCameraPointersInput,ArcRotateCameraInputsManager,ArcRotateCamera} from 'babylonjs/arcRotateCamera';
  193. import {FreeCameraMouseInput,FreeCameraKeyboardMoveInput,FreeCameraInputsManager,FreeCamera} from 'babylonjs/freeCamera';
  194. import {HemisphericLight} from 'babylonjs/hemisphericLight';
  195. import {IShadowLight,ShadowLight,PointLight} from 'babylonjs/pointLight';
  196. import {SpotLight} from 'babylonjs/spotLight';
  197. import {CubeTexture,RenderTargetTexture,IMultiRenderTargetOptions,MultiRenderTarget,MirrorTexture,RefractionTexture,DynamicTexture,VideoTexture,RawTexture} from 'babylonjs/additionalTextures';
  198. import {AudioEngine,Sound,SoundTrack,Analyser} from 'babylonjs/audio';
  199. import {ILoadingScreen,DefaultLoadingScreen,SceneLoaderProgressEvent,ISceneLoaderPluginExtensions,ISceneLoaderPluginFactory,ISceneLoaderPlugin,ISceneLoaderPluginAsync,SceneLoader,FilesInput} from 'babylonjs/loader';
  200. import {IShadowGenerator,ShadowGenerator} from 'babylonjs/shadows';
  201. import {StringDictionary} from 'babylonjs/stringDictionary';
  202. import {Tags,AndOrNotEvaluator} from 'babylonjs/userData';
  203. import {FresnelParameters} from 'babylonjs/fresnel';
  204. import {MultiMaterial} from 'babylonjs/multiMaterial';
  205. import {Database} from 'babylonjs/offline';
  206. import {FreeCameraTouchInput,TouchCamera} from 'babylonjs/touchCamera';
  207. import {ProceduralTexture,CustomProceduralTexture} from 'babylonjs/procedural';
  208. import {FreeCameraGamepadInput,ArcRotateCameraGamepadInput,GamepadManager,StickValues,GamepadButtonChanges,Gamepad,GenericPad,Xbox360Button,Xbox360Dpad,Xbox360Pad,PoseEnabledControllerType,MutableGamepadButton,ExtendedGamepadButton,PoseEnabledControllerHelper,PoseEnabledController,WebVRController,OculusTouchController,ViveController,GenericController,WindowsMotionController} from 'babylonjs/gamepad';
  209. import {FollowCamera,ArcFollowCamera,UniversalCamera,GamepadCamera} from 'babylonjs/additionalCameras';
  210. import {DepthRenderer} from 'babylonjs/depthRenderer';
  211. import {GeometryBufferRenderer} from 'babylonjs/geometryBufferRenderer';
  212. import {PostProcessOptions,PostProcess,PassPostProcess} from 'babylonjs/postProcesses';
  213. import {BlurPostProcess} from 'babylonjs/additionalPostProcess_blur';
  214. import {FxaaPostProcess} from 'babylonjs/additionalPostProcess_fxaa';
  215. import {HighlightsPostProcess} from 'babylonjs/additionalPostProcess_highlights';
  216. import {RefractionPostProcess,BlackAndWhitePostProcess,ConvolutionPostProcess,FilterPostProcess,VolumetricLightScatteringPostProcess,ColorCorrectionPostProcess,TonemappingOperator,TonemapPostProcess,DisplayPassPostProcess,ImageProcessingPostProcess} from 'babylonjs/additionalPostProcesses';
  217. import {PostProcessRenderPipelineManager,PostProcessRenderPass,PostProcessRenderEffect,PostProcessRenderPipeline} from 'babylonjs/renderingPipeline';
  218. import {SSAORenderingPipeline,SSAO2RenderingPipeline,LensRenderingPipeline,StandardRenderingPipeline} from 'babylonjs/additionalRenderingPipeline';
  219. import {DefaultRenderingPipeline} from 'babylonjs/defaultRenderingPipeline';
  220. import {Bone,BoneIKController,BoneLookController,Skeleton} from 'babylonjs/bones';
  221. import {SphericalPolynomial,SphericalHarmonics,CubeMapToSphericalPolynomialTools,CubeMapInfo,PanoramaToCubeMapTools,HDRInfo,HDRTools,HDRCubeTexture} from 'babylonjs/hdr';
  222. import {CSG} from 'babylonjs/csg';
  223. import {Polygon,PolygonMeshBuilder} from 'babylonjs/polygonMesh';
  224. import {LensFlare,LensFlareSystem} from 'babylonjs/lensFlares';
  225. 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';
  226. import {TGATools,DDSInfo,DDSTools,KhronosTextureContainer} from 'babylonjs/textureFormats';
  227. import {Debug,RayHelper,DebugLayer,BoundingBoxRenderer} from 'babylonjs/debug';
  228. import {MorphTarget,MorphTargetManager} from 'babylonjs/morphTargets';
  229. import {IOctreeContainer,Octree,OctreeBlock} from 'babylonjs/octrees';
  230. import {SIMDHelper} from 'babylonjs/simd';
  231. 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';
  232. import {JoystickAxis,VirtualJoystick,VirtualJoysticksCamera,FreeCameraVirtualJoystickInput} from 'babylonjs/virtualJoystick';
  233. 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';
  234. import {OutlineRenderer,EdgesRenderer,IHighlightLayerOptions,HighlightLayer} from 'babylonjs/highlights';
  235. import {SceneSerializer} from 'babylonjs/serialization';
  236. import {AssetTaskState,AbstractAssetTask,IAssetsProgressEvent,AssetsProgressEvent,MeshAssetTask,TextFileAssetTask,BinaryFileAssetTask,ImageAssetTask,ITextureAssetTask,TextureAssetTask,CubeTextureAssetTask,HDRCubeTextureAssetTask,AssetsManager} from 'babylonjs/assetsManager';
  237. import {ReflectionProbe} from 'babylonjs/probes';
  238. import {BackgroundMaterial} from 'babylonjs/backgroundMaterial';
  239. import {Layer} from 'babylonjs/layer';
  240. import {IEnvironmentHelperOptions,EnvironmentHelper} from 'babylonjs/environmentHelper';