Results 1 to 3 of 3

Thread: How to create a mesh with FCollada

  1. #1
    Junior Member
    Join Date
    Jul 2009
    Posts
    15

    How to create a mesh with FCollada

    Hello huys,

    I'm using FCollada from FeelingSoftware to manipulate colldata files.

    http://www.feelingsoftware.com/en_US/3D ... llada.html


    Does any one know how to use FCollada? I'm trying to create a mesh, this is my code (but it does not work, the format of output is incorrect)

    Code :
    	FCollada::Initialize();
     
    	FUObjectRef<FCDocument> merged_document2 = FCollada::NewTopDocument();	
    	FCDSceneNode* merged_top2 = merged_document2->AddVisualScene();
     
    	FCDGeometry* newgeometry = new FCDGeometry(merged_document2);
    	FCDGeometryMesh* m1 = newgeometry->CreateMesh();
     
    	// adding source
    	FloatList flist;
    	FillFList(flist);
    	FCDGeometrySource *s1 = m1->AddSource(FUDaeGeometryInput::POSITION);
    	s1->SetName(L"PositionSource");
    	s1->SetStride(3);
    	s1->SetSourceType(FUDaeGeometryInput::POSITION);
    	s1->SetData(flist, geometry->GetMesh()->GetPositionSource()->GetStride(), 0, 0);
     
    	m1->AddVertexSource(s1);
     
    	// invalid format from here
    	//adding triangles
    	FCDGeometryPolygons *p1 = m1->AddPolygons();				
    	p1->SetPrimitiveType(temp_geometry->GetMesh()->GetPolygons(0)->GetPrimitiveType());
    	FCDGeometryPolygonsInput *p1_input = p1->AddInput(s1, 0);
    	p1_input->AddIndices(indices_list);
    	p1->AddFace(indices_count);
    	merged_document2->GetGeometryLibrary()->AddEntity(newgeometry);
     
    	FCDEntity* merged_entity2 = (FCDEntity*)merged_document2->GetGeometryLibrary()->GetEntity(0);
    	FCDSceneNode* merged_second = merged_top2->AddChildNode();
    	merged_second->AddInstance(merged_entity2);
     
    	FCollada::SaveDocument(merged_document2, "./test.dae");
    	delete newgeometry;
     
    	FCollada::Release();

  2. #2
    Junior Member
    Join Date
    Jul 2009
    Posts
    15

    Re: How to create a mesh with FCollada

    This is one of my result:


    <?xml version="1.0" encoding="utf-8"?>
    <COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
    <asset>
    <created>2009-09-04T15:30:20Z</created>
    <modified>2009-09-04T15:30:20Z</modified>
    </asset>
    <library_geometries>
    <geometry id="Geometry">
    <mesh>
    <source id="GeometrySource" name="PositionSource">
    <float_array id="GeometrySource-array" count="62">-685.86 -688.151 -688.151 -685.86 -688.151 -686.658 -686.658 -688.151 -686.658 -688.252 -688.252 -686.658 -688.252 -686.36 -686.36 -688.252 -686.36 -686.161 -686.161 -686.36 -686.161 -682.676 -682.676 -686.161 -682.676 -679.589 -679.589 -682.676 -679.589 -678.195 -678.195 -679.589 -678.195 -676.601 -676.601 -678.195 -676.601 -674.012 -674.012 -676.601 -674.012 -672.022 -672.022 -674.012 -672.022 -685.378 -685.378 -672.022 -685.378 -685.122 -685.122 -685.378 -685.122 -685.86 -685.86 -685.122 -685.122 -685.378 -672.022 -685.122 -672.022 -671.82</float_array>
    <technique_common>
    <accessor source="#GeometrySource-array" count="20" stride="3">
    <param name="X" type="float"/>
    <param name="Y" type="float"/>
    <param name="Z" type="float"/>
    </accessor>
    </technique_common>
    </source>
    <vertices id="Geometry-vertices">
    <input semantic="POSITION" source="#GeometrySource"/>
    </vertices>
    <polylist count="1">
    <input semantic="VERTEX" source="#Geometry-vertices" offset="0"/>
    <vcount>84</vcount>


    0 1 2 0 2 3 4 5 6 4 6 7 8 9 10 8 10 11 12 13 14 12 14 15 16 17 18 16 18 19 20 21 22 20 22 23 24 25 26 24 26 27 28 29 30 28 30 31 32 33 34 32 34 35 36 37 38 36 38 39 40 41 42 40 42 43 44 45 46 44 46 47 48 49 50 48 50 51 52 53 54 52 54 55</p>
    </polylist>
    <polylist count="1">
    <input semantic="VERTEX" source="#Geometry-vertices" offset="0"/>
    <vcount>6</vcount>


    159836104 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 84 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 85 159830568 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 86 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 87 76502800 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 88 76502800 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 89</p>

    </polylist>
    </mesh>
    </geometry>
    </library_geometries>
    <library_visual_scenes>
    <visual_scene id="VisualSceneNode">
    <node id="VisualSceneNode1" type="NODE"/>
    </visual_scene>
    </library_visual_scenes>
    <scene>
    <instance_visual_scene url="#VisualSceneNode"/>
    </scene>
    </COLLADA>

  3. #3
    Junior Member
    Join Date
    Jul 2009
    Posts
    15

    Re: How to create a mesh with FCollada

    I found the problem, it's in input offset

Posting Permissions

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