bakedVertexAnimationManager.d.ts 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. import type { Nullable } from "../types";
  2. import type { Scene } from "../scene";
  3. import type { BaseTexture } from "../Materials/Textures/baseTexture";
  4. import { Vector4 } from "../Maths/math.vector";
  5. import type { Effect } from "../Materials/effect";
  6. /**
  7. * Interface for baked vertex animation texture, see BakedVertexAnimationManager
  8. * @since 5.0
  9. */
  10. export interface IBakedVertexAnimationManager {
  11. /**
  12. * The vertex animation texture
  13. */
  14. texture: Nullable<BaseTexture>;
  15. /**
  16. * Gets or sets a boolean indicating if the edgesRenderer is active
  17. */
  18. isEnabled: boolean;
  19. /**
  20. * The animation parameters for the mesh. See setAnimationParameters()
  21. */
  22. animationParameters: Vector4;
  23. /**
  24. * The time counter, to pick the correct animation frame.
  25. */
  26. time: number;
  27. /**
  28. * Binds to the effect.
  29. * @param effect The effect to bind to.
  30. * @param useInstances True when it's an instance.
  31. */
  32. bind(effect: Effect, useInstances: boolean): void;
  33. /**
  34. * Sets animation parameters.
  35. * @param startFrame The first frame of the animation.
  36. * @param endFrame The last frame of the animation.
  37. * @param offset The offset when starting the animation.
  38. * @param speedFramesPerSecond The frame rate.
  39. */
  40. setAnimationParameters(startFrame: number, endFrame: number, offset: number, speedFramesPerSecond: number): void;
  41. /**
  42. * Disposes the resources of the manager.
  43. * @param forceDisposeTextures - Forces the disposal of all textures.
  44. */
  45. dispose(forceDisposeTextures?: boolean): void;
  46. /**
  47. * Get the current class name useful for serialization or dynamic coding.
  48. * @returns "BakedVertexAnimationManager"
  49. */
  50. getClassName(): string;
  51. }
  52. /**
  53. * This class is used to animate meshes using a baked vertex animation texture
  54. * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/baked_texture_animations
  55. * @since 5.0
  56. */
  57. export declare class BakedVertexAnimationManager implements IBakedVertexAnimationManager {
  58. private _scene;
  59. private _texture;
  60. /**
  61. * The vertex animation texture
  62. */
  63. texture: Nullable<BaseTexture>;
  64. private _isEnabled;
  65. /**
  66. * Enable or disable the vertex animation manager
  67. */
  68. isEnabled: boolean;
  69. /**
  70. * The animation parameters for the mesh. See setAnimationParameters()
  71. */
  72. animationParameters: Vector4;
  73. /**
  74. * The time counter, to pick the correct animation frame.
  75. */
  76. time: number;
  77. /**
  78. * Creates a new BakedVertexAnimationManager
  79. * @param scene defines the current scene
  80. */
  81. constructor(scene?: Nullable<Scene>);
  82. /** @internal */
  83. _markSubMeshesAsAttributesDirty(): void;
  84. /**
  85. * Binds to the effect.
  86. * @param effect The effect to bind to.
  87. * @param useInstances True when it's an instance.
  88. */
  89. bind(effect: Effect, useInstances?: boolean): void;
  90. /**
  91. * Clone the current manager
  92. * @returns a new BakedVertexAnimationManager
  93. */
  94. clone(): BakedVertexAnimationManager;
  95. /**
  96. * Sets animation parameters.
  97. * @param startFrame The first frame of the animation.
  98. * @param endFrame The last frame of the animation.
  99. * @param offset The offset when starting the animation.
  100. * @param speedFramesPerSecond The frame rate.
  101. */
  102. setAnimationParameters(startFrame: number, endFrame: number, offset?: number, speedFramesPerSecond?: number): void;
  103. /**
  104. * Disposes the resources of the manager.
  105. * @param forceDisposeTextures - Forces the disposal of all textures.
  106. */
  107. dispose(forceDisposeTextures?: boolean): void;
  108. /**
  109. * Get the current class name useful for serialization or dynamic coding.
  110. * @returns "BakedVertexAnimationManager"
  111. */
  112. getClassName(): string;
  113. /**
  114. * Makes a duplicate of the current instance into another one.
  115. * @param vatMap define the instance where to copy the info
  116. */
  117. copyTo(vatMap: BakedVertexAnimationManager): void;
  118. /**
  119. * Serializes this vertex animation instance
  120. * @returns - An object with the serialized instance.
  121. */
  122. serialize(): any;
  123. /**
  124. * Parses a vertex animation setting from a serialized object.
  125. * @param source - Serialized object.
  126. * @param scene Defines the scene we are parsing for
  127. * @param rootUrl Defines the rootUrl to load from
  128. */
  129. parse(source: any, scene: Scene, rootUrl: string): void;
  130. }