VertexPositionNormal.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // VertexPositionNormal.cs
  4. //
  5. // Microsoft XNA Community Game Platform
  6. // Copyright (C) Microsoft Corporation. All rights reserved.
  7. //-----------------------------------------------------------------------------
  8. #endregion
  9. #region Using Statements
  10. using Microsoft.Xna.Framework;
  11. using Microsoft.Xna.Framework.Graphics;
  12. #endregion
  13. namespace PerformanceMeasuring
  14. {
  15. /// <summary>
  16. /// Custom vertex type for vertices that have just a
  17. /// position and a normal, without any texture coordinates.
  18. ///
  19. /// This struct is borrowed from the Primitives3D sample.
  20. /// </summary>
  21. public struct VertexPositionNormal : IVertexType
  22. {
  23. public Vector3 Position;
  24. public Vector3 Normal;
  25. /// <summary>
  26. /// Constructor.
  27. /// </summary>
  28. public VertexPositionNormal(Vector3 position, Vector3 normal)
  29. {
  30. Position = position;
  31. Normal = normal;
  32. }
  33. /// <summary>
  34. /// A VertexDeclaration object, which contains information about the vertex
  35. /// elements contained within this struct.
  36. /// </summary>
  37. public static readonly VertexDeclaration VertexDeclaration = new VertexDeclaration
  38. (
  39. new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),
  40. new VertexElement(12, VertexElementFormat.Vector3, VertexElementUsage.Normal, 0)
  41. );
  42. VertexDeclaration IVertexType.VertexDeclaration
  43. {
  44. get { return VertexPositionNormal.VertexDeclaration; }
  45. }
  46. }
  47. }