我尝试使用透明图像为动画创建纹理图集。取而代之的是我的纹理,我最终得到了黑色的方形图像,将我想要打包的第一个纹理的大小与纹理图集进行匹配。我使用这个纹理打包器https://www.codeandweb.com/texturepacker,因为libgdx的gui由于某种原因无法打包它(它说错误已经发生)。在透明图像之前,我使用它作为正常的非透明图像,并且它工作正常。由于涉及透明度,我似乎正在变黑影像。有没有人有透明纹理类似的问题?包含Texture Packer的透明像素图像为黑色
代码:
mainCharAtlas= new TextureAtlas("Sh/mainChar.txt");
mainCharRegions= new Array<TextureAtlas.AtlasRegion>(mainCharAtlas.getRegions());
mainCharAnim= new Animation(1f/31f,mainCharRegions);
mainChar= Decal.newDecal(mainCharRegions.first(),true);
CameraGroupStrategy cameraGroupStrategy = new CameraGroupStrategy(camera);
decalBatch=new DecalBatch(cameraGroupStrategy);
mainChar.setPosition(0.14f, 0f - 1.83f, 0.64f);
mainChar.setWidth(7f);
mainChar.setHeight(7f);
mainChar.setRotation(0, 90, 20.5F);
这是从txt文件样本:有质感打包机创建
mainCharacter.png
size: 4849, 4069
format: RGBA8888
filter: Linear,Linear
repeat: none
01
rotate: false
xy: 571, 1
size: 568, 568
orig: 906, 906
offset: 168, 167
index: -1
02
rotate: true
xy: 1141, 1
size: 568, 572
orig: 906, 906
offset: 166, 161
index: -1
03
rotate: true
xy: 2922, 1
size: 577, 606
orig: 906, 906
offset: 161, 144
index: -1
mainCharacter.png包含透明区域,这样是好的。
你是绝对正确的。为了在移动平台上安全,我下载到了1024x1024,因为这是libgdx文档推荐的数字。 – brumbrum