refactor: continual refactor to support multiple render targets

This commit is contained in:
Nick Fisher
2024-09-28 18:28:05 +08:00
parent 767aa88930
commit 22020d8607
51 changed files with 1714 additions and 877 deletions

View File

@@ -3,6 +3,7 @@
#include <filament/Engine.h>
#include <filament/ToneMapper.h>
#include <filament/ColorGrading.h>
#include <filament/Camera.h>
#include "ThermionDartApi.h"
#include "TView.h"
@@ -150,6 +151,11 @@ using namespace filament;
return reinterpret_cast<TScene*>(view->getScene());
}
EMSCRIPTEN_KEEPALIVE TCamera* View_getCamera(TView *tView) {
auto view = reinterpret_cast<View *>(tView);
return reinterpret_cast<TCamera*>(&(view->getCamera()));
}
#ifdef __cplusplus
}

View File

@@ -348,8 +348,13 @@ extern "C"
void (*callback)(void *buf, size_t size, void *data),
void *data)
{
auto swapChain = reinterpret_cast<SwapChain *>(tSwapChain);
auto viewer = reinterpret_cast<FilamentViewer *>(tViewer);
auto swapChain = reinterpret_cast<SwapChain *>(tSwapChain);
if(!swapChain) {
swapChain = viewer->getSwapChainAt(0);
}
auto *view = reinterpret_cast<View*>(tView);
return viewer->render(frameTimeInNanos, view, swapChain, pixelBuffer, callback, data);
}
@@ -413,6 +418,12 @@ extern "C"
return reinterpret_cast<TSwapChain *>(swapChain);
}
EMSCRIPTEN_KEEPALIVE TSwapChain* Viewer_getSwapChainAt(TViewer *tViewer, int index) {
auto viewer = reinterpret_cast<FilamentViewer *>(tViewer);
auto swapChain = viewer->getSwapChainAt(index);
return reinterpret_cast<TSwapChain *>(swapChain);
}
EMSCRIPTEN_KEEPALIVE TView *Viewer_createView(TViewer *tViewer)
{
auto viewer = reinterpret_cast<FilamentViewer *>(tViewer);