commit 5e7e2c9fd433ce4c6e4d16e34bab76650b5b71ef
parent a50229a187661b8ce263d5f1e3eff720bd6be5db
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Mon, 5 Sep 2016 16:30:18 +0200
Keep a copy of the transform applied to object instances.
Needed for world/local basis transforms.
Diffstat:
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/src/ssol_object_instance.c b/src/ssol_object_instance.c
@@ -22,6 +22,7 @@
#include <rsys/rsys.h>
#include <rsys/mem_allocator.h>
#include <rsys/ref_count.h>
+#include <rsys/double33.h>
#include <string.h>
@@ -74,6 +75,8 @@ ssol_object_instantiate
instance->dev = dev;
instance->object = object;
+ d33_set_identity(instance->transform);
+ d3_splat(instance->transform + 9, 0);
instance->target_mask = 0;
str_init(dev->allocator, &instance->receiver_name);
SSOL(object_ref_get(object));
diff --git a/src/ssol_object_instance_c.h b/src/ssol_object_instance_c.h
@@ -25,6 +25,7 @@ struct ssol_object_instance
struct ssol_object* object; /* Instantiated object */
struct s3d_shape* s3d_shape; /* Instantiated Star-3D shape */
struct str receiver_name; /* Empty if not a receiver */
+ double transform[12];
uint32_t target_mask;
struct ssol_device* dev;
@@ -54,6 +55,13 @@ object_instance_get_receiver_name(const struct ssol_object_instance* instance)
? NULL : str_cget(&instance->receiver_name);
}
+static INLINE const double*
+object_instance_get_transform(const struct ssol_object_instance* instance)
+{
+ ASSERT(instance);
+ return instance->transform;
+}
+
static INLINE uint32_t
object_instance_get_target_mask(const struct ssol_object_instance* instance)
{