index.d.ts 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. declare module 'babylonjs/highlights' {
  2. class OutlineRenderer {
  3. private _scene;
  4. private _effect;
  5. private _cachedDefines;
  6. zOffset: number;
  7. constructor(scene: Scene);
  8. render(subMesh: SubMesh, batch: _InstancesBatch, useOverlay?: boolean): void;
  9. isReady(subMesh: SubMesh, useInstances: boolean): boolean;
  10. }
  11. }
  12. declare module 'babylonjs/highlights' {
  13. class EdgesRenderer {
  14. edgesWidthScalerForOrthographic: number;
  15. edgesWidthScalerForPerspective: number;
  16. private _source;
  17. private _linesPositions;
  18. private _linesNormals;
  19. private _linesIndices;
  20. private _epsilon;
  21. private _indicesCount;
  22. private _lineShader;
  23. private _ib;
  24. private _buffers;
  25. private _checkVerticesInsteadOfIndices;
  26. constructor(source: AbstractMesh, epsilon?: number, checkVerticesInsteadOfIndices?: boolean);
  27. private _prepareRessources();
  28. _rebuild(): void;
  29. dispose(): void;
  30. private _processEdgeForAdjacencies(pa, pb, p0, p1, p2);
  31. private _processEdgeForAdjacenciesWithVertices(pa, pb, p0, p1, p2);
  32. private _checkEdge(faceIndex, edge, faceNormals, p0, p1);
  33. _generateEdgesLines(): void;
  34. render(): void;
  35. }
  36. }
  37. declare module 'babylonjs/highlights' {
  38. /**
  39. * Highlight layer options. This helps customizing the behaviour
  40. * of the highlight layer.
  41. */
  42. interface IHighlightLayerOptions {
  43. /**
  44. * Multiplication factor apply to the canvas size to compute the render target size
  45. * used to generated the glowing objects (the smaller the faster).
  46. */
  47. mainTextureRatio: number;
  48. /**
  49. * Enforces a fixed size texture to ensure resize independant blur.
  50. */
  51. mainTextureFixedSize?: number;
  52. /**
  53. * Multiplication factor apply to the main texture size in the first step of the blur to reduce the size
  54. * of the picture to blur (the smaller the faster).
  55. */
  56. blurTextureSizeRatio: number;
  57. /**
  58. * How big in texel of the blur texture is the vertical blur.
  59. */
  60. blurVerticalSize: number;
  61. /**
  62. * How big in texel of the blur texture is the horizontal blur.
  63. */
  64. blurHorizontalSize: number;
  65. /**
  66. * Alpha blending mode used to apply the blur. Default is combine.
  67. */
  68. alphaBlendingMode: number;
  69. /**
  70. * The camera attached to the layer.
  71. */
  72. camera: Nullable<Camera>;
  73. }
  74. /**
  75. * The highlight layer Helps adding a glow effect around a mesh.
  76. *
  77. * Once instantiated in a scene, simply use the pushMesh or removeMesh method to add or remove
  78. * glowy meshes to your scene.
  79. *
  80. * !!! THIS REQUIRES AN ACTIVE STENCIL BUFFER ON THE CANVAS !!!
  81. */
  82. class HighlightLayer {
  83. name: string;
  84. /**
  85. * The neutral color used during the preparation of the glow effect.
  86. * This is black by default as the blend operation is a blend operation.
  87. */
  88. static neutralColor: Color4;
  89. /**
  90. * Stencil value used for glowing meshes.
  91. */
  92. static glowingMeshStencilReference: number;
  93. /**
  94. * Stencil value used for the other meshes in the scene.
  95. */
  96. static normalMeshStencilReference: number;
  97. private _scene;
  98. private _engine;
  99. private _options;
  100. private _vertexBuffers;
  101. private _indexBuffer;
  102. private _downSamplePostprocess;
  103. private _horizontalBlurPostprocess;
  104. private _verticalBlurPostprocess;
  105. private _cachedDefines;
  106. private _glowMapGenerationEffect;
  107. private _glowMapMergeEffect;
  108. private _blurTexture;
  109. private _mainTexture;
  110. private _mainTextureDesiredSize;
  111. private _meshes;
  112. private _maxSize;
  113. private _shouldRender;
  114. private _instanceGlowingMeshStencilReference;
  115. private _excludedMeshes;
  116. /**
  117. * Specifies whether or not the inner glow is ACTIVE in the layer.
  118. */
  119. innerGlow: boolean;
  120. /**
  121. * Specifies whether or not the outer glow is ACTIVE in the layer.
  122. */
  123. outerGlow: boolean;
  124. /**
  125. * Specifies wether the highlight layer is enabled or not.
  126. */
  127. isEnabled: boolean;
  128. /**
  129. * Gets the horizontal size of the blur.
  130. */
  131. /**
  132. * Specifies the horizontal size of the blur.
  133. */
  134. blurHorizontalSize: number;
  135. /**
  136. * Gets the vertical size of the blur.
  137. */
  138. /**
  139. * Specifies the vertical size of the blur.
  140. */
  141. blurVerticalSize: number;
  142. /**
  143. * Gets the camera attached to the layer.
  144. */
  145. readonly camera: Nullable<Camera>;
  146. /**
  147. * An event triggered when the highlight layer has been disposed.
  148. * @type {BABYLON.Observable}
  149. */
  150. onDisposeObservable: Observable<HighlightLayer>;
  151. /**
  152. * An event triggered when the highlight layer is about rendering the main texture with the glowy parts.
  153. * @type {BABYLON.Observable}
  154. */
  155. onBeforeRenderMainTextureObservable: Observable<HighlightLayer>;
  156. /**
  157. * An event triggered when the highlight layer is being blurred.
  158. * @type {BABYLON.Observable}
  159. */
  160. onBeforeBlurObservable: Observable<HighlightLayer>;
  161. /**
  162. * An event triggered when the highlight layer has been blurred.
  163. * @type {BABYLON.Observable}
  164. */
  165. onAfterBlurObservable: Observable<HighlightLayer>;
  166. /**
  167. * An event triggered when the glowing blurred texture is being merged in the scene.
  168. * @type {BABYLON.Observable}
  169. */
  170. onBeforeComposeObservable: Observable<HighlightLayer>;
  171. /**
  172. * An event triggered when the glowing blurred texture has been merged in the scene.
  173. * @type {BABYLON.Observable}
  174. */
  175. onAfterComposeObservable: Observable<HighlightLayer>;
  176. /**
  177. * An event triggered when the highlight layer changes its size.
  178. * @type {BABYLON.Observable}
  179. */
  180. onSizeChangedObservable: Observable<HighlightLayer>;
  181. /**
  182. * Instantiates a new highlight Layer and references it to the scene..
  183. * @param name The name of the layer
  184. * @param scene The scene to use the layer in
  185. * @param options Sets of none mandatory options to use with the layer (see IHighlightLayerOptions for more information)
  186. */
  187. constructor(name: string, scene: Scene, options?: IHighlightLayerOptions);
  188. private _createIndexBuffer();
  189. _rebuild(): void;
  190. /**
  191. * Creates the render target textures and post processes used in the highlight layer.
  192. */
  193. private createTextureAndPostProcesses();
  194. /**
  195. * Checks for the readiness of the element composing the layer.
  196. * @param subMesh the mesh to check for
  197. * @param useInstances specify wether or not to use instances to render the mesh
  198. * @param emissiveTexture the associated emissive texture used to generate the glow
  199. * @return true if ready otherwise, false
  200. */
  201. private isReady(subMesh, useInstances, emissiveTexture);
  202. /**
  203. * Renders the glowing part of the scene by blending the blurred glowing meshes on top of the rendered scene.
  204. */
  205. render(): void;
  206. /**
  207. * Add a mesh in the exclusion list to prevent it to impact or being impacted by the highlight layer.
  208. * @param mesh The mesh to exclude from the highlight layer
  209. */
  210. addExcludedMesh(mesh: Mesh): void;
  211. /**
  212. * Remove a mesh from the exclusion list to let it impact or being impacted by the highlight layer.
  213. * @param mesh The mesh to highlight
  214. */
  215. removeExcludedMesh(mesh: Mesh): void;
  216. /**
  217. * Add a mesh in the highlight layer in order to make it glow with the chosen color.
  218. * @param mesh The mesh to highlight
  219. * @param color The color of the highlight
  220. * @param glowEmissiveOnly Extract the glow from the emissive texture
  221. */
  222. addMesh(mesh: Mesh, color: Color3, glowEmissiveOnly?: boolean): void;
  223. /**
  224. * Remove a mesh from the highlight layer in order to make it stop glowing.
  225. * @param mesh The mesh to highlight
  226. */
  227. removeMesh(mesh: Mesh): void;
  228. /**
  229. * Returns true if the layer contains information to display, otherwise false.
  230. */
  231. shouldRender(): boolean;
  232. /**
  233. * Sets the main texture desired size which is the closest power of two
  234. * of the engine canvas size.
  235. */
  236. private setMainTextureSize();
  237. /**
  238. * Force the stencil to the normal expected value for none glowing parts
  239. */
  240. private defaultStencilReference(mesh);
  241. /**
  242. * Dispose only the render target textures and post process.
  243. */
  244. private disposeTextureAndPostProcesses();
  245. /**
  246. * Dispose the highlight layer and free resources.
  247. */
  248. dispose(): void;
  249. }
  250. }
  251. 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';
  252. import {EngineInstrumentation,SceneInstrumentation,_TimeToken} from 'babylonjs/instrumentation';
  253. import {Particle,IParticleSystem,ParticleSystem,BoxParticleEmitter,ConeParticleEmitter,SphereParticleEmitter,SphereDirectedParticleEmitter,IParticleEmitterType} from 'babylonjs/particles';
  254. import {GPUParticleSystem} from 'babylonjs/gpuParticles';
  255. import {FramingBehavior,BouncingBehavior,AutoRotationBehavior} from 'babylonjs/cameraBehaviors';
  256. import {NullEngineOptions,NullEngine} from 'babylonjs/nullEngine';
  257. import {TextureTools} from 'babylonjs/textureTools';
  258. import {SolidParticle,ModelShape,DepthSortedParticle,SolidParticleSystem} from 'babylonjs/solidParticles';
  259. import {Collider,CollisionWorker,ICollisionCoordinator,SerializedMesh,SerializedSubMesh,SerializedGeometry,BabylonMessage,SerializedColliderToWorker,WorkerTaskType,WorkerReply,CollisionReplyPayload,InitPayload,CollidePayload,UpdatePayload,WorkerReplyType,CollisionCoordinatorWorker,CollisionCoordinatorLegacy} from 'babylonjs/collisions';
  260. import {IntersectionInfo,PickingInfo,Ray} from 'babylonjs/picking';
  261. import {SpriteManager,Sprite} from 'babylonjs/sprites';
  262. 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';
  263. import {Condition,ValueCondition,PredicateCondition,StateCondition,Action,ActionEvent,ActionManager,InterpolateValueAction,SwitchBooleanAction,SetStateAction,SetValueAction,IncrementValueAction,PlayAnimationAction,StopAnimationAction,DoNothingAction,CombineAction,ExecuteCodeAction,SetParentAction,PlaySoundAction,StopSoundAction} from 'babylonjs/actions';
  264. import {GroundMesh,InstancedMesh,LinesMesh} from 'babylonjs/additionalMeshes';
  265. import {ShaderMaterial} from 'babylonjs/shaderMaterial';
  266. import {MeshBuilder} from 'babylonjs/meshBuilder';
  267. import {PBRBaseMaterial,PBRBaseSimpleMaterial,PBRMaterial,PBRMetallicRoughnessMaterial,PBRSpecularGlossinessMaterial} from 'babylonjs/pbrMaterial';
  268. import {CameraInputTypes,ICameraInput,CameraInputsMap,CameraInputsManager,TargetCamera} from 'babylonjs/targetCamera';
  269. import {ArcRotateCameraKeyboardMoveInput,ArcRotateCameraMouseWheelInput,ArcRotateCameraPointersInput,ArcRotateCameraInputsManager,ArcRotateCamera} from 'babylonjs/arcRotateCamera';
  270. import {FreeCameraMouseInput,FreeCameraKeyboardMoveInput,FreeCameraInputsManager,FreeCamera} from 'babylonjs/freeCamera';
  271. import {HemisphericLight} from 'babylonjs/hemisphericLight';
  272. import {IShadowLight,ShadowLight,PointLight} from 'babylonjs/pointLight';
  273. import {DirectionalLight} from 'babylonjs/directionalLight';
  274. import {SpotLight} from 'babylonjs/spotLight';
  275. import {CubeTexture,RenderTargetTexture,IMultiRenderTargetOptions,MultiRenderTarget,MirrorTexture,RefractionTexture,DynamicTexture,VideoTexture,RawTexture} from 'babylonjs/additionalTextures';
  276. import {AudioEngine,Sound,SoundTrack,Analyser} from 'babylonjs/audio';
  277. import {ILoadingScreen,DefaultLoadingScreen,SceneLoaderProgressEvent,ISceneLoaderPluginExtensions,ISceneLoaderPluginFactory,ISceneLoaderPlugin,ISceneLoaderPluginAsync,SceneLoader,FilesInput} from 'babylonjs/loader';
  278. import {IShadowGenerator,ShadowGenerator} from 'babylonjs/shadows';
  279. import {StringDictionary} from 'babylonjs/stringDictionary';
  280. import {Tags,AndOrNotEvaluator} from 'babylonjs/userData';
  281. import {FresnelParameters} from 'babylonjs/fresnel';
  282. import {MultiMaterial} from 'babylonjs/multiMaterial';
  283. import {Database} from 'babylonjs/offline';
  284. import {FreeCameraTouchInput,TouchCamera} from 'babylonjs/touchCamera';
  285. import {ProceduralTexture,CustomProceduralTexture} from 'babylonjs/procedural';
  286. import {FreeCameraGamepadInput,ArcRotateCameraGamepadInput,GamepadManager,StickValues,GamepadButtonChanges,Gamepad,GenericPad,Xbox360Button,Xbox360Dpad,Xbox360Pad,PoseEnabledControllerType,MutableGamepadButton,ExtendedGamepadButton,PoseEnabledControllerHelper,PoseEnabledController,WebVRController,OculusTouchController,ViveController,GenericController,WindowsMotionController} from 'babylonjs/gamepad';
  287. import {FollowCamera,ArcFollowCamera,UniversalCamera,GamepadCamera} from 'babylonjs/additionalCameras';
  288. import {DepthRenderer} from 'babylonjs/depthRenderer';
  289. import {GeometryBufferRenderer} from 'babylonjs/geometryBufferRenderer';
  290. import {PostProcessOptions,PostProcess,PassPostProcess} from 'babylonjs/postProcesses';
  291. import {BlurPostProcess} from 'babylonjs/additionalPostProcess_blur';
  292. import {FxaaPostProcess} from 'babylonjs/additionalPostProcess_fxaa';
  293. import {HighlightsPostProcess} from 'babylonjs/additionalPostProcess_highlights';
  294. import {RefractionPostProcess,BlackAndWhitePostProcess,ConvolutionPostProcess,FilterPostProcess,VolumetricLightScatteringPostProcess,ColorCorrectionPostProcess,TonemappingOperator,TonemapPostProcess,DisplayPassPostProcess,ImageProcessingPostProcess} from 'babylonjs/additionalPostProcesses';
  295. import {PostProcessRenderPipelineManager,PostProcessRenderPass,PostProcessRenderEffect,PostProcessRenderPipeline} from 'babylonjs/renderingPipeline';
  296. import {SSAORenderingPipeline,SSAO2RenderingPipeline,LensRenderingPipeline,StandardRenderingPipeline} from 'babylonjs/additionalRenderingPipeline';
  297. import {DefaultRenderingPipeline} from 'babylonjs/defaultRenderingPipeline';
  298. import {Bone,BoneIKController,BoneLookController,Skeleton} from 'babylonjs/bones';
  299. import {SphericalPolynomial,SphericalHarmonics,CubeMapToSphericalPolynomialTools,CubeMapInfo,PanoramaToCubeMapTools,HDRInfo,HDRTools,HDRCubeTexture} from 'babylonjs/hdr';
  300. import {CSG} from 'babylonjs/csg';
  301. import {Polygon,PolygonMeshBuilder} from 'babylonjs/polygonMesh';
  302. import {LensFlare,LensFlareSystem} from 'babylonjs/lensFlares';
  303. 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';
  304. import {TGATools,DDSInfo,DDSTools,KhronosTextureContainer} from 'babylonjs/textureFormats';
  305. import {Debug,RayHelper,DebugLayer,BoundingBoxRenderer} from 'babylonjs/debug';
  306. import {MorphTarget,MorphTargetManager} from 'babylonjs/morphTargets';
  307. import {IOctreeContainer,Octree,OctreeBlock} from 'babylonjs/octrees';
  308. import {SIMDHelper} from 'babylonjs/simd';
  309. 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';
  310. import {JoystickAxis,VirtualJoystick,VirtualJoysticksCamera,FreeCameraVirtualJoystickInput} from 'babylonjs/virtualJoystick';
  311. 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';
  312. import {SceneSerializer} from 'babylonjs/serialization';
  313. import {AssetTaskState,AbstractAssetTask,IAssetsProgressEvent,AssetsProgressEvent,MeshAssetTask,TextFileAssetTask,BinaryFileAssetTask,ImageAssetTask,ITextureAssetTask,TextureAssetTask,CubeTextureAssetTask,HDRCubeTextureAssetTask,AssetsManager} from 'babylonjs/assetsManager';
  314. import {ReflectionProbe} from 'babylonjs/probes';
  315. import {BackgroundMaterial} from 'babylonjs/backgroundMaterial';
  316. import {Layer} from 'babylonjs/layer';
  317. import {IEnvironmentHelperOptions,EnvironmentHelper} from 'babylonjs/environmentHelper';