summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-11-22 00:10:03 -0500
committerTavian Barnes <tavianator@gmail.com>2010-11-22 00:10:03 -0500
commit8054e510b83702b931f3b81bb1e1385f9a7ecb80 (patch)
tree6fbe806c69f227e0fa60bbbc9919d884a7d03f84
parentd47af986a7832add1c149235f44fa8f57b56e6d8 (diff)
downloaddimension-8054e510b83702b931f3b81bb1e1385f9a7ecb80.tar.xz
Rename dmnsn_*_init() to dmnsn_initialize_*().
-rw-r--r--bench/libdimension/prtree.c2
-rw-r--r--libdimension/color_map.c12
-rw-r--r--libdimension/csg.c30
-rw-r--r--libdimension/dimension/object.h6
-rw-r--r--libdimension/dimension/pattern.h2
-rw-r--r--libdimension/dimension/scene.h2
-rw-r--r--libdimension/dimension/sky_sphere.h2
-rw-r--r--libdimension/dimension/texture.h14
-rw-r--r--libdimension/object.c22
-rw-r--r--libdimension/pattern.c2
-rw-r--r--libdimension/raytrace.c2
-rw-r--r--libdimension/scene.c6
-rw-r--r--libdimension/sky_sphere.c4
-rw-r--r--libdimension/texture.c20
-rw-r--r--tests/libdimension/prtree.c2
15 files changed, 65 insertions, 63 deletions
diff --git a/bench/libdimension/prtree.c b/bench/libdimension/prtree.c
index c6888ae..6b0bfdf 100644
--- a/bench/libdimension/prtree.c
+++ b/bench/libdimension/prtree.c
@@ -77,7 +77,7 @@ main(void)
dmnsn_array *objects = dmnsn_new_array(sizeof(dmnsn_object *));
for (size_t i = 0; i < nobjects; ++i) {
dmnsn_object *object = dmnsn_new_fake_object();
- dmnsn_object_init(object);
+ dmnsn_initialize_object(object);
dmnsn_array_push(objects, &object);
}
diff --git a/libdimension/color_map.c b/libdimension/color_map.c
index 4cfaf75..c794374 100644
--- a/libdimension/color_map.c
+++ b/libdimension/color_map.c
@@ -113,12 +113,12 @@ dmnsn_color_map_pigment_fn(const dmnsn_pigment *pigment, dmnsn_vector v)
/** color_map initialization callback. */
static void
-dmnsn_color_map_init_fn(dmnsn_pigment *pigment)
+dmnsn_color_map_initialize_fn(dmnsn_pigment *pigment)
{
dmnsn_color_map_payload *payload = pigment->ptr;
payload->pattern->trans = dmnsn_matrix_mul(pigment->trans,
payload->pattern->trans);
- dmnsn_pattern_init(payload->pattern);
+ dmnsn_initialize_pattern(payload->pattern);
}
dmnsn_pigment *
@@ -131,9 +131,9 @@ dmnsn_new_color_map_pigment(dmnsn_pattern *pattern, dmnsn_color_map *map)
payload->pattern = pattern;
payload->map = map;
- pigment->pigment_fn = &dmnsn_color_map_pigment_fn;
- pigment->init_fn = &dmnsn_color_map_init_fn;
- pigment->free_fn = &dmnsn_delete_color_map_payload;
- pigment->ptr = payload;
+ pigment->pigment_fn = &dmnsn_color_map_pigment_fn;
+ pigment->initialize_fn = &dmnsn_color_map_initialize_fn;
+ pigment->free_fn = &dmnsn_delete_color_map_payload;
+ pigment->ptr = payload;
return pigment;
}
diff --git a/libdimension/csg.c b/libdimension/csg.c
index ff45158..804e71c 100644
--- a/libdimension/csg.c
+++ b/libdimension/csg.c
@@ -67,11 +67,11 @@ dmnsn_csg_union_inside_fn(const dmnsn_object *csg, dmnsn_vector point)
/** CSG union initialization callback. */
static void
-dmnsn_csg_union_init_fn(dmnsn_object *csg)
+dmnsn_csg_union_initialize_fn(dmnsn_object *csg)
{
DMNSN_ARRAY_FOREACH (dmnsn_object **, child, csg->children) {
dmnsn_csg_cascade(csg, *child);
- dmnsn_object_init(*child);
+ dmnsn_initialize_object(*child);
}
csg->trans = dmnsn_identity_matrix();
@@ -99,7 +99,7 @@ dmnsn_new_csg_union(const dmnsn_array *objects)
csg->intersection_fn = &dmnsn_csg_union_intersection_fn;
csg->inside_fn = &dmnsn_csg_union_inside_fn;
- csg->init_fn = &dmnsn_csg_union_init_fn;
+ csg->initialize_fn = &dmnsn_csg_union_initialize_fn;
csg->free_fn = &dmnsn_csg_union_free_fn;
return csg;
@@ -212,7 +212,7 @@ dmnsn_csg_intersection_inside_fn(const dmnsn_object *csg, dmnsn_vector point)
/** CSG intersection initialization callback. */
static void
-dmnsn_csg_intersection_init_fn(dmnsn_object *csg)
+dmnsn_csg_intersection_initialize_fn(dmnsn_object *csg)
{
dmnsn_object **params = csg->ptr;
dmnsn_object *A = params[0];
@@ -221,8 +221,8 @@ dmnsn_csg_intersection_init_fn(dmnsn_object *csg)
dmnsn_csg_cascade(csg, A);
dmnsn_csg_cascade(csg, B);
- dmnsn_object_init(A);
- dmnsn_object_init(B);
+ dmnsn_initialize_object(A);
+ dmnsn_initialize_object(B);
csg->trans = dmnsn_identity_matrix();
csg->bounding_box.min
@@ -243,7 +243,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->init_fn = &dmnsn_csg_intersection_init_fn;
+ csg->initialize_fn = &dmnsn_csg_intersection_initialize_fn;
csg->free_fn = &dmnsn_csg_free_fn;
return csg;
@@ -273,7 +273,7 @@ dmnsn_csg_difference_inside_fn(const dmnsn_object *csg, dmnsn_vector point)
/** CSG difference initialization callback. */
static void
-dmnsn_csg_difference_init_fn(dmnsn_object *csg)
+dmnsn_csg_difference_initialize_fn(dmnsn_object *csg)
{
dmnsn_object **params = csg->ptr;
dmnsn_object *A = params[0];
@@ -282,8 +282,8 @@ dmnsn_csg_difference_init_fn(dmnsn_object *csg)
dmnsn_csg_cascade(csg, A);
dmnsn_csg_cascade(csg, B);
- dmnsn_object_init(A);
- dmnsn_object_init(B);
+ dmnsn_initialize_object(A);
+ dmnsn_initialize_object(B);
csg->trans = dmnsn_identity_matrix();
csg->bounding_box = A->bounding_box;
@@ -301,7 +301,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->init_fn = &dmnsn_csg_difference_init_fn;
+ csg->initialize_fn = &dmnsn_csg_difference_initialize_fn;
csg->free_fn = &dmnsn_csg_free_fn;
return csg;
@@ -331,7 +331,7 @@ dmnsn_csg_merge_inside_fn(const dmnsn_object *csg, dmnsn_vector point)
/** CSG merge initialization callback. */
static void
-dmnsn_csg_merge_init_fn(dmnsn_object *csg)
+dmnsn_csg_merge_initialize_fn(dmnsn_object *csg)
{
dmnsn_object **params = csg->ptr;
dmnsn_object *A = params[0];
@@ -340,8 +340,8 @@ dmnsn_csg_merge_init_fn(dmnsn_object *csg)
dmnsn_csg_cascade(csg, A);
dmnsn_csg_cascade(csg, B);
- dmnsn_object_init(A);
- dmnsn_object_init(B);
+ dmnsn_initialize_object(A);
+ dmnsn_initialize_object(B);
csg->trans = dmnsn_identity_matrix();
csg->bounding_box.min
@@ -362,7 +362,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->init_fn = &dmnsn_csg_merge_init_fn;
+ csg->initialize_fn = &dmnsn_csg_merge_initialize_fn;
csg->free_fn = &dmnsn_csg_free_fn;
return csg;
diff --git a/libdimension/dimension/object.h b/libdimension/dimension/object.h
index 2ee4b67..267a515 100644
--- a/libdimension/dimension/object.h
+++ b/libdimension/dimension/object.h
@@ -49,7 +49,7 @@ typedef struct dmnsn_object dmnsn_object;
* Object initialization callback.
* @param[in,out] object The object to initialize.
*/
-typedef void dmnsn_object_init_fn(dmnsn_object *object);
+typedef void dmnsn_object_initialize_fn(dmnsn_object *object);
/**
* Ray-object intersection callback.
@@ -86,7 +86,7 @@ struct dmnsn_object {
sub-objects for bounding purposes (for unions and meshes, for example). */
dmnsn_array *children;
- dmnsn_object_init_fn *init_fn; /**< Initialization callback. */
+ dmnsn_object_initialize_fn *initialize_fn; /**< Initialization callback. */
dmnsn_object_intersection_fn *intersection_fn; /**< Intersection callback. */
dmnsn_object_inside_fn *inside_fn; /**< Inside callback. */
dmnsn_free_fn *free_fn; /**< Destruction callback. */
@@ -111,7 +111,7 @@ void dmnsn_delete_object(dmnsn_object *object);
* Initialize an object and potentially its children.
* @param[in,out] object The object to initialize.
*/
-void dmnsn_object_init(dmnsn_object *object);
+void dmnsn_initialize_object(dmnsn_object *object);
/**
* Appropriately transform a ray, then test for an intersection.
diff --git a/libdimension/dimension/pattern.h b/libdimension/dimension/pattern.h
index a696f7a..4a4aa33 100644
--- a/libdimension/dimension/pattern.h
+++ b/libdimension/dimension/pattern.h
@@ -68,7 +68,7 @@ void dmnsn_delete_pattern(dmnsn_pattern *pattern);
* initialized for you.
* @param[in,out] pattern The pattern to initialize.
*/
-void dmnsn_pattern_init(dmnsn_pattern *pattern);
+void dmnsn_initialize_pattern(dmnsn_pattern *pattern);
/**
* Invoke the pattern callback with the right transformation.
diff --git a/libdimension/dimension/scene.h b/libdimension/dimension/scene.h
index 0889359..17c5238 100644
--- a/libdimension/dimension/scene.h
+++ b/libdimension/dimension/scene.h
@@ -90,6 +90,6 @@ void dmnsn_delete_scene(dmnsn_scene *scene);
* Initialize a scene.
* @param[in,out] scene The scene to initalize.
*/
-void dmnsn_scene_init(dmnsn_scene *scene);
+void dmnsn_initialize_scene(dmnsn_scene *scene);
#endif /* DIMENSION_SCENE_H */
diff --git a/libdimension/dimension/sky_sphere.h b/libdimension/dimension/sky_sphere.h
index 5edacb0..f74442e 100644
--- a/libdimension/dimension/sky_sphere.h
+++ b/libdimension/dimension/sky_sphere.h
@@ -49,7 +49,7 @@ void dmnsn_delete_sky_sphere(dmnsn_sky_sphere *sky_sphere);
* Initialize a sky sphere.
* @param[in,out] sky_sphere The sky sphere to initialize.
*/
-void dmnsn_sky_sphere_init(dmnsn_sky_sphere *sky_sphere);
+void dmnsn_initialize_sky_sphere(dmnsn_sky_sphere *sky_sphere);
/**
* Evaluate the color of the sky sphere.
diff --git a/libdimension/dimension/texture.h b/libdimension/dimension/texture.h
index 646f4b1..0398abc 100644
--- a/libdimension/dimension/texture.h
+++ b/libdimension/dimension/texture.h
@@ -46,13 +46,13 @@ typedef dmnsn_color dmnsn_pigment_fn(const dmnsn_pigment *pigment,
* Pigment initializer callback.
* @param[in,out] pigment The pigment to initialize.
*/
-typedef void dmnsn_pigment_init_fn(dmnsn_pigment *pigment);
+typedef void dmnsn_pigment_initialize_fn(dmnsn_pigment *pigment);
/** A pigment. */
struct dmnsn_pigment {
- dmnsn_pigment_fn *pigment_fn; /**< The pigment callback. */
- dmnsn_pigment_init_fn *init_fn; /**< The initializer callback. */
- dmnsn_free_fn *free_fn; /**< The destructor callback. */
+ dmnsn_pigment_fn *pigment_fn; /**< The pigment callback. */
+ dmnsn_pigment_initialize_fn *initialize_fn; /**< The initializer callback. */
+ dmnsn_free_fn *free_fn; /**< The destructor callback. */
dmnsn_matrix trans; /**< Transformation matrix. */
dmnsn_matrix trans_inv; /**< The inverse of the transformation matrix. */
@@ -82,7 +82,7 @@ void dmnsn_delete_pigment(dmnsn_pigment *pigment);
* initialized for you.
* @param[in,out] pigment The pigment to initialize.
*/
-void dmnsn_pigment_init(dmnsn_pigment *pigment);
+void dmnsn_initialize_pigment(dmnsn_pigment *pigment);
/*
* Finishes
@@ -175,7 +175,7 @@ typedef struct {
dmnsn_matrix trans_inv; /**< The inverse of the transformation matrix. */
unsigned int *refcount; /**< @internal Reference count. */
- bool should_init; /**< @internal Whether to init the texture. */
+ bool should_init; /**< @internal Whether to initialize the texture. */
} dmnsn_texture;
/**
@@ -196,6 +196,6 @@ void dmnsn_delete_texture(dmnsn_texture *texture);
* initialized for you.
* @param[in,out] texture The texture to initialize.
*/
-void dmnsn_texture_init(dmnsn_texture *texture);
+void dmnsn_initialize_texture(dmnsn_texture *texture);
#endif /* DIMENSION_TEXTURE_H */
diff --git a/libdimension/object.c b/libdimension/object.c
index 5914b46..66cbd78 100644
--- a/libdimension/object.c
+++ b/libdimension/object.c
@@ -31,12 +31,14 @@ 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->children = dmnsn_new_array(sizeof(dmnsn_object *));
- object->init_fn = NULL;
- object->free_fn = NULL;
+ object->texture = NULL;
+ object->interior = NULL;
+ object->trans = dmnsn_identity_matrix();
+ object->children = dmnsn_new_array(sizeof(dmnsn_object *));
+ object->intersection_fn = NULL;
+ object->inside_fn = NULL;
+ object->initialize_fn = NULL;
+ object->free_fn = NULL;
return object;
}
@@ -60,7 +62,7 @@ dmnsn_delete_object(dmnsn_object *object)
/* Precompute object properties */
void
-dmnsn_object_init(dmnsn_object *object)
+dmnsn_initialize_object(dmnsn_object *object)
{
/* Don't double-init textures */
bool should_init = false;
@@ -70,8 +72,8 @@ dmnsn_object_init(dmnsn_object *object)
object->texture->should_init = false;
}
- if (object->init_fn) {
- (*object->init_fn)(object);
+ if (object->initialize_fn) {
+ (*object->initialize_fn)(object);
}
object->bounding_box
@@ -82,7 +84,7 @@ dmnsn_object_init(dmnsn_object *object)
/* Transform the texture with the object */
object->texture->trans
= dmnsn_matrix_mul(old_trans, object->texture->trans);
- dmnsn_texture_init(object->texture);
+ dmnsn_initialize_texture(object->texture);
}
}
diff --git a/libdimension/pattern.c b/libdimension/pattern.c
index 9e8dacb..073456d 100644
--- a/libdimension/pattern.c
+++ b/libdimension/pattern.c
@@ -47,7 +47,7 @@ dmnsn_delete_pattern(dmnsn_pattern *pattern)
/* Precompute the transformation matrix inverse */
void
-dmnsn_pattern_init(dmnsn_pattern *pattern)
+dmnsn_initialize_pattern(dmnsn_pattern *pattern)
{
pattern->trans_inv = dmnsn_matrix_inverse(pattern->trans);
}
diff --git a/libdimension/raytrace.c b/libdimension/raytrace.c
index 3534331..9d330ab 100644
--- a/libdimension/raytrace.c
+++ b/libdimension/raytrace.c
@@ -78,7 +78,7 @@ dmnsn_raytrace_scene_thread(void *ptr)
dmnsn_raytrace_payload *payload = ptr;
/* Pre-calculate bounding box transformations, etc. */
- dmnsn_scene_init(payload->scene);
+ dmnsn_initialize_scene(payload->scene);
/* Time the bounding tree construction */
payload->scene->bounding_timer = dmnsn_new_timer();
diff --git a/libdimension/scene.c b/libdimension/scene.c
index c43a93a..42936cd 100644
--- a/libdimension/scene.c
+++ b/libdimension/scene.c
@@ -75,13 +75,13 @@ dmnsn_delete_scene(dmnsn_scene *scene)
}
void
-dmnsn_scene_init(dmnsn_scene *scene)
+dmnsn_initialize_scene(dmnsn_scene *scene)
{
if (scene->sky_sphere) {
- dmnsn_sky_sphere_init(scene->sky_sphere);
+ dmnsn_initialize_sky_sphere(scene->sky_sphere);
}
DMNSN_ARRAY_FOREACH (dmnsn_object **, object, scene->objects) {
- dmnsn_object_init(*object);
+ dmnsn_initialize_object(*object);
}
}
diff --git a/libdimension/sky_sphere.c b/libdimension/sky_sphere.c
index bb38c16..2223b10 100644
--- a/libdimension/sky_sphere.c
+++ b/libdimension/sky_sphere.c
@@ -46,11 +46,11 @@ dmnsn_delete_sky_sphere(dmnsn_sky_sphere *sky_sphere)
}
void
-dmnsn_sky_sphere_init(dmnsn_sky_sphere *sky_sphere)
+dmnsn_initialize_sky_sphere(dmnsn_sky_sphere *sky_sphere)
{
DMNSN_ARRAY_FOREACH (dmnsn_pigment **, pigment, sky_sphere->pigments) {
(*pigment)->trans = dmnsn_matrix_mul(sky_sphere->trans, (*pigment)->trans);
- dmnsn_pigment_init(*pigment);
+ dmnsn_initialize_pigment(*pigment);
}
}
diff --git a/libdimension/texture.c b/libdimension/texture.c
index f69f748..e925adb 100644
--- a/libdimension/texture.c
+++ b/libdimension/texture.c
@@ -31,11 +31,11 @@ dmnsn_pigment *
dmnsn_new_pigment()
{
dmnsn_pigment *pigment = dmnsn_malloc(sizeof(dmnsn_pigment));
- pigment->pigment_fn = NULL;
- pigment->init_fn = NULL;
- pigment->free_fn = NULL;
- pigment->trans = dmnsn_identity_matrix();
- pigment->quick_color = dmnsn_black;
+ pigment->pigment_fn = NULL;
+ pigment->initialize_fn = NULL;
+ pigment->free_fn = NULL;
+ pigment->trans = dmnsn_identity_matrix();
+ pigment->quick_color = dmnsn_black;
return pigment;
}
@@ -53,10 +53,10 @@ dmnsn_delete_pigment(dmnsn_pigment *pigment)
/* Precompute pigment properties */
void
-dmnsn_pigment_init(dmnsn_pigment *pigment)
+dmnsn_initialize_pigment(dmnsn_pigment *pigment)
{
- if (pigment->init_fn) {
- (*pigment->init_fn)(pigment);
+ if (pigment->initialize_fn) {
+ (*pigment->initialize_fn)(pigment);
}
pigment->trans_inv = dmnsn_matrix_inverse(pigment->trans);
@@ -119,12 +119,12 @@ dmnsn_delete_texture(dmnsn_texture *texture)
/* Calculate matrix inverses */
void
-dmnsn_texture_init(dmnsn_texture *texture)
+dmnsn_initialize_texture(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_init(texture->pigment);
+ dmnsn_initialize_pigment(texture->pigment);
}
}
diff --git a/tests/libdimension/prtree.c b/tests/libdimension/prtree.c
index e8e9953..ffb75bd 100644
--- a/tests/libdimension/prtree.c
+++ b/tests/libdimension/prtree.c
@@ -64,7 +64,7 @@ main(void)
dmnsn_object *object = dmnsn_new_object();
dmnsn_randomize_bounding_box(object);
object->intersection_fn = &dmnsn_fake_intersection_fn;
- dmnsn_object_init(object);
+ dmnsn_initialize_object(object);
dmnsn_array_push(scene->objects, &object);
}