PhysicsMesh.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. using System;
  4. using System.Runtime.CompilerServices;
  5. namespace BansheeEngine
  6. {
  7. /** @addtogroup Physics
  8. * @{
  9. */
  10. /// <summary>
  11. /// Mesh that is used purely for collision purposes and not rendering. For example as a collider or a trigger.
  12. /// </summary>
  13. public class PhysicsMesh : Resource
  14. {
  15. /// <summary>
  16. /// Constructor for internal use by the runtime.
  17. /// </summary>
  18. private PhysicsMesh()
  19. { }
  20. /// <summary>
  21. /// Retrieves the vertex and index data of the mesh.
  22. /// </summary>
  23. public MeshData MeshData
  24. {
  25. get { return Internal_GetMeshData(mCachedPtr); }
  26. }
  27. /// <summary>
  28. /// Returns the type of the mesh.
  29. /// </summary>
  30. public PhysicsMeshType MeshType
  31. {
  32. get { return (PhysicsMeshType)Internal_GetMeshType(mCachedPtr); }
  33. }
  34. [MethodImpl(MethodImplOptions.InternalCall)]
  35. private static extern MeshData Internal_GetMeshData(IntPtr thisPtr);
  36. [MethodImpl(MethodImplOptions.InternalCall)]
  37. private static extern int Internal_GetMeshType(IntPtr thisPtr);
  38. }
  39. /// <summary>
  40. /// Valid types of a mesh used for physics.
  41. /// </summary>
  42. public enum PhysicsMeshType // Note: Must match C++ enum PhysicsMeshType
  43. {
  44. /// <summary>
  45. /// A regular triangle mesh. Mesh can be of arbitrary size but cannot be used for triggers and non-kinematic
  46. /// objects. Occurs a significantly larger performance impact than convex meshes.
  47. /// </summary>
  48. Triangle,
  49. /// <summary>
  50. /// Mesh representing a convex shape. Mesh will not have more than 256 vertices. Occurs a significantly lower
  51. /// performance impact than triangle meshes.
  52. /// </summary>
  53. Convex
  54. }
  55. /** @} */
  56. }