NativeMeshCollider.cs 1.3 KB

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