NativeMeshCollider.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. /** @cond INTEROP */
  8. /** @addtogroup Interop
  9. * @{
  10. */
  11. /// <summary>
  12. /// Wrapper around the native MeshCollider class.
  13. /// <see cref="MeshCollider"/>
  14. /// </summary>
  15. internal class NativeMeshCollider : NativeCollider
  16. {
  17. public NativeMeshCollider()
  18. {
  19. Internal_CreateInstance(this);
  20. }
  21. public PhysicsMesh Mesh
  22. {
  23. get { return Internal_GetMesh(mCachedPtr); }
  24. set
  25. {
  26. IntPtr meshPtr = IntPtr.Zero;
  27. if (value != null)
  28. meshPtr = value.GetCachedPtr();
  29. Internal_SetMesh(mCachedPtr, meshPtr);
  30. }
  31. }
  32. [MethodImpl(MethodImplOptions.InternalCall)]
  33. private static extern void Internal_CreateInstance(NativeMeshCollider instance);
  34. [MethodImpl(MethodImplOptions.InternalCall)]
  35. private static extern PhysicsMesh Internal_GetMesh(IntPtr thisPtr);
  36. [MethodImpl(MethodImplOptions.InternalCall)]
  37. private static extern void Internal_SetMesh(IntPtr thisPtr, IntPtr mesh);
  38. }
  39. /** @} */
  40. /** @endcond */
  41. }