diff options
author | Tavian Barnes <tavianator@gmail.com> | 2009-07-08 17:12:02 +0000 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2009-07-08 17:12:02 +0000 |
commit | bff7f2b3b440c30d0d6eb692576af57ef42edd1b (patch) | |
tree | 0ba45051db1ee7b7808339cfb587f8f76d8c7c5c /libdimension/cameras.c | |
parent | 14c9cd86e1b7c6ff27c5000d72721c54a718daac (diff) | |
download | dimension-bff7f2b3b440c30d0d6eb692576af57ef42edd1b.tar.xz |
Comments and style adjustments, and a couple fixes.
Diffstat (limited to 'libdimension/cameras.c')
-rw-r--r-- | libdimension/cameras.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libdimension/cameras.c b/libdimension/cameras.c index f346bbc..29d1df4 100644 --- a/libdimension/cameras.c +++ b/libdimension/cameras.c @@ -36,16 +36,19 @@ static dmnsn_line dmnsn_perspective_camera_ray_fn(const dmnsn_camera *camera, dmnsn_camera * dmnsn_new_perspective_camera(dmnsn_matrix trans) { + dmnsn_matrix *ptr; dmnsn_camera *camera = dmnsn_new_camera(); if (camera) { camera->ray_fn = &dmnsn_perspective_camera_ray_fn; - camera->ptr = malloc(sizeof(dmnsn_matrix)); - if (!camera->ptr) { + /* Allocate room for the transformation matrix */ + ptr = malloc(sizeof(dmnsn_matrix)); + if (!ptr) { dmnsn_delete_camera(camera); return NULL; } - *((dmnsn_matrix*)camera->ptr) = trans; + *ptr = trans; + camera->ptr = ptr; } return camera; } |