DragonBones / DragonBonesAS

DragonBones ActionScript Runtime
MIT License
251 stars 117 forks source link

Handling multi-resolution textures with `addTextureAtlasData` #87

Open loksland opened 7 years ago

loksland commented 7 years ago

I am using addTextureAtlasData to load texture atlases from the Starling assetManager:

factory.addTextureAtlasData(StarlingTextureAtlasData.fromTextureAtlas(assets.getTextureAtlas('anim')), 'anim');

The scale of the textures that are rendered is not right as the textures are a different scale to those used to configure the DragonBones project. This is because I need to support multiple-resolutions.

What is the best way to implement asset scaling through this call?

factory.scaleForTexture seems to have no effect and I don't want to use the factory.parseTextureAtlasData method in this situation.

akdcl commented 7 years ago

Hi, You can have a look about this demo in dev branch. https://github.com/DragonBones/DragonBonesAS/blob/dev/Starling/Demos/src/MultiResolutionTextureAtlas.as

loksland commented 7 years ago

Thanks @akdcl, in the provided demo the scale factor param has been added to the parseTextureAtlasData method in dev branch, though in my situation I am using addTextureAtlasData. Is there an equivalent way to set the scale for this method?

akdcl commented 7 years ago

StarlingTextureAtlasData.fromTextureAtlas will set the scale from starling, may be the scale is not suitable for the armature scale. You can scale dragonBoneData when you parse it. You can also look at this issue, https://github.com/DragonBones/DragonBonesAS/issues/86