Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Pixi v6 Deprecated methods #37

Closed
radames opened this issue Apr 2, 2021 · 4 comments
Closed

Pixi v6 Deprecated methods #37

radames opened this issue Apr 2, 2021 · 4 comments

Comments

@radames
Copy link

radames commented Apr 2, 2021

I'd be happy to submit a PR if that's the case.

PIXI.systems.Resource --> PIXI.ResourceDeprecated
PIXI.resources.TextureSystem --> PIXI.TextureSystemDeprecated

image

@ivanpopelyshev
Copy link
Contributor

the problem is, typings were changed. a lot. We cant compile it with TS anymore.

I can only modify resulting JS and publish it.

Alternatively, I can move it to new build system like pixi-tilemap was moved.

@ivanpopelyshev
Copy link
Contributor

Also PixiJS v6 has compressed-textures internally, if you dont need my special kind of loader :)

https://github.com/pixijs/pixi.js/tree/dev/packages/compressed-textures

@radames
Copy link
Author

radames commented Apr 9, 2021

hi @ivanpopelyshev, vey cool it's all integrated now!
I'm not sure if was able to port my code, I'm using compressedTextures.loadFromArrayBuffer and fetching .basis manually. I couldn't find similar API on v6

mainTexture = fetch(
  !darkMode
    ? await FileAttachment("final-100n-250-white-8192@1.basis").url()
    : await FileAttachment("final-100n-250-black-8192.basis").url()
)
  //   .arrayBuffer() // FileAttachment("final-basis-level-3.basis")
  .then(d => d.blob())
  .then(blob => blob.arrayBuffer())
  .then(array => PIXI.compressedTextures.loadFromArrayBuffer(array))
  .then(d => {
    const texture = new PIXI.BaseTexture(d);
    texture.scaleMode = PIXI.SCALE_MODES.NEAREST;
    return texture;
  })

@radames
Copy link
Author

radames commented May 25, 2021

finally spent some time on this and found a way to use the loader functions directly

mainTexture = fetch(
  !darkMode
    ? await FileAttachment("final-100n-250-white-8192@1.basis").url()
    : await FileAttachment("final-100n-250-black-8192.basis").url()
)
  .then((d) => d.blob())
  .then((blob) => blob.arrayBuffer())
  .then((array) => PIXI.BasisLoader.transcodeAsync(array))
  .then((transcoded) => {
    const e = PIXI.BasisLoader.registerTextures("mainTexture", transcoded);
    return e.texture;
  })
  .then((texture) => {
    texture.scaleMode = PIXI.SCALE_MODES.NEAREST;
    return texture;
  })

here is the final example!

https://observablehq.com/@radames/blocks-embeddings

@radames radames closed this as completed May 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants