DynamicModelMeshPartContent.cs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #region License
  2. // Copyright 2016 Kastellanos Nikolaos
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. #endregion
  16. using System.Collections.ObjectModel;
  17. using Microsoft.Xna.Framework.Content;
  18. using Microsoft.Xna.Framework.Content.Pipeline.Graphics;
  19. using Microsoft.Xna.Framework.Content.Pipeline.Processors;
  20. namespace nkast.Aether.Content.Pipeline.Graphics
  21. {
  22. public class DynamicModelMeshPartContent
  23. {
  24. protected internal ModelMeshPartContent Source { get; protected set; }
  25. // Summary:
  26. // Gets the offset, in bytes, from the first index of the of vertex buffer for this mesh part.
  27. public int VertexOffset { get; set; }
  28. // Summary:
  29. // Gets the number of vertices used in this mesh part.
  30. public int NumVertices { get; set; }
  31. // Summary:
  32. // Gets the location in the index buffer at which to start reading vertices.
  33. public int StartIndex { get; set; }
  34. // Summary:
  35. // Gets the number of primitives to render for this mesh part.
  36. public int PrimitiveCount { get; set; }
  37. // Summary:
  38. // Gets the vertex buffer associated with this mesh part.
  39. [ContentSerializerIgnore]
  40. public VertexBufferContent VertexBuffer { get; set; }
  41. // Summary:
  42. // Gets the index buffer associated with this mesh part.
  43. [ContentSerializerIgnore]
  44. public Collection<int> IndexBuffer { get; set; }
  45. // Summary:
  46. // Gets the material of this mesh part.
  47. [ContentSerializer(SharedResource = true)]
  48. public MaterialContent Material { get; set; }
  49. // Summary:
  50. // Gets a user defined tag object.
  51. [ContentSerializer(SharedResource = true)]
  52. public object Tag { get; set; }
  53. public DynamicModelMeshPartContent(ModelMeshPartContent source)
  54. {
  55. this.Source = source;
  56. this.VertexOffset = source.VertexOffset;
  57. this.NumVertices = source.NumVertices;
  58. this.StartIndex = source.StartIndex;
  59. this.PrimitiveCount = source.PrimitiveCount;
  60. this.VertexBuffer = source.VertexBuffer;
  61. this.IndexBuffer = source.IndexBuffer;
  62. this.Material = source.Material;
  63. this.Tag = Tag;
  64. }
  65. }
  66. }