我来自 2D 动画背景,所以当我使用动画序列时,我更喜欢使用图像序列。对我来说,这很有意义,因为您可以轻松地从合成/编辑软件中导出图像序列并轻松定义方面。
我是游戏开发的新手,对 Sprite 表的使用感到好奇。有什么优点和缺点。文件大小是问题吗? - 对我来说,一堆小图像似乎与一个大图像相同。此外,定义 Sprite 的每个单独区域似乎很麻烦。
基本上,我不明白你为什么要使用 Sprite 表 - 请赐教。
谢谢
最佳答案
Sprite 表的性能更好,因为您将所有数据都包含在单个纹理中。假设您有 1000 个 Sprite 从 Sprite 表播放相同的动画。绘图的过程会像这样。
Set the sprite sheet texture.
Adjust UV's to show single frame of animation.
Draw sprite 0
Adjust UV's
Draw sprite 1
.
.
.
Adjust UV's
Draw sprite 998
Adjust UV's
Draw sprite 999
使用纹理序列可能导致最坏的情况:
Set the animation texture.
Draw sprite 0
Set the new animation texture.
Draw sprite 1
.
.
.
Set the new animation texture.
Draw sprite 998
Set the new animation texture.
Draw sprite 999
嘎!在绘制每个 Sprite 之前,您必须将渲染状态设置为使用不同的纹理,这比调整几个 UV 慢得多。
关于image - 与图像序列相比, Sprite 表的优缺点是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3473151/