BsScriptJointCommon.cpp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #include "Wrappers/Physics/BsScriptJointCommon.h"
  4. #include "BsMonoClass.h"
  5. #include "BsMonoMethod.h"
  6. #include "BsMonoUtil.h"
  7. // DEBUG ONLY
  8. #include "BsMonoProperty.h"
  9. namespace bs
  10. {
  11. ScriptD6JointDrive::GetNativeDataThunkDef ScriptD6JointDrive::getNativeDataThunk = nullptr;
  12. ScriptD6JointDrive::ScriptD6JointDrive(MonoObject* instance)
  13. :ScriptObject(instance)
  14. { }
  15. void ScriptD6JointDrive::initRuntimeData()
  16. {
  17. getNativeDataThunk = (GetNativeDataThunkDef)metaData.scriptClass->getMethod("Internal_GetNative")->getThunk();
  18. }
  19. D6Joint::Drive ScriptD6JointDrive::convert(MonoObject* instance)
  20. {
  21. MonoException* exception = nullptr;
  22. MonoObject* boxedOutput = getNativeDataThunk(instance, &exception);
  23. MonoUtil::throwIfException(exception);
  24. return *(D6Joint::Drive*)MonoUtil::unbox(boxedOutput);
  25. }
  26. ScriptHingeJointDrive::GetNativeDataThunkDef ScriptHingeJointDrive::getNativeDataThunk = nullptr;
  27. ScriptHingeJointDrive::ScriptHingeJointDrive(MonoObject* instance)
  28. :ScriptObject(instance)
  29. { }
  30. void ScriptHingeJointDrive::initRuntimeData()
  31. {
  32. getNativeDataThunk = (GetNativeDataThunkDef)metaData.scriptClass->getMethod("Internal_GetNative")->getThunk();
  33. }
  34. HingeJoint::Drive ScriptHingeJointDrive::convert(MonoObject* instance)
  35. {
  36. MonoException* exception = nullptr;
  37. MonoObject* boxedOutput = getNativeDataThunk(instance, &exception);
  38. MonoUtil::throwIfException(exception);
  39. return *(HingeJoint::Drive*)MonoUtil::unbox(boxedOutput);
  40. }
  41. ScriptLimitLinearRange::GetNativeDataThunkDef ScriptLimitLinearRange::getNativeDataThunk = nullptr;
  42. ScriptLimitLinearRange::ScriptLimitLinearRange(MonoObject* instance)
  43. :ScriptObject(instance)
  44. { }
  45. void ScriptLimitLinearRange::initRuntimeData()
  46. {
  47. getNativeDataThunk = (GetNativeDataThunkDef)metaData.scriptClass->getMethod("Internal_GetNative")->getThunk();
  48. }
  49. LimitLinearRange ScriptLimitLinearRange::convert(MonoObject* instance)
  50. {
  51. MonoException* exception = nullptr;
  52. MonoObject* boxedOutput = getNativeDataThunk(instance, &exception);
  53. MonoUtil::throwIfException(exception);
  54. return *(LimitLinearRange*)MonoUtil::unbox(boxedOutput);
  55. }
  56. ScriptLimitLinear::GetNativeDataThunkDef ScriptLimitLinear::getNativeDataThunk = nullptr;
  57. ScriptLimitLinear::ScriptLimitLinear(MonoObject* instance)
  58. :ScriptObject(instance)
  59. { }
  60. void ScriptLimitLinear::initRuntimeData()
  61. {
  62. getNativeDataThunk = (GetNativeDataThunkDef)metaData.scriptClass->getMethod("Internal_GetNative")->getThunk();
  63. }
  64. LimitLinear ScriptLimitLinear::convert(MonoObject* instance)
  65. {
  66. MonoException* exception = nullptr;
  67. MonoObject* boxedOutput = getNativeDataThunk(instance, &exception);
  68. MonoUtil::throwIfException(exception);
  69. return *(LimitLinear*)MonoUtil::unbox(boxedOutput);
  70. }
  71. ScriptLimitAngularRange::GetNativeDataThunkDef ScriptLimitAngularRange::getNativeDataThunk = nullptr;
  72. ScriptLimitAngularRange::ScriptLimitAngularRange(MonoObject* instance)
  73. :ScriptObject(instance)
  74. { }
  75. void ScriptLimitAngularRange::initRuntimeData()
  76. {
  77. getNativeDataThunk = (GetNativeDataThunkDef)metaData.scriptClass->getMethod("Internal_GetNative")->getThunk();
  78. }
  79. LimitAngularRange ScriptLimitAngularRange::convert(MonoObject* instance)
  80. {
  81. MonoException* exception = nullptr;
  82. MonoObject* boxedOutput = getNativeDataThunk(instance, &exception);
  83. MonoUtil::throwIfException(exception);
  84. return *(LimitAngularRange*)MonoUtil::unbox(boxedOutput);
  85. }
  86. ScriptLimitConeRange::GetNativeDataThunkDef ScriptLimitConeRange::getNativeDataThunk = nullptr;
  87. ScriptLimitConeRange::ScriptLimitConeRange(MonoObject* instance)
  88. :ScriptObject(instance)
  89. { }
  90. void ScriptLimitConeRange::initRuntimeData()
  91. {
  92. getNativeDataThunk = (GetNativeDataThunkDef)metaData.scriptClass->getMethod("Internal_GetNative")->getThunk();
  93. }
  94. LimitConeRange ScriptLimitConeRange::convert(MonoObject* instance)
  95. {
  96. MonoException* exception = nullptr;
  97. MonoObject* boxedOutput = getNativeDataThunk(instance, &exception);
  98. MonoUtil::throwIfException(exception);
  99. return *(LimitConeRange*)MonoUtil::unbox(boxedOutput);
  100. }
  101. }