using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Primitives3D
{
        /// <summary>
        /// Custom vertex type for vertices that have position, normal, texture coordinates,
        /// tangent and binormal.
        /// </summary>
        public struct VertexWater : IVertexType
        {
            public Vector3 position;
            public Vector3 normal;
            public Vector2 textureCoordinate;
            public Vector3 tangent;
            public Vector3 biNormal;

            /// <summary>
            /// Constructor.
            /// </summary>
            public VertexWater(Vector3 position, Vector3 normal, Vector2 textureCoordinate, Vector3 tangent, Vector3 biNormal)
            {
                this.position = position;
                this.normal = normal;
                this.textureCoordinate = textureCoordinate;
                this.tangent = tangent;
                this.biNormal = biNormal;
            }

            /// <summary>
            /// A VertexDeclaration object, which contains information about the vertex
            /// elements contained within this struct.
            /// </summary>
            public static readonly VertexDeclaration VertexDeclaration = new VertexDeclaration
            (
                new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),
                new VertexElement(sizeof(float) * 3, VertexElementFormat.Vector3, VertexElementUsage.Normal, 0),
                new VertexElement(sizeof(float) * 6, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0),
                new VertexElement(sizeof(float) * 8, VertexElementFormat.Vector3, VertexElementUsage.Tangent, 0),
                new VertexElement(sizeof(float) * 11, VertexElementFormat.Vector3, VertexElementUsage.Binormal, 0)
            );

            VertexDeclaration IVertexType.VertexDeclaration
            {
                get { return VertexWater.VertexDeclaration; }
            }
    }
}
