index.d.ts 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. declare module 'babylonjs/pointLight' {
  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/pointLight' {
  104. class PointLight extends ShadowLight {
  105. private _shadowAngle;
  106. /**
  107. * Getter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback
  108. * This specifies what angle the shadow will use to be created.
  109. *
  110. * It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.
  111. */
  112. /**
  113. * Setter: In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback
  114. * This specifies what angle the shadow will use to be created.
  115. *
  116. * It default to 90 degrees to work nicely with the cube texture generation for point lights shadow maps.
  117. */
  118. shadowAngle: number;
  119. /**
  120. * In case of direction provided, the shadow will not use a cube texture but simulate a spot shadow as a fallback
  121. */
  122. direction: Vector3;
  123. /**
  124. * Creates a PointLight object from the passed name and position (Vector3) and adds it in the scene.
  125. * A PointLight emits the light in every direction.
  126. * It can cast shadows.
  127. * If the scene camera is already defined and you want to set your PointLight at the camera position, just set it :
  128. * ```javascript
  129. * var pointLight = new BABYLON.PointLight("pl", camera.position, scene);
  130. * ```
  131. * Documentation : http://doc.babylonjs.com/tutorials/lights
  132. */
  133. constructor(name: string, position: Vector3, scene: Scene);
  134. /**
  135. * Returns the string "PointLight"
  136. */
  137. getClassName(): string;
  138. /**
  139. * Returns the integer 0.
  140. */
  141. getTypeID(): number;
  142. /**
  143. * Specifies wether or not the shadowmap should be a cube texture.
  144. */
  145. needCube(): boolean;
  146. /**
  147. * Returns a new Vector3 aligned with the PointLight cube system according to the passed cube face index (integer).
  148. */
  149. getShadowDirection(faceIndex?: number): Vector3;
  150. /**
  151. * Sets the passed matrix "matrix" as a left-handed perspective projection matrix with the following settings :
  152. * - fov = PI / 2
  153. * - aspect ratio : 1.0
  154. * - z-near and far equal to the active camera minZ and maxZ.
  155. * Returns the PointLight.
  156. */
  157. protected _setDefaultShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): void;
  158. protected _buildUniformLayout(): void;
  159. /**
  160. * Sets the passed Effect "effect" with the PointLight transformed position (or position, if none) and passed name (string).
  161. * Returns the PointLight.
  162. */
  163. transferToEffect(effect: Effect, lightIndex: string): PointLight;
  164. }
  165. }
  166. 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';
  167. import {EngineInstrumentation,SceneInstrumentation,_TimeToken} from 'babylonjs/instrumentation';
  168. import {Particle,IParticleSystem,ParticleSystem,BoxParticleEmitter,ConeParticleEmitter,SphereParticleEmitter,SphereDirectedParticleEmitter,IParticleEmitterType} from 'babylonjs/particles';
  169. import {GPUParticleSystem} from 'babylonjs/gpuParticles';
  170. import {FramingBehavior,BouncingBehavior,AutoRotationBehavior} from 'babylonjs/cameraBehaviors';
  171. import {NullEngineOptions,NullEngine} from 'babylonjs/nullEngine';
  172. import {TextureTools} from 'babylonjs/textureTools';
  173. import {SolidParticle,ModelShape,DepthSortedParticle,SolidParticleSystem} from 'babylonjs/solidParticles';
  174. import {Collider,CollisionWorker,ICollisionCoordinator,SerializedMesh,SerializedSubMesh,SerializedGeometry,BabylonMessage,SerializedColliderToWorker,WorkerTaskType,WorkerReply,CollisionReplyPayload,InitPayload,CollidePayload,UpdatePayload,WorkerReplyType,CollisionCoordinatorWorker,CollisionCoordinatorLegacy} from 'babylonjs/collisions';
  175. import {IntersectionInfo,PickingInfo,Ray} from 'babylonjs/picking';
  176. import {SpriteManager,Sprite} from 'babylonjs/sprites';
  177. 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';
  178. import {Condition,ValueCondition,PredicateCondition,StateCondition,Action,ActionEvent,ActionManager,InterpolateValueAction,SwitchBooleanAction,SetStateAction,SetValueAction,IncrementValueAction,PlayAnimationAction,StopAnimationAction,DoNothingAction,CombineAction,ExecuteCodeAction,SetParentAction,PlaySoundAction,StopSoundAction} from 'babylonjs/actions';
  179. import {GroundMesh,InstancedMesh,LinesMesh} from 'babylonjs/additionalMeshes';
  180. import {ShaderMaterial} from 'babylonjs/shaderMaterial';
  181. import {MeshBuilder} from 'babylonjs/meshBuilder';
  182. import {PBRBaseMaterial,PBRBaseSimpleMaterial,PBRMaterial,PBRMetallicRoughnessMaterial,PBRSpecularGlossinessMaterial} from 'babylonjs/pbrMaterial';
  183. import {CameraInputTypes,ICameraInput,CameraInputsMap,CameraInputsManager,TargetCamera} from 'babylonjs/targetCamera';
  184. import {ArcRotateCameraKeyboardMoveInput,ArcRotateCameraMouseWheelInput,ArcRotateCameraPointersInput,ArcRotateCameraInputsManager,ArcRotateCamera} from 'babylonjs/arcRotateCamera';
  185. import {FreeCameraMouseInput,FreeCameraKeyboardMoveInput,FreeCameraInputsManager,FreeCamera} from 'babylonjs/freeCamera';
  186. import {HemisphericLight} from 'babylonjs/hemisphericLight';
  187. import {IShadowLight,ShadowLight,DirectionalLight} from 'babylonjs/directionalLight';
  188. import {SpotLight} from 'babylonjs/spotLight';
  189. import {CubeTexture,RenderTargetTexture,IMultiRenderTargetOptions,MultiRenderTarget,MirrorTexture,RefractionTexture,DynamicTexture,VideoTexture,RawTexture} from 'babylonjs/additionalTextures';
  190. import {AudioEngine,Sound,SoundTrack,Analyser} from 'babylonjs/audio';
  191. import {ILoadingScreen,DefaultLoadingScreen,SceneLoaderProgressEvent,ISceneLoaderPluginExtensions,ISceneLoaderPluginFactory,ISceneLoaderPlugin,ISceneLoaderPluginAsync,SceneLoader,FilesInput} from 'babylonjs/loader';
  192. import {IShadowGenerator,ShadowGenerator} from 'babylonjs/shadows';
  193. import {StringDictionary} from 'babylonjs/stringDictionary';
  194. import {Tags,AndOrNotEvaluator} from 'babylonjs/userData';
  195. import {FresnelParameters} from 'babylonjs/fresnel';
  196. import {MultiMaterial} from 'babylonjs/multiMaterial';
  197. import {Database} from 'babylonjs/offline';
  198. import {FreeCameraTouchInput,TouchCamera} from 'babylonjs/touchCamera';
  199. import {ProceduralTexture,CustomProceduralTexture} from 'babylonjs/procedural';
  200. import {FreeCameraGamepadInput,ArcRotateCameraGamepadInput,GamepadManager,StickValues,GamepadButtonChanges,Gamepad,GenericPad,Xbox360Button,Xbox360Dpad,Xbox360Pad,PoseEnabledControllerType,MutableGamepadButton,ExtendedGamepadButton,PoseEnabledControllerHelper,PoseEnabledController,WebVRController,OculusTouchController,ViveController,GenericController,WindowsMotionController} from 'babylonjs/gamepad';
  201. import {FollowCamera,ArcFollowCamera,UniversalCamera,GamepadCamera} from 'babylonjs/additionalCameras';
  202. import {DepthRenderer} from 'babylonjs/depthRenderer';
  203. import {GeometryBufferRenderer} from 'babylonjs/geometryBufferRenderer';
  204. import {PostProcessOptions,PostProcess,PassPostProcess} from 'babylonjs/postProcesses';
  205. import {BlurPostProcess} from 'babylonjs/additionalPostProcess_blur';
  206. import {FxaaPostProcess} from 'babylonjs/additionalPostProcess_fxaa';
  207. import {HighlightsPostProcess} from 'babylonjs/additionalPostProcess_highlights';
  208. import {RefractionPostProcess,BlackAndWhitePostProcess,ConvolutionPostProcess,FilterPostProcess,VolumetricLightScatteringPostProcess,ColorCorrectionPostProcess,TonemappingOperator,TonemapPostProcess,DisplayPassPostProcess,ImageProcessingPostProcess} from 'babylonjs/additionalPostProcesses';
  209. import {PostProcessRenderPipelineManager,PostProcessRenderPass,PostProcessRenderEffect,PostProcessRenderPipeline} from 'babylonjs/renderingPipeline';
  210. import {SSAORenderingPipeline,SSAO2RenderingPipeline,LensRenderingPipeline,StandardRenderingPipeline} from 'babylonjs/additionalRenderingPipeline';
  211. import {DefaultRenderingPipeline} from 'babylonjs/defaultRenderingPipeline';
  212. import {Bone,BoneIKController,BoneLookController,Skeleton} from 'babylonjs/bones';
  213. import {SphericalPolynomial,SphericalHarmonics,CubeMapToSphericalPolynomialTools,CubeMapInfo,PanoramaToCubeMapTools,HDRInfo,HDRTools,HDRCubeTexture} from 'babylonjs/hdr';
  214. import {CSG} from 'babylonjs/csg';
  215. import {Polygon,PolygonMeshBuilder} from 'babylonjs/polygonMesh';
  216. import {LensFlare,LensFlareSystem} from 'babylonjs/lensFlares';
  217. 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';
  218. import {TGATools,DDSInfo,DDSTools,KhronosTextureContainer} from 'babylonjs/textureFormats';
  219. import {Debug,RayHelper,DebugLayer,BoundingBoxRenderer} from 'babylonjs/debug';
  220. import {MorphTarget,MorphTargetManager} from 'babylonjs/morphTargets';
  221. import {IOctreeContainer,Octree,OctreeBlock} from 'babylonjs/octrees';
  222. import {SIMDHelper} from 'babylonjs/simd';
  223. 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';
  224. import {JoystickAxis,VirtualJoystick,VirtualJoysticksCamera,FreeCameraVirtualJoystickInput} from 'babylonjs/virtualJoystick';
  225. 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';
  226. import {OutlineRenderer,EdgesRenderer,IHighlightLayerOptions,HighlightLayer} from 'babylonjs/highlights';
  227. import {SceneSerializer} from 'babylonjs/serialization';
  228. import {AssetTaskState,AbstractAssetTask,IAssetsProgressEvent,AssetsProgressEvent,MeshAssetTask,TextFileAssetTask,BinaryFileAssetTask,ImageAssetTask,ITextureAssetTask,TextureAssetTask,CubeTextureAssetTask,HDRCubeTextureAssetTask,AssetsManager} from 'babylonjs/assetsManager';
  229. import {ReflectionProbe} from 'babylonjs/probes';
  230. import {BackgroundMaterial} from 'babylonjs/backgroundMaterial';
  231. import {Layer} from 'babylonjs/layer';
  232. import {IEnvironmentHelperOptions,EnvironmentHelper} from 'babylonjs/environmentHelper';