commit 1ccc9fb447914e2f9c28062687c625f5baa19764
parent be44f8b9f6bfd80bb7ae3b3badfb17fcf3a2dbee
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Mon, 18 Jul 2016 14:18:31 +0200
Rm the ssol_object_instance_set_receiver_image function
Diffstat:
6 files changed, 8 insertions(+), 45 deletions(-)
diff --git a/src/ssol.h b/src/ssol.h
@@ -419,12 +419,6 @@ ssol_object_instance_set_receiver
const char* name);
SSOL_API res_T
-ssol_object_instance_set_receiver_image
- (struct ssol_object_instance* instance,
- struct ssol_image* image,
- const enum ssol_parametrization_type type);
-
-SSOL_API res_T
ssol_object_instance_is_attached
(struct ssol_object_instance* instance,
char* is_attached);
diff --git a/src/ssol_object_instance.c b/src/ssol_object_instance.c
@@ -38,7 +38,6 @@ object_instance_release(ref_T* ref)
dev = instance->dev;
ASSERT(dev && dev->allocator);
SSOL(object_ref_put(instance->object));
- if (instance->image) SSOL(image_ref_put(instance->image));
MEM_RM(dev->allocator, instance->receiver_name);
MEM_RM(dev->allocator, instance);
SSOL(device_ref_put(dev));
@@ -55,8 +54,9 @@ ssol_object_instantiate
struct ssol_object_instance* instance = NULL;
struct ssol_device* dev;
res_T res = RES_OK;
- if (!object || !object->dev || !out_instance) {
- return RES_BAD_ARG;
+ if (!object || !out_instance) {
+ res = RES_BAD_ARG;
+ goto error;
}
dev = object->dev;
@@ -130,26 +130,6 @@ ssol_object_instance_set_receiver
instance->receiver_name = MEM_ALLOC(instance->dev->allocator, strlen(name) + 1);
if (!instance->receiver_name) return RES_MEM_ERR;
strcpy(instance->receiver_name, name);
-
- return RES_OK;
-}
-
-res_T
-ssol_object_instance_set_receiver_image
- (struct ssol_object_instance* instance,
- struct ssol_image* image,
- const enum ssol_parametrization_type type)
-{
- if(!instance
- || !image
- || ( type != SSOL_PARAMETRIZATION_TEXCOORD
- && type != SSOL_PARAMETRIZATION_PRIMITIVE_ID))
- return RES_BAD_ARG;
-
- if (instance->image) SSOL(image_ref_put(instance->image));
- SSOL(image_ref_get(image));
- instance->image = image;
- instance->param_type = type;
return RES_OK;
}
diff --git a/src/ssol_object_instance_c.h b/src/ssol_object_instance_c.h
@@ -20,10 +20,9 @@
#include <rsys/list.h>
struct ssol_object_instance {
- struct ssol_object* object;
- double transform[12];
- struct ssol_image* image;
- enum ssol_parametrization_type param_type;
+ struct ssol_object* object; /* Instantiated object */
+ double transform[12]; /* Object to world 3x4 column major affine transform */
+
struct list_node scene_attachment;
char* receiver_name; /* NULL if not a receiver */
diff --git a/src/ssol_scene_c.h b/src/ssol_scene_c.h
@@ -30,3 +30,4 @@ struct ssol_scene {
};
#endif /* SSOL_SCENE_C_H */
+
diff --git a/src/ssol_shape.c b/src/ssol_shape.c
@@ -327,3 +327,4 @@ ssol_mesh_setup
MEM_RM(shape->dev->allocator, attrib3);
return res;
}
+
diff --git a/src/test_ssol_object_instance.c b/src/test_ssol_object_instance.c
@@ -27,7 +27,6 @@ main(int argc, char** argv)
struct ssol_shape* shape;
struct ssol_material* material;
struct ssol_object* object;
- struct ssol_image* image;
struct ssol_object_instance* instance;
double transform[12];
(void) argc, (void) argv;
@@ -62,19 +61,8 @@ main(int argc, char** argv)
CHECK(ssol_object_instance_set_receiver(instance, NULL), RES_BAD_ARG);
CHECK(ssol_object_instance_set_receiver(instance, "receiver 1"), RES_OK);
- CHECK(ssol_image_create(dev, &image), RES_OK);
- CHECK(ssol_object_instance_set_receiver_image
- (NULL, image, SSOL_PARAMETRIZATION_PRIMITIVE_ID), RES_BAD_ARG);
- CHECK(ssol_object_instance_set_receiver_image
- (instance, NULL, SSOL_PARAMETRIZATION_PRIMITIVE_ID), RES_BAD_ARG);
- CHECK(ssol_object_instance_set_receiver_image
- (instance, image, (enum ssol_parametrization_type)999), RES_BAD_ARG);
- CHECK(ssol_object_instance_set_receiver_image
- (instance, image, SSOL_PARAMETRIZATION_PRIMITIVE_ID), RES_OK);
-
CHECK(ssol_object_instance_ref_put(instance), RES_OK);
- CHECK(ssol_image_ref_put(image), RES_OK);
CHECK(ssol_object_ref_put(object), RES_OK);
CHECK(ssol_shape_ref_put(shape), RES_OK);
CHECK(ssol_material_ref_put(material), RES_OK);