我正在研究一个.为我的游戏引擎导入 DAE。我一直在使用 MilkShape 导出的模型,它们工作正常:
- 我的引擎:http://snag.gy/yj7tl.jpg
- 素描:http://snag.gy/6120D.jpg
现在我已经从互联网上下载了一个更大的多边形网格(带有骨架),我正在尝试导入那个。我只想要网格,暂时不需要骨架/动画。
问题是,我的引擎中的输出不正确。
- 我的引擎:http://snag.gy/RkfR3.jpg
- 草图:http://snag.gy/4Plxq.jpg
不确定我做错了什么。这些结果是否为某人敲响了警钟?
这是 .顺便说一下,DAE 文件;
- 4款 (奶形出口): http://pastebin.com/wRgqTLZN
- 朱丽叶(未知导出(7MB!)):http://files.dukesoft.nl/juliet.dae
干杯抢
啊,我想通了!
一个模型(牛奶形状的模型)
像这样使用部分;
00 0 1 1 1 2 3 2
哪里:
0=<position index> 0=<normal_index> 0=<vertex index>
1=<position index> 1=<normal_index> 1=<vertex index>
2=<position index> 3=<normal_index> 2=<vertex index>
但另一个模型没有使用这种偏移量,而是在位置、法线和顶点上使用共享索引。
0 1 2 3
哪里:
0 = <position index & normal_index & vertex index>
1 = <position index & normal_index & vertex index>
2 = <position index & normal_index & vertex index>'
3 = <position index & normal_index & vertex index>
你可以看到4个模型有:
<triangles material="Block" count="12">
<input semantic="VERTEX" source="#Box01-geometry-vertices" offset="0" />
<input semantic="NORMAL" source="#Box01-normals" offset="1" />
<input semantic="TEXCOORD" source="#Box01-texcoords" offset="2" />
<p>0 0 0 1 0 1 2 0 2 1 0 1 3 0 (...)</p> (vertexes X 3 numbers)
</triangles>
另一个有:
<triangles material="Block" count="12">
<input semantic="VERTEX" source="#Box01-geometry-vertices" />
<input semantic="NORMAL" source="#Box01-normals" />
<input semantic="TEXCOORD" source="#Box01-texcoords" />
<p>0 1 2 3 4 5 6 7 7 8 9 10 11 (...)</p> (vertexes X 1 numbers)
</triangles>
因此,我所要做的就是删除硬编码的偏移量并使用XML中的offets。