move outline material to embedded binary

This commit is contained in:
Nick Fisher
2025-07-01 11:06:51 +08:00
parent 215515a4fc
commit 9a5b737391
12 changed files with 5716 additions and 24 deletions

View File

@@ -17,6 +17,7 @@
#include "material/image.h"
#include "material/grid.h"
#include "material/unlit_fixed_size.h"
#include "material/outline.h"
#include "c_api/TMaterialInstance.h"
@@ -74,6 +75,14 @@ namespace thermion
return reinterpret_cast<TMaterial *>(material);
}
EMSCRIPTEN_KEEPALIVE TMaterial *Material_createOutlineMaterial(TEngine *tEngine) {
auto *engine = reinterpret_cast<filament::Engine *>(tEngine);
auto *material = filament::Material::Builder()
.package(OUTLINE_OUTLINE_DATA, OUTLINE_OUTLINE_SIZE)
.build(*engine);
return reinterpret_cast<TMaterial *>(material);
}
EMSCRIPTEN_KEEPALIVE bool Material_hasParameter(TMaterial *tMaterial, const char *propertyName) {
auto *material = reinterpret_cast<filament::Material *>(tMaterial);
return material->hasParameter(propertyName);

View File

@@ -513,6 +513,17 @@ extern "C"
auto fut = _renderThread->add_task(lambda);
}
EMSCRIPTEN_KEEPALIVE void Material_createOutlineMaterialRenderThread(TEngine *tEngine, void (*onComplete)(TMaterial *))
{
std::packaged_task<void()> lambda(
[=]() mutable
{
auto *instance = Material_createOutlineMaterial(tEngine);
PROXY(onComplete(instance));
});
auto fut = _renderThread->add_task(lambda);
}
EMSCRIPTEN_KEEPALIVE void Material_createInstanceRenderThread(TMaterial *tMaterial, void (*onComplete)(TMaterialInstance *))
{
std::packaged_task<void()> lambda(