spritePackedManager.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. import { SpriteManager } from "./spriteManager";
  2. import { Scene } from "../scene";
  3. import { Texture } from "../Materials/Textures/texture";
  4. /**
  5. * Class used to manage multiple sprites of different sizes on the same spritesheet
  6. * @see http://doc.babylonjs.com/babylon101/sprites
  7. */
  8. export class SpritePackedManager extends SpriteManager{
  9. /**
  10. * Creates a new sprite manager from a packed sprite sheet
  11. * @param name defines the manager's name
  12. * @param imgUrl defines the sprite sheet url
  13. * @param capacity defines the maximum allowed number of sprites
  14. * @param scene defines the hosting scene
  15. * @param spriteJSON null otherwise a JSON object defining sprite sheet data
  16. * @param epsilon defines the epsilon value to align texture (0.01 by default)
  17. * @param samplingMode defines the smapling mode to use with spritesheet
  18. * @param fromPacked set to true; do not alter
  19. */
  20. constructor(
  21. /** defines the packed manager's name */
  22. public name: string,
  23. imgUrl: string, capacity: number, scene: Scene, spriteJSON: string | null = null, epsilon: number = 0.01, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE) {
  24. //the cellSize parameter is not used when built from JSON which provides individual cell data, defaults to 64 if JSON load fails
  25. super(name, imgUrl, capacity, 64, scene, epsilon, samplingMode, true, spriteJSON);
  26. }
  27. }