void ScriptSpriteTexture::Internal_setTexture(ScriptSpriteTexture* thisPtr, MonoObject* texture) { ResourceHandle<Texture> tmptexture; ScriptTexture* scripttexture; scripttexture = ScriptTexture::toNative(texture); if(scripttexture != nullptr) tmptexture = scripttexture->getHandle(); thisPtr->getHandle()->setTexture(tmptexture); }
void ScriptSpriteTexture::Internal_create0(MonoObject* managedInstance, Vector2* uvOffset, Vector2* uvScale, MonoObject* texture) { ResourceHandle<Texture> tmptexture; ScriptTexture* scripttexture; scripttexture = ScriptTexture::toNative(texture); if(scripttexture != nullptr) tmptexture = scripttexture->getHandle(); ResourceHandle<SpriteTexture> instance = SpriteTexture::create(*uvOffset, *uvScale, tmptexture); ScriptResourceManager::instance().createBuiltinScriptResource(instance, managedInstance); }
void ScriptRenderTexture2D::internal_create(MonoObject* instance, MonoArray* colorSurfaces, ScriptTexture* depthStencilSurface) { ScriptArray colorSurfacesList(colorSurfaces); RENDER_SURFACE_DESC depthStencilSurfaceDesc; if (depthStencilSurface != nullptr) { depthStencilSurfaceDesc.face = 0; depthStencilSurfaceDesc.mipLevel = 0; depthStencilSurfaceDesc.numFaces = 1; HTexture textureHandle = depthStencilSurface->getHandle(); if (!textureHandle.isLoaded()) { LOGERR("Render texture must be created using a fully loaded texture."); } else depthStencilSurfaceDesc.texture = textureHandle; } UINT32 numSurfaces = std::min(colorSurfacesList.size(), (UINT32)BS_MAX_MULTIPLE_RENDER_TARGETS); RENDER_TEXTURE_DESC desc; for (UINT32 i = 0; i < numSurfaces; i++) { RENDER_SURFACE_DESC surfaceDesc; surfaceDesc.face = 0; surfaceDesc.mipLevel = 0; surfaceDesc.numFaces = 1; ScriptTexture* scriptSurface = colorSurfacesList.get<ScriptTexture*>(i); if (scriptSurface != nullptr) { HTexture textureHandle = scriptSurface->getHandle(); if (!textureHandle.isLoaded()) { LOGERR("Render texture must be created using a fully loaded texture."); } else surfaceDesc.texture = textureHandle; } desc.colorSurfaces[i] = surfaceDesc; } desc.depthStencilSurface = depthStencilSurfaceDesc; SPtr<RenderTarget> tex = RenderTexture::create(desc); new (bs_alloc<ScriptRenderTexture2D>()) ScriptRenderTexture2D(tex, instance); }