/src/Microsoft.Xna.Framework/Graphics/VertexDeclaration.cs

https://bitbucket.org/alisci01/monoxna · C# · 123 lines · 70 code · 25 blank · 28 comment · 4 complexity · 398bf496d5a1cdb6d71ec433bff0716b MD5 · raw file

  1. #region License
  2. /*
  3. MIT License
  4. Copyright © 2006 The Mono.Xna Team
  5. All rights reserved.
  6. Permission is hereby granted, free of charge, to any person obtaining a copy
  7. of this software and associated documentation files (the "Software"), to deal
  8. in the Software without restriction, including without limitation the rights
  9. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. copies of the Software, and to permit persons to whom the Software is
  11. furnished to do so, subject to the following conditions:
  12. The above copyright notice and this permission notice shall be included in all
  13. copies or substantial portions of the Software.
  14. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  20. SOFTWARE.
  21. */
  22. #endregion License
  23. using System;
  24. using System.Collections.Generic;
  25. using System.Text;
  26. namespace Microsoft.Xna.Framework.Graphics
  27. {
  28. public class VertexDeclaration : IDisposable
  29. {
  30. VertexElement[] vertexelements;
  31. GraphicsDevice graphicsDevice;
  32. public VertexDeclaration(GraphicsDevice graphicsDevice, VertexElement[] elements)
  33. {
  34. //Internaly emulate the VertexDeclaration because there isn't something like that in OpenGl
  35. vertexelements = elements;
  36. }
  37. ~VertexDeclaration()
  38. {
  39. }
  40. public static bool operator !=(VertexDeclaration left, VertexDeclaration right) { throw new NotImplementedException(); }
  41. public static bool operator ==(VertexDeclaration left, VertexDeclaration right) { throw new NotImplementedException(); }
  42. public GraphicsDevice GraphicsDevice { get { throw new NotImplementedException(); } }
  43. public bool IsDisposed { get { throw new NotImplementedException(); } }
  44. public string Name { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } }
  45. public object Tag { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } }
  46. public event EventHandler Disposing;
  47. public void Dispose() { throw new NotImplementedException(); }
  48. protected virtual void Dispose(bool disposing) { throw new NotImplementedException(); }
  49. public override bool Equals(object obj) { throw new NotImplementedException(); }
  50. public override int GetHashCode() { throw new NotImplementedException(); }
  51. public VertexElement[] GetVertexElements()
  52. {
  53. return vertexelements;
  54. }
  55. public int GetVertexStrideSize(int stream)
  56. {
  57. int size = 0;
  58. foreach ( VertexElement element in vertexelements)
  59. {
  60. int typesize = 0;
  61. if (element.Stream != stream) continue;
  62. switch (element.VertexElementFormat)
  63. {
  64. case VertexElementFormat.Vector2:
  65. typesize = 2 * 4;
  66. break;
  67. case VertexElementFormat.Vector3:
  68. typesize = 3 * 4;
  69. break;
  70. case VertexElementFormat.Byte4:
  71. typesize = 4 * 1;
  72. break;
  73. case VertexElementFormat.Color:
  74. typesize = 4 * 1;
  75. break;
  76. case VertexElementFormat.HalfVector2:
  77. //typesize = 3 * 4; Unknown
  78. break;
  79. case VertexElementFormat.HalfVector4:
  80. //typesize = 3 * 4; Unknown
  81. break;
  82. case VertexElementFormat.Rgba32:
  83. //typesize = 3 * 4; Unknown
  84. break;
  85. }
  86. if (element.Offset + typesize > size) size = element.Offset + typesize;
  87. }
  88. return size;
  89. }
  90. public static int GetVertexStrideSize(VertexElement[] elements, int stream) { throw new NotImplementedException(); }
  91. protected void raise_Disposing(object sender, EventArgs e) { throw new NotImplementedException(); }
  92. public override string ToString() { throw new NotImplementedException(); }
  93. }
  94. }