motionBlurPostProcess.d.ts 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. import type { Nullable } from "../types";
  2. import type { Camera } from "../Cameras/camera";
  3. import type { PostProcessOptions } from "./postProcess";
  4. import { PostProcess } from "./postProcess";
  5. import type { AbstractMesh } from "../Meshes/abstractMesh";
  6. import "../Animations/animatable";
  7. import "../Rendering/geometryBufferRendererSceneComponent";
  8. import "../Shaders/motionBlur.fragment";
  9. import type { AbstractEngine } from "../Engines/abstractEngine";
  10. import type { Scene } from "../scene";
  11. /**
  12. * The Motion Blur Post Process which blurs an image based on the objects velocity in scene.
  13. * Velocity can be affected by each object's rotation, position and scale depending on the transformation speed.
  14. * As an example, all you have to do is to create the post-process:
  15. * var mb = new BABYLON.MotionBlurPostProcess(
  16. * 'mb', // The name of the effect.
  17. * scene, // The scene containing the objects to blur according to their velocity.
  18. * 1.0, // The required width/height ratio to downsize to before computing the render pass.
  19. * camera // The camera to apply the render pass to.
  20. * );
  21. * Then, all objects moving, rotating and/or scaling will be blurred depending on the transformation speed.
  22. */
  23. export declare class MotionBlurPostProcess extends PostProcess {
  24. /**
  25. * Defines how much the image is blurred by the movement. Default value is equal to 1
  26. */
  27. motionStrength: number;
  28. /**
  29. * Gets the number of iterations are used for motion blur quality. Default value is equal to 32
  30. */
  31. get motionBlurSamples(): number;
  32. /**
  33. * Sets the number of iterations to be used for motion blur quality
  34. */
  35. set motionBlurSamples(samples: number);
  36. private _motionBlurSamples;
  37. /**
  38. * Gets whether or not the motion blur post-process is in object based mode.
  39. */
  40. get isObjectBased(): boolean;
  41. /**
  42. * Sets whether or not the motion blur post-process is in object based mode.
  43. */
  44. set isObjectBased(value: boolean);
  45. private _isObjectBased;
  46. private _forceGeometryBuffer;
  47. private get _geometryBufferRenderer();
  48. private get _prePassRenderer();
  49. private _invViewProjection;
  50. private _previousViewProjection;
  51. /**
  52. * Gets a string identifying the name of the class
  53. * @returns "MotionBlurPostProcess" string
  54. */
  55. getClassName(): string;
  56. /**
  57. * Creates a new instance MotionBlurPostProcess
  58. * @param name The name of the effect.
  59. * @param scene The scene containing the objects to blur according to their velocity.
  60. * @param options The required width/height ratio to downsize to before computing the render pass.
  61. * @param camera The camera to apply the render pass to.
  62. * @param samplingMode The sampling mode to be used when computing the pass. (default: 0)
  63. * @param engine The engine which the post process will be applied. (default: current engine)
  64. * @param reusable If the post process can be reused on the same frame. (default: false)
  65. * @param textureType Type of textures used when performing the post process. (default: 0)
  66. * @param blockCompilation If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: true)
  67. * @param forceGeometryBuffer If this post process should use geometry buffer instead of prepass (default: false)
  68. */
  69. constructor(name: string, scene: Scene, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: AbstractEngine, reusable?: boolean, textureType?: number, blockCompilation?: boolean, forceGeometryBuffer?: boolean);
  70. /**
  71. * Excludes the given skinned mesh from computing bones velocities.
  72. * Computing bones velocities can have a cost and that cost. The cost can be saved by calling this function and by passing the skinned mesh reference to ignore.
  73. * @param skinnedMesh The mesh containing the skeleton to ignore when computing the velocity map.
  74. */
  75. excludeSkinnedMesh(skinnedMesh: AbstractMesh): void;
  76. /**
  77. * Removes the given skinned mesh from the excluded meshes to integrate bones velocities while rendering the velocity map.
  78. * @param skinnedMesh The mesh containing the skeleton that has been ignored previously.
  79. * @see excludeSkinnedMesh to exclude a skinned mesh from bones velocity computation.
  80. */
  81. removeExcludedSkinnedMesh(skinnedMesh: AbstractMesh): void;
  82. /**
  83. * Disposes the post process.
  84. * @param camera The camera to dispose the post process on.
  85. */
  86. dispose(camera?: Camera): void;
  87. /**
  88. * Called on the mode changed (object based or screen based).
  89. * @returns void
  90. */
  91. private _applyMode;
  92. /**
  93. * Called on the effect is applied when the motion blur post-process is in object based mode.
  94. * @param effect
  95. */
  96. private _onApplyObjectBased;
  97. /**
  98. * Called on the effect is applied when the motion blur post-process is in screen based mode.
  99. * @param effect
  100. */
  101. private _onApplyScreenBased;
  102. /**
  103. * Called on the effect must be updated (changed mode, samples count, etc.).
  104. */
  105. private _updateEffect;
  106. /**
  107. * @internal
  108. */
  109. static _Parse(parsedPostProcess: any, targetCamera: Camera, scene: Scene, rootUrl: string): Nullable<MotionBlurPostProcess>;
  110. }