public static Geometry Polylist(string geoID, string geoName, string matName, GeometryDataType[] dataTypes, float[][] data, ulong[] channels, Semantic[] semantics, ulong[] dataSources, ulong[] sets, int[] vCount, int[] primitives) { int maxLength = Math.Min((int)data.Length, (int)dataTypes.Length); Mesh mesh = new Mesh(); mesh.source = new Source[0]; Polylist polylist = new Polylist((ulong)vCount.Length, matName, vCount, primitives); polylist.input = new InputOffset[0]; // ! ! ! ! // separate adding data and adding semantic inputs into two loops/steps // -> add a GeometryDataType enumeration to identify each data array as a specific data (Vertex, Normal, Texcoord, Colors) // -> and the Semantic which generates the "input" types for the composed vertex data which is generated by the primitive list for (int i = 0; i < maxLength; i++) { DAEGeometry.AppendDataSource(mesh, geoName, dataTypes[i], data[i], channels[i]); } for (int i = 0; i < maxLength; i++) { DAEGeometry.AppendPolylistSemantic(polylist, geoName, semantics[i], dataSources[i], sets[i]); } mesh.primitives = new object[] { polylist }; Geometry geo = new Geometry(geoID, geoName, mesh); return(geo); }
public static Geometry Geometry(string id, string name, DAEGeometryDataSource[] dataSources) { int maxLength = dataSources.Length; Mesh mesh = new Mesh(); mesh.source = new Source[0]; for (int i = 0; i < maxLength; i++) { DAEGeometry.AppendDataSource(mesh, name, dataSources[i].Info.Type, dataSources[i].Data, dataSources[i].Info.Index); } Geometry geo = new Geometry(id, name, mesh); return(geo); }
public static Geometry Mesh(string id, string name, DAEGeometryDataSourceInfo[] dataSourceInfos, float[][] data) { int maxLength = Math.Min((int)data.Length, (int)dataSourceInfos.Length); Mesh mesh = new Mesh(); mesh.source = new Source[0]; mesh.primitives = new object[0]; for (int i = 0; i < maxLength; i++) { DAEGeometry.AppendDataSource(mesh, name, dataSourceInfos[i].Type, data[i], dataSourceInfos[i].Index); } Geometry geo = new Geometry(id, name, mesh); return(geo); }
public static Geometry Polylist(string geoID, string geoName, string matName, DAEGeometryDataSourceInfo[] dataSourceInfos, float[][] data, DAEGeometryInputSemanticInfo[] semanticsInfos, int[] vCount, int[] primitives) { int maxLength = Math.Min((int)data.Length, (int)dataSourceInfos.Length); Mesh mesh = new Mesh(); mesh.source = new Source[0]; Polylist polylist = new Polylist((ulong)vCount.Length, matName, vCount, primitives); polylist.input = new InputOffset[0]; for (int i = 0; i < maxLength; i++) { DAEGeometry.AppendDataSource(mesh, geoName, dataSourceInfos[i].Type, data[i], dataSourceInfos[i].Index); } for (int i = 0; i < semanticsInfos.Length; i++) { DAEGeometry.AppendPolylistSemantic(polylist, geoName, semanticsInfos[i].Semantic, semanticsInfos[i].DataSourceIndex, semanticsInfos[i].SetIndex); } mesh.primitives = new object[] { polylist }; Geometry geo = new Geometry(geoID, geoName, mesh); return(geo); }