| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- #include "BsScriptRenderTexture.generated.h"
- #include "BsMonoMethod.h"
- #include "BsMonoClass.h"
- #include "BsMonoUtil.h"
- #include "../../../bsf/Source/Foundation/bsfCore/RenderAPI/BsRenderTexture.h"
- #include "BsScriptResourceManager.h"
- #include "BsScriptTexture.generated.h"
- #include "BsScriptRenderTexture.generated.h"
- #include "../../SBansheeEngine/Extensions/BsRenderTargetEx.h"
- namespace bs
- {
- ScriptRenderTexture::ScriptRenderTexture(MonoObject* managedInstance, const SPtr<RenderTexture>& value)
- :ScriptObject(managedInstance)
- {
- mInternal = value;
- }
- SPtr<RenderTexture> ScriptRenderTexture::getInternal() const
- {
- return std::static_pointer_cast<RenderTexture>(mInternal);
- }
- void ScriptRenderTexture::initRuntimeData()
- {
- metaData.scriptClass->addInternalCall("Internal_create", (void*)&ScriptRenderTexture::Internal_create);
- metaData.scriptClass->addInternalCall("Internal_create0", (void*)&ScriptRenderTexture::Internal_create0);
- metaData.scriptClass->addInternalCall("Internal_create1", (void*)&ScriptRenderTexture::Internal_create1);
- metaData.scriptClass->addInternalCall("Internal_create2", (void*)&ScriptRenderTexture::Internal_create2);
- metaData.scriptClass->addInternalCall("Internal_create3", (void*)&ScriptRenderTexture::Internal_create3);
- metaData.scriptClass->addInternalCall("Internal_getColorSurface", (void*)&ScriptRenderTexture::Internal_getColorSurface);
- metaData.scriptClass->addInternalCall("Internal_getColorSurfaces", (void*)&ScriptRenderTexture::Internal_getColorSurfaces);
- metaData.scriptClass->addInternalCall("Internal_getDepthStencilSurface", (void*)&ScriptRenderTexture::Internal_getDepthStencilSurface);
- }
- MonoObject* ScriptRenderTexture::create(const SPtr<RenderTexture>& value)
- {
- if(value == nullptr) return nullptr;
- bool dummy = false;
- void* ctorParams[1] = { &dummy };
- MonoObject* managedInstance = metaData.scriptClass->createInstance("bool", ctorParams);
- new (bs_alloc<ScriptRenderTexture>()) ScriptRenderTexture(managedInstance, value);
- return managedInstance;
- }
- void ScriptRenderTexture::Internal_create(MonoObject* managedInstance, PixelFormat format, int32_t width, int32_t height, int32_t numSamples, bool gammaCorrection, bool createDepth, PixelFormat depthStencilFormat)
- {
- SPtr<RenderTexture> instance = RenderTextureEx::create(format, width, height, numSamples, gammaCorrection, createDepth, depthStencilFormat);
- new (bs_alloc<ScriptRenderTexture>())ScriptRenderTexture(managedInstance, instance);
- }
- void ScriptRenderTexture::Internal_create0(MonoObject* managedInstance, MonoObject* colorSurface)
- {
- ResourceHandle<Texture> tmpcolorSurface;
- ScriptTexture* scriptcolorSurface;
- scriptcolorSurface = ScriptTexture::toNative(colorSurface);
- if(scriptcolorSurface != nullptr)
- tmpcolorSurface = scriptcolorSurface->getHandle();
- SPtr<RenderTexture> instance = RenderTextureEx::create(tmpcolorSurface);
- new (bs_alloc<ScriptRenderTexture>())ScriptRenderTexture(managedInstance, instance);
- }
- void ScriptRenderTexture::Internal_create1(MonoObject* managedInstance, MonoObject* colorSurface, MonoObject* depthStencilSurface)
- {
- ResourceHandle<Texture> tmpcolorSurface;
- ScriptTexture* scriptcolorSurface;
- scriptcolorSurface = ScriptTexture::toNative(colorSurface);
- if(scriptcolorSurface != nullptr)
- tmpcolorSurface = scriptcolorSurface->getHandle();
- ResourceHandle<Texture> tmpdepthStencilSurface;
- ScriptTexture* scriptdepthStencilSurface;
- scriptdepthStencilSurface = ScriptTexture::toNative(depthStencilSurface);
- if(scriptdepthStencilSurface != nullptr)
- tmpdepthStencilSurface = scriptdepthStencilSurface->getHandle();
- SPtr<RenderTexture> instance = RenderTextureEx::create(tmpcolorSurface, tmpdepthStencilSurface);
- new (bs_alloc<ScriptRenderTexture>())ScriptRenderTexture(managedInstance, instance);
- }
- void ScriptRenderTexture::Internal_create2(MonoObject* managedInstance, MonoArray* colorSurface)
- {
- Vector<ResourceHandle<Texture>> veccolorSurface;
- if(colorSurface != nullptr)
- {
- ScriptArray arraycolorSurface(colorSurface);
- veccolorSurface.resize(arraycolorSurface.size());
- for(int i = 0; i < (int)arraycolorSurface.size(); i++)
- {
- ScriptTexture* scriptcolorSurface;
- scriptcolorSurface = ScriptTexture::toNative(arraycolorSurface.get<MonoObject*>(i));
- if(scriptcolorSurface != nullptr)
- veccolorSurface[i] = scriptcolorSurface->getHandle();
- }
- }
- SPtr<RenderTexture> instance = RenderTextureEx::create(veccolorSurface);
- new (bs_alloc<ScriptRenderTexture>())ScriptRenderTexture(managedInstance, instance);
- }
- void ScriptRenderTexture::Internal_create3(MonoObject* managedInstance, MonoArray* colorSurface, MonoObject* depthStencilSurface)
- {
- Vector<ResourceHandle<Texture>> veccolorSurface;
- if(colorSurface != nullptr)
- {
- ScriptArray arraycolorSurface(colorSurface);
- veccolorSurface.resize(arraycolorSurface.size());
- for(int i = 0; i < (int)arraycolorSurface.size(); i++)
- {
- ScriptTexture* scriptcolorSurface;
- scriptcolorSurface = ScriptTexture::toNative(arraycolorSurface.get<MonoObject*>(i));
- if(scriptcolorSurface != nullptr)
- veccolorSurface[i] = scriptcolorSurface->getHandle();
- }
- }
- ResourceHandle<Texture> tmpdepthStencilSurface;
- ScriptTexture* scriptdepthStencilSurface;
- scriptdepthStencilSurface = ScriptTexture::toNative(depthStencilSurface);
- if(scriptdepthStencilSurface != nullptr)
- tmpdepthStencilSurface = scriptdepthStencilSurface->getHandle();
- SPtr<RenderTexture> instance = RenderTextureEx::create(veccolorSurface, tmpdepthStencilSurface);
- new (bs_alloc<ScriptRenderTexture>())ScriptRenderTexture(managedInstance, instance);
- }
- MonoObject* ScriptRenderTexture::Internal_getColorSurface(ScriptRenderTexture* thisPtr)
- {
- ResourceHandle<Texture> tmp__output;
- tmp__output = RenderTextureEx::getColorSurface(thisPtr->getInternal());
- MonoObject* __output;
- ScriptResourceBase* script__output;
- script__output = ScriptResourceManager::instance().getScriptResource(tmp__output, true);
- if(script__output != nullptr)
- __output = script__output->getManagedInstance();
- else
- __output = nullptr;
- return __output;
- }
- MonoArray* ScriptRenderTexture::Internal_getColorSurfaces(ScriptRenderTexture* thisPtr)
- {
- Vector<ResourceHandle<Texture>> vec__output;
- vec__output = RenderTextureEx::getColorSurfaces(thisPtr->getInternal());
- MonoArray* __output;
- int arraySize__output = (int)vec__output.size();
- ScriptArray array__output = ScriptArray::create<ScriptTexture>(arraySize__output);
- for(int i = 0; i < arraySize__output; i++)
- {
- ScriptResourceBase* script__output;
- script__output = ScriptResourceManager::instance().getScriptResource(vec__output[i], true);
- if(script__output != nullptr)
- array__output.set(i, script__output->getManagedInstance());
- else
- array__output.set(i, nullptr);
- }
- __output = array__output.getInternal();
- return __output;
- }
- MonoObject* ScriptRenderTexture::Internal_getDepthStencilSurface(ScriptRenderTexture* thisPtr)
- {
- ResourceHandle<Texture> tmp__output;
- tmp__output = RenderTextureEx::getDepthStencilSurface(thisPtr->getInternal());
- MonoObject* __output;
- ScriptResourceBase* script__output;
- script__output = ScriptResourceManager::instance().getScriptResource(tmp__output, true);
- if(script__output != nullptr)
- __output = script__output->getManagedInstance();
- else
- __output = nullptr;
- return __output;
- }
- }
|