Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save/load texture atlas for caching to improve performance #12

Open
deathcap opened this issue Jan 17, 2016 · 0 comments
Open

Save/load texture atlas for caching to improve performance #12

deathcap opened this issue Jan 17, 2016 · 0 comments

Comments

@deathcap
Copy link
Member

The complete process of generating the texture atlas is fairly expensive (including extracting the texture .png files from the resource pack .zip archives, which is not cached either: deathcap/artpacks#15), so it ought to be possible to save it and load a precomputed stitched atlas (including all the mipmap levels) for better performance.

There is existing code when the debug option is enabled to log the canvases to the document:

  if (showLevels) {
    // add each mip level to the page for debugging TODO: refactor with rect-mip-map demo
    pyramid.forEach(function(level, i) {
      var img = new Image();
      img.src = savePixels(level, 'canvas').toDataURL();
      img.style.border = '1px dotted black';
      document.body.appendChild(document.createElement('br'));
      document.body.appendChild(img);
      document.body.appendChild(document.createTextNode(' level #'+i+' ('+img.width+'x'+img.height+')'));
    });
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant