This is a breaking change needed to fully implement instancing and stencil highlighting.
Previously, users would work directly with entities (on the Dart side, ThermionEntity), e.g.
final entity = await viewer.loadGlb("some.glb");
However, Filament "entities" are a lower-level abstraction.
Loading a glTF file, for example, inserts multiple entities into the scene.
For example, each mesh, light, and camera within a glTF asset will be assigned an entity. A top-level (non-renderable) entity will also be created for the glTF asset, which can be used to transform the entire hierarchy.
"Asset" is a better representation for loading/inserting objects into the scene; think of this as a bundle of entities.
Unless you need to work directly with transforms, instancing, materials and renderables, you can work directly with ThermionAsset.
42 lines
1.1 KiB
C++
42 lines
1.1 KiB
C++
#include <filament/View.h>
|
|
#include <filament/Engine.h>
|
|
#include <filament/Scene.h>
|
|
|
|
#include "c_api/TGizmo.h"
|
|
#include "scene/Gizmo.hpp"
|
|
#include "Log.hpp"
|
|
|
|
#ifdef __cplusplus
|
|
namespace thermion
|
|
{
|
|
extern "C"
|
|
{
|
|
using namespace filament;
|
|
#endif
|
|
|
|
EMSCRIPTEN_KEEPALIVE void Gizmo_pick(TGizmo *tGizmo, uint32_t x, uint32_t y, GizmoPickCallback callback)
|
|
{
|
|
auto *gizmo = reinterpret_cast<Gizmo *>(tGizmo);
|
|
gizmo->pick(x, y, reinterpret_cast<Gizmo::GizmoPickCallback>(callback));
|
|
}
|
|
|
|
EMSCRIPTEN_KEEPALIVE void Gizmo_highlight(TGizmo *tGizmo, TGizmoAxis tAxis)
|
|
{
|
|
auto *gizmo = reinterpret_cast<Gizmo *>(tGizmo);
|
|
auto axis = static_cast<Gizmo::Axis>(tAxis);
|
|
gizmo->highlight(axis);
|
|
}
|
|
|
|
EMSCRIPTEN_KEEPALIVE void Gizmo_unhighlight(TGizmo *tGizmo)
|
|
{
|
|
auto *gizmo = reinterpret_cast<Gizmo *>(tGizmo);
|
|
gizmo->unhighlight(Gizmo::Axis::X);
|
|
gizmo->unhighlight(Gizmo::Axis::Y);
|
|
gizmo->unhighlight(Gizmo::Axis::Z);
|
|
}
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
}
|
|
#endif
|