BsScriptRenderTexture.generated.cpp 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. #include "BsScriptRenderTexture.generated.h"
  2. #include "BsMonoMethod.h"
  3. #include "BsMonoClass.h"
  4. #include "BsMonoUtil.h"
  5. #include "../../../bsf/Source/Foundation/bsfCore/RenderAPI/BsRenderTexture.h"
  6. #include "BsScriptResourceManager.h"
  7. #include "BsScriptTexture.generated.h"
  8. #include "BsScriptRenderTexture.generated.h"
  9. #include "../../SBansheeEngine/Extensions/BsRenderTargetEx.h"
  10. namespace bs
  11. {
  12. ScriptRenderTexture::ScriptRenderTexture(MonoObject* managedInstance, const SPtr<RenderTexture>& value)
  13. :ScriptObject(managedInstance)
  14. {
  15. mInternal = value;
  16. }
  17. SPtr<RenderTexture> ScriptRenderTexture::getInternal() const
  18. {
  19. return std::static_pointer_cast<RenderTexture>(mInternal);
  20. }
  21. void ScriptRenderTexture::initRuntimeData()
  22. {
  23. metaData.scriptClass->addInternalCall("Internal_create", (void*)&ScriptRenderTexture::Internal_create);
  24. metaData.scriptClass->addInternalCall("Internal_create0", (void*)&ScriptRenderTexture::Internal_create0);
  25. metaData.scriptClass->addInternalCall("Internal_create1", (void*)&ScriptRenderTexture::Internal_create1);
  26. metaData.scriptClass->addInternalCall("Internal_create2", (void*)&ScriptRenderTexture::Internal_create2);
  27. metaData.scriptClass->addInternalCall("Internal_create3", (void*)&ScriptRenderTexture::Internal_create3);
  28. metaData.scriptClass->addInternalCall("Internal_getColorSurface", (void*)&ScriptRenderTexture::Internal_getColorSurface);
  29. metaData.scriptClass->addInternalCall("Internal_getColorSurfaces", (void*)&ScriptRenderTexture::Internal_getColorSurfaces);
  30. metaData.scriptClass->addInternalCall("Internal_getDepthStencilSurface", (void*)&ScriptRenderTexture::Internal_getDepthStencilSurface);
  31. }
  32. MonoObject* ScriptRenderTexture::create(const SPtr<RenderTexture>& value)
  33. {
  34. if(value == nullptr) return nullptr;
  35. bool dummy = false;
  36. void* ctorParams[1] = { &dummy };
  37. MonoObject* managedInstance = metaData.scriptClass->createInstance("bool", ctorParams);
  38. new (bs_alloc<ScriptRenderTexture>()) ScriptRenderTexture(managedInstance, value);
  39. return managedInstance;
  40. }
  41. void ScriptRenderTexture::Internal_create(MonoObject* managedInstance, PixelFormat format, int32_t width, int32_t height, int32_t numSamples, bool gammaCorrection, bool createDepth, PixelFormat depthStencilFormat)
  42. {
  43. SPtr<RenderTexture> instance = RenderTextureEx::create(format, width, height, numSamples, gammaCorrection, createDepth, depthStencilFormat);
  44. new (bs_alloc<ScriptRenderTexture>())ScriptRenderTexture(managedInstance, instance);
  45. }
  46. void ScriptRenderTexture::Internal_create0(MonoObject* managedInstance, MonoObject* colorSurface)
  47. {
  48. ResourceHandle<Texture> tmpcolorSurface;
  49. ScriptTexture* scriptcolorSurface;
  50. scriptcolorSurface = ScriptTexture::toNative(colorSurface);
  51. if(scriptcolorSurface != nullptr)
  52. tmpcolorSurface = scriptcolorSurface->getHandle();
  53. SPtr<RenderTexture> instance = RenderTextureEx::create(tmpcolorSurface);
  54. new (bs_alloc<ScriptRenderTexture>())ScriptRenderTexture(managedInstance, instance);
  55. }
  56. void ScriptRenderTexture::Internal_create1(MonoObject* managedInstance, MonoObject* colorSurface, MonoObject* depthStencilSurface)
  57. {
  58. ResourceHandle<Texture> tmpcolorSurface;
  59. ScriptTexture* scriptcolorSurface;
  60. scriptcolorSurface = ScriptTexture::toNative(colorSurface);
  61. if(scriptcolorSurface != nullptr)
  62. tmpcolorSurface = scriptcolorSurface->getHandle();
  63. ResourceHandle<Texture> tmpdepthStencilSurface;
  64. ScriptTexture* scriptdepthStencilSurface;
  65. scriptdepthStencilSurface = ScriptTexture::toNative(depthStencilSurface);
  66. if(scriptdepthStencilSurface != nullptr)
  67. tmpdepthStencilSurface = scriptdepthStencilSurface->getHandle();
  68. SPtr<RenderTexture> instance = RenderTextureEx::create(tmpcolorSurface, tmpdepthStencilSurface);
  69. new (bs_alloc<ScriptRenderTexture>())ScriptRenderTexture(managedInstance, instance);
  70. }
  71. void ScriptRenderTexture::Internal_create2(MonoObject* managedInstance, MonoArray* colorSurface)
  72. {
  73. Vector<ResourceHandle<Texture>> veccolorSurface;
  74. if(colorSurface != nullptr)
  75. {
  76. ScriptArray arraycolorSurface(colorSurface);
  77. veccolorSurface.resize(arraycolorSurface.size());
  78. for(int i = 0; i < (int)arraycolorSurface.size(); i++)
  79. {
  80. ScriptTexture* scriptcolorSurface;
  81. scriptcolorSurface = ScriptTexture::toNative(arraycolorSurface.get<MonoObject*>(i));
  82. if(scriptcolorSurface != nullptr)
  83. veccolorSurface[i] = scriptcolorSurface->getHandle();
  84. }
  85. }
  86. SPtr<RenderTexture> instance = RenderTextureEx::create(veccolorSurface);
  87. new (bs_alloc<ScriptRenderTexture>())ScriptRenderTexture(managedInstance, instance);
  88. }
  89. void ScriptRenderTexture::Internal_create3(MonoObject* managedInstance, MonoArray* colorSurface, MonoObject* depthStencilSurface)
  90. {
  91. Vector<ResourceHandle<Texture>> veccolorSurface;
  92. if(colorSurface != nullptr)
  93. {
  94. ScriptArray arraycolorSurface(colorSurface);
  95. veccolorSurface.resize(arraycolorSurface.size());
  96. for(int i = 0; i < (int)arraycolorSurface.size(); i++)
  97. {
  98. ScriptTexture* scriptcolorSurface;
  99. scriptcolorSurface = ScriptTexture::toNative(arraycolorSurface.get<MonoObject*>(i));
  100. if(scriptcolorSurface != nullptr)
  101. veccolorSurface[i] = scriptcolorSurface->getHandle();
  102. }
  103. }
  104. ResourceHandle<Texture> tmpdepthStencilSurface;
  105. ScriptTexture* scriptdepthStencilSurface;
  106. scriptdepthStencilSurface = ScriptTexture::toNative(depthStencilSurface);
  107. if(scriptdepthStencilSurface != nullptr)
  108. tmpdepthStencilSurface = scriptdepthStencilSurface->getHandle();
  109. SPtr<RenderTexture> instance = RenderTextureEx::create(veccolorSurface, tmpdepthStencilSurface);
  110. new (bs_alloc<ScriptRenderTexture>())ScriptRenderTexture(managedInstance, instance);
  111. }
  112. MonoObject* ScriptRenderTexture::Internal_getColorSurface(ScriptRenderTexture* thisPtr)
  113. {
  114. ResourceHandle<Texture> tmp__output;
  115. tmp__output = RenderTextureEx::getColorSurface(thisPtr->getInternal());
  116. MonoObject* __output;
  117. ScriptResourceBase* script__output;
  118. script__output = ScriptResourceManager::instance().getScriptResource(tmp__output, true);
  119. if(script__output != nullptr)
  120. __output = script__output->getManagedInstance();
  121. else
  122. __output = nullptr;
  123. return __output;
  124. }
  125. MonoArray* ScriptRenderTexture::Internal_getColorSurfaces(ScriptRenderTexture* thisPtr)
  126. {
  127. Vector<ResourceHandle<Texture>> vec__output;
  128. vec__output = RenderTextureEx::getColorSurfaces(thisPtr->getInternal());
  129. MonoArray* __output;
  130. int arraySize__output = (int)vec__output.size();
  131. ScriptArray array__output = ScriptArray::create<ScriptTexture>(arraySize__output);
  132. for(int i = 0; i < arraySize__output; i++)
  133. {
  134. ScriptResourceBase* script__output;
  135. script__output = ScriptResourceManager::instance().getScriptResource(vec__output[i], true);
  136. if(script__output != nullptr)
  137. array__output.set(i, script__output->getManagedInstance());
  138. else
  139. array__output.set(i, nullptr);
  140. }
  141. __output = array__output.getInternal();
  142. return __output;
  143. }
  144. MonoObject* ScriptRenderTexture::Internal_getDepthStencilSurface(ScriptRenderTexture* thisPtr)
  145. {
  146. ResourceHandle<Texture> tmp__output;
  147. tmp__output = RenderTextureEx::getDepthStencilSurface(thisPtr->getInternal());
  148. MonoObject* __output;
  149. ScriptResourceBase* script__output;
  150. script__output = ScriptResourceManager::instance().getScriptResource(tmp__output, true);
  151. if(script__output != nullptr)
  152. __output = script__output->getManagedInstance();
  153. else
  154. __output = nullptr;
  155. return __output;
  156. }
  157. }