diff options
author | Tavian Barnes <tavianator@gmail.com> | 2010-04-15 00:06:22 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2010-04-15 00:06:22 -0400 |
commit | 3037c067f2937b68bfd0c7f906f7e7ecadd4b8d5 (patch) | |
tree | 1372d1f823fa665ee29a102779627464dd49dabf /libdimension/dimension | |
parent | 59dc3d29a1edf73cf54f10ee32d61815a437619f (diff) | |
download | dimension-3037c067f2937b68bfd0c7f906f7e7ecadd4b8d5.tar.xz |
Add transformations to textures and pigments.
Also, object intersection callbacks are now responsible for handling their own
transformations.
Diffstat (limited to 'libdimension/dimension')
-rw-r--r-- | libdimension/dimension/object.h | 4 | ||||
-rw-r--r-- | libdimension/dimension/texture.h | 11 |
2 files changed, 15 insertions, 0 deletions
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 */ |