Loading Mesh

Hello, i’m newb in Collada. I’m loading a simple Mesh “cube.dae”. So i wrote code:


	DAE dae;
	daeElement* root = dae.open("cube.dae");

	daeElementRef geometry = root->getChild("library_geometries")->getChild("geometry");
	domGeometryRef geomElement = (domGeometry*)(domElement*)geometry;
	domMeshRef meshEl = geomElement->getMesh();		// not NULL
	domPolylist_Array polyList = meshEl->getPolylist_array();	// NULL
	domTriangles_Array triList = meshEl->getTriangles_array();	// NULL
	domVerticesRef vert = meshEl->getVertices();		// not NULL, but containt only correct id

All fields of meshEl are NULL except vertices. Why? How correct get mesh points (box-lib-positions-array) and polylist

here part of dae file :


<library_geometries>
        <geometry id="box-lib" name="box">
            <mesh>
                <source id="box-lib-positions" name="position">
                    <float_array id="box-lib-positions-array" count="24">-50 50 50 50 50 50 -50 -50 50 50 -50 50 -50 50 -50 50 50 -50 -50 -50 -50 50 -50 -50 </float_array>
                    <technique_common>
                        <accessor count="8" source="#box-lib-positions-array" stride="3">
                            <param name="X" type="float"/>
                            <param name="Y" type="float"/>
                            <param name="Z" type="float"/>
                        </accessor>
                    </technique_common>
                </source>
                <source id="box-lib-normals" name="normal">

...

<vertices id="box-lib-vertices">
                    <input semantic="POSITION" source="#box-lib-positions"/>
                </vertices>
                <polylist count="6" material="BlueSG">
                    <input offset="0" semantic="VERTEX" source="#box-lib-vertices"/>
                    <input offset="1" semantic="NORMAL" source="#box-lib-normals"/>
                    <vcount>4 4 4 4 4 4 </vcount>
                    

0 0 2 1 3 2 1 3 0 4 1 5 5 6 4 7 6 8 7 9 3 10 2 11 0 12 4 13 6 14 2 15 3 16 7 17 5 18 1 19 5 20 7 21 6 22 4 23 </p>
                </polylist>
            </mesh>
        </geometry>
    </library_geometries>

Thanks.

Solution which i found:

Replace


domGeometryRef geomElement	= (domGeometry*)(domElement*)geometry;
domMeshRef meshEl			= geomElement->getMesh();

->


daeElementRef geometry = root->getDescendant("Mesh");
domMeshRef meshEl	= (domMesh*)(domElement*)root;

Previous post is wrong, and i still can’t understand why mesh from geometry dosn’t containt valid ptrs to polygon array / other arrays