|
@@ -0,0 +1,1881 @@
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+// ------------------------------------------------------------------------------
|
|
|
|
|
+// <auto-generated>
|
|
|
|
|
+// This code was generated by a tool.
|
|
|
|
|
+// Runtime Version: 17.0.0.0
|
|
|
|
|
+//
|
|
|
|
|
+// Changes to this file may cause incorrect behavior and will be lost if
|
|
|
|
|
+// the code is regenerated.
|
|
|
|
|
+// </auto-generated>
|
|
|
|
|
+// ------------------------------------------------------------------------------
|
|
|
|
|
+using System;
|
|
|
|
|
+using System.Collections.Generic;
|
|
|
|
|
+using System.Diagnostics.CodeAnalysis;
|
|
|
|
|
+using System.Numerics;
|
|
|
|
|
+using System.Text;
|
|
|
|
|
+
|
|
|
|
|
+using SharpGLTF.Memory;
|
|
|
|
|
+
|
|
|
|
|
+using ENCODING = SharpGLTF.Schema2.EncodingType;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+namespace SharpGLTF.Geometry.VertexTypes
|
|
|
|
|
+{
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// Defines a Vertex attribute with a material Color.
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")]
|
|
|
|
|
+ [System.Diagnostics.DebuggerDisplay("{_GetDebuggerDisplay(),nq}")]
|
|
|
|
|
+ [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]
|
|
|
|
|
+ public partial struct VertexTexture1 : IVertexMaterial, IEquatable<VertexTexture1>
|
|
|
|
|
+ {
|
|
|
|
|
+ #region diagnostics
|
|
|
|
|
+
|
|
|
|
|
+ private readonly string _GetDebuggerDisplay() => VertexUtils._GetDebuggerDisplay(this);
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region constructors
|
|
|
|
|
+
|
|
|
|
|
+ public VertexTexture1(Vector2 texcoord)
|
|
|
|
|
+ {
|
|
|
|
|
+ TexCoord = texcoord;
|
|
|
|
|
+ }
|
|
|
|
|
+ public VertexTexture1(IVertexMaterial src)
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.NotNull(src, nameof(src));
|
|
|
|
|
+ this.TexCoord = 0 < src.MaxTextCoords ? src.GetTexCoord(0) : Vector2.Zero;
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region data
|
|
|
|
|
+
|
|
|
|
|
+ public Vector2 TexCoord;
|
|
|
|
|
+
|
|
|
|
|
+ IEnumerable<KeyValuePair<string, AttributeFormat>> IVertexReflection.GetEncodingAttributes()
|
|
|
|
|
+ {
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_0", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly int MaxColors => 0;
|
|
|
|
|
+
|
|
|
|
|
+ public readonly int MaxTextCoords => 1;
|
|
|
|
|
+
|
|
|
|
|
+ public readonly override int GetHashCode()
|
|
|
|
|
+ {
|
|
|
|
|
+ #if !NETSTANDARD2_0
|
|
|
|
|
+ return HashCode.Combine(TexCoord);
|
|
|
|
|
+ #else
|
|
|
|
|
+ return TexCoord.GetHashCode();
|
|
|
|
|
+ #endif
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public readonly override bool Equals(Object obj) { return obj is VertexTexture1 other ? Equals(other) : false; }
|
|
|
|
|
+
|
|
|
|
|
+ public readonly bool Equals(VertexTexture1 other) { return AreEqual(this, other); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool operator ==(in VertexTexture1 a, in VertexTexture1 b) { return AreEqual(a, b); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool operator !=(in VertexTexture1 a, in VertexTexture1 b) { return !AreEqual(a, b); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool AreEqual(in VertexTexture1 a, in VertexTexture1 b)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (a.TexCoord != b.TexCoord) return false;
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region API
|
|
|
|
|
+
|
|
|
|
|
+ public readonly VertexMaterialDelta Subtract(IVertexMaterial baseValue)
|
|
|
|
|
+ {
|
|
|
|
|
+ return new VertexMaterialDelta((VertexTexture1)baseValue, this);
|
|
|
|
|
+ }
|
|
|
|
|
+ public void Add(in VertexMaterialDelta delta)
|
|
|
|
|
+ {
|
|
|
|
|
+ this.TexCoord += delta.TexCoord0Delta;
|
|
|
|
|
+ }
|
|
|
|
|
+ void IVertexMaterial.SetColor(int index, Vector4 color)
|
|
|
|
|
+ {
|
|
|
|
|
+ }
|
|
|
|
|
+ void IVertexMaterial.SetTexCoord(int index, Vector2 coord)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (index == 0) this.TexCoord = coord;
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly Vector4 GetColor(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ switch (index)
|
|
|
|
|
+ {
|
|
|
|
|
+ default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly Vector2 GetTexCoord(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ switch (index)
|
|
|
|
|
+ {
|
|
|
|
|
+ case 0: return this.TexCoord;
|
|
|
|
|
+ default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// Defines a Vertex attribute with a material Color.
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")]
|
|
|
|
|
+ [System.Diagnostics.DebuggerDisplay("{_GetDebuggerDisplay(),nq}")]
|
|
|
|
|
+ [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]
|
|
|
|
|
+ public partial struct VertexTexture2 : IVertexMaterial, IEquatable<VertexTexture2>
|
|
|
|
|
+ {
|
|
|
|
|
+ #region diagnostics
|
|
|
|
|
+
|
|
|
|
|
+ private readonly string _GetDebuggerDisplay() => VertexUtils._GetDebuggerDisplay(this);
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region constructors
|
|
|
|
|
+
|
|
|
|
|
+ public VertexTexture2(Vector2 texcoord0, Vector2 texcoord1)
|
|
|
|
|
+ {
|
|
|
|
|
+ TexCoord0 = texcoord0;
|
|
|
|
|
+ TexCoord1 = texcoord1;
|
|
|
|
|
+ }
|
|
|
|
|
+ public VertexTexture2(IVertexMaterial src)
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.NotNull(src, nameof(src));
|
|
|
|
|
+ this.TexCoord0 = 0 < src.MaxTextCoords ? src.GetTexCoord(0) : Vector2.Zero;
|
|
|
|
|
+ this.TexCoord1 = 1 < src.MaxTextCoords ? src.GetTexCoord(1) : Vector2.Zero;
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region data
|
|
|
|
|
+
|
|
|
|
|
+ public Vector2 TexCoord0;
|
|
|
|
|
+ public Vector2 TexCoord1;
|
|
|
|
|
+
|
|
|
|
|
+ IEnumerable<KeyValuePair<string, AttributeFormat>> IVertexReflection.GetEncodingAttributes()
|
|
|
|
|
+ {
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_0", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_1", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly int MaxColors => 0;
|
|
|
|
|
+
|
|
|
|
|
+ public readonly int MaxTextCoords => 2;
|
|
|
|
|
+
|
|
|
|
|
+ public readonly override int GetHashCode()
|
|
|
|
|
+ {
|
|
|
|
|
+ #if !NETSTANDARD2_0
|
|
|
|
|
+ return HashCode.Combine(TexCoord0, TexCoord1);
|
|
|
|
|
+ #else
|
|
|
|
|
+ return TexCoord0.GetHashCode()+TexCoord1.GetHashCode();
|
|
|
|
|
+ #endif
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public readonly override bool Equals(Object obj) { return obj is VertexTexture2 other ? Equals(other) : false; }
|
|
|
|
|
+
|
|
|
|
|
+ public readonly bool Equals(VertexTexture2 other) { return AreEqual(this, other); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool operator ==(in VertexTexture2 a, in VertexTexture2 b) { return AreEqual(a, b); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool operator !=(in VertexTexture2 a, in VertexTexture2 b) { return !AreEqual(a, b); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool AreEqual(in VertexTexture2 a, in VertexTexture2 b)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (a.TexCoord0 != b.TexCoord0) return false;
|
|
|
|
|
+ if (a.TexCoord1 != b.TexCoord1) return false;
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region API
|
|
|
|
|
+
|
|
|
|
|
+ public readonly VertexMaterialDelta Subtract(IVertexMaterial baseValue)
|
|
|
|
|
+ {
|
|
|
|
|
+ return new VertexMaterialDelta((VertexTexture2)baseValue, this);
|
|
|
|
|
+ }
|
|
|
|
|
+ public void Add(in VertexMaterialDelta delta)
|
|
|
|
|
+ {
|
|
|
|
|
+ this.TexCoord0 += delta.TexCoord0Delta;
|
|
|
|
|
+ this.TexCoord1 += delta.TexCoord1Delta;
|
|
|
|
|
+ }
|
|
|
|
|
+ void IVertexMaterial.SetColor(int index, Vector4 color)
|
|
|
|
|
+ {
|
|
|
|
|
+ }
|
|
|
|
|
+ void IVertexMaterial.SetTexCoord(int index, Vector2 coord)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (index == 0) this.TexCoord0 = coord;
|
|
|
|
|
+ if (index == 1) this.TexCoord1 = coord;
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly Vector4 GetColor(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ switch (index)
|
|
|
|
|
+ {
|
|
|
|
|
+ default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly Vector2 GetTexCoord(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ switch (index)
|
|
|
|
|
+ {
|
|
|
|
|
+ case 0: return this.TexCoord0;
|
|
|
|
|
+ case 1: return this.TexCoord1;
|
|
|
|
|
+ default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// Defines a Vertex attribute with a material Color.
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")]
|
|
|
|
|
+ [System.Diagnostics.DebuggerDisplay("{_GetDebuggerDisplay(),nq}")]
|
|
|
|
|
+ [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]
|
|
|
|
|
+ public partial struct VertexTexture3 : IVertexMaterial, IEquatable<VertexTexture3>
|
|
|
|
|
+ {
|
|
|
|
|
+ #region diagnostics
|
|
|
|
|
+
|
|
|
|
|
+ private readonly string _GetDebuggerDisplay() => VertexUtils._GetDebuggerDisplay(this);
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region constructors
|
|
|
|
|
+
|
|
|
|
|
+ public VertexTexture3(Vector2 texcoord0, Vector2 texcoord1, Vector2 texcoord2)
|
|
|
|
|
+ {
|
|
|
|
|
+ TexCoord0 = texcoord0;
|
|
|
|
|
+ TexCoord1 = texcoord1;
|
|
|
|
|
+ TexCoord2 = texcoord2;
|
|
|
|
|
+ }
|
|
|
|
|
+ public VertexTexture3(IVertexMaterial src)
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.NotNull(src, nameof(src));
|
|
|
|
|
+ this.TexCoord0 = 0 < src.MaxTextCoords ? src.GetTexCoord(0) : Vector2.Zero;
|
|
|
|
|
+ this.TexCoord1 = 1 < src.MaxTextCoords ? src.GetTexCoord(1) : Vector2.Zero;
|
|
|
|
|
+ this.TexCoord2 = 2 < src.MaxTextCoords ? src.GetTexCoord(2) : Vector2.Zero;
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region data
|
|
|
|
|
+
|
|
|
|
|
+ public Vector2 TexCoord0;
|
|
|
|
|
+ public Vector2 TexCoord1;
|
|
|
|
|
+ public Vector2 TexCoord2;
|
|
|
|
|
+
|
|
|
|
|
+ IEnumerable<KeyValuePair<string, AttributeFormat>> IVertexReflection.GetEncodingAttributes()
|
|
|
|
|
+ {
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_0", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_1", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_2", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly int MaxColors => 0;
|
|
|
|
|
+
|
|
|
|
|
+ public readonly int MaxTextCoords => 3;
|
|
|
|
|
+
|
|
|
|
|
+ public readonly override int GetHashCode()
|
|
|
|
|
+ {
|
|
|
|
|
+ #if !NETSTANDARD2_0
|
|
|
|
|
+ return HashCode.Combine(TexCoord0, TexCoord1, TexCoord2);
|
|
|
|
|
+ #else
|
|
|
|
|
+ return TexCoord0.GetHashCode()+TexCoord1.GetHashCode()+TexCoord2.GetHashCode();
|
|
|
|
|
+ #endif
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public readonly override bool Equals(Object obj) { return obj is VertexTexture3 other ? Equals(other) : false; }
|
|
|
|
|
+
|
|
|
|
|
+ public readonly bool Equals(VertexTexture3 other) { return AreEqual(this, other); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool operator ==(in VertexTexture3 a, in VertexTexture3 b) { return AreEqual(a, b); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool operator !=(in VertexTexture3 a, in VertexTexture3 b) { return !AreEqual(a, b); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool AreEqual(in VertexTexture3 a, in VertexTexture3 b)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (a.TexCoord0 != b.TexCoord0) return false;
|
|
|
|
|
+ if (a.TexCoord1 != b.TexCoord1) return false;
|
|
|
|
|
+ if (a.TexCoord2 != b.TexCoord2) return false;
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region API
|
|
|
|
|
+
|
|
|
|
|
+ public readonly VertexMaterialDelta Subtract(IVertexMaterial baseValue)
|
|
|
|
|
+ {
|
|
|
|
|
+ return new VertexMaterialDelta((VertexTexture3)baseValue, this);
|
|
|
|
|
+ }
|
|
|
|
|
+ public void Add(in VertexMaterialDelta delta)
|
|
|
|
|
+ {
|
|
|
|
|
+ this.TexCoord0 += delta.TexCoord0Delta;
|
|
|
|
|
+ this.TexCoord1 += delta.TexCoord1Delta;
|
|
|
|
|
+ this.TexCoord2 += delta.TexCoord2Delta;
|
|
|
|
|
+ }
|
|
|
|
|
+ void IVertexMaterial.SetColor(int index, Vector4 color)
|
|
|
|
|
+ {
|
|
|
|
|
+ }
|
|
|
|
|
+ void IVertexMaterial.SetTexCoord(int index, Vector2 coord)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (index == 0) this.TexCoord0 = coord;
|
|
|
|
|
+ if (index == 1) this.TexCoord1 = coord;
|
|
|
|
|
+ if (index == 2) this.TexCoord2 = coord;
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly Vector4 GetColor(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ switch (index)
|
|
|
|
|
+ {
|
|
|
|
|
+ default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly Vector2 GetTexCoord(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ switch (index)
|
|
|
|
|
+ {
|
|
|
|
|
+ case 0: return this.TexCoord0;
|
|
|
|
|
+ case 1: return this.TexCoord1;
|
|
|
|
|
+ case 2: return this.TexCoord2;
|
|
|
|
|
+ default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// Defines a Vertex attribute with a material Color.
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")]
|
|
|
|
|
+ [System.Diagnostics.DebuggerDisplay("{_GetDebuggerDisplay(),nq}")]
|
|
|
|
|
+ [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]
|
|
|
|
|
+ public partial struct VertexTexture4 : IVertexMaterial, IEquatable<VertexTexture4>
|
|
|
|
|
+ {
|
|
|
|
|
+ #region diagnostics
|
|
|
|
|
+
|
|
|
|
|
+ private readonly string _GetDebuggerDisplay() => VertexUtils._GetDebuggerDisplay(this);
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region constructors
|
|
|
|
|
+
|
|
|
|
|
+ public VertexTexture4(Vector2 texcoord0, Vector2 texcoord1, Vector2 texcoord2, Vector2 texcoord3)
|
|
|
|
|
+ {
|
|
|
|
|
+ TexCoord0 = texcoord0;
|
|
|
|
|
+ TexCoord1 = texcoord1;
|
|
|
|
|
+ TexCoord2 = texcoord2;
|
|
|
|
|
+ TexCoord3 = texcoord3;
|
|
|
|
|
+ }
|
|
|
|
|
+ public VertexTexture4(IVertexMaterial src)
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.NotNull(src, nameof(src));
|
|
|
|
|
+ this.TexCoord0 = 0 < src.MaxTextCoords ? src.GetTexCoord(0) : Vector2.Zero;
|
|
|
|
|
+ this.TexCoord1 = 1 < src.MaxTextCoords ? src.GetTexCoord(1) : Vector2.Zero;
|
|
|
|
|
+ this.TexCoord2 = 2 < src.MaxTextCoords ? src.GetTexCoord(2) : Vector2.Zero;
|
|
|
|
|
+ this.TexCoord3 = 3 < src.MaxTextCoords ? src.GetTexCoord(3) : Vector2.Zero;
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region data
|
|
|
|
|
+
|
|
|
|
|
+ public Vector2 TexCoord0;
|
|
|
|
|
+ public Vector2 TexCoord1;
|
|
|
|
|
+ public Vector2 TexCoord2;
|
|
|
|
|
+ public Vector2 TexCoord3;
|
|
|
|
|
+
|
|
|
|
|
+ IEnumerable<KeyValuePair<string, AttributeFormat>> IVertexReflection.GetEncodingAttributes()
|
|
|
|
|
+ {
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_0", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_1", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_2", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_3", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly int MaxColors => 0;
|
|
|
|
|
+
|
|
|
|
|
+ public readonly int MaxTextCoords => 4;
|
|
|
|
|
+
|
|
|
|
|
+ public readonly override int GetHashCode()
|
|
|
|
|
+ {
|
|
|
|
|
+ #if !NETSTANDARD2_0
|
|
|
|
|
+ return HashCode.Combine(TexCoord0, TexCoord1, TexCoord2, TexCoord3);
|
|
|
|
|
+ #else
|
|
|
|
|
+ return TexCoord0.GetHashCode()+TexCoord1.GetHashCode()+TexCoord2.GetHashCode()+TexCoord3.GetHashCode();
|
|
|
|
|
+ #endif
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public readonly override bool Equals(Object obj) { return obj is VertexTexture4 other ? Equals(other) : false; }
|
|
|
|
|
+
|
|
|
|
|
+ public readonly bool Equals(VertexTexture4 other) { return AreEqual(this, other); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool operator ==(in VertexTexture4 a, in VertexTexture4 b) { return AreEqual(a, b); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool operator !=(in VertexTexture4 a, in VertexTexture4 b) { return !AreEqual(a, b); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool AreEqual(in VertexTexture4 a, in VertexTexture4 b)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (a.TexCoord0 != b.TexCoord0) return false;
|
|
|
|
|
+ if (a.TexCoord1 != b.TexCoord1) return false;
|
|
|
|
|
+ if (a.TexCoord2 != b.TexCoord2) return false;
|
|
|
|
|
+ if (a.TexCoord3 != b.TexCoord3) return false;
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region API
|
|
|
|
|
+
|
|
|
|
|
+ public readonly VertexMaterialDelta Subtract(IVertexMaterial baseValue)
|
|
|
|
|
+ {
|
|
|
|
|
+ return new VertexMaterialDelta((VertexTexture4)baseValue, this);
|
|
|
|
|
+ }
|
|
|
|
|
+ public void Add(in VertexMaterialDelta delta)
|
|
|
|
|
+ {
|
|
|
|
|
+ this.TexCoord0 += delta.TexCoord0Delta;
|
|
|
|
|
+ this.TexCoord1 += delta.TexCoord1Delta;
|
|
|
|
|
+ this.TexCoord2 += delta.TexCoord2Delta;
|
|
|
|
|
+ this.TexCoord3 += delta.TexCoord3Delta;
|
|
|
|
|
+ }
|
|
|
|
|
+ void IVertexMaterial.SetColor(int index, Vector4 color)
|
|
|
|
|
+ {
|
|
|
|
|
+ }
|
|
|
|
|
+ void IVertexMaterial.SetTexCoord(int index, Vector2 coord)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (index == 0) this.TexCoord0 = coord;
|
|
|
|
|
+ if (index == 1) this.TexCoord1 = coord;
|
|
|
|
|
+ if (index == 2) this.TexCoord2 = coord;
|
|
|
|
|
+ if (index == 3) this.TexCoord3 = coord;
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly Vector4 GetColor(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ switch (index)
|
|
|
|
|
+ {
|
|
|
|
|
+ default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly Vector2 GetTexCoord(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ switch (index)
|
|
|
|
|
+ {
|
|
|
|
|
+ case 0: return this.TexCoord0;
|
|
|
|
|
+ case 1: return this.TexCoord1;
|
|
|
|
|
+ case 2: return this.TexCoord2;
|
|
|
|
|
+ case 3: return this.TexCoord3;
|
|
|
|
|
+ default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// Defines a Vertex attribute with a material Color.
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")]
|
|
|
|
|
+ [System.Diagnostics.DebuggerDisplay("{_GetDebuggerDisplay(),nq}")]
|
|
|
|
|
+ [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]
|
|
|
|
|
+ public partial struct VertexColor1 : IVertexMaterial, IEquatable<VertexColor1>
|
|
|
|
|
+ {
|
|
|
|
|
+ #region diagnostics
|
|
|
|
|
+
|
|
|
|
|
+ private readonly string _GetDebuggerDisplay() => VertexUtils._GetDebuggerDisplay(this);
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region constructors
|
|
|
|
|
+
|
|
|
|
|
+ public VertexColor1(Vector4 color)
|
|
|
|
|
+ {
|
|
|
|
|
+ Color = color;
|
|
|
|
|
+ }
|
|
|
|
|
+ public VertexColor1(IVertexMaterial src)
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.NotNull(src, nameof(src));
|
|
|
|
|
+ this.Color = 0 < src.MaxColors ? src.GetColor(0) : Vector4.One;
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region data
|
|
|
|
|
+
|
|
|
|
|
+ public Vector4 Color;
|
|
|
|
|
+
|
|
|
|
|
+ IEnumerable<KeyValuePair<string, AttributeFormat>> IVertexReflection.GetEncodingAttributes()
|
|
|
|
|
+ {
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("COLOR_0", new AttributeFormat(Schema2.DimensionType.VEC4, ENCODING.UNSIGNED_BYTE, true));
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly int MaxColors => 1;
|
|
|
|
|
+
|
|
|
|
|
+ public readonly int MaxTextCoords => 0;
|
|
|
|
|
+
|
|
|
|
|
+ public readonly override int GetHashCode()
|
|
|
|
|
+ {
|
|
|
|
|
+ #if !NETSTANDARD2_0
|
|
|
|
|
+ return HashCode.Combine(Color);
|
|
|
|
|
+ #else
|
|
|
|
|
+ return Color.GetHashCode();
|
|
|
|
|
+ #endif
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public readonly override bool Equals(Object obj) { return obj is VertexColor1 other ? Equals(other) : false; }
|
|
|
|
|
+
|
|
|
|
|
+ public readonly bool Equals(VertexColor1 other) { return AreEqual(this, other); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool operator ==(in VertexColor1 a, in VertexColor1 b) { return AreEqual(a, b); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool operator !=(in VertexColor1 a, in VertexColor1 b) { return !AreEqual(a, b); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool AreEqual(in VertexColor1 a, in VertexColor1 b)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (a.Color != b.Color) return false;
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region API
|
|
|
|
|
+
|
|
|
|
|
+ public readonly VertexMaterialDelta Subtract(IVertexMaterial baseValue)
|
|
|
|
|
+ {
|
|
|
|
|
+ return new VertexMaterialDelta((VertexColor1)baseValue, this);
|
|
|
|
|
+ }
|
|
|
|
|
+ public void Add(in VertexMaterialDelta delta)
|
|
|
|
|
+ {
|
|
|
|
|
+ this.Color += delta.Color0Delta;
|
|
|
|
|
+ }
|
|
|
|
|
+ void IVertexMaterial.SetColor(int index, Vector4 color)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (index == 0) this.Color = color;
|
|
|
|
|
+ }
|
|
|
|
|
+ void IVertexMaterial.SetTexCoord(int index, Vector2 coord)
|
|
|
|
|
+ {
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly Vector4 GetColor(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ switch (index)
|
|
|
|
|
+ {
|
|
|
|
|
+ case 0: return this.Color;
|
|
|
|
|
+ default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly Vector2 GetTexCoord(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ switch (index)
|
|
|
|
|
+ {
|
|
|
|
|
+ default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// Defines a Vertex attribute with a material Color.
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")]
|
|
|
|
|
+ [System.Diagnostics.DebuggerDisplay("{_GetDebuggerDisplay(),nq}")]
|
|
|
|
|
+ [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]
|
|
|
|
|
+ public partial struct VertexColor1Texture1 : IVertexMaterial, IEquatable<VertexColor1Texture1>
|
|
|
|
|
+ {
|
|
|
|
|
+ #region diagnostics
|
|
|
|
|
+
|
|
|
|
|
+ private readonly string _GetDebuggerDisplay() => VertexUtils._GetDebuggerDisplay(this);
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region constructors
|
|
|
|
|
+
|
|
|
|
|
+ public VertexColor1Texture1(Vector4 color, Vector2 texcoord)
|
|
|
|
|
+ {
|
|
|
|
|
+ Color = color;
|
|
|
|
|
+ TexCoord = texcoord;
|
|
|
|
|
+ }
|
|
|
|
|
+ public VertexColor1Texture1(IVertexMaterial src)
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.NotNull(src, nameof(src));
|
|
|
|
|
+ this.Color = 0 < src.MaxColors ? src.GetColor(0) : Vector4.One;
|
|
|
|
|
+ this.TexCoord = 0 < src.MaxTextCoords ? src.GetTexCoord(0) : Vector2.Zero;
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region data
|
|
|
|
|
+
|
|
|
|
|
+ public Vector4 Color;
|
|
|
|
|
+ public Vector2 TexCoord;
|
|
|
|
|
+
|
|
|
|
|
+ IEnumerable<KeyValuePair<string, AttributeFormat>> IVertexReflection.GetEncodingAttributes()
|
|
|
|
|
+ {
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("COLOR_0", new AttributeFormat(Schema2.DimensionType.VEC4, ENCODING.UNSIGNED_BYTE, true));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_0", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly int MaxColors => 1;
|
|
|
|
|
+
|
|
|
|
|
+ public readonly int MaxTextCoords => 1;
|
|
|
|
|
+
|
|
|
|
|
+ public readonly override int GetHashCode()
|
|
|
|
|
+ {
|
|
|
|
|
+ #if !NETSTANDARD2_0
|
|
|
|
|
+ return HashCode.Combine(Color, TexCoord);
|
|
|
|
|
+ #else
|
|
|
|
|
+ return Color.GetHashCode()+TexCoord.GetHashCode();
|
|
|
|
|
+ #endif
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public readonly override bool Equals(Object obj) { return obj is VertexColor1Texture1 other ? Equals(other) : false; }
|
|
|
|
|
+
|
|
|
|
|
+ public readonly bool Equals(VertexColor1Texture1 other) { return AreEqual(this, other); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool operator ==(in VertexColor1Texture1 a, in VertexColor1Texture1 b) { return AreEqual(a, b); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool operator !=(in VertexColor1Texture1 a, in VertexColor1Texture1 b) { return !AreEqual(a, b); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool AreEqual(in VertexColor1Texture1 a, in VertexColor1Texture1 b)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (a.Color != b.Color) return false;
|
|
|
|
|
+ if (a.TexCoord != b.TexCoord) return false;
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region API
|
|
|
|
|
+
|
|
|
|
|
+ public readonly VertexMaterialDelta Subtract(IVertexMaterial baseValue)
|
|
|
|
|
+ {
|
|
|
|
|
+ return new VertexMaterialDelta((VertexColor1Texture1)baseValue, this);
|
|
|
|
|
+ }
|
|
|
|
|
+ public void Add(in VertexMaterialDelta delta)
|
|
|
|
|
+ {
|
|
|
|
|
+ this.Color += delta.Color0Delta;
|
|
|
|
|
+ this.TexCoord += delta.TexCoord0Delta;
|
|
|
|
|
+ }
|
|
|
|
|
+ void IVertexMaterial.SetColor(int index, Vector4 color)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (index == 0) this.Color = color;
|
|
|
|
|
+ }
|
|
|
|
|
+ void IVertexMaterial.SetTexCoord(int index, Vector2 coord)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (index == 0) this.TexCoord = coord;
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly Vector4 GetColor(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ switch (index)
|
|
|
|
|
+ {
|
|
|
|
|
+ case 0: return this.Color;
|
|
|
|
|
+ default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly Vector2 GetTexCoord(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ switch (index)
|
|
|
|
|
+ {
|
|
|
|
|
+ case 0: return this.TexCoord;
|
|
|
|
|
+ default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// Defines a Vertex attribute with a material Color.
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")]
|
|
|
|
|
+ [System.Diagnostics.DebuggerDisplay("{_GetDebuggerDisplay(),nq}")]
|
|
|
|
|
+ [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]
|
|
|
|
|
+ public partial struct VertexColor1Texture2 : IVertexMaterial, IEquatable<VertexColor1Texture2>
|
|
|
|
|
+ {
|
|
|
|
|
+ #region diagnostics
|
|
|
|
|
+
|
|
|
|
|
+ private readonly string _GetDebuggerDisplay() => VertexUtils._GetDebuggerDisplay(this);
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region constructors
|
|
|
|
|
+
|
|
|
|
|
+ public VertexColor1Texture2(Vector4 color, Vector2 texcoord0, Vector2 texcoord1)
|
|
|
|
|
+ {
|
|
|
|
|
+ Color = color;
|
|
|
|
|
+ TexCoord0 = texcoord0;
|
|
|
|
|
+ TexCoord1 = texcoord1;
|
|
|
|
|
+ }
|
|
|
|
|
+ public VertexColor1Texture2(IVertexMaterial src)
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.NotNull(src, nameof(src));
|
|
|
|
|
+ this.Color = 0 < src.MaxColors ? src.GetColor(0) : Vector4.One;
|
|
|
|
|
+ this.TexCoord0 = 0 < src.MaxTextCoords ? src.GetTexCoord(0) : Vector2.Zero;
|
|
|
|
|
+ this.TexCoord1 = 1 < src.MaxTextCoords ? src.GetTexCoord(1) : Vector2.Zero;
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region data
|
|
|
|
|
+
|
|
|
|
|
+ public Vector4 Color;
|
|
|
|
|
+ public Vector2 TexCoord0;
|
|
|
|
|
+ public Vector2 TexCoord1;
|
|
|
|
|
+
|
|
|
|
|
+ IEnumerable<KeyValuePair<string, AttributeFormat>> IVertexReflection.GetEncodingAttributes()
|
|
|
|
|
+ {
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("COLOR_0", new AttributeFormat(Schema2.DimensionType.VEC4, ENCODING.UNSIGNED_BYTE, true));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_0", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_1", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly int MaxColors => 1;
|
|
|
|
|
+
|
|
|
|
|
+ public readonly int MaxTextCoords => 2;
|
|
|
|
|
+
|
|
|
|
|
+ public readonly override int GetHashCode()
|
|
|
|
|
+ {
|
|
|
|
|
+ #if !NETSTANDARD2_0
|
|
|
|
|
+ return HashCode.Combine(Color, TexCoord0, TexCoord1);
|
|
|
|
|
+ #else
|
|
|
|
|
+ return Color.GetHashCode()+TexCoord0.GetHashCode()+TexCoord1.GetHashCode();
|
|
|
|
|
+ #endif
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public readonly override bool Equals(Object obj) { return obj is VertexColor1Texture2 other ? Equals(other) : false; }
|
|
|
|
|
+
|
|
|
|
|
+ public readonly bool Equals(VertexColor1Texture2 other) { return AreEqual(this, other); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool operator ==(in VertexColor1Texture2 a, in VertexColor1Texture2 b) { return AreEqual(a, b); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool operator !=(in VertexColor1Texture2 a, in VertexColor1Texture2 b) { return !AreEqual(a, b); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool AreEqual(in VertexColor1Texture2 a, in VertexColor1Texture2 b)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (a.Color != b.Color) return false;
|
|
|
|
|
+ if (a.TexCoord0 != b.TexCoord0) return false;
|
|
|
|
|
+ if (a.TexCoord1 != b.TexCoord1) return false;
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region API
|
|
|
|
|
+
|
|
|
|
|
+ public readonly VertexMaterialDelta Subtract(IVertexMaterial baseValue)
|
|
|
|
|
+ {
|
|
|
|
|
+ return new VertexMaterialDelta((VertexColor1Texture2)baseValue, this);
|
|
|
|
|
+ }
|
|
|
|
|
+ public void Add(in VertexMaterialDelta delta)
|
|
|
|
|
+ {
|
|
|
|
|
+ this.Color += delta.Color0Delta;
|
|
|
|
|
+ this.TexCoord0 += delta.TexCoord0Delta;
|
|
|
|
|
+ this.TexCoord1 += delta.TexCoord1Delta;
|
|
|
|
|
+ }
|
|
|
|
|
+ void IVertexMaterial.SetColor(int index, Vector4 color)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (index == 0) this.Color = color;
|
|
|
|
|
+ }
|
|
|
|
|
+ void IVertexMaterial.SetTexCoord(int index, Vector2 coord)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (index == 0) this.TexCoord0 = coord;
|
|
|
|
|
+ if (index == 1) this.TexCoord1 = coord;
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly Vector4 GetColor(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ switch (index)
|
|
|
|
|
+ {
|
|
|
|
|
+ case 0: return this.Color;
|
|
|
|
|
+ default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly Vector2 GetTexCoord(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ switch (index)
|
|
|
|
|
+ {
|
|
|
|
|
+ case 0: return this.TexCoord0;
|
|
|
|
|
+ case 1: return this.TexCoord1;
|
|
|
|
|
+ default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// Defines a Vertex attribute with a material Color.
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")]
|
|
|
|
|
+ [System.Diagnostics.DebuggerDisplay("{_GetDebuggerDisplay(),nq}")]
|
|
|
|
|
+ [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]
|
|
|
|
|
+ public partial struct VertexColor1Texture3 : IVertexMaterial, IEquatable<VertexColor1Texture3>
|
|
|
|
|
+ {
|
|
|
|
|
+ #region diagnostics
|
|
|
|
|
+
|
|
|
|
|
+ private readonly string _GetDebuggerDisplay() => VertexUtils._GetDebuggerDisplay(this);
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region constructors
|
|
|
|
|
+
|
|
|
|
|
+ public VertexColor1Texture3(Vector4 color, Vector2 texcoord0, Vector2 texcoord1, Vector2 texcoord2)
|
|
|
|
|
+ {
|
|
|
|
|
+ Color = color;
|
|
|
|
|
+ TexCoord0 = texcoord0;
|
|
|
|
|
+ TexCoord1 = texcoord1;
|
|
|
|
|
+ TexCoord2 = texcoord2;
|
|
|
|
|
+ }
|
|
|
|
|
+ public VertexColor1Texture3(IVertexMaterial src)
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.NotNull(src, nameof(src));
|
|
|
|
|
+ this.Color = 0 < src.MaxColors ? src.GetColor(0) : Vector4.One;
|
|
|
|
|
+ this.TexCoord0 = 0 < src.MaxTextCoords ? src.GetTexCoord(0) : Vector2.Zero;
|
|
|
|
|
+ this.TexCoord1 = 1 < src.MaxTextCoords ? src.GetTexCoord(1) : Vector2.Zero;
|
|
|
|
|
+ this.TexCoord2 = 2 < src.MaxTextCoords ? src.GetTexCoord(2) : Vector2.Zero;
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region data
|
|
|
|
|
+
|
|
|
|
|
+ public Vector4 Color;
|
|
|
|
|
+ public Vector2 TexCoord0;
|
|
|
|
|
+ public Vector2 TexCoord1;
|
|
|
|
|
+ public Vector2 TexCoord2;
|
|
|
|
|
+
|
|
|
|
|
+ IEnumerable<KeyValuePair<string, AttributeFormat>> IVertexReflection.GetEncodingAttributes()
|
|
|
|
|
+ {
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("COLOR_0", new AttributeFormat(Schema2.DimensionType.VEC4, ENCODING.UNSIGNED_BYTE, true));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_0", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_1", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_2", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly int MaxColors => 1;
|
|
|
|
|
+
|
|
|
|
|
+ public readonly int MaxTextCoords => 3;
|
|
|
|
|
+
|
|
|
|
|
+ public readonly override int GetHashCode()
|
|
|
|
|
+ {
|
|
|
|
|
+ #if !NETSTANDARD2_0
|
|
|
|
|
+ return HashCode.Combine(Color, TexCoord0, TexCoord1, TexCoord2);
|
|
|
|
|
+ #else
|
|
|
|
|
+ return Color.GetHashCode()+TexCoord0.GetHashCode()+TexCoord1.GetHashCode()+TexCoord2.GetHashCode();
|
|
|
|
|
+ #endif
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public readonly override bool Equals(Object obj) { return obj is VertexColor1Texture3 other ? Equals(other) : false; }
|
|
|
|
|
+
|
|
|
|
|
+ public readonly bool Equals(VertexColor1Texture3 other) { return AreEqual(this, other); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool operator ==(in VertexColor1Texture3 a, in VertexColor1Texture3 b) { return AreEqual(a, b); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool operator !=(in VertexColor1Texture3 a, in VertexColor1Texture3 b) { return !AreEqual(a, b); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool AreEqual(in VertexColor1Texture3 a, in VertexColor1Texture3 b)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (a.Color != b.Color) return false;
|
|
|
|
|
+ if (a.TexCoord0 != b.TexCoord0) return false;
|
|
|
|
|
+ if (a.TexCoord1 != b.TexCoord1) return false;
|
|
|
|
|
+ if (a.TexCoord2 != b.TexCoord2) return false;
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region API
|
|
|
|
|
+
|
|
|
|
|
+ public readonly VertexMaterialDelta Subtract(IVertexMaterial baseValue)
|
|
|
|
|
+ {
|
|
|
|
|
+ return new VertexMaterialDelta((VertexColor1Texture3)baseValue, this);
|
|
|
|
|
+ }
|
|
|
|
|
+ public void Add(in VertexMaterialDelta delta)
|
|
|
|
|
+ {
|
|
|
|
|
+ this.Color += delta.Color0Delta;
|
|
|
|
|
+ this.TexCoord0 += delta.TexCoord0Delta;
|
|
|
|
|
+ this.TexCoord1 += delta.TexCoord1Delta;
|
|
|
|
|
+ this.TexCoord2 += delta.TexCoord2Delta;
|
|
|
|
|
+ }
|
|
|
|
|
+ void IVertexMaterial.SetColor(int index, Vector4 color)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (index == 0) this.Color = color;
|
|
|
|
|
+ }
|
|
|
|
|
+ void IVertexMaterial.SetTexCoord(int index, Vector2 coord)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (index == 0) this.TexCoord0 = coord;
|
|
|
|
|
+ if (index == 1) this.TexCoord1 = coord;
|
|
|
|
|
+ if (index == 2) this.TexCoord2 = coord;
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly Vector4 GetColor(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ switch (index)
|
|
|
|
|
+ {
|
|
|
|
|
+ case 0: return this.Color;
|
|
|
|
|
+ default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly Vector2 GetTexCoord(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ switch (index)
|
|
|
|
|
+ {
|
|
|
|
|
+ case 0: return this.TexCoord0;
|
|
|
|
|
+ case 1: return this.TexCoord1;
|
|
|
|
|
+ case 2: return this.TexCoord2;
|
|
|
|
|
+ default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// Defines a Vertex attribute with a material Color.
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")]
|
|
|
|
|
+ [System.Diagnostics.DebuggerDisplay("{_GetDebuggerDisplay(),nq}")]
|
|
|
|
|
+ [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]
|
|
|
|
|
+ public partial struct VertexColor1Texture4 : IVertexMaterial, IEquatable<VertexColor1Texture4>
|
|
|
|
|
+ {
|
|
|
|
|
+ #region diagnostics
|
|
|
|
|
+
|
|
|
|
|
+ private readonly string _GetDebuggerDisplay() => VertexUtils._GetDebuggerDisplay(this);
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region constructors
|
|
|
|
|
+
|
|
|
|
|
+ public VertexColor1Texture4(Vector4 color, Vector2 texcoord0, Vector2 texcoord1, Vector2 texcoord2, Vector2 texcoord3)
|
|
|
|
|
+ {
|
|
|
|
|
+ Color = color;
|
|
|
|
|
+ TexCoord0 = texcoord0;
|
|
|
|
|
+ TexCoord1 = texcoord1;
|
|
|
|
|
+ TexCoord2 = texcoord2;
|
|
|
|
|
+ TexCoord3 = texcoord3;
|
|
|
|
|
+ }
|
|
|
|
|
+ public VertexColor1Texture4(IVertexMaterial src)
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.NotNull(src, nameof(src));
|
|
|
|
|
+ this.Color = 0 < src.MaxColors ? src.GetColor(0) : Vector4.One;
|
|
|
|
|
+ this.TexCoord0 = 0 < src.MaxTextCoords ? src.GetTexCoord(0) : Vector2.Zero;
|
|
|
|
|
+ this.TexCoord1 = 1 < src.MaxTextCoords ? src.GetTexCoord(1) : Vector2.Zero;
|
|
|
|
|
+ this.TexCoord2 = 2 < src.MaxTextCoords ? src.GetTexCoord(2) : Vector2.Zero;
|
|
|
|
|
+ this.TexCoord3 = 3 < src.MaxTextCoords ? src.GetTexCoord(3) : Vector2.Zero;
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region data
|
|
|
|
|
+
|
|
|
|
|
+ public Vector4 Color;
|
|
|
|
|
+ public Vector2 TexCoord0;
|
|
|
|
|
+ public Vector2 TexCoord1;
|
|
|
|
|
+ public Vector2 TexCoord2;
|
|
|
|
|
+ public Vector2 TexCoord3;
|
|
|
|
|
+
|
|
|
|
|
+ IEnumerable<KeyValuePair<string, AttributeFormat>> IVertexReflection.GetEncodingAttributes()
|
|
|
|
|
+ {
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("COLOR_0", new AttributeFormat(Schema2.DimensionType.VEC4, ENCODING.UNSIGNED_BYTE, true));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_0", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_1", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_2", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_3", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly int MaxColors => 1;
|
|
|
|
|
+
|
|
|
|
|
+ public readonly int MaxTextCoords => 4;
|
|
|
|
|
+
|
|
|
|
|
+ public readonly override int GetHashCode()
|
|
|
|
|
+ {
|
|
|
|
|
+ #if !NETSTANDARD2_0
|
|
|
|
|
+ return HashCode.Combine(Color, TexCoord0, TexCoord1, TexCoord2, TexCoord3);
|
|
|
|
|
+ #else
|
|
|
|
|
+ return Color.GetHashCode()+TexCoord0.GetHashCode()+TexCoord1.GetHashCode()+TexCoord2.GetHashCode()+TexCoord3.GetHashCode();
|
|
|
|
|
+ #endif
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public readonly override bool Equals(Object obj) { return obj is VertexColor1Texture4 other ? Equals(other) : false; }
|
|
|
|
|
+
|
|
|
|
|
+ public readonly bool Equals(VertexColor1Texture4 other) { return AreEqual(this, other); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool operator ==(in VertexColor1Texture4 a, in VertexColor1Texture4 b) { return AreEqual(a, b); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool operator !=(in VertexColor1Texture4 a, in VertexColor1Texture4 b) { return !AreEqual(a, b); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool AreEqual(in VertexColor1Texture4 a, in VertexColor1Texture4 b)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (a.Color != b.Color) return false;
|
|
|
|
|
+ if (a.TexCoord0 != b.TexCoord0) return false;
|
|
|
|
|
+ if (a.TexCoord1 != b.TexCoord1) return false;
|
|
|
|
|
+ if (a.TexCoord2 != b.TexCoord2) return false;
|
|
|
|
|
+ if (a.TexCoord3 != b.TexCoord3) return false;
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region API
|
|
|
|
|
+
|
|
|
|
|
+ public readonly VertexMaterialDelta Subtract(IVertexMaterial baseValue)
|
|
|
|
|
+ {
|
|
|
|
|
+ return new VertexMaterialDelta((VertexColor1Texture4)baseValue, this);
|
|
|
|
|
+ }
|
|
|
|
|
+ public void Add(in VertexMaterialDelta delta)
|
|
|
|
|
+ {
|
|
|
|
|
+ this.Color += delta.Color0Delta;
|
|
|
|
|
+ this.TexCoord0 += delta.TexCoord0Delta;
|
|
|
|
|
+ this.TexCoord1 += delta.TexCoord1Delta;
|
|
|
|
|
+ this.TexCoord2 += delta.TexCoord2Delta;
|
|
|
|
|
+ this.TexCoord3 += delta.TexCoord3Delta;
|
|
|
|
|
+ }
|
|
|
|
|
+ void IVertexMaterial.SetColor(int index, Vector4 color)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (index == 0) this.Color = color;
|
|
|
|
|
+ }
|
|
|
|
|
+ void IVertexMaterial.SetTexCoord(int index, Vector2 coord)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (index == 0) this.TexCoord0 = coord;
|
|
|
|
|
+ if (index == 1) this.TexCoord1 = coord;
|
|
|
|
|
+ if (index == 2) this.TexCoord2 = coord;
|
|
|
|
|
+ if (index == 3) this.TexCoord3 = coord;
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly Vector4 GetColor(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ switch (index)
|
|
|
|
|
+ {
|
|
|
|
|
+ case 0: return this.Color;
|
|
|
|
|
+ default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly Vector2 GetTexCoord(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ switch (index)
|
|
|
|
|
+ {
|
|
|
|
|
+ case 0: return this.TexCoord0;
|
|
|
|
|
+ case 1: return this.TexCoord1;
|
|
|
|
|
+ case 2: return this.TexCoord2;
|
|
|
|
|
+ case 3: return this.TexCoord3;
|
|
|
|
|
+ default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// Defines a Vertex attribute with a material Color.
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")]
|
|
|
|
|
+ [System.Diagnostics.DebuggerDisplay("{_GetDebuggerDisplay(),nq}")]
|
|
|
|
|
+ [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]
|
|
|
|
|
+ public partial struct VertexColor2 : IVertexMaterial, IEquatable<VertexColor2>
|
|
|
|
|
+ {
|
|
|
|
|
+ #region diagnostics
|
|
|
|
|
+
|
|
|
|
|
+ private readonly string _GetDebuggerDisplay() => VertexUtils._GetDebuggerDisplay(this);
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region constructors
|
|
|
|
|
+
|
|
|
|
|
+ public VertexColor2(Vector4 color0, Vector4 color1)
|
|
|
|
|
+ {
|
|
|
|
|
+ Color0 = color0;
|
|
|
|
|
+ Color1 = color1;
|
|
|
|
|
+ }
|
|
|
|
|
+ public VertexColor2(IVertexMaterial src)
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.NotNull(src, nameof(src));
|
|
|
|
|
+ this.Color0 = 0 < src.MaxColors ? src.GetColor(0) : Vector4.One;
|
|
|
|
|
+ this.Color1 = 1 < src.MaxColors ? src.GetColor(1) : Vector4.One;
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region data
|
|
|
|
|
+
|
|
|
|
|
+ public Vector4 Color0;
|
|
|
|
|
+ public Vector4 Color1;
|
|
|
|
|
+
|
|
|
|
|
+ IEnumerable<KeyValuePair<string, AttributeFormat>> IVertexReflection.GetEncodingAttributes()
|
|
|
|
|
+ {
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("COLOR_0", new AttributeFormat(Schema2.DimensionType.VEC4, ENCODING.UNSIGNED_BYTE, true));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("COLOR_1", new AttributeFormat(Schema2.DimensionType.VEC4, ENCODING.UNSIGNED_BYTE, true));
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly int MaxColors => 2;
|
|
|
|
|
+
|
|
|
|
|
+ public readonly int MaxTextCoords => 0;
|
|
|
|
|
+
|
|
|
|
|
+ public readonly override int GetHashCode()
|
|
|
|
|
+ {
|
|
|
|
|
+ #if !NETSTANDARD2_0
|
|
|
|
|
+ return HashCode.Combine(Color0, Color1);
|
|
|
|
|
+ #else
|
|
|
|
|
+ return Color0.GetHashCode()+Color1.GetHashCode();
|
|
|
|
|
+ #endif
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public readonly override bool Equals(Object obj) { return obj is VertexColor2 other ? Equals(other) : false; }
|
|
|
|
|
+
|
|
|
|
|
+ public readonly bool Equals(VertexColor2 other) { return AreEqual(this, other); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool operator ==(in VertexColor2 a, in VertexColor2 b) { return AreEqual(a, b); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool operator !=(in VertexColor2 a, in VertexColor2 b) { return !AreEqual(a, b); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool AreEqual(in VertexColor2 a, in VertexColor2 b)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (a.Color0 != b.Color0) return false;
|
|
|
|
|
+ if (a.Color1 != b.Color1) return false;
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region API
|
|
|
|
|
+
|
|
|
|
|
+ public readonly VertexMaterialDelta Subtract(IVertexMaterial baseValue)
|
|
|
|
|
+ {
|
|
|
|
|
+ return new VertexMaterialDelta((VertexColor2)baseValue, this);
|
|
|
|
|
+ }
|
|
|
|
|
+ public void Add(in VertexMaterialDelta delta)
|
|
|
|
|
+ {
|
|
|
|
|
+ this.Color0 += delta.Color0Delta;
|
|
|
|
|
+ this.Color1 += delta.Color1Delta;
|
|
|
|
|
+ }
|
|
|
|
|
+ void IVertexMaterial.SetColor(int index, Vector4 color)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (index == 0) this.Color0 = color;
|
|
|
|
|
+ if (index == 1) this.Color1 = color;
|
|
|
|
|
+ }
|
|
|
|
|
+ void IVertexMaterial.SetTexCoord(int index, Vector2 coord)
|
|
|
|
|
+ {
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly Vector4 GetColor(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ switch (index)
|
|
|
|
|
+ {
|
|
|
|
|
+ case 0: return this.Color0;
|
|
|
|
|
+ case 1: return this.Color1;
|
|
|
|
|
+ default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly Vector2 GetTexCoord(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ switch (index)
|
|
|
|
|
+ {
|
|
|
|
|
+ default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// Defines a Vertex attribute with a material Color.
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")]
|
|
|
|
|
+ [System.Diagnostics.DebuggerDisplay("{_GetDebuggerDisplay(),nq}")]
|
|
|
|
|
+ [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]
|
|
|
|
|
+ public partial struct VertexColor2Texture1 : IVertexMaterial, IEquatable<VertexColor2Texture1>
|
|
|
|
|
+ {
|
|
|
|
|
+ #region diagnostics
|
|
|
|
|
+
|
|
|
|
|
+ private readonly string _GetDebuggerDisplay() => VertexUtils._GetDebuggerDisplay(this);
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region constructors
|
|
|
|
|
+
|
|
|
|
|
+ public VertexColor2Texture1(Vector4 color0, Vector4 color1, Vector2 texcoord)
|
|
|
|
|
+ {
|
|
|
|
|
+ Color0 = color0;
|
|
|
|
|
+ Color1 = color1;
|
|
|
|
|
+ TexCoord = texcoord;
|
|
|
|
|
+ }
|
|
|
|
|
+ public VertexColor2Texture1(IVertexMaterial src)
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.NotNull(src, nameof(src));
|
|
|
|
|
+ this.Color0 = 0 < src.MaxColors ? src.GetColor(0) : Vector4.One;
|
|
|
|
|
+ this.Color1 = 1 < src.MaxColors ? src.GetColor(1) : Vector4.One;
|
|
|
|
|
+ this.TexCoord = 0 < src.MaxTextCoords ? src.GetTexCoord(0) : Vector2.Zero;
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region data
|
|
|
|
|
+
|
|
|
|
|
+ public Vector4 Color0;
|
|
|
|
|
+ public Vector4 Color1;
|
|
|
|
|
+ public Vector2 TexCoord;
|
|
|
|
|
+
|
|
|
|
|
+ IEnumerable<KeyValuePair<string, AttributeFormat>> IVertexReflection.GetEncodingAttributes()
|
|
|
|
|
+ {
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("COLOR_0", new AttributeFormat(Schema2.DimensionType.VEC4, ENCODING.UNSIGNED_BYTE, true));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("COLOR_1", new AttributeFormat(Schema2.DimensionType.VEC4, ENCODING.UNSIGNED_BYTE, true));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_0", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly int MaxColors => 2;
|
|
|
|
|
+
|
|
|
|
|
+ public readonly int MaxTextCoords => 1;
|
|
|
|
|
+
|
|
|
|
|
+ public readonly override int GetHashCode()
|
|
|
|
|
+ {
|
|
|
|
|
+ #if !NETSTANDARD2_0
|
|
|
|
|
+ return HashCode.Combine(Color0, Color1, TexCoord);
|
|
|
|
|
+ #else
|
|
|
|
|
+ return Color0.GetHashCode()+Color1.GetHashCode()+TexCoord.GetHashCode();
|
|
|
|
|
+ #endif
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public readonly override bool Equals(Object obj) { return obj is VertexColor2Texture1 other ? Equals(other) : false; }
|
|
|
|
|
+
|
|
|
|
|
+ public readonly bool Equals(VertexColor2Texture1 other) { return AreEqual(this, other); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool operator ==(in VertexColor2Texture1 a, in VertexColor2Texture1 b) { return AreEqual(a, b); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool operator !=(in VertexColor2Texture1 a, in VertexColor2Texture1 b) { return !AreEqual(a, b); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool AreEqual(in VertexColor2Texture1 a, in VertexColor2Texture1 b)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (a.Color0 != b.Color0) return false;
|
|
|
|
|
+ if (a.Color1 != b.Color1) return false;
|
|
|
|
|
+ if (a.TexCoord != b.TexCoord) return false;
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region API
|
|
|
|
|
+
|
|
|
|
|
+ public readonly VertexMaterialDelta Subtract(IVertexMaterial baseValue)
|
|
|
|
|
+ {
|
|
|
|
|
+ return new VertexMaterialDelta((VertexColor2Texture1)baseValue, this);
|
|
|
|
|
+ }
|
|
|
|
|
+ public void Add(in VertexMaterialDelta delta)
|
|
|
|
|
+ {
|
|
|
|
|
+ this.Color0 += delta.Color0Delta;
|
|
|
|
|
+ this.Color1 += delta.Color1Delta;
|
|
|
|
|
+ this.TexCoord += delta.TexCoord0Delta;
|
|
|
|
|
+ }
|
|
|
|
|
+ void IVertexMaterial.SetColor(int index, Vector4 color)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (index == 0) this.Color0 = color;
|
|
|
|
|
+ if (index == 1) this.Color1 = color;
|
|
|
|
|
+ }
|
|
|
|
|
+ void IVertexMaterial.SetTexCoord(int index, Vector2 coord)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (index == 0) this.TexCoord = coord;
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly Vector4 GetColor(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ switch (index)
|
|
|
|
|
+ {
|
|
|
|
|
+ case 0: return this.Color0;
|
|
|
|
|
+ case 1: return this.Color1;
|
|
|
|
|
+ default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly Vector2 GetTexCoord(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ switch (index)
|
|
|
|
|
+ {
|
|
|
|
|
+ case 0: return this.TexCoord;
|
|
|
|
|
+ default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// Defines a Vertex attribute with a material Color.
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")]
|
|
|
|
|
+ [System.Diagnostics.DebuggerDisplay("{_GetDebuggerDisplay(),nq}")]
|
|
|
|
|
+ [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]
|
|
|
|
|
+ public partial struct VertexColor2Texture2 : IVertexMaterial, IEquatable<VertexColor2Texture2>
|
|
|
|
|
+ {
|
|
|
|
|
+ #region diagnostics
|
|
|
|
|
+
|
|
|
|
|
+ private readonly string _GetDebuggerDisplay() => VertexUtils._GetDebuggerDisplay(this);
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region constructors
|
|
|
|
|
+
|
|
|
|
|
+ public VertexColor2Texture2(Vector4 color0, Vector4 color1, Vector2 texcoord0, Vector2 texcoord1)
|
|
|
|
|
+ {
|
|
|
|
|
+ Color0 = color0;
|
|
|
|
|
+ Color1 = color1;
|
|
|
|
|
+ TexCoord0 = texcoord0;
|
|
|
|
|
+ TexCoord1 = texcoord1;
|
|
|
|
|
+ }
|
|
|
|
|
+ public VertexColor2Texture2(IVertexMaterial src)
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.NotNull(src, nameof(src));
|
|
|
|
|
+ this.Color0 = 0 < src.MaxColors ? src.GetColor(0) : Vector4.One;
|
|
|
|
|
+ this.Color1 = 1 < src.MaxColors ? src.GetColor(1) : Vector4.One;
|
|
|
|
|
+ this.TexCoord0 = 0 < src.MaxTextCoords ? src.GetTexCoord(0) : Vector2.Zero;
|
|
|
|
|
+ this.TexCoord1 = 1 < src.MaxTextCoords ? src.GetTexCoord(1) : Vector2.Zero;
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region data
|
|
|
|
|
+
|
|
|
|
|
+ public Vector4 Color0;
|
|
|
|
|
+ public Vector4 Color1;
|
|
|
|
|
+ public Vector2 TexCoord0;
|
|
|
|
|
+ public Vector2 TexCoord1;
|
|
|
|
|
+
|
|
|
|
|
+ IEnumerable<KeyValuePair<string, AttributeFormat>> IVertexReflection.GetEncodingAttributes()
|
|
|
|
|
+ {
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("COLOR_0", new AttributeFormat(Schema2.DimensionType.VEC4, ENCODING.UNSIGNED_BYTE, true));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("COLOR_1", new AttributeFormat(Schema2.DimensionType.VEC4, ENCODING.UNSIGNED_BYTE, true));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_0", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_1", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly int MaxColors => 2;
|
|
|
|
|
+
|
|
|
|
|
+ public readonly int MaxTextCoords => 2;
|
|
|
|
|
+
|
|
|
|
|
+ public readonly override int GetHashCode()
|
|
|
|
|
+ {
|
|
|
|
|
+ #if !NETSTANDARD2_0
|
|
|
|
|
+ return HashCode.Combine(Color0, Color1, TexCoord0, TexCoord1);
|
|
|
|
|
+ #else
|
|
|
|
|
+ return Color0.GetHashCode()+Color1.GetHashCode()+TexCoord0.GetHashCode()+TexCoord1.GetHashCode();
|
|
|
|
|
+ #endif
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public readonly override bool Equals(Object obj) { return obj is VertexColor2Texture2 other ? Equals(other) : false; }
|
|
|
|
|
+
|
|
|
|
|
+ public readonly bool Equals(VertexColor2Texture2 other) { return AreEqual(this, other); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool operator ==(in VertexColor2Texture2 a, in VertexColor2Texture2 b) { return AreEqual(a, b); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool operator !=(in VertexColor2Texture2 a, in VertexColor2Texture2 b) { return !AreEqual(a, b); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool AreEqual(in VertexColor2Texture2 a, in VertexColor2Texture2 b)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (a.Color0 != b.Color0) return false;
|
|
|
|
|
+ if (a.Color1 != b.Color1) return false;
|
|
|
|
|
+ if (a.TexCoord0 != b.TexCoord0) return false;
|
|
|
|
|
+ if (a.TexCoord1 != b.TexCoord1) return false;
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region API
|
|
|
|
|
+
|
|
|
|
|
+ public readonly VertexMaterialDelta Subtract(IVertexMaterial baseValue)
|
|
|
|
|
+ {
|
|
|
|
|
+ return new VertexMaterialDelta((VertexColor2Texture2)baseValue, this);
|
|
|
|
|
+ }
|
|
|
|
|
+ public void Add(in VertexMaterialDelta delta)
|
|
|
|
|
+ {
|
|
|
|
|
+ this.Color0 += delta.Color0Delta;
|
|
|
|
|
+ this.Color1 += delta.Color1Delta;
|
|
|
|
|
+ this.TexCoord0 += delta.TexCoord0Delta;
|
|
|
|
|
+ this.TexCoord1 += delta.TexCoord1Delta;
|
|
|
|
|
+ }
|
|
|
|
|
+ void IVertexMaterial.SetColor(int index, Vector4 color)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (index == 0) this.Color0 = color;
|
|
|
|
|
+ if (index == 1) this.Color1 = color;
|
|
|
|
|
+ }
|
|
|
|
|
+ void IVertexMaterial.SetTexCoord(int index, Vector2 coord)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (index == 0) this.TexCoord0 = coord;
|
|
|
|
|
+ if (index == 1) this.TexCoord1 = coord;
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly Vector4 GetColor(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ switch (index)
|
|
|
|
|
+ {
|
|
|
|
|
+ case 0: return this.Color0;
|
|
|
|
|
+ case 1: return this.Color1;
|
|
|
|
|
+ default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly Vector2 GetTexCoord(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ switch (index)
|
|
|
|
|
+ {
|
|
|
|
|
+ case 0: return this.TexCoord0;
|
|
|
|
|
+ case 1: return this.TexCoord1;
|
|
|
|
|
+ default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// Defines a Vertex attribute with a material Color.
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")]
|
|
|
|
|
+ [System.Diagnostics.DebuggerDisplay("{_GetDebuggerDisplay(),nq}")]
|
|
|
|
|
+ [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]
|
|
|
|
|
+ public partial struct VertexColor2Texture3 : IVertexMaterial, IEquatable<VertexColor2Texture3>
|
|
|
|
|
+ {
|
|
|
|
|
+ #region diagnostics
|
|
|
|
|
+
|
|
|
|
|
+ private readonly string _GetDebuggerDisplay() => VertexUtils._GetDebuggerDisplay(this);
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region constructors
|
|
|
|
|
+
|
|
|
|
|
+ public VertexColor2Texture3(Vector4 color0, Vector4 color1, Vector2 texcoord0, Vector2 texcoord1, Vector2 texcoord2)
|
|
|
|
|
+ {
|
|
|
|
|
+ Color0 = color0;
|
|
|
|
|
+ Color1 = color1;
|
|
|
|
|
+ TexCoord0 = texcoord0;
|
|
|
|
|
+ TexCoord1 = texcoord1;
|
|
|
|
|
+ TexCoord2 = texcoord2;
|
|
|
|
|
+ }
|
|
|
|
|
+ public VertexColor2Texture3(IVertexMaterial src)
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.NotNull(src, nameof(src));
|
|
|
|
|
+ this.Color0 = 0 < src.MaxColors ? src.GetColor(0) : Vector4.One;
|
|
|
|
|
+ this.Color1 = 1 < src.MaxColors ? src.GetColor(1) : Vector4.One;
|
|
|
|
|
+ this.TexCoord0 = 0 < src.MaxTextCoords ? src.GetTexCoord(0) : Vector2.Zero;
|
|
|
|
|
+ this.TexCoord1 = 1 < src.MaxTextCoords ? src.GetTexCoord(1) : Vector2.Zero;
|
|
|
|
|
+ this.TexCoord2 = 2 < src.MaxTextCoords ? src.GetTexCoord(2) : Vector2.Zero;
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region data
|
|
|
|
|
+
|
|
|
|
|
+ public Vector4 Color0;
|
|
|
|
|
+ public Vector4 Color1;
|
|
|
|
|
+ public Vector2 TexCoord0;
|
|
|
|
|
+ public Vector2 TexCoord1;
|
|
|
|
|
+ public Vector2 TexCoord2;
|
|
|
|
|
+
|
|
|
|
|
+ IEnumerable<KeyValuePair<string, AttributeFormat>> IVertexReflection.GetEncodingAttributes()
|
|
|
|
|
+ {
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("COLOR_0", new AttributeFormat(Schema2.DimensionType.VEC4, ENCODING.UNSIGNED_BYTE, true));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("COLOR_1", new AttributeFormat(Schema2.DimensionType.VEC4, ENCODING.UNSIGNED_BYTE, true));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_0", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_1", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_2", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly int MaxColors => 2;
|
|
|
|
|
+
|
|
|
|
|
+ public readonly int MaxTextCoords => 3;
|
|
|
|
|
+
|
|
|
|
|
+ public readonly override int GetHashCode()
|
|
|
|
|
+ {
|
|
|
|
|
+ #if !NETSTANDARD2_0
|
|
|
|
|
+ return HashCode.Combine(Color0, Color1, TexCoord0, TexCoord1, TexCoord2);
|
|
|
|
|
+ #else
|
|
|
|
|
+ return Color0.GetHashCode()+Color1.GetHashCode()+TexCoord0.GetHashCode()+TexCoord1.GetHashCode()+TexCoord2.GetHashCode();
|
|
|
|
|
+ #endif
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public readonly override bool Equals(Object obj) { return obj is VertexColor2Texture3 other ? Equals(other) : false; }
|
|
|
|
|
+
|
|
|
|
|
+ public readonly bool Equals(VertexColor2Texture3 other) { return AreEqual(this, other); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool operator ==(in VertexColor2Texture3 a, in VertexColor2Texture3 b) { return AreEqual(a, b); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool operator !=(in VertexColor2Texture3 a, in VertexColor2Texture3 b) { return !AreEqual(a, b); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool AreEqual(in VertexColor2Texture3 a, in VertexColor2Texture3 b)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (a.Color0 != b.Color0) return false;
|
|
|
|
|
+ if (a.Color1 != b.Color1) return false;
|
|
|
|
|
+ if (a.TexCoord0 != b.TexCoord0) return false;
|
|
|
|
|
+ if (a.TexCoord1 != b.TexCoord1) return false;
|
|
|
|
|
+ if (a.TexCoord2 != b.TexCoord2) return false;
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region API
|
|
|
|
|
+
|
|
|
|
|
+ public readonly VertexMaterialDelta Subtract(IVertexMaterial baseValue)
|
|
|
|
|
+ {
|
|
|
|
|
+ return new VertexMaterialDelta((VertexColor2Texture3)baseValue, this);
|
|
|
|
|
+ }
|
|
|
|
|
+ public void Add(in VertexMaterialDelta delta)
|
|
|
|
|
+ {
|
|
|
|
|
+ this.Color0 += delta.Color0Delta;
|
|
|
|
|
+ this.Color1 += delta.Color1Delta;
|
|
|
|
|
+ this.TexCoord0 += delta.TexCoord0Delta;
|
|
|
|
|
+ this.TexCoord1 += delta.TexCoord1Delta;
|
|
|
|
|
+ this.TexCoord2 += delta.TexCoord2Delta;
|
|
|
|
|
+ }
|
|
|
|
|
+ void IVertexMaterial.SetColor(int index, Vector4 color)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (index == 0) this.Color0 = color;
|
|
|
|
|
+ if (index == 1) this.Color1 = color;
|
|
|
|
|
+ }
|
|
|
|
|
+ void IVertexMaterial.SetTexCoord(int index, Vector2 coord)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (index == 0) this.TexCoord0 = coord;
|
|
|
|
|
+ if (index == 1) this.TexCoord1 = coord;
|
|
|
|
|
+ if (index == 2) this.TexCoord2 = coord;
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly Vector4 GetColor(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ switch (index)
|
|
|
|
|
+ {
|
|
|
|
|
+ case 0: return this.Color0;
|
|
|
|
|
+ case 1: return this.Color1;
|
|
|
|
|
+ default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly Vector2 GetTexCoord(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ switch (index)
|
|
|
|
|
+ {
|
|
|
|
|
+ case 0: return this.TexCoord0;
|
|
|
|
|
+ case 1: return this.TexCoord1;
|
|
|
|
|
+ case 2: return this.TexCoord2;
|
|
|
|
|
+ default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// Defines a Vertex attribute with a material Color.
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")]
|
|
|
|
|
+ [System.Diagnostics.DebuggerDisplay("{_GetDebuggerDisplay(),nq}")]
|
|
|
|
|
+ [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]
|
|
|
|
|
+ public partial struct VertexColor2Texture4 : IVertexMaterial, IEquatable<VertexColor2Texture4>
|
|
|
|
|
+ {
|
|
|
|
|
+ #region diagnostics
|
|
|
|
|
+
|
|
|
|
|
+ private readonly string _GetDebuggerDisplay() => VertexUtils._GetDebuggerDisplay(this);
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region constructors
|
|
|
|
|
+
|
|
|
|
|
+ public VertexColor2Texture4(Vector4 color0, Vector4 color1, Vector2 texcoord0, Vector2 texcoord1, Vector2 texcoord2, Vector2 texcoord3)
|
|
|
|
|
+ {
|
|
|
|
|
+ Color0 = color0;
|
|
|
|
|
+ Color1 = color1;
|
|
|
|
|
+ TexCoord0 = texcoord0;
|
|
|
|
|
+ TexCoord1 = texcoord1;
|
|
|
|
|
+ TexCoord2 = texcoord2;
|
|
|
|
|
+ TexCoord3 = texcoord3;
|
|
|
|
|
+ }
|
|
|
|
|
+ public VertexColor2Texture4(IVertexMaterial src)
|
|
|
|
|
+ {
|
|
|
|
|
+ Guard.NotNull(src, nameof(src));
|
|
|
|
|
+ this.Color0 = 0 < src.MaxColors ? src.GetColor(0) : Vector4.One;
|
|
|
|
|
+ this.Color1 = 1 < src.MaxColors ? src.GetColor(1) : Vector4.One;
|
|
|
|
|
+ this.TexCoord0 = 0 < src.MaxTextCoords ? src.GetTexCoord(0) : Vector2.Zero;
|
|
|
|
|
+ this.TexCoord1 = 1 < src.MaxTextCoords ? src.GetTexCoord(1) : Vector2.Zero;
|
|
|
|
|
+ this.TexCoord2 = 2 < src.MaxTextCoords ? src.GetTexCoord(2) : Vector2.Zero;
|
|
|
|
|
+ this.TexCoord3 = 3 < src.MaxTextCoords ? src.GetTexCoord(3) : Vector2.Zero;
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region data
|
|
|
|
|
+
|
|
|
|
|
+ public Vector4 Color0;
|
|
|
|
|
+ public Vector4 Color1;
|
|
|
|
|
+ public Vector2 TexCoord0;
|
|
|
|
|
+ public Vector2 TexCoord1;
|
|
|
|
|
+ public Vector2 TexCoord2;
|
|
|
|
|
+ public Vector2 TexCoord3;
|
|
|
|
|
+
|
|
|
|
|
+ IEnumerable<KeyValuePair<string, AttributeFormat>> IVertexReflection.GetEncodingAttributes()
|
|
|
|
|
+ {
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("COLOR_0", new AttributeFormat(Schema2.DimensionType.VEC4, ENCODING.UNSIGNED_BYTE, true));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("COLOR_1", new AttributeFormat(Schema2.DimensionType.VEC4, ENCODING.UNSIGNED_BYTE, true));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_0", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_1", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_2", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ yield return new KeyValuePair<string, AttributeFormat>("TEXCOORD_3", new AttributeFormat(Schema2.DimensionType.VEC2));
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly int MaxColors => 2;
|
|
|
|
|
+
|
|
|
|
|
+ public readonly int MaxTextCoords => 4;
|
|
|
|
|
+
|
|
|
|
|
+ public readonly override int GetHashCode()
|
|
|
|
|
+ {
|
|
|
|
|
+ #if !NETSTANDARD2_0
|
|
|
|
|
+ return HashCode.Combine(Color0, Color1, TexCoord0, TexCoord1, TexCoord2, TexCoord3);
|
|
|
|
|
+ #else
|
|
|
|
|
+ return Color0.GetHashCode()+Color1.GetHashCode()+TexCoord0.GetHashCode()+TexCoord1.GetHashCode()+TexCoord2.GetHashCode()+TexCoord3.GetHashCode();
|
|
|
|
|
+ #endif
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public readonly override bool Equals(Object obj) { return obj is VertexColor2Texture4 other ? Equals(other) : false; }
|
|
|
|
|
+
|
|
|
|
|
+ public readonly bool Equals(VertexColor2Texture4 other) { return AreEqual(this, other); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool operator ==(in VertexColor2Texture4 a, in VertexColor2Texture4 b) { return AreEqual(a, b); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool operator !=(in VertexColor2Texture4 a, in VertexColor2Texture4 b) { return !AreEqual(a, b); }
|
|
|
|
|
+
|
|
|
|
|
+ public static bool AreEqual(in VertexColor2Texture4 a, in VertexColor2Texture4 b)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (a.Color0 != b.Color0) return false;
|
|
|
|
|
+ if (a.Color1 != b.Color1) return false;
|
|
|
|
|
+ if (a.TexCoord0 != b.TexCoord0) return false;
|
|
|
|
|
+ if (a.TexCoord1 != b.TexCoord1) return false;
|
|
|
|
|
+ if (a.TexCoord2 != b.TexCoord2) return false;
|
|
|
|
|
+ if (a.TexCoord3 != b.TexCoord3) return false;
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ #region API
|
|
|
|
|
+
|
|
|
|
|
+ public readonly VertexMaterialDelta Subtract(IVertexMaterial baseValue)
|
|
|
|
|
+ {
|
|
|
|
|
+ return new VertexMaterialDelta((VertexColor2Texture4)baseValue, this);
|
|
|
|
|
+ }
|
|
|
|
|
+ public void Add(in VertexMaterialDelta delta)
|
|
|
|
|
+ {
|
|
|
|
|
+ this.Color0 += delta.Color0Delta;
|
|
|
|
|
+ this.Color1 += delta.Color1Delta;
|
|
|
|
|
+ this.TexCoord0 += delta.TexCoord0Delta;
|
|
|
|
|
+ this.TexCoord1 += delta.TexCoord1Delta;
|
|
|
|
|
+ this.TexCoord2 += delta.TexCoord2Delta;
|
|
|
|
|
+ this.TexCoord3 += delta.TexCoord3Delta;
|
|
|
|
|
+ }
|
|
|
|
|
+ void IVertexMaterial.SetColor(int index, Vector4 color)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (index == 0) this.Color0 = color;
|
|
|
|
|
+ if (index == 1) this.Color1 = color;
|
|
|
|
|
+ }
|
|
|
|
|
+ void IVertexMaterial.SetTexCoord(int index, Vector2 coord)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (index == 0) this.TexCoord0 = coord;
|
|
|
|
|
+ if (index == 1) this.TexCoord1 = coord;
|
|
|
|
|
+ if (index == 2) this.TexCoord2 = coord;
|
|
|
|
|
+ if (index == 3) this.TexCoord3 = coord;
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly Vector4 GetColor(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ switch (index)
|
|
|
|
|
+ {
|
|
|
|
|
+ case 0: return this.Color0;
|
|
|
|
|
+ case 1: return this.Color1;
|
|
|
|
|
+ default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ public readonly Vector2 GetTexCoord(int index)
|
|
|
|
|
+ {
|
|
|
|
|
+ switch (index)
|
|
|
|
|
+ {
|
|
|
|
|
+ case 0: return this.TexCoord0;
|
|
|
|
|
+ case 1: return this.TexCoord1;
|
|
|
|
|
+ case 2: return this.TexCoord2;
|
|
|
|
|
+ case 3: return this.TexCoord3;
|
|
|
|
|
+ default: throw new ArgumentOutOfRangeException(nameof(index));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ #endregion
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ partial struct VertexMaterialDelta
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+internal VertexMaterialDelta(in VertexTexture1 rootVal, in VertexTexture1 morphVal)
|
|
|
|
|
+ {
|
|
|
|
|
+ MaxColors = 0;
|
|
|
|
|
+ MaxTextCoords = 1;
|
|
|
|
|
+ Color0Delta = Vector4.Zero;
|
|
|
|
|
+ Color1Delta = Vector4.Zero;
|
|
|
|
|
+ TexCoord0Delta = morphVal.TexCoord - rootVal.TexCoord;
|
|
|
|
|
+ TexCoord1Delta = Vector2.Zero;
|
|
|
|
|
+ TexCoord2Delta = Vector2.Zero;
|
|
|
|
|
+ TexCoord3Delta = Vector2.Zero;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+internal VertexMaterialDelta(in VertexTexture2 rootVal, in VertexTexture2 morphVal)
|
|
|
|
|
+ {
|
|
|
|
|
+ MaxColors = 0;
|
|
|
|
|
+ MaxTextCoords = 2;
|
|
|
|
|
+ Color0Delta = Vector4.Zero;
|
|
|
|
|
+ Color1Delta = Vector4.Zero;
|
|
|
|
|
+ TexCoord0Delta = morphVal.TexCoord0 - rootVal.TexCoord0;
|
|
|
|
|
+ TexCoord1Delta = morphVal.TexCoord1 - rootVal.TexCoord1;
|
|
|
|
|
+ TexCoord2Delta = Vector2.Zero;
|
|
|
|
|
+ TexCoord3Delta = Vector2.Zero;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+internal VertexMaterialDelta(in VertexTexture3 rootVal, in VertexTexture3 morphVal)
|
|
|
|
|
+ {
|
|
|
|
|
+ MaxColors = 0;
|
|
|
|
|
+ MaxTextCoords = 3;
|
|
|
|
|
+ Color0Delta = Vector4.Zero;
|
|
|
|
|
+ Color1Delta = Vector4.Zero;
|
|
|
|
|
+ TexCoord0Delta = morphVal.TexCoord0 - rootVal.TexCoord0;
|
|
|
|
|
+ TexCoord1Delta = morphVal.TexCoord1 - rootVal.TexCoord1;
|
|
|
|
|
+ TexCoord2Delta = morphVal.TexCoord2 - rootVal.TexCoord2;
|
|
|
|
|
+ TexCoord3Delta = Vector2.Zero;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+internal VertexMaterialDelta(in VertexTexture4 rootVal, in VertexTexture4 morphVal)
|
|
|
|
|
+ {
|
|
|
|
|
+ MaxColors = 0;
|
|
|
|
|
+ MaxTextCoords = 4;
|
|
|
|
|
+ Color0Delta = Vector4.Zero;
|
|
|
|
|
+ Color1Delta = Vector4.Zero;
|
|
|
|
|
+ TexCoord0Delta = morphVal.TexCoord0 - rootVal.TexCoord0;
|
|
|
|
|
+ TexCoord1Delta = morphVal.TexCoord1 - rootVal.TexCoord1;
|
|
|
|
|
+ TexCoord2Delta = morphVal.TexCoord2 - rootVal.TexCoord2;
|
|
|
|
|
+ TexCoord3Delta = morphVal.TexCoord3 - rootVal.TexCoord3;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+internal VertexMaterialDelta(in VertexColor1 rootVal, in VertexColor1 morphVal)
|
|
|
|
|
+ {
|
|
|
|
|
+ MaxColors = 1;
|
|
|
|
|
+ MaxTextCoords = 0;
|
|
|
|
|
+ Color0Delta = morphVal.Color - rootVal.Color;
|
|
|
|
|
+ Color1Delta = Vector4.Zero;
|
|
|
|
|
+ TexCoord0Delta = Vector2.Zero;
|
|
|
|
|
+ TexCoord1Delta = Vector2.Zero;
|
|
|
|
|
+ TexCoord2Delta = Vector2.Zero;
|
|
|
|
|
+ TexCoord3Delta = Vector2.Zero;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+internal VertexMaterialDelta(in VertexColor1Texture1 rootVal, in VertexColor1Texture1 morphVal)
|
|
|
|
|
+ {
|
|
|
|
|
+ MaxColors = 1;
|
|
|
|
|
+ MaxTextCoords = 1;
|
|
|
|
|
+ Color0Delta = morphVal.Color - rootVal.Color;
|
|
|
|
|
+ Color1Delta = Vector4.Zero;
|
|
|
|
|
+ TexCoord0Delta = morphVal.TexCoord - rootVal.TexCoord;
|
|
|
|
|
+ TexCoord1Delta = Vector2.Zero;
|
|
|
|
|
+ TexCoord2Delta = Vector2.Zero;
|
|
|
|
|
+ TexCoord3Delta = Vector2.Zero;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+internal VertexMaterialDelta(in VertexColor1Texture2 rootVal, in VertexColor1Texture2 morphVal)
|
|
|
|
|
+ {
|
|
|
|
|
+ MaxColors = 1;
|
|
|
|
|
+ MaxTextCoords = 2;
|
|
|
|
|
+ Color0Delta = morphVal.Color - rootVal.Color;
|
|
|
|
|
+ Color1Delta = Vector4.Zero;
|
|
|
|
|
+ TexCoord0Delta = morphVal.TexCoord0 - rootVal.TexCoord0;
|
|
|
|
|
+ TexCoord1Delta = morphVal.TexCoord1 - rootVal.TexCoord1;
|
|
|
|
|
+ TexCoord2Delta = Vector2.Zero;
|
|
|
|
|
+ TexCoord3Delta = Vector2.Zero;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+internal VertexMaterialDelta(in VertexColor1Texture3 rootVal, in VertexColor1Texture3 morphVal)
|
|
|
|
|
+ {
|
|
|
|
|
+ MaxColors = 1;
|
|
|
|
|
+ MaxTextCoords = 3;
|
|
|
|
|
+ Color0Delta = morphVal.Color - rootVal.Color;
|
|
|
|
|
+ Color1Delta = Vector4.Zero;
|
|
|
|
|
+ TexCoord0Delta = morphVal.TexCoord0 - rootVal.TexCoord0;
|
|
|
|
|
+ TexCoord1Delta = morphVal.TexCoord1 - rootVal.TexCoord1;
|
|
|
|
|
+ TexCoord2Delta = morphVal.TexCoord2 - rootVal.TexCoord2;
|
|
|
|
|
+ TexCoord3Delta = Vector2.Zero;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+internal VertexMaterialDelta(in VertexColor1Texture4 rootVal, in VertexColor1Texture4 morphVal)
|
|
|
|
|
+ {
|
|
|
|
|
+ MaxColors = 1;
|
|
|
|
|
+ MaxTextCoords = 4;
|
|
|
|
|
+ Color0Delta = morphVal.Color - rootVal.Color;
|
|
|
|
|
+ Color1Delta = Vector4.Zero;
|
|
|
|
|
+ TexCoord0Delta = morphVal.TexCoord0 - rootVal.TexCoord0;
|
|
|
|
|
+ TexCoord1Delta = morphVal.TexCoord1 - rootVal.TexCoord1;
|
|
|
|
|
+ TexCoord2Delta = morphVal.TexCoord2 - rootVal.TexCoord2;
|
|
|
|
|
+ TexCoord3Delta = morphVal.TexCoord3 - rootVal.TexCoord3;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+internal VertexMaterialDelta(in VertexColor2 rootVal, in VertexColor2 morphVal)
|
|
|
|
|
+ {
|
|
|
|
|
+ MaxColors = 2;
|
|
|
|
|
+ MaxTextCoords = 0;
|
|
|
|
|
+ Color0Delta = morphVal.Color0 - rootVal.Color0;
|
|
|
|
|
+ Color1Delta = morphVal.Color1 - rootVal.Color1;
|
|
|
|
|
+ TexCoord0Delta = Vector2.Zero;
|
|
|
|
|
+ TexCoord1Delta = Vector2.Zero;
|
|
|
|
|
+ TexCoord2Delta = Vector2.Zero;
|
|
|
|
|
+ TexCoord3Delta = Vector2.Zero;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+internal VertexMaterialDelta(in VertexColor2Texture1 rootVal, in VertexColor2Texture1 morphVal)
|
|
|
|
|
+ {
|
|
|
|
|
+ MaxColors = 2;
|
|
|
|
|
+ MaxTextCoords = 1;
|
|
|
|
|
+ Color0Delta = morphVal.Color0 - rootVal.Color0;
|
|
|
|
|
+ Color1Delta = morphVal.Color1 - rootVal.Color1;
|
|
|
|
|
+ TexCoord0Delta = morphVal.TexCoord - rootVal.TexCoord;
|
|
|
|
|
+ TexCoord1Delta = Vector2.Zero;
|
|
|
|
|
+ TexCoord2Delta = Vector2.Zero;
|
|
|
|
|
+ TexCoord3Delta = Vector2.Zero;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+internal VertexMaterialDelta(in VertexColor2Texture2 rootVal, in VertexColor2Texture2 morphVal)
|
|
|
|
|
+ {
|
|
|
|
|
+ MaxColors = 2;
|
|
|
|
|
+ MaxTextCoords = 2;
|
|
|
|
|
+ Color0Delta = morphVal.Color0 - rootVal.Color0;
|
|
|
|
|
+ Color1Delta = morphVal.Color1 - rootVal.Color1;
|
|
|
|
|
+ TexCoord0Delta = morphVal.TexCoord0 - rootVal.TexCoord0;
|
|
|
|
|
+ TexCoord1Delta = morphVal.TexCoord1 - rootVal.TexCoord1;
|
|
|
|
|
+ TexCoord2Delta = Vector2.Zero;
|
|
|
|
|
+ TexCoord3Delta = Vector2.Zero;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+internal VertexMaterialDelta(in VertexColor2Texture3 rootVal, in VertexColor2Texture3 morphVal)
|
|
|
|
|
+ {
|
|
|
|
|
+ MaxColors = 2;
|
|
|
|
|
+ MaxTextCoords = 3;
|
|
|
|
|
+ Color0Delta = morphVal.Color0 - rootVal.Color0;
|
|
|
|
|
+ Color1Delta = morphVal.Color1 - rootVal.Color1;
|
|
|
|
|
+ TexCoord0Delta = morphVal.TexCoord0 - rootVal.TexCoord0;
|
|
|
|
|
+ TexCoord1Delta = morphVal.TexCoord1 - rootVal.TexCoord1;
|
|
|
|
|
+ TexCoord2Delta = morphVal.TexCoord2 - rootVal.TexCoord2;
|
|
|
|
|
+ TexCoord3Delta = Vector2.Zero;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+internal VertexMaterialDelta(in VertexColor2Texture4 rootVal, in VertexColor2Texture4 morphVal)
|
|
|
|
|
+ {
|
|
|
|
|
+ MaxColors = 2;
|
|
|
|
|
+ MaxTextCoords = 4;
|
|
|
|
|
+ Color0Delta = morphVal.Color0 - rootVal.Color0;
|
|
|
|
|
+ Color1Delta = morphVal.Color1 - rootVal.Color1;
|
|
|
|
|
+ TexCoord0Delta = morphVal.TexCoord0 - rootVal.TexCoord0;
|
|
|
|
|
+ TexCoord1Delta = morphVal.TexCoord1 - rootVal.TexCoord1;
|
|
|
|
|
+ TexCoord2Delta = morphVal.TexCoord2 - rootVal.TexCoord2;
|
|
|
|
|
+ TexCoord3Delta = morphVal.TexCoord3 - rootVal.TexCoord3;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+}
|