aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/extantz/camera.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/extantz/camera.c')
-rw-r--r--src/extantz/camera.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/extantz/camera.c b/src/extantz/camera.c
index bbf8b01..937d965 100644
--- a/src/extantz/camera.c
+++ b/src/extantz/camera.c
@@ -30,22 +30,22 @@ Eina_Bool animateCamera(Scene_Data *scene)
30 Evas_Real x, y, z; 30 Evas_Real x, y, z;
31 Eo *n = scene->avatar_node; 31 Eo *n = scene->avatar_node;
32 32
33 euler_to_quaternion(&rotate, DEGREE_TO_RADIAN(scene->move->r), DEGREE_TO_RADIAN(scene->move->s), DEGREE_TO_RADIAN(scene->move->p));
34 eina_quaternion_mul(&result, &orient, &rotate);
35 eina_quaternion_normalized(&result, &result);
36 if (n) 33 if (n)
37 { 34 {
38 evas_canvas3d_node_orientation_get(n, EVAS_CANVAS3D_SPACE_PARENT, &orient.x, &orient.y, &orient.z, &orient.w); 35 evas_canvas3d_node_orientation_get(n, EVAS_CANVAS3D_SPACE_PARENT, &orient.x, &orient.y, &orient.z, &orient.w);
36 euler_to_quaternion(&rotate, DEGREE_TO_RADIAN(scene->move->r), DEGREE_TO_RADIAN(scene->move->s), DEGREE_TO_RADIAN(scene->move->p));
37 eina_quaternion_mul(&result, &orient, &rotate);
38 eina_quaternion_normalized(&result, &result);
39 evas_canvas3d_node_orientation_set(n, result.x, result.y, result.z, result.w); 39 evas_canvas3d_node_orientation_set(n, result.x, result.y, result.z, result.w);
40 40
41 eina_quaternion_set(&move, scene->move->x, scene->move->y, scene->move->z, 0); 41 eina_quaternion_set(&move, -scene->move->x, scene->move->y, -scene->move->z, 0);
42 eina_quaternion_mul(&rotate, &result, &move);
43 eina_quaternion_conjugate(&result, &result);
44 eina_quaternion_mul(&move, &rotate, &result);
45 x += move.x;
46 y += move.y;
47 z += move.z;
48 evas_canvas3d_node_position_get(n, EVAS_CANVAS3D_SPACE_PARENT, &x, &y, &z); 42 evas_canvas3d_node_position_get(n, EVAS_CANVAS3D_SPACE_PARENT, &x, &y, &z);
43 eina_quaternion_mul(&rotate, &result, &move);
44 eina_quaternion_conjugate(&result, &result);
45 eina_quaternion_mul(&move, &rotate, &result);
46 x += move.x;
47 y += move.y;
48 z += move.z;
49 evas_canvas3d_node_position_set(n, x, y, z); 49 evas_canvas3d_node_position_set(n, x, y, z);
50 } 50 }
51 51
@@ -66,14 +66,14 @@ static void _on_camera_input_down(void *data, Evas *evas, Evas_Object *obj, void
66 if (0 == strcmp(ev->key, "Escape")) 66 if (0 == strcmp(ev->key, "Escape"))
67 { 67 {
68 } 68 }
69 else if (0 == strcmp(ev->key, "Left")) move->s = 2.0; 69 else if (0 == strcmp(ev->key, "Left")) move->s = 4.0;
70 else if (0 == strcmp(ev->key, "Right")) move->s = -2.0; 70 else if (0 == strcmp(ev->key, "Right")) move->s = -4.0;
71 else if (0 == strcmp(ev->key, "Up")) move->z = -2.0; 71 else if (0 == strcmp(ev->key, "Up")) move->z = -0.1;
72 else if (0 == strcmp(ev->key, "Down")) move->z = 2.0; 72 else if (0 == strcmp(ev->key, "Down")) move->z = 0.1;
73 else if (0 == strcmp(ev->key, "Prior")) move->y = 2.0; // Pg Up for humans. 73 else if (0 == strcmp(ev->key, "Prior")) move->y = 0.1; // Pg Up for humans.
74 else if (0 == strcmp(ev->key, "Next")) move->y = -2.0; // Pg Dn for humans. 74 else if (0 == strcmp(ev->key, "Next")) move->y = -0.1; // Pg Dn for humans.
75 else if (0 == strcmp(ev->key, "Home")) move->x = -2.0; 75 else if (0 == strcmp(ev->key, "Home")) move->x = -0.1;
76 else if (0 == strcmp(ev->key, "End")) move->x = 2.0; 76 else if (0 == strcmp(ev->key, "End")) move->x = 0.1;
77 else if (0 == strcmp(ev->key, "space")) move->jump = 1.0; 77 else if (0 == strcmp(ev->key, "space")) move->jump = 1.0;
78 else PW("Unexpected down keystroke - %s", ev->key); 78 else PW("Unexpected down keystroke - %s", ev->key);
79 } 79 }
@@ -142,6 +142,7 @@ static void _on_camera_input_down(void *data, Evas *evas, Evas_Object *obj, void
142 * Setting the x or y to be the DIFFERENCE in window position of the mouse (-1.0 to 1.0) since the last frame. 142 * Setting the x or y to be the DIFFERENCE in window position of the mouse (-1.0 to 1.0) since the last frame.
143 * 143 *
144 * TODO - In the Elm_glview version, 2.0 seems to be correct speed for walking, but I thought 1.0 was in Evas_GL. 144 * TODO - In the Elm_glview version, 2.0 seems to be correct speed for walking, but I thought 1.0 was in Evas_GL.
145 * And now in Evas_3D, it's different again.
145 */ 146 */
146 147
147static void _on_camera_input_up(void *data, Evas *evas, Evas_Object *obj, void *event_info) 148static void _on_camera_input_up(void *data, Evas *evas, Evas_Object *obj, void *event_info)