private void buildModelInfo(int mdlIdx, uint verNum) { //clear the current model if it exists! if (modelData.NumMeshes > 0) { modelData = new ModelInfo(); } //use the marshaller to copy over the float vals int colorSize = 4 * sizeof(float); int vec3Size = 3 * sizeof(float); IntPtr tempBuf = Marshal.AllocHGlobal(Math.Max(colorSize, vec3Size)); NativeFunctions.GetModelCenter(mdlIdx, tempBuf); Vector3 bndCenter = Vector3.FromNativeArray(tempBuf); NativeFunctions.GetModelAABBBounds(mdlIdx, tempBuf); Vector3 aabbBnd = Vector3.FromNativeArray(tempBuf); modelData.FileVersion = verNum; modelData.BoundsCenter = bndCenter; modelData.AABBBounds = aabbBnd; modelData.BoundsRadius = NativeFunctions.GetModelRadius(mdlIdx); //now add meshes for (int i = 0; i < NativeFunctions.GetMeshCount(mdlIdx); ++i) { MeshInfo inf = new MeshInfo(); inf.NumVerts = (uint)NativeFunctions.GetMeshVertexCount(mdlIdx, i); inf.NumInds = (uint)NativeFunctions.GetMeshIndexCount(mdlIdx, i); inf.Diffuse = LColor.FromNativeArray(NativeFunctions.GetMeshMaterialDiffuseColor(mdlIdx, i)); inf.Specular = LColor.FromNativeArray(NativeFunctions.GetMeshMaterialSpecularColor(mdlIdx, i)); inf.Emissive = LColor.FromNativeArray(NativeFunctions.GetMeshMaterialEmissiveColor(mdlIdx, i)); inf.DiffuseTexGUID = NativeFunctions.GetMeshMaterialDiffuseMapGUID(mdlIdx, i); inf.SpecularTexGUID = NativeFunctions.GetMeshMaterialSpecularMapGUID(mdlIdx, i); inf.NormalTexGUID = NativeFunctions.GetMeshMaterialNormalMapGUID(mdlIdx, i); inf.GlowTexGUID = NativeFunctions.GetMeshMaterialEmissiveMapGUID(mdlIdx, i); modelData.AddMesh(inf); } NativeFunctions.ListModelData(mdlIdx); updateLog(); }