From 5b80dd3a3d1a30c6f905062ceafd8737c7ff99d3 Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Wed, 5 Mar 2025 14:57:20 +0800 Subject: [PATCH] bounding box geometry doesn't cast/receive shadows --- thermion_dart/lib/src/viewer/src/ffi/src/ffi_asset.dart | 7 +++++-- .../native/src/scene/GeometrySceneAssetBuilder.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/thermion_dart/lib/src/viewer/src/ffi/src/ffi_asset.dart b/thermion_dart/lib/src/viewer/src/ffi/src/ffi_asset.dart index 041df325..22884c74 100644 --- a/thermion_dart/lib/src/viewer/src/ffi/src/ffi_asset.dart +++ b/thermion_dart/lib/src/viewer/src/ffi/src/ffi_asset.dart @@ -263,8 +263,8 @@ class FFIAsset extends ThermionAsset { @override Future setBoundingBoxVisibility(bool visible) async { if (boundingBoxAsset == null) { - final boundingBox = await SceneAsset_getBoundingBox(pointer!); - + final boundingBox = await SceneAsset_getBoundingBox(pointer); + final min = [ boundingBox.centerX - boundingBox.halfExtentX, boundingBox.centerY - boundingBox.halfExtentY, @@ -343,6 +343,9 @@ class FFIAsset extends ThermionAsset { keepData: false, ) as FFIAsset; + await viewer.setCastShadows(boundingBoxAsset!.entity, false); + await viewer.setReceiveShadows(boundingBoxAsset!.entity, false); + TransformManager_setParent(Engine_getTransformManager(engine), boundingBoxAsset!.entity, entity, false); } diff --git a/thermion_dart/native/src/scene/GeometrySceneAssetBuilder.cpp b/thermion_dart/native/src/scene/GeometrySceneAssetBuilder.cpp index 209d8b67..c2079453 100644 --- a/thermion_dart/native/src/scene/GeometrySceneAssetBuilder.cpp +++ b/thermion_dart/native/src/scene/GeometrySceneAssetBuilder.cpp @@ -92,17 +92,17 @@ namespace thermion return nullptr; } - Log("Creating buffers..."); + TRACE("Creating buffers..."); auto [vertexBuffer, indexBuffer] = createBuffers(); if (!vertexBuffer || !indexBuffer) { Log("Failed to create buffers: VB=%p, IB=%p", vertexBuffer, indexBuffer); return nullptr; } - Log("Buffers created successfully: VB=%p, IB=%p", vertexBuffer, indexBuffer); + TRACE("Buffers created successfully: VB=%p, IB=%p", vertexBuffer, indexBuffer); Box boundingBox = computeBoundingBox(); - Log("Computed bounding box: min={%f,%f,%f}, max={%f,%f,%f}", + TRACE("Computed bounding box: min={%f,%f,%f}, max={%f,%f,%f}", boundingBox.getMin().x, boundingBox.getMin().y, boundingBox.getMin().z, boundingBox.getMax().x, boundingBox.getMax().y, boundingBox.getMax().z); @@ -285,7 +285,7 @@ namespace thermion return false; } - Log("Validation passed: vertices=%d, normals=%s, uvs=%d, indices=%d", + TRACE("Validation passed: vertices=%d, normals=%s, uvs=%d, indices=%d", mVertices->size(), (!mNormals->empty() ? "yes" : "no"), mUVs->size(),