NativeMeshCollider.cs 1.4 KB

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