PhysicsMesh.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. /// <summary>
  8. /// Mesh that is used purely for collision purposes and not rendering. For example as a collider or a trigger.
  9. /// </summary>
  10. public class PhysicsMesh : Resource
  11. {
  12. /// <summary>
  13. /// Constructor for internal use by the runtime.
  14. /// </summary>
  15. private PhysicsMesh()
  16. { }
  17. /// <summary>
  18. /// Retrieves the vertex and index data of the mesh.
  19. /// </summary>
  20. public MeshData MeshData
  21. {
  22. get { return Internal_GetMeshData(mCachedPtr); }
  23. }
  24. /// <summary>
  25. /// Returns the type of the mesh.
  26. /// </summary>
  27. public PhysicsMeshType MeshType
  28. {
  29. get { return (PhysicsMeshType)Internal_GetMeshType(mCachedPtr); }
  30. }
  31. [MethodImpl(MethodImplOptions.InternalCall)]
  32. private static extern MeshData Internal_GetMeshData(IntPtr thisPtr);
  33. [MethodImpl(MethodImplOptions.InternalCall)]
  34. private static extern int Internal_GetMeshType(IntPtr thisPtr);
  35. }
  36. /// <summary>
  37. /// Valid types of a mesh used for physics.
  38. /// </summary>
  39. public enum PhysicsMeshType // Note: Must match C++ enum PhysicsMeshType
  40. {
  41. /// <summary>
  42. /// A regular triangle mesh. Mesh can be of arbitrary size but cannot be used for triggers and non-kinematic
  43. /// objects. Occurs a significantly larger performance impact than convex meshes.
  44. /// </summary>
  45. Triangle,
  46. /// <summary>
  47. /// Mesh representing a convex shape. Mesh will not have more than 256 vertices. Occurs a significantly lower
  48. /// performance impact than triangle meshes.
  49. /// </summary>
  50. Convex
  51. }
  52. }