Results 1 to 2 of 2

Thread: get geometry data c++ collada dom

  1. #1

    get geometry data c++ collada dom

    Hy.
    I'm still animating a skinned mesh from collada in directx with collada dom, the problem is that i have:
    Code :
      <library_visual_scenes>
        <visual_scene id="test_bones_03_max" name="test_bones_03_max">
          <node id="Bone01-node" name="Bone01" sid="Bone01-node" type="JOINT">
            <matrix>0.000000 -1 0 13.1309 0 0 -1 0 1 0.000000 0 -0.969015 0 0 0 1</matrix>
            <node id="Bone02-node" name="Bone02" sid="Bone02-node" type="JOINT">
              <matrix>0.999969 0.007935 0 23.3795 -0.007935 0.999969 0 -0.000004 0 0 1 0.000001 0 0 0 1</matrix>
              <node id="Bone03-node" name="Bone03" sid="Bone03-node" type="JOINT">
    		  </node>
    		<node id="Bone04-node" name="Bone04" sid="Bone04-node" type="JOINT">
                	<matrix sid="transform">1 0 0 9.74263 0 1 0 0.000001 0 0 1 0.000000 0 0 0 1</matrix>
                 	<matrix sid="transform">0.999972 0.007447 0 18.8841 -0.007447 0.999972 0 0.000001 0 0 1 0.000000 0 0 0 1</matrix>
                 </node>
     
            </node>
          </node>
          <node id="Box02-node" name="Box02" type="NODE">
            <instance_controller url="#Box02-mesh-skin">
              <skeleton>#Bone01-node</skeleton>
              <bind_material>
                <technique_common>
                  <instance_material symbol="ColorMaterial_86060600" target="#ColorMaterial_86060600"/>
                </technique_common>
              </bind_material>
            </instance_controller>
          </node>
          <extra>
            <technique profile="MAX3D">
              <frame_rate>30</frame_rate>
            </technique>
            <technique profile="FCOLLADA">
              <start_time>0</start_time>
              <end_time>3.33333</end_time>
            </technique>
          </extra>
        </visual_scene>
      </library_visual_scenes>
      <scene>
        <instance_visual_scene url="#test_bones_03_max"/>
      </scene>
    </COLLADA>

    i'm imported the bones , but the problem is the geometry, in this code:
    Code :
          <node id="Box02-node" name="Box02" type="NODE">
            <instance_controller url="#Box02-mesh-skin">
              <skeleton>#Bone01-node</skeleton>
              <bind_material>
                <technique_common>
                  <instance_material symbol="ColorMaterial_86060600" target="#ColorMaterial_86060600"/>
                </technique_common>
              </bind_material>
            </instance_controller>
          </node>

    How i get a geometry instance and a material instance from this node?
    the id of geometry section that i would import is Box02-mesh and have all that i need!
    And for the material ?
    Thanks.

  2. #2
    Junior Member
    Join Date
    Dec 2008
    Posts
    9

    Re: get geometry data c++ collada dom

    Search for "#Box02-mesh-skin" in library_controllers
    Code :
     	// Process Instance Controllers 
    	for (CrtUInt i = 0; i < node->getInstance_controller_array().getCount(); i++)
    	{
    		domInstance_controller *icontroller  = node->getInstance_controller_array()[i];
    		CrtInstanceController * instanceController = ReadInstanceController(icontroller);
    			.
    			.
     	}

    Search for skin element in instance_controller
    Code :
     CrtController *CrtScene::ReadController( domControllerRef lib )
      {
      	domSkin *skinElement	= lib->getSkin();
    	if (skinElement) // no skin in this controller DO LATER, we will support non-skin controller later
    		new_crtcontroller = ReadSkin(skinElement);

    Search for skin source, retrieve geometry with skin source
    Code :
    	domElement * source_element = skinElement->getSource().getElement();
     
       	// Make a CrtSkin to hold this info
    	CrtSkin *newSkin = CrtNew( CrtSkin );
    	CrtAssert("No memory\n", newSkin!=NULL);
     
    	// set the geometry
    	base_geometry = ReadGeometry((domGeometry *) source_element);

    See CrtSkin *CrtScene::ReadSkin( domSkinRef skinElement ) in CrtSceneRead.cpp in COLLADA-DOM 2.2 for more details:


    To retrieve instalce_material, see CrtInstanceController *CrtScene::ReadInstanceController( domInstance_controllerRef lib) in CrtSceneRead.cpp in COLLADA-DOM 2.2:

    Code :
    	CrtInstanceController *newiController = CrtNew(CrtInstanceController);
    	newiController->AbstractController = ctrl;
     
     	domBind_materialRef bind_material = lib->getBind_material();
    	if(bind_material)
    	{
    		// Get the <technique_common>
    		domBind_material::domTechnique_common *techniqueCommon = bind_material->getTechnique_common();
    		if(techniqueCommon)
    		{
    			// Get the <instance_material>s
    			domInstance_material_Array &instance_material_array = techniqueCommon->getInstance_material_array();
    			for(CrtUInt j = 0; j < instance_material_array.getCount(); j++)
    			{
    				CrtInstanceMaterial * newiMaterial = ReadInstanceMaterial(instance_material_array[j]);
    				.
    				.
    	}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •