summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-06-04 10:15:21 -0600
committerTavian Barnes <tavianator@gmail.com>2010-06-04 10:15:21 -0600
commit4a2dd35a34d456b9164e90b4fb1a06b1d009869f (patch)
treea896e926bebae2e1a64b341b800169f1224df359
parentca7780971fe39c8a7e0e867e0d8bd9f3b5a21e33 (diff)
downloaddimension-4a2dd35a34d456b9164e90b4fb1a06b1d009869f.tar.xz
Rename `precompute' to `init'.
-rw-r--r--libdimension/csg.c32
-rw-r--r--libdimension/dimension/object.h6
-rw-r--r--libdimension/dimension/texture.h4
-rw-r--r--libdimension/object.c18
-rw-r--r--libdimension/raytrace.c2
-rw-r--r--libdimension/texture.c6
6 files changed, 34 insertions, 34 deletions
diff --git a/libdimension/csg.c b/libdimension/csg.c
index 2445abf..eb7f2c5 100644
--- a/libdimension/csg.c
+++ b/libdimension/csg.c
@@ -90,7 +90,7 @@ dmnsn_csg_union_inside_fn(const dmnsn_object *csg, dmnsn_vector point)
}
static void
-dmnsn_csg_union_precompute_fn(dmnsn_object *csg)
+dmnsn_csg_union_init_fn(dmnsn_object *csg)
{
dmnsn_object **params = csg->ptr;
dmnsn_object *A = params[0];
@@ -99,8 +99,8 @@ dmnsn_csg_union_precompute_fn(dmnsn_object *csg)
dmnsn_csg_cascade(csg, A);
dmnsn_csg_cascade(csg, B);
- dmnsn_object_precompute(A);
- dmnsn_object_precompute(B);
+ dmnsn_object_init(A);
+ dmnsn_object_init(B);
csg->trans = dmnsn_identity_matrix();
csg->bounding_box.min
@@ -121,7 +121,7 @@ dmnsn_new_csg_union(dmnsn_object *A, dmnsn_object *B)
csg->ptr = params;
csg->intersection_fn = &dmnsn_csg_union_intersection_fn;
csg->inside_fn = &dmnsn_csg_union_inside_fn;
- csg->precompute_fn = &dmnsn_csg_union_precompute_fn;
+ csg->init_fn = &dmnsn_csg_union_init_fn;
csg->free_fn = &dmnsn_csg_free_fn;
return csg;
@@ -215,7 +215,7 @@ dmnsn_csg_intersection_inside_fn(const dmnsn_object *csg, dmnsn_vector point)
}
static void
-dmnsn_csg_intersection_precompute_fn(dmnsn_object *csg)
+dmnsn_csg_intersection_init_fn(dmnsn_object *csg)
{
dmnsn_object **params = csg->ptr;
dmnsn_object *A = params[0];
@@ -224,8 +224,8 @@ dmnsn_csg_intersection_precompute_fn(dmnsn_object *csg)
dmnsn_csg_cascade(csg, A);
dmnsn_csg_cascade(csg, B);
- dmnsn_object_precompute(A);
- dmnsn_object_precompute(B);
+ dmnsn_object_init(A);
+ dmnsn_object_init(B);
csg->trans = dmnsn_identity_matrix();
csg->bounding_box.min
@@ -246,7 +246,7 @@ dmnsn_new_csg_intersection(dmnsn_object *A, dmnsn_object *B)
csg->ptr = params;
csg->intersection_fn = &dmnsn_csg_intersection_intersection_fn;
csg->inside_fn = &dmnsn_csg_intersection_inside_fn;
- csg->precompute_fn = &dmnsn_csg_intersection_precompute_fn;
+ csg->init_fn = &dmnsn_csg_intersection_init_fn;
csg->free_fn = &dmnsn_csg_free_fn;
return csg;
@@ -271,7 +271,7 @@ dmnsn_csg_difference_inside_fn(const dmnsn_object *csg, dmnsn_vector point)
}
static void
-dmnsn_csg_difference_precompute_fn(dmnsn_object *csg)
+dmnsn_csg_difference_init_fn(dmnsn_object *csg)
{
dmnsn_object **params = csg->ptr;
dmnsn_object *A = params[0];
@@ -280,8 +280,8 @@ dmnsn_csg_difference_precompute_fn(dmnsn_object *csg)
dmnsn_csg_cascade(csg, A);
dmnsn_csg_cascade(csg, B);
- dmnsn_object_precompute(A);
- dmnsn_object_precompute(B);
+ dmnsn_object_init(A);
+ dmnsn_object_init(B);
csg->trans = dmnsn_identity_matrix();
csg->bounding_box = A->bounding_box;
@@ -299,7 +299,7 @@ dmnsn_new_csg_difference(dmnsn_object *A, dmnsn_object *B)
csg->ptr = params;
csg->intersection_fn = &dmnsn_csg_difference_intersection_fn;
csg->inside_fn = &dmnsn_csg_difference_inside_fn;
- csg->precompute_fn = &dmnsn_csg_difference_precompute_fn;
+ csg->init_fn = &dmnsn_csg_difference_init_fn;
csg->free_fn = &dmnsn_csg_free_fn;
return csg;
@@ -324,7 +324,7 @@ dmnsn_csg_merge_inside_fn(const dmnsn_object *csg, dmnsn_vector point)
}
static void
-dmnsn_csg_merge_precompute_fn(dmnsn_object *csg)
+dmnsn_csg_merge_init_fn(dmnsn_object *csg)
{
dmnsn_object **params = csg->ptr;
dmnsn_object *A = params[0];
@@ -333,8 +333,8 @@ dmnsn_csg_merge_precompute_fn(dmnsn_object *csg)
dmnsn_csg_cascade(csg, A);
dmnsn_csg_cascade(csg, B);
- dmnsn_object_precompute(A);
- dmnsn_object_precompute(B);
+ dmnsn_object_init(A);
+ dmnsn_object_init(B);
csg->trans = dmnsn_identity_matrix();
csg->bounding_box.min
@@ -355,7 +355,7 @@ dmnsn_new_csg_merge(dmnsn_object *A, dmnsn_object *B)
csg->ptr = params;
csg->intersection_fn = &dmnsn_csg_merge_intersection_fn;
csg->inside_fn = &dmnsn_csg_merge_inside_fn;
- csg->precompute_fn = &dmnsn_csg_merge_precompute_fn;
+ csg->init_fn = &dmnsn_csg_merge_init_fn;
csg->free_fn = &dmnsn_csg_free_fn;
return csg;
diff --git a/libdimension/dimension/object.h b/libdimension/dimension/object.h
index 3b8768f..11847b0 100644
--- a/libdimension/dimension/object.h
+++ b/libdimension/dimension/object.h
@@ -48,7 +48,7 @@ typedef struct dmnsn_object dmnsn_object;
/* Object callback types */
-typedef void dmnsn_object_precompute_fn(dmnsn_object *object);
+typedef void dmnsn_object_init_fn(dmnsn_object *object);
typedef bool dmnsn_object_intersection_fn(const dmnsn_object *object,
dmnsn_line line,
dmnsn_intersection *intersection);
@@ -70,7 +70,7 @@ struct dmnsn_object {
dmnsn_bounding_box bounding_box;
/* Callback functions */
- dmnsn_object_precompute_fn *precompute_fn;
+ dmnsn_object_init_fn *init_fn;
dmnsn_object_intersection_fn *intersection_fn;
dmnsn_object_inside_fn *inside_fn;
dmnsn_free_fn *free_fn;
@@ -84,6 +84,6 @@ dmnsn_object *dmnsn_new_object();
/* Free an object */
void dmnsn_delete_object(dmnsn_object *object);
-void dmnsn_object_precompute(dmnsn_object *object);
+void dmnsn_object_init(dmnsn_object *object);
#endif /* DIMENSION_OBJECT_H */
diff --git a/libdimension/dimension/texture.h b/libdimension/dimension/texture.h
index 9c5fae1..b2eef05 100644
--- a/libdimension/dimension/texture.h
+++ b/libdimension/dimension/texture.h
@@ -52,7 +52,7 @@ struct dmnsn_pigment {
dmnsn_pigment *dmnsn_new_pigment();
void dmnsn_delete_pigment(dmnsn_pigment *pigment);
-void dmnsn_pigment_precompute(dmnsn_pigment *pigment);
+void dmnsn_pigment_init(dmnsn_pigment *pigment);
/*
* Finishes
@@ -110,6 +110,6 @@ typedef struct {
dmnsn_texture *dmnsn_new_texture();
void dmnsn_delete_texture(dmnsn_texture *texture);
-void dmnsn_texture_precompute(dmnsn_texture *texture);
+void dmnsn_texture_init(dmnsn_texture *texture);
#endif /* DIMENSION_TEXTURE_H */
diff --git a/libdimension/object.c b/libdimension/object.c
index acc0163..a714f6e 100644
--- a/libdimension/object.c
+++ b/libdimension/object.c
@@ -37,11 +37,11 @@ dmnsn_object *
dmnsn_new_object()
{
dmnsn_object *object = dmnsn_malloc(sizeof(dmnsn_object));
- object->texture = NULL;
- object->interior = NULL;
- object->trans = dmnsn_identity_matrix();
- object->precompute_fn = NULL;
- object->free_fn = NULL;
+ object->texture = NULL;
+ object->interior = NULL;
+ object->trans = dmnsn_identity_matrix();
+ object->init_fn = NULL;
+ object->free_fn = NULL;
return object;
}
@@ -61,10 +61,10 @@ dmnsn_delete_object(dmnsn_object *object)
/* Precompute object properties */
void
-dmnsn_object_precompute(dmnsn_object *object)
+dmnsn_object_init(dmnsn_object *object)
{
- if (object->precompute_fn) {
- (*object->precompute_fn)(object);
+ if (object->init_fn) {
+ (*object->init_fn)(object);
}
object->bounding_box
@@ -74,6 +74,6 @@ dmnsn_object_precompute(dmnsn_object *object)
if (object->texture) {
object->texture->trans
= dmnsn_matrix_mul(object->trans, object->texture->trans);
- dmnsn_texture_precompute(object->texture);
+ dmnsn_texture_init(object->texture);
}
}
diff --git a/libdimension/raytrace.c b/libdimension/raytrace.c
index 8adde41..e10a7c0 100644
--- a/libdimension/raytrace.c
+++ b/libdimension/raytrace.c
@@ -78,7 +78,7 @@ dmnsn_raytrace_scene_thread(void *ptr)
/* Pre-calculate bounding box transformations, etc. */
DMNSN_ARRAY_FOREACH (dmnsn_object **, object, payload->scene->objects) {
- dmnsn_object_precompute(*object);
+ dmnsn_object_init(*object);
}
payload->prtree = dmnsn_new_prtree(payload->scene->objects);
diff --git a/libdimension/texture.c b/libdimension/texture.c
index 93279bb..0ca5b98 100644
--- a/libdimension/texture.c
+++ b/libdimension/texture.c
@@ -45,7 +45,7 @@ dmnsn_delete_pigment(dmnsn_pigment *pigment)
/* Precompute pigment properties */
void
-dmnsn_pigment_precompute(dmnsn_pigment *pigment)
+dmnsn_pigment_init(dmnsn_pigment *pigment)
{
pigment->trans_inv = dmnsn_matrix_inverse(pigment->trans);
}
@@ -106,12 +106,12 @@ dmnsn_delete_texture(dmnsn_texture *texture)
/* Calculate matrix inverses */
void
-dmnsn_texture_precompute(dmnsn_texture *texture)
+dmnsn_texture_init(dmnsn_texture *texture)
{
texture->trans_inv = dmnsn_matrix_inverse(texture->trans);
if (texture->pigment) {
texture->pigment->trans
= dmnsn_matrix_mul(texture->trans, texture->pigment->trans);
- dmnsn_pigment_precompute(texture->pigment);
+ dmnsn_pigment_init(texture->pigment);
}
}