From 3037c067f2937b68bfd0c7f906f7e7ecadd4b8d5 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 15 Apr 2010 00:06:22 -0400 Subject: Add transformations to textures and pigments. Also, object intersection callbacks are now responsible for handling their own transformations. --- libdimension/dimension/object.h | 4 ++++ libdimension/dimension/texture.h | 11 +++++++++++ 2 files changed, 15 insertions(+) (limited to 'libdimension/dimension') diff --git a/libdimension/dimension/object.h b/libdimension/dimension/object.h index f0395cd..1d5f580 100644 --- a/libdimension/dimension/object.h +++ b/libdimension/dimension/object.h @@ -41,6 +41,8 @@ typedef struct dmnsn_intersection { const dmnsn_interior *interior; } dmnsn_intersection; +dmnsn_vector dmnsn_matrix_normal_mul(dmnsn_matrix trans, dmnsn_vector normal); + /* Forward-declare dmnsn_object */ typedef struct dmnsn_object dmnsn_object; @@ -80,4 +82,6 @@ dmnsn_object *dmnsn_new_object(); /* Free an object */ void dmnsn_delete_object(dmnsn_object *object); +void dmnsn_object_precompute(dmnsn_object *object); + #endif /* DIMENSION_OBJECT_H */ diff --git a/libdimension/dimension/texture.h b/libdimension/dimension/texture.h index 70cfdc5..91dda23 100644 --- a/libdimension/dimension/texture.h +++ b/libdimension/dimension/texture.h @@ -42,6 +42,9 @@ struct dmnsn_pigment { dmnsn_pigment_fn *pigment_fn; dmnsn_free_fn *free_fn; + /* Transformation matrix */ + dmnsn_matrix trans, trans_inv; + /* Generic pointer */ void *ptr; }; @@ -49,6 +52,8 @@ struct dmnsn_pigment { dmnsn_pigment *dmnsn_new_pigment(); void dmnsn_delete_pigment(dmnsn_pigment *pigment); +void dmnsn_pigment_precompute(dmnsn_pigment *pigment); + /* * Finishes */ @@ -91,11 +96,17 @@ void dmnsn_delete_finish(dmnsn_finish *finish); */ typedef struct { + /* Texture components */ dmnsn_pigment *pigment; dmnsn_finish *finish; + + /* Transformation matrix */ + dmnsn_matrix trans, trans_inv; } dmnsn_texture; dmnsn_texture *dmnsn_new_texture(); void dmnsn_delete_texture(dmnsn_texture *texture); +void dmnsn_texture_precompute(dmnsn_texture *texture); + #endif /* DIMENSION_TEXTURE_H */ -- cgit v1.2.3