commit 9b5846ee7e1a811d47e59955d59c63a625c15919
parent c8327dc41e5d221c1f3dbf233888510866551b88
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Mon, 27 Feb 2017 14:50:07 +0100
Fix the scene view synchronisation
No "update" was notify to embree when the cached instantiated geometry was
updated.
Diffstat:
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/s3d_scene_view.c b/src/s3d_scene_view.c
@@ -221,7 +221,14 @@ embree_geometry_register
ASSERT(scnview && geom && (geom->type==GEOM_MESH || geom->type==GEOM_INSTANCE));
/* Create the Embree geometry if it is not valid */
- if(geom->irtc == RTC_INVALID_GEOMETRY_ID) {
+ if(geom->irtc != RTC_INVALID_GEOMETRY_ID) {
+ if(geom->type == GEOM_INSTANCE) {
+ /* If the geometry is an instance one have to update it if the
+ * instantiated geometry was updated. Currently, we have no simple way to
+ * know if the geometry was upd or not so we simply force the update. */
+ rtcUpdate(scnview->rtc_scn, geom->irtc);
+ }
+ } else {
switch(geom->type) {
case GEOM_MESH:
geom->irtc = rtcNewTriangleMesh(scnview->rtc_scn, RTC_GEOMETRY_DYNAMIC,
@@ -312,9 +319,9 @@ embree_geometry_setup_transform
geom->irtc,
RTC_MATRIX_COLUMN_MAJOR,
geom->data.instance->transform);
+ rtcUpdate(scnview->rtc_scn, geom->irtc);
}
-
static INLINE res_T
scene_view_setup_embree(struct s3d_scene_view* scnview)
{