BsScriptJointCommon.cpp 4.3 KB

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