feat! js_interop improvements

This commit is contained in:
Nick Fisher
2025-05-07 17:06:38 +08:00
parent 63e2dcd0ca
commit 2f16908992
159 changed files with 12989 additions and 8377 deletions

View File

@@ -11,11 +11,8 @@
#include <utils/Panic.h>
#include <utils/Systrace.h>
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#include <emscripten/html5.h>
#include <emscripten/threading.h>
#include <filament/webgl/WebEngine.h>
#include <sys/types.h>
#endif
#include <filament/Box.h>
#include <filament/Camera.h>
@@ -36,6 +33,8 @@
#include "RenderTicker.hpp"
#include <chrono>
namespace thermion
{
@@ -61,16 +60,18 @@ namespace thermion
} else {
mRenderable.emplace_back(swapChain, swapChainViews);
}
TRACE("Set %d views as renderable", numViews);
}
void RenderTicker::render(uint64_t frameTimeInNanos)
{
auto startTime = std::chrono::high_resolution_clock::now();
std::lock_guard lock(mMutex);
for (auto animationManager : mAnimationManagers) {
animationManager->update(frameTimeInNanos);
TRACE("Updated AnimationManager");
}
#ifdef ENABLE_TRACING
@@ -91,6 +92,8 @@ namespace thermion
{
mRenderer->render(view);
}
} else {
Log("Skipping frame");
}
mRenderer->endFrame();
#ifdef ENABLE_TRACING
@@ -103,9 +106,14 @@ namespace thermion
}
#endif
}
#ifdef __EMSCRIPTEN__
_engine->execute();
#endif
#ifdef __EMSCRIPTEN__
mEngine->execute();
#endif
auto endTime = std::chrono::high_resolution_clock::now();
auto durationNs = std::chrono::duration_cast<std::chrono::nanoseconds>(endTime - startTime).count();
float durationMs = durationNs / 1e6f;
TRACE("Total render() time: %.3f ms", durationMs);
}
void RenderTicker::addAnimationManager(AnimationManager* animationManager) {