GithubHelp home page GithubHelp logo

Comments (4)

ivanpopelyshev avatar ivanpopelyshev commented on May 28, 2024

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.

from pixi-compressed-textures.

ivanpopelyshev avatar ivanpopelyshev commented on May 28, 2024

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

from pixi-compressed-textures.

radames avatar radames commented on May 28, 2024

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("[email protected]").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;
  })

from pixi-compressed-textures.

radames avatar radames commented on May 28, 2024

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

mainTexture = fetch(
  !darkMode
    ? await FileAttachment("[email protected]").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

from pixi-compressed-textures.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.