phaser-ce icon indicating copy to clipboard operation
phaser-ce copied to clipboard

Requesting PVRTC texture loading for Phaser.Loader#atlas

Open eschaefer opened this issue 8 years ago • 9 comments

Feature Request

Firstly, thanks so much for this great and well-documented library!

Currently there is the beautiful option of loading PVRTC (or other compressed texture formats) with Phaser.Loader#image [1] and Phaser.Loader#texture [2].

However my preferred way of loading spritesheets with frames for animation is via Phaser.Loader#atlasJSONHash [3], but this method only accepts a normal image file along with the atlas data file (in JSON format).

I suppose my question is: how can we support an object with compressed texture formats (and a fallback truecolor image file as an argument passed to the Phaser.Loader#atlasJSONHash method? Is this desirable behavior for anyone else?

  • [1] https://github.com/photonstorm/phaser-ce/blob/master/src/loader/Loader.js#L736
  • [2] https://github.com/photonstorm/phaser-ce/blob/master/src/loader/Loader.js#L793
  • [3] https://github.com/photonstorm/phaser-ce/blob/master/src/loader/Loader.js#L1584

eschaefer avatar Mar 03 '17 09:03 eschaefer

ping @bitnenfer as well, since I noticed you worked on this a little bit.

eschaefer avatar Mar 03 '17 09:03 eschaefer

Is there a reason it can't be setup to work the same way as image and texture? We were in the process of setting up compressed texture support until noticing that it doesn't work with atlasJSONHash as you mentioned, which is what we use as well.

goldfire avatar Apr 11 '17 17:04 goldfire

I think we won't know until someone looks into it. 😃

Can anyone provide a set of atlas/texture files (to test an implementation)?

samme avatar Apr 11 '17 18:04 samme

Here's a very simple texture/atlas: https://cloudup.com/cWXKCYhDLnL

goldfire avatar Apr 11 '17 19:04 goldfire

Here's a very simple texture/atlas: https://cloudup.com/cWXKCYhDLnL

"The download of this file has been disabled" 😞

samme avatar Apr 11 '17 20:04 samme

Hmm, that's odd. How about this? https://www.dropbox.com/s/jgjrukxg5quh11l/Compressed%20Atlas%20Test.zip?dl=0

goldfire avatar Apr 11 '17 20:04 goldfire

Have you tried using Phaser.Cache#addTextureAtlas like http://codepen.io/samme/pen/ybLpdJ ? (Not a compressed texture, but it may work the same.)

samme avatar Apr 12 '17 23:04 samme

@samme Thanks for that sample, I think that should work for us; however, I've run into a different issue trying to get this setup with the actual loading of the compressed textures (https://github.com/photonstorm/phaser-ce/issues/162).

goldfire avatar Apr 15 '17 17:04 goldfire

Just a heads up that we've gotten this approach implemented now in https://github.com/goldfire/phaser-webpack-loader.

goldfire avatar Apr 19 '17 23:04 goldfire