VertexPositionNormal.cs 1.6 KB

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