using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Collada141; using System.Runtime.InteropServices; using System.Diagnostics; using System.Globalization; using System.Xml; using ColladaHelper; using OpenTK; using Toolbox.Library.Rendering; namespace Toolbox.Library { public class DAE : DAEHelper { public List objects = new List(); public List materials = new List(); public STSkeleton skeleton; public List BoneNames = new List(); public bool UseTransformMatrix = true; Dictionary VertexSkinSources = new Dictionary(); Dictionary MatrixSkinSources = new Dictionary(); public bool LoadFile(string FileName) { COLLADA collada = COLLADA.Load(FileName); foreach (var item in collada.Items) { if (item is library_geometries) { LoadGeometry((library_geometries)item); } } return true; } private void SetControllers(COLLADA collada) { } private void LoadGeometry(library_geometries Geometries) { foreach (var geom in Geometries.geometry) { var mesh = geom.Item as mesh; if (mesh == null) continue; Console.WriteLine(geom.name); foreach (var source in mesh.source) { var float_array = source.Item as float_array; if (float_array == null) continue; Console.Write("Geometry {0} source {1} : ", geom.id, source.id); foreach (var mesh_source_value in float_array.Values) Console.Write("{0} ", mesh_source_value); Console.WriteLine(); } } } private List CreateGenericObjects(string Name, library_geometries Geometries) { List objects = new List(); foreach (var geom in Geometries.geometry) { var daeMesh = geom.Item as mesh; if (daeMesh == null) continue; STGenericObject mesh = new STGenericObject(); mesh.ObjectName = Name; foreach (var source in daeMesh.source) { var float_array = source.Item as float_array; if (float_array == null) continue; } objects.Add(mesh); } return objects; } } }