summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChunEon Park <hermet@hermet.pe.kr>2014-04-16 22:29:02 +0900
committerChunEon Park <hermet@hermet.pe.kr>2014-04-16 22:29:02 +0900
commitde350d6b98c825bd0af102e69fd0777555d88886 (patch)
treecc6202428b4c5bc2e9b09e36fc0fa46420103f5a
parent39f8f3466cf223ee07c453a1a5e98a8765b7a00c (diff)
downloadefl-devs/cedric/evas-3d.tar.gz
evas/evas3d: clean up camera code.devs/cedric/evas-3d
rewrite for more efl style.
-rw-r--r--src/lib/evas/canvas/evas_3d_camera.c68
1 files changed, 35 insertions, 33 deletions
diff --git a/src/lib/evas/canvas/evas_3d_camera.c b/src/lib/evas/canvas/evas_3d_camera.c
index 6607c047fd..8e84e68609 100644
--- a/src/lib/evas/canvas/evas_3d_camera.c
+++ b/src/lib/evas/canvas/evas_3d_camera.c
@@ -1,8 +1,3 @@
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <stdlib.h>
#include "evas_common_private.h"
#include "evas_private.h"
@@ -21,14 +16,14 @@ _camera_node_change_notify(const Eina_Hash *hash EINA_UNUSED, const void *key,
}
EOLIAN static void
-_eo_evas_3d_camera_eo_evas_3d_object_change_notify(Eo *obj, Evas_3D_Camera_Data *pd, Evas_3D_State state EINA_UNUSED, Evas_3D_Object *ref EINA_UNUSED)
+_eo_evas_3d_camera_eo_evas_3d_object_change_notify(Eo *obj,Evas_3D_Camera_Data *pd, Evas_3D_State state EINA_UNUSED, Evas_3D_Object *ref EINA_UNUSED)
{
- if (pd->nodes)
- eina_hash_foreach(pd->nodes, _camera_node_change_notify, obj);
+ if (pd->nodes) eina_hash_foreach(pd->nodes, _camera_node_change_notify, obj);
}
EOLIAN static void
-_eo_evas_3d_camera_eo_evas_3d_object_update_notify(Eo *obj EINA_UNUSED, Evas_3D_Camera_Data *pd EINA_UNUSED)
+_eo_evas_3d_camera_eo_evas_3d_object_update_notify(Eo *obj EINA_UNUSED,
+ Evas_3D_Camera_Data *pd EINA_UNUSED)
{
}
@@ -36,57 +31,54 @@ _eo_evas_3d_camera_eo_evas_3d_object_update_notify(Eo *obj EINA_UNUSED, Evas_3D_
void
evas_3d_camera_node_add(Evas_3D_Camera *camera, Evas_3D_Node *node)
{
- int count = 0;
Evas_3D_Camera_Data *pd = eo_data_scope_get(camera, MY_CLASS);
- if (pd->nodes == NULL)
+ int count = 0;
+
+ if (!pd->nodes)
{
pd->nodes = eina_hash_pointer_new(NULL);
- if (pd->nodes == NULL)
+ if (!pd->nodes)
{
- ERR("Failed to create hash table.");
+ ERR("Failed to create hash table. camera(%p)", camera);
return;
}
}
- else
- count = (int)eina_hash_find(pd->nodes, &node);
-
+ else count = (int)eina_hash_find(pd->nodes, &node);
eina_hash_set(pd->nodes, &node, (const void *)(count + 1));
}
void
evas_3d_camera_node_del(Evas_3D_Camera *camera, Evas_3D_Node *node)
{
- int count = 0;
Evas_3D_Camera_Data *pd = eo_data_scope_get(camera, MY_CLASS);
+ int count = 0;
- if (pd->nodes == NULL)
+ if (!pd->nodes)
{
ERR("No node to delete.");
return;
}
count = (int)eina_hash_find(pd->nodes, &node);
-
- if (count == 1)
- eina_hash_del(pd->nodes, &node, NULL);
- else
- eina_hash_set(pd->nodes, &node, (const void *)(count - 1));
+ if (count == 1) eina_hash_del(pd->nodes, &node, NULL);
+ else eina_hash_set(pd->nodes, &node, (const void *)(count - 1));
}
EOLIAN static void
-_eo_evas_3d_camera_eo_base_constructor(Eo *obj, Evas_3D_Camera_Data *pd EINA_UNUSED)
+_eo_evas_3d_camera_eo_base_constructor(Eo *obj,
+ Evas_3D_Camera_Data *pd EINA_UNUSED)
{
eo_do_super(obj, MY_CLASS, eo_constructor());
eo_do(obj, eo_evas_3d_object_type_set(EVAS_3D_OBJECT_TYPE_CAMERA));
}
EOLIAN static void
-_eo_evas_3d_camera_eo_base_destructor(Eo *obj EINA_UNUSED, Evas_3D_Camera_Data *pd)
+_eo_evas_3d_camera_eo_base_destructor(Eo *obj EINA_UNUSED,
+ Evas_3D_Camera_Data *pd)
{
//evas_3d_object_unreference(&pd->base);
- if (pd->nodes)
- eina_hash_free(pd->nodes);
+ if (pd->nodes) eina_hash_free(pd->nodes);
}
EAPI Evas_3D_Camera *
@@ -98,24 +90,28 @@ evas_3d_camera_add(Evas *e)
Evas_Object *eo_obj = eo_add(MY_CLASS, e);
eo_unref(eo_obj);
return eo_obj;
- //return evas_3d_camera_new(e);
}
EOLIAN static void
-_eo_evas_3d_camera_projection_matrix_set(Eo *obj, Evas_3D_Camera_Data *pd, const Evas_Real *matrix)
+_eo_evas_3d_camera_projection_matrix_set(Eo *obj, Evas_3D_Camera_Data *pd,
+ const Evas_Real *matrix)
{
evas_mat4_array_set(&pd->projection, matrix);
evas_3d_object_change(obj, EVAS_3D_STATE_CAMERA_PROJECTION, NULL);
}
EOLIAN static void
-_eo_evas_3d_camera_projection_matrix_get(Eo *obj EINA_UNUSED, Evas_3D_Camera_Data *pd, Evas_Real *matrix)
+_eo_evas_3d_camera_projection_matrix_get(Eo *obj EINA_UNUSED,
+ Evas_3D_Camera_Data *pd,
+ Evas_Real *matrix)
{
memcpy(matrix, &pd->projection.m[0], sizeof(Evas_Real) * 16);
}
EOLIAN static void
-_eo_evas_3d_camera_projection_perspective_set(Eo *obj, Evas_3D_Camera_Data *pd, Evas_Real fovy, Evas_Real aspect, Evas_Real near, Evas_Real far)
+_eo_evas_3d_camera_projection_perspective_set(Eo *obj, Evas_3D_Camera_Data *pd,
+ Evas_Real fovy, Evas_Real aspect,
+ Evas_Real near, Evas_Real far)
{
Evas_Real xmax;
Evas_Real ymax;
@@ -128,14 +124,20 @@ _eo_evas_3d_camera_projection_perspective_set(Eo *obj, Evas_3D_Camera_Data *pd,
}
EOLIAN static void
-_eo_evas_3d_camera_projection_frustum_set(Eo *obj, Evas_3D_Camera_Data *pd, Evas_Real left, Evas_Real right, Evas_Real bottom, Evas_Real top, Evas_Real near, Evas_Real far)
+_eo_evas_3d_camera_projection_frustum_set(Eo *obj, Evas_3D_Camera_Data *pd,
+ Evas_Real left, Evas_Real right,
+ Evas_Real bottom, Evas_Real top,
+ Evas_Real near, Evas_Real far)
{
evas_mat4_frustum_set(&pd->projection, left, right, bottom, top, near, far);
evas_3d_object_change(obj, EVAS_3D_STATE_CAMERA_PROJECTION, NULL);
}
EOLIAN static void
-_eo_evas_3d_camera_projection_ortho_set(Eo *obj, Evas_3D_Camera_Data *pd, Evas_Real left, Evas_Real right, Evas_Real bottom, Evas_Real top, Evas_Real near, Evas_Real far)
+_eo_evas_3d_camera_projection_ortho_set(Eo *obj, Evas_3D_Camera_Data *pd,
+ Evas_Real left, Evas_Real right,
+ Evas_Real bottom, Evas_Real top,
+ Evas_Real near, Evas_Real far)
{
evas_mat4_ortho_set(&pd->projection, left, right, bottom, top, near, far);
evas_3d_object_change(obj, EVAS_3D_STATE_CAMERA_PROJECTION, NULL);