2
0

ParticleVertex.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // ParticleVertex.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. using Microsoft.Xna.Framework.Graphics.PackedVector;
  13. #endregion
  14. namespace Particle3DSample
  15. {
  16. /// <summary>
  17. /// Custom vertex structure for drawing particles.
  18. /// </summary>
  19. struct ParticleVertex
  20. {
  21. // Stores which corner of the particle quad this vertex represents.
  22. public Short2 Corner;
  23. // Stores the starting position of the particle.
  24. public Vector3 Position;
  25. // Stores the starting velocity of the particle.
  26. public Vector3 Velocity;
  27. // Four random values, used to make each particle look slightly different.
  28. public Color Random;
  29. // The time (in seconds) at which this particle was created.
  30. public float Time;
  31. // Describe the layout of this vertex structure.
  32. public static readonly VertexDeclaration VertexDeclaration = new VertexDeclaration
  33. (
  34. new VertexElement (0, VertexElementFormat.Short2,
  35. VertexElementUsage.Position, 0),
  36. new VertexElement (4, VertexElementFormat.Vector3,
  37. VertexElementUsage.Position, 1),
  38. new VertexElement (16, VertexElementFormat.Vector3,
  39. VertexElementUsage.Normal, 0),
  40. new VertexElement (28, VertexElementFormat.Color,
  41. VertexElementUsage.Color, 0),
  42. new VertexElement (32, VertexElementFormat.Single,
  43. VertexElementUsage.TextureCoordinate, 0)
  44. );
  45. // Describe the size of this vertex structure.
  46. public const int SizeInBytes = 36;
  47. }
  48. }