using Microsoft.Xna.Framework; namespace Kav { public class Model : ICullable { public Mesh[] Meshes { get; } public BoundingBox BoundingBox { get; } 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; } } } } public float Roughness { set { foreach (var mesh in Meshes) { foreach (var meshPart in mesh.MeshParts) { meshPart.Roughness = value; } } } } public Model(Mesh[] meshes) { Meshes = meshes; BoundingBox boundingBox = new BoundingBox(); foreach (var mesh in Meshes) { boundingBox = BoundingBox.CreateMerged(boundingBox, mesh.BoundingBox); } BoundingBox = boundingBox; } 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; } } } public void DisableMetallicRoughnessMaps() { foreach (var mesh in Meshes) { foreach (var meshPart in mesh.MeshParts) { meshPart.DisableMetallicRoughnessMap = true; } } } } }