From 7ecf414a472a3fea9c9e9eff78c353281e7bc693 Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Thu, 26 Sep 2024 15:52:50 +0800 Subject: [PATCH] feat: set camera model matrix directly --- thermion_dart/native/include/ThermionDartApi.h | 1 + thermion_dart/native/src/ThermionDartApi.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/thermion_dart/native/include/ThermionDartApi.h b/thermion_dart/native/include/ThermionDartApi.h index a6183b05..1ef8d712 100644 --- a/thermion_dart/native/include/ThermionDartApi.h +++ b/thermion_dart/native/include/ThermionDartApi.h @@ -232,6 +232,7 @@ extern "C" EMSCRIPTEN_KEEPALIVE void set_camera_manipulator_options(TViewer *viewer, _ManipulatorMode mode, double orbitSpeedX, double orbitSpeedY, double zoomSpeed); EMSCRIPTEN_KEEPALIVE void Camera_setCustomProjectionWithCulling(TCamera* camera, double4x4 projectionMatrix, double near, double far); + EMSCRIPTEN_KEEPALIVE void Camera_setModelMatrix(TCamera* camera, double4x4 modelMatrix); EMSCRIPTEN_KEEPALIVE void Camera_setLensProjection(TCamera *camera, double near, double far, double aspect, double focalLength); EMSCRIPTEN_KEEPALIVE double4x4 Camera_getModelMatrix(TCamera* camera); EMSCRIPTEN_KEEPALIVE EntityId Camera_getEntity(TCamera* camera); diff --git a/thermion_dart/native/src/ThermionDartApi.cpp b/thermion_dart/native/src/ThermionDartApi.cpp index e1b34ccd..10c2b7f9 100644 --- a/thermion_dart/native/src/ThermionDartApi.cpp +++ b/thermion_dart/native/src/ThermionDartApi.cpp @@ -283,6 +283,12 @@ extern "C" cam->setLensProjection(focalLength, aspect, near, far); } + void Camera_setModelMatrix(TCamera *camera, double4x4 matrix) + { + auto cam = reinterpret_cast(camera); + cam->setModelMatrix(convert_double4x4_to_mat4(matrix)); + } + double get_camera_near(TCamera *camera) { auto cam = reinterpret_cast(camera);