update Kav

pull/1/head
cosmonaut 2020-08-06 00:10:54 -07:00
parent e620cc479a
commit 1bcccead06
3 changed files with 2 additions and 60 deletions

2
Kav

@ -1 +1 @@
Subproject commit 4c4150620456c6625cf660d7a81571e4b1f7f9d5 Subproject commit da52273dd0e9d67e7838d0d0e76e7154a675d95f

View File

@ -31,7 +31,7 @@ namespace KavTest
protected override void LoadContent() protected override void LoadContent()
{ {
var rustyBallModel = ModelLoader.Load( var rustyBallModel = Kav.ModelLoader.Load(
GraphicsDevice, GraphicsDevice,
Smuggler.Importer.ImportGLB(GraphicsDevice, File.OpenRead("Content/rustysphere.glb")) Smuggler.Importer.ImportGLB(GraphicsDevice, File.OpenRead("Content/rustysphere.glb"))
); );

View File

@ -1,58 +0,0 @@
using System.Collections.Generic;
using Microsoft.Xna.Framework.Graphics;
namespace KavTest
{
public static class ModelLoader
{
public static Kav.Model Load(GraphicsDevice graphicsDevice, Smuggler.ModelData modelData)
{
var meshes = new List<Kav.Mesh>();
foreach (var meshData in modelData.Meshes)
{
var meshParts = new List<Kav.MeshPart>();
foreach (var meshPartData in meshData.MeshParts)
{
var effect = new Kav.PBREffect(
graphicsDevice
)
{
Albedo = meshPartData.Albedo,
Metallic = meshPartData.Metallic,
Roughness = meshPartData.Roughness,
AlbedoTexture = meshPartData.AlbedoTexture,
NormalTexture = meshPartData.NormalTexture,
MetallicRoughnessTexture = meshPartData.MetallicRoughnessTexture
};
var triangles = new Kav.Triangle[meshPartData.Triangles.Length];
for (int i = 0; i < meshPartData.Triangles.Length; i++)
{
var smugglerTriangle = meshPartData.Triangles[i];
triangles[i] = new Kav.Triangle(
smugglerTriangle.A,
smugglerTriangle.B,
smugglerTriangle.C
);
}
meshParts.Add(new Kav.MeshPart(
meshPartData.VertexBuffer,
meshPartData.IndexBuffer,
meshPartData.Positions,
triangles,
effect
));
}
meshes.Add(new Kav.Mesh(meshParts.ToArray()));
}
return new Kav.Model(meshes.ToArray());
}
}
}