diff options
author | Tavian Barnes <tavianator@gmail.com> | 2011-10-19 13:59:24 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2011-10-30 18:11:22 -0400 |
commit | 8e3a7158ecae541692826e7b5998c8ffc810173a (patch) | |
tree | beda4f9f8604f77d0513d5fb02b7ddf53d203d09 /libdimension/dimension | |
parent | e9810a7b1aae15320e58371b657a2f963562834d (diff) | |
download | dimension-8e3a7158ecae541692826e7b5998c8ffc810173a.tar.xz |
Make API more consistent.
Object methods should be dmnsn_<object>_<fn>().
Diffstat (limited to 'libdimension/dimension')
-rw-r--r-- | libdimension/dimension/canvas.h | 10 | ||||
-rw-r--r-- | libdimension/dimension/map.h | 4 | ||||
-rw-r--r-- | libdimension/dimension/object.h | 2 | ||||
-rw-r--r-- | libdimension/dimension/pigment.h | 4 | ||||
-rw-r--r-- | libdimension/dimension/polynomial.h | 8 | ||||
-rw-r--r-- | libdimension/dimension/raytrace.h | 6 | ||||
-rw-r--r-- | libdimension/dimension/refcount.h | 9 | ||||
-rw-r--r-- | libdimension/dimension/scene.h | 2 | ||||
-rw-r--r-- | libdimension/dimension/texture.h | 2 | ||||
-rw-r--r-- | libdimension/dimension/timer.h | 4 |
10 files changed, 21 insertions, 30 deletions
diff --git a/libdimension/dimension/canvas.h b/libdimension/dimension/canvas.h index 39e159b..48a64c1 100644 --- a/libdimension/dimension/canvas.h +++ b/libdimension/dimension/canvas.h @@ -84,7 +84,7 @@ void dmnsn_delete_canvas(dmnsn_canvas *canvas); * @param[in,out] canvas The canvas to optimize. * @param[in] optimizer The optimizer to use. */ -void dmnsn_optimize_canvas(dmnsn_canvas *canvas, +void dmnsn_canvas_optimize(dmnsn_canvas *canvas, dmnsn_canvas_optimizer optimizer); /* Pixel accessors */ @@ -97,7 +97,7 @@ void dmnsn_optimize_canvas(dmnsn_canvas *canvas, * @return The color of the canvas at (\p x, \p y). */ DMNSN_INLINE dmnsn_color -dmnsn_get_pixel(const dmnsn_canvas *canvas, size_t x, size_t y) +dmnsn_canvas_get_pixel(const dmnsn_canvas *canvas, size_t x, size_t y) { dmnsn_assert(x < canvas->width && y < canvas->height, "Canvas access out of bounds."); @@ -111,12 +111,12 @@ dmnsn_get_pixel(const dmnsn_canvas *canvas, size_t x, size_t y) * @param[in] y The y coordinate of the pixel. * @param[in] color The color to set the pixel at (\p x, \p y) to. */ -void dmnsn_set_pixel(dmnsn_canvas *canvas, size_t x, size_t y, - dmnsn_color color); +void dmnsn_canvas_set_pixel(dmnsn_canvas *canvas, size_t x, size_t y, + dmnsn_color color); /** * Clear a canvas uniformly with a given color. * @param[in,out] canvas The canvas to erase. * @param[in] color The color to paint it with. */ -void dmnsn_clear_canvas(dmnsn_canvas *canvas, dmnsn_color color); +void dmnsn_canvas_clear(dmnsn_canvas *canvas, dmnsn_color color); diff --git a/libdimension/dimension/map.h b/libdimension/dimension/map.h index 0355557..7e12e7e 100644 --- a/libdimension/dimension/map.h +++ b/libdimension/dimension/map.h @@ -49,7 +49,7 @@ void dmnsn_delete_map(dmnsn_map *map); * @param[in] n The index of the entry. * @param[in] obj The value of the entry. */ -void dmnsn_add_map_entry(dmnsn_map *map, double n, const void *obj); +void dmnsn_map_add_entry(dmnsn_map *map, double n, const void *obj); /** * Return the number of entries in a map. @@ -66,7 +66,7 @@ size_t dmnsn_map_size(const dmnsn_map *map); * @param[out] obj1 The first object. * @param[out] obj2 The second object. */ -void dmnsn_evaluate_map(const dmnsn_map *map, double n, +void dmnsn_map_evaluate(const dmnsn_map *map, double n, double *val, void *obj1, void *obj2); /** diff --git a/libdimension/dimension/object.h b/libdimension/dimension/object.h index 8b497ce..24c4785 100644 --- a/libdimension/dimension/object.h +++ b/libdimension/dimension/object.h @@ -109,7 +109,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_initialize_object(dmnsn_object *object); +void dmnsn_object_initialize(dmnsn_object *object); /** * Appropriately transform a ray, then test for an intersection. diff --git a/libdimension/dimension/pigment.h b/libdimension/dimension/pigment.h index 487a8dc..716c28b 100644 --- a/libdimension/dimension/pigment.h +++ b/libdimension/dimension/pigment.h @@ -78,7 +78,7 @@ void dmnsn_delete_pigment(dmnsn_pigment *pigment); * initialized for you. * @param[in,out] pigment The pigment to initialize. */ -void dmnsn_initialize_pigment(dmnsn_pigment *pigment); +void dmnsn_pigment_initialize(dmnsn_pigment *pigment); /** * Evaluate the color of a pigment at a point. @@ -86,5 +86,5 @@ void dmnsn_initialize_pigment(dmnsn_pigment *pigment); * @param[in] v The point to color. * @return The color at \p v. */ -dmnsn_color dmnsn_evaluate_pigment(const dmnsn_pigment *pigment, +dmnsn_color dmnsn_pigment_evaluate(const dmnsn_pigment *pigment, dmnsn_vector v); diff --git a/libdimension/dimension/polynomial.h b/libdimension/dimension/polynomial.h index 38e2032..ab95d50 100644 --- a/libdimension/dimension/polynomial.h +++ b/libdimension/dimension/polynomial.h @@ -37,7 +37,7 @@ * @param[in] x The value of the variable at which to evaluate. */ DMNSN_INLINE double -dmnsn_evaluate_polynomial(const double poly[], size_t degree, double x) +dmnsn_polynomial_evaluate(const double poly[], size_t degree, double x) { double ret = poly[degree]; size_t i; @@ -54,7 +54,7 @@ dmnsn_evaluate_polynomial(const double poly[], size_t degree, double x) * @param[in] x The value of the variable at which to evaluate. */ DMNSN_INLINE double -dmnsn_evaluate_polynomial_derivative(const double poly[], size_t degree, +dmnsn_polynomial_evaluate_derivative(const double poly[], size_t degree, double x) { double ret = poly[degree]*degree; @@ -73,7 +73,7 @@ dmnsn_evaluate_polynomial_derivative(const double poly[], size_t degree, * dimension \p degree. * @return The number of positive roots stored in \c x[]. */ -size_t dmnsn_solve_polynomial(const double poly[], size_t degree, double x[]); +size_t dmnsn_polynomial_solve(const double poly[], size_t degree, double x[]); /** * Output a polynomial. The polynomial is printed as a function of x suitable @@ -82,4 +82,4 @@ size_t dmnsn_solve_polynomial(const double poly[], size_t degree, double x[]); * @param[in] poly The coefficients of the polynomial to print. * @param[in] degree The degree of the polynomial. */ -void dmnsn_print_polynomial(FILE *file, const double poly[], size_t degree); +void dmnsn_polynomial_print(FILE *file, const double poly[], size_t degree); diff --git a/libdimension/dimension/raytrace.h b/libdimension/dimension/raytrace.h index 79c148d..82fb759 100644 --- a/libdimension/dimension/raytrace.h +++ b/libdimension/dimension/raytrace.h @@ -24,14 +24,14 @@ */ /** - * Render a scene by raytracing. + * Render a scene by ray tracing. * @param[in,out] scene The scene to render. */ -void dmnsn_raytrace_scene(dmnsn_scene *scene); +void dmnsn_ray_trace(dmnsn_scene *scene); /** * Render a scene in the background. * @param[in,out] scene The scene to render. * @return A \p dmnsn_future object. */ -dmnsn_future *dmnsn_raytrace_scene_async(dmnsn_scene *scene); +dmnsn_future *dmnsn_ray_trace_async(dmnsn_scene *scene); diff --git a/libdimension/dimension/refcount.h b/libdimension/dimension/refcount.h index a0f5b6e..f9f3286 100644 --- a/libdimension/dimension/refcount.h +++ b/libdimension/dimension/refcount.h @@ -40,12 +40,3 @@ typedef unsigned int dmnsn_refcount; ++(object)->refcount; \ } \ } while (0) - -/** - * @internal - * Decrement a reference count. - * @param[in,out] object The reference-counted object to release. - * @return Whether the object is now garbage. - */ -#define DMNSN_DECREF(object) \ - ((object) && ((object)->refcount == 0 || --(object)->refcount == 0)) diff --git a/libdimension/dimension/scene.h b/libdimension/dimension/scene.h index c8abb5a..875c1bb 100644 --- a/libdimension/dimension/scene.h +++ b/libdimension/dimension/scene.h @@ -97,4 +97,4 @@ void dmnsn_delete_scene(dmnsn_scene *scene); * Initialize a scene. * @param[in,out] scene The scene to initalize. */ -void dmnsn_initialize_scene(dmnsn_scene *scene); +void dmnsn_scene_initialize(dmnsn_scene *scene); diff --git a/libdimension/dimension/texture.h b/libdimension/dimension/texture.h index 46e387b..a3cf744 100644 --- a/libdimension/dimension/texture.h +++ b/libdimension/dimension/texture.h @@ -53,7 +53,7 @@ void dmnsn_delete_texture(dmnsn_texture *texture); * initialized for you. * @param[in,out] texture The texture to initialize. */ -void dmnsn_initialize_texture(dmnsn_texture *texture); +void dmnsn_texture_initialize(dmnsn_texture *texture); /** * Fill missing texture properties from a default texture. diff --git a/libdimension/dimension/timer.h b/libdimension/dimension/timer.h index 5725b63..55d66ff 100644 --- a/libdimension/dimension/timer.h +++ b/libdimension/dimension/timer.h @@ -45,10 +45,10 @@ typedef struct dmnsn_timer { * Start a timer. The values of an unfinished timer are undefined. * @param[in,out] timer The timer to start. */ -void dmnsn_start_timer(dmnsn_timer *timer); +void dmnsn_timer_start(dmnsn_timer *timer); /** * Finish timing. The members of the timer struct will now contain timing data. * @param[in,out] timer The timer to stop. */ -void dmnsn_stop_timer(dmnsn_timer *timer); +void dmnsn_timer_stop(dmnsn_timer *timer); |