add gltfio FFI methods and expose texture/render target creation directly
This commit is contained in:
41
thermion_dart/native/src/c_api/TRenderTarget.cpp
Normal file
41
thermion_dart/native/src/c_api/TRenderTarget.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
#include "c_api/TScene.h"
|
||||
|
||||
#include <filament/Engine.h>
|
||||
#include <filament/Fence.h>
|
||||
#include <filament/RenderTarget.h>
|
||||
#include <filament/Texture.h>
|
||||
#include <filament/TextureSampler.h>
|
||||
|
||||
#include "Log.hpp"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace thermion
|
||||
{
|
||||
extern "C"
|
||||
{
|
||||
using namespace filament;
|
||||
#endif
|
||||
|
||||
EMSCRIPTEN_KEEPALIVE TRenderTarget *RenderTarget_create(
|
||||
TEngine *tEngine,
|
||||
uint32_t width,
|
||||
uint32_t height,
|
||||
TTexture *tColor,
|
||||
TTexture *tDepth)
|
||||
{
|
||||
auto engine = reinterpret_cast<filament::Engine *>(tEngine);
|
||||
auto color = reinterpret_cast<filament::Texture *>(tColor);
|
||||
auto depth = reinterpret_cast<filament::Texture *>(tDepth);
|
||||
|
||||
auto rt = filament::RenderTarget::Builder()
|
||||
.texture(RenderTarget::AttachmentPoint::COLOR, color)
|
||||
.texture(RenderTarget::AttachmentPoint::DEPTH, depth)
|
||||
.build(*engine);
|
||||
return reinterpret_cast<TRenderTarget *>(rt);
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user