phaserjs / phaser-ce

Phaser CE is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.
http://phaser.io
MIT License
1.34k stars 491 forks source link

Requesting PVRTC texture loading for Phaser.Loader#atlas #42

Open eschaefer opened 7 years ago

eschaefer commented 7 years ago

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?

eschaefer commented 7 years ago

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

goldfire commented 7 years ago

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.

samme commented 7 years ago

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

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

goldfire commented 7 years ago

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

samme commented 7 years ago

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

"The download of this file has been disabled" 😞

goldfire commented 7 years ago

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

samme commented 7 years ago

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

goldfire commented 7 years ago

@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 commented 7 years ago

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