1al_build_camera_transform(3) al_build_camera_transform(3)
2
3
4
6 al_build_camera_transform - Allegro 5 API
7
9 #include <allegro5/allegro.h>
10
11 void al_build_camera_transform(ALLEGRO_TRANSFORM *trans,
12 float position_x, float position_y, float position_z,
13 float look_x, float look_y, float look_z,
14 float up_x, float up_y, float up_z)
15
17 Builds a transformation which can be used to transform 3D coordinates
18 in world space to camera space. This involves translation and a rota‐
19 tion. The function expects three coordinate triplets: The camera's
20 position, the position the camera is looking at and an up vector. The
21 up vector does not need to be of unit length and also does not need to
22 be perpendicular to the view direction - it can usually just be the
23 world up direction (most commonly 0/1/0).
24
25 For example:
26
27 al_build_camera_transform(&t,
28 1, 1, 1,
29 5, 5, 5,
30 0, 1, 0);
31
32 This create a transformation for a camera standing at 1/1/1 and looking
33 towards 5/5/5.
34
35 Note: If the position and look parameters are identical, or if
36 the up direction is parallel to the view direction, an identity
37 matrix is created.
38
39 Another example which will simply re-create the identity matrix:
40
41 al_build_camera_transform(&t,
42 0, 0, 0,
43 0, 0, -1,
44 0, 1, 0);
45
46 An example where the up vector will cause the camera to lean (roll) by
47 45 degrees:
48
49 al_build_camera_transform(&t,
50 1, 1, 1,
51 5, 5, 5,
52 1, 1, 0);
53
54 Since 5.1.9
55
57 al_translate_transform_3d(3), al_rotate_transform_3d(3),
58 al_scale_transform_3d(3), al_compose_transform(3), al_use_transform(3)
59
60
61
62Allegro reference manual al_build_camera_transform(3)