Ejemplo n.º 1
0
 public static void CreatePrimitiveMesh(Content.Geometry geometry, ContentToolsAPIStructs.PrimitiveInitInfo info)
 {
     Debug.Assert(geometry != null);
     using var sceneData = new ContentToolsAPIStructs.SceneData();
     try
     {
         sceneData.ImportSettings.FromContentSettings(geometry);
         CreatePrimitiveMesh(sceneData, info);
         Debug.Assert(sceneData.Data != IntPtr.Zero && sceneData.DataSize > 0);
         var data = new byte[sceneData.DataSize];
         Marshal.Copy(sceneData.Data, data, 0, sceneData.DataSize);
         geometry.FromRawData(data);
     }
     catch (Exception ex)
     {
         Utils.Logger.Log(Utils.MessageTypes.Error, $"Failed to create {info.Type} primitive mesh");
         Debug.WriteLine(ex.Message);
     }
 }
Ejemplo n.º 2
0
 private static extern void CreatePrimitiveMesh([In, Out] ContentToolsAPIStructs.SceneData data, ContentToolsAPIStructs.PrimitiveInitInfo info);