Kav/Geometry/Model.cs

99 lines
2.3 KiB
C#
Raw Normal View History

2020-08-04 09:32:02 +00:00
using Microsoft.Xna.Framework;
namespace Kav
{
2020-12-11 00:02:13 +00:00
public class Model
2020-08-04 09:32:02 +00:00
{
public Mesh[] Meshes { get; }
2020-10-20 01:22:54 +00:00
public BoundingBox BoundingBox { get; }
2020-08-04 09:32:02 +00:00
2020-12-07 03:36:00 +00:00
public Color Albedo
{
set
{
foreach (var mesh in Meshes)
{
foreach (var meshPart in mesh.MeshParts)
{
meshPart.Albedo = value.ToVector3();
}
}
}
}
public float Metallic
{
set
{
foreach (var mesh in Meshes)
{
foreach (var meshPart in mesh.MeshParts)
{
meshPart.Metallic = value;
}
}
2020-12-07 03:36:00 +00:00
}
}
public float Roughness
{
set
{
foreach (var mesh in Meshes)
{
foreach (var meshPart in mesh.MeshParts)
{
meshPart.Roughness = value;
}
}
2020-12-07 03:36:00 +00:00
}
}
2020-08-05 19:15:22 +00:00
public Model(Mesh[] meshes)
2020-08-04 09:32:02 +00:00
{
Meshes = meshes;
2020-10-20 01:22:54 +00:00
BoundingBox boundingBox = new BoundingBox();
foreach (var mesh in Meshes)
{
boundingBox = BoundingBox.CreateMerged(boundingBox, mesh.BoundingBox);
}
BoundingBox = boundingBox;
2020-08-04 09:32:02 +00:00
}
public void DisableAlbedoMaps()
{
foreach (var mesh in Meshes)
{
foreach (var meshPart in mesh.MeshParts)
{
meshPart.DisableAlbedoMap = true;
}
}
}
public void DisableNormalMaps()
{
foreach (var mesh in Meshes)
{
foreach (var meshPart in mesh.MeshParts)
{
meshPart.DisableNormalMap = true;
}
}
}
2020-12-07 03:36:00 +00:00
public void DisableMetallicRoughnessMaps()
{
foreach (var mesh in Meshes)
{
foreach (var meshPart in mesh.MeshParts)
{
meshPart.DisableMetallicRoughnessMap = true;
}
}
}
2020-08-04 09:32:02 +00:00
}
}