Skip to content

Commit

Permalink
Added Create method to ModelMeshDescEXT
Browse files Browse the repository at this point in the history
  • Loading branch information
rds1983 committed Sep 17, 2024
1 parent fdfdc0a commit b27334d
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/Graphics/ModelBuilderEXT.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Security.Cryptography;

namespace Microsoft.Xna.Framework.Graphics
{
Expand Down Expand Up @@ -82,6 +83,22 @@ public void AddModelMeshPart(IndexBuffer indexBuffer, int startIndex,

Parts.Add(part);
}

/// <summary>
/// Creates the model mesh
/// </summary>
/// <param name="device">Graphics Device</param>
/// <returns></returns>
public ModelMesh Create(GraphicsDevice device)
{
var modelMesh = new ModelMesh(device, Parts)
{
Name = Name,
BoundingSphere = BoundingSphere,
};

return modelMesh;
}
}

/// <summary>
Expand Down Expand Up @@ -158,12 +175,7 @@ public static Model Create(GraphicsDevice device, List<ModelMeshDescEXT> meshes,
var modelMeshes = new List<ModelMesh>();
foreach (var desc in meshes)
{
var modelMesh = new ModelMesh(device, desc.Parts)
{
Name = desc.Name,
BoundingSphere = desc.BoundingSphere,
};

var modelMesh = desc.Create(device);
modelMeshes.Add(modelMesh);
}

Expand Down

0 comments on commit b27334d

Please sign in to comment.