2

TinyXML を使用して .dae ファイルから DirectX プロジェクトにメッシュを読み込もうとしていますが、.dae ファイルがメッシュ データを格納する方法を理解するのが困難です。

メッシュ データが保存されている場所を見つけたと思います。タグ内<library_geometries>には次のコードがあります。

<library_geometries>
    <geometry id="Tall_bodyShape" name="Tall_bodyShape">
        <mesh>
            <source id="Tall_bodyShape-positions" name="position">
                <float_array id="Tall_bodyShape-positions-array" count="2910"> *** lots of numbers *** </float_array>
                <technique_common>
                    <accessor source="#Tall_bodyShape-positions-array" count="970" stride="3">
                        <param name="X" type="float"/>
                        <param name="Y" type="float"/>
                        <param name="Z" type="float"/>
                    </accessor>
                </technique_common>
            </source>
            <source id="Tall_bodyShape-normals" name="normal">
                <float_array id="Tall_bodyShape-normals-array" count="3948"> *** lots of numbers *** </float_array>
                <technique_common>
                    <accessor source="#Tall_bodyShape-normals-array" count="1316" stride="3">
                        <param name="X" type="float"/>
                        <param name="Y" type="float"/>
                        <param name="Z" type="float"/>
                    </accessor>
                </technique_common>
            </source>
            <source id="Tall_bodyShape-UVChannel_1" name="UVChannel_1">
                <float_array id="Tall_bodyShape-UVChannel_1-array" count="2892"> *** lots of numbers *** </float_array>
                <technique_common>
                    <accessor source="#Tall_bodyShape-UVChannel_1-array" count="1446" stride="2">
                        <param name="S" type="float"/>
                        <param name="T" type="float"/>
                    </accessor>
                </technique_common>
            </source>
            <vertices id="Tall_bodyShape-vertices">
                <input semantic="POSITION" source="#Tall_bodyShape-positions"/>
            </vertices>
            <triangles material="Tall_bodySG" count="1883">
                <input semantic="VERTEX" source="#Tall_bodyShape-vertices" offset="0"/>
                <input semantic="NORMAL" source="#Tall_bodyShape-normals" offset="1"/>
                <input semantic="TEXCOORD" source="#Tall_bodyShape-UVChannel_1" offset="2" set="0"/>
                <p> *** lots of numbers *** </p>
            </triangles>
        </mesh>
        <extra>
            <technique profile="MAYA">
                <double_sided>1</double_sided>
            </technique>
        </extra>
    </geometry>
</library_geometries>

したがって、頂点は<source>という名前のタグ"position"内に保存され、法線は という名前の<source>タグ内に保存され、 UV 座標と法線がどの頂点に関連付けられているか"normal"のタグがリストされます。<triangles>

三角形は「ライン」または「ストリップ」のいずれかの方法でリストされていると思いますが、どちらを試してもどちらもギザギザの丸みを帯びた三角形の混乱を示しています。

Dae の別の部分にある、または私が間違っている可能性のある場所にある、私が見逃した他のメッシュ データがあるかどうか、誰かが知っていますか? 必要に応じて、メッシュ データを読み込む関数を投稿できます。

編集: 追記: .dae ファイルは PhyreEngine に正しくロードできるため、正しく有効であると確信しています (昨年大学のプロジェクトで使用した .dae を使用しています)。

4

2 に答える 2

2

assimp を使用してメッシュ データを読み込みました。説明とコードはこちら: http://www.youtube.com/watch?v=ClqnhYAYtcY http://www.mediafire.com/download/006lk0xomup7laq/assimpLinux.zip

于 2013-10-11T21:01:12.200 に答える