DynamicModelMeshContent.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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.Generic;
  17. using Microsoft.Xna.Framework;
  18. using Microsoft.Xna.Framework.Content;
  19. using Microsoft.Xna.Framework.Content.Pipeline.Processors;
  20. namespace nkast.Aether.Content.Pipeline.Graphics
  21. {
  22. public class DynamicModelMeshContent
  23. {
  24. protected internal ModelMeshContent Source { get; protected set; }
  25. // Summary:
  26. // Gets the mesh name.
  27. public string Name { get { return Source.Name; } }
  28. // Summary:
  29. // Gets the parent bone.
  30. [ContentSerializerIgnore]
  31. public ModelBoneContent ParentBone { get { return Source.ParentBone; } }
  32. // Summary:
  33. // Gets the bounding sphere for this mesh.
  34. public BoundingSphere BoundingSphere { get { return Source.BoundingSphere; } }
  35. // Summary:
  36. // Gets the children mesh parts associated with this mesh.
  37. [ContentSerializerIgnore]
  38. public List<DynamicModelMeshPartContent> MeshParts { get; private set; }
  39. // Summary:
  40. // Gets a user defined tag object.
  41. [ContentSerializer(SharedResource = true)]
  42. public object Tag { get { return Source.Tag; } set { Source.Tag = value; } }
  43. public DynamicModelMeshContent(ModelMeshContent source)
  44. {
  45. this.Source = source;
  46. //deep clone MeshParts
  47. MeshParts = new List<DynamicModelMeshPartContent>(source.MeshParts.Count);
  48. foreach (var mesh in source.MeshParts)
  49. MeshParts.Add(new DynamicModelMeshPartContent(mesh));
  50. }
  51. }
  52. }