2020-08-04 09:32:02 +00:00
|
|
|
using Microsoft.Xna.Framework;
|
|
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
|
|
|
|
|
|
namespace Kav
|
|
|
|
{
|
2020-12-08 10:49:18 +00:00
|
|
|
public class MeshPart : IIndexDrawable, IGBufferDrawable, ICullable, IHasVertexPositions
|
2020-08-04 09:32:02 +00:00
|
|
|
{
|
|
|
|
public IndexBuffer IndexBuffer { get; }
|
|
|
|
public VertexBuffer VertexBuffer { get; }
|
|
|
|
public Triangle[] Triangles { get; }
|
|
|
|
public Vector3[] Positions { get; }
|
2020-10-20 01:22:54 +00:00
|
|
|
|
|
|
|
public BoundingBox BoundingBox { get; }
|
2020-12-07 09:30:09 +00:00
|
|
|
|
2020-10-02 05:26:40 +00:00
|
|
|
private Texture2D albedoTexture = null;
|
|
|
|
private Texture2D normalTexture = null;
|
|
|
|
private Texture2D metallicRoughnessTexture = null;
|
2020-08-04 09:32:02 +00:00
|
|
|
|
2020-12-07 09:30:09 +00:00
|
|
|
public Texture2D AlbedoTexture
|
|
|
|
{
|
2020-10-02 05:26:40 +00:00
|
|
|
get { return DisableAlbedoMap ? null : albedoTexture; }
|
|
|
|
set { albedoTexture = value; }
|
|
|
|
}
|
|
|
|
|
2020-12-07 09:30:09 +00:00
|
|
|
public Texture2D NormalTexture
|
|
|
|
{
|
|
|
|
get { return DisableNormalMap ? null : normalTexture; }
|
2020-10-02 05:26:40 +00:00
|
|
|
set { normalTexture = value; }
|
|
|
|
}
|
|
|
|
|
2020-12-07 09:30:09 +00:00
|
|
|
public Texture2D MetallicRoughnessTexture
|
|
|
|
{
|
2020-10-02 05:26:40 +00:00
|
|
|
get { return DisableMetallicRoughnessMap ? null : metallicRoughnessTexture; }
|
2020-12-07 09:30:09 +00:00
|
|
|
set { metallicRoughnessTexture = value; }
|
2020-10-02 05:26:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public Vector3 Albedo { get; set; } = Vector3.One;
|
|
|
|
public float Metallic { get; set; } = 0.5f;
|
|
|
|
public float Roughness { get; set; } = 0.5f;
|
|
|
|
|
2020-12-09 06:20:54 +00:00
|
|
|
public int NumTextureRows { get; set; } = 1;
|
|
|
|
public int NumTextureColumns { get; set; } = 1;
|
|
|
|
|
2020-10-02 05:26:40 +00:00
|
|
|
public bool DisableAlbedoMap { get; set; } = false;
|
|
|
|
public bool DisableNormalMap { get; set; } = false;
|
|
|
|
public bool DisableMetallicRoughnessMap { get; set; } = false;
|
|
|
|
|
|
|
|
public MeshPart(
|
|
|
|
VertexBuffer vertexBuffer,
|
|
|
|
IndexBuffer indexBuffer,
|
|
|
|
Vector3[] positions,
|
|
|
|
Triangle[] triangles
|
|
|
|
) {
|
2020-08-04 09:32:02 +00:00
|
|
|
VertexBuffer = vertexBuffer;
|
|
|
|
IndexBuffer = indexBuffer;
|
|
|
|
Positions = positions;
|
|
|
|
Triangles = triangles;
|
2020-10-20 01:22:54 +00:00
|
|
|
|
|
|
|
BoundingBox = BoundingBox.CreateFromPoints(Positions);
|
2020-08-04 09:32:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|