From: subhransu Date: Mon, 14 Apr 2014 10:59:38 +0000 (+0900) Subject: Evas_3D : Eolian change for Evas_3D_Object. X-Git-Tag: v1.10.0-alpha1~68 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ac7cea1eb822c007e20c5b192625074251f9c00d;p=platform%2Fupstream%2Fefl.git Evas_3D : Eolian change for Evas_3D_Object. Conflicts: src/lib/evas/Evas_Eo.h --- diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am index 27f5054..673bcd6 100644 --- a/src/Makefile_Evas.am +++ b/src/Makefile_Evas.am @@ -75,7 +75,9 @@ BUILT_SOURCES += \ lib/evas/canvas/evas_3d_node.eo.c\ lib/evas/canvas/evas_3d_node.eo.h\ lib/evas/canvas/evas_3d_scene.eo.c\ - lib/evas/canvas/evas_3d_scene.eo.h + lib/evas/canvas/evas_3d_scene.eo.h\ + lib/evas/canvas/evas_3d_object.eo.c\ + lib/evas/canvas/evas_3d_object.eo.h evaseolianfilesdir = $(datadir)/eolian/include/evas-@VMAJ@ evaseolianfiles_DATA = \ @@ -107,7 +109,8 @@ evaseolianfiles_DATA = \ lib/evas/canvas/evas_3d_light.eo\ lib/evas/canvas/evas_3d_mesh.eo\ lib/evas/canvas/evas_3d_node.eo\ - lib/evas/canvas/evas_3d_scene.eo + lib/evas/canvas/evas_3d_scene.eo\ + lib/evas/canvas/evas_3d_object.eo EXTRA_DIST += \ ${evaseolianfiles_DATA} diff --git a/src/lib/evas/Evas_Common.h b/src/lib/evas/Evas_Common.h index ebf3e8e..84f5609 100644 --- a/src/lib/evas/Evas_Common.h +++ b/src/lib/evas/Evas_Common.h @@ -134,6 +134,71 @@ typedef enum _Evas_Callback_Type */ typedef Eo_Callback_Priority Evas_Callback_Priority; +// 3D Stuff +typedef enum _Evas_3D_Object_Type +{ + EVAS_3D_OBJECT_TYPE_INVALID = 0, + EVAS_3D_OBJECT_TYPE_SCENE, + EVAS_3D_OBJECT_TYPE_NODE, + EVAS_3D_OBJECT_TYPE_CAMERA, + EVAS_3D_OBJECT_TYPE_LIGHT, + EVAS_3D_OBJECT_TYPE_MODEL, + EVAS_3D_OBJECT_TYPE_MESH, + EVAS_3D_OBJECT_TYPE_TEXTURE, + EVAS_3D_OBJECT_TYPE_MATERIAL, +} Evas_3D_Object_Type; + +typedef enum _Evas_3D_State +{ + EVAS_3D_STATE_MAX = 16, + + EVAS_3D_STATE_ANY = 0, + + EVAS_3D_STATE_SCENE_ROOT_NODE = 1, + EVAS_3D_STATE_SCENE_CAMERA_NODE, + EVAS_3D_STATE_SCENE_BACKGROUND_COLOR, + EVAS_3D_STATE_SCENE_SIZE, + + EVAS_3D_STATE_TEXTURE_DATA = 1, + EVAS_3D_STATE_TEXTURE_WRAP, + EVAS_3D_STATE_TEXTURE_FILTER, + + EVAS_3D_STATE_MATERIAL_ID = 1, + EVAS_3D_STATE_MATERIAL_COLOR, + EVAS_3D_STATE_MATERIAL_TEXTURE, + + EVAS_3D_STATE_MESH_VERTEX_COUNT = 1, + EVAS_3D_STATE_MESH_FRAME, + EVAS_3D_STATE_MESH_MATERIAL, + EVAS_3D_STATE_MESH_TRANSFORM, + EVAS_3D_STATE_MESH_VERTEX_DATA, + EVAS_3D_STATE_MESH_INDEX_DATA, + EVAS_3D_STATE_MESH_VERTEX_ASSEMBLY, + EVAS_3D_STATE_MESH_SHADE_MODE, + + EVAS_3D_STATE_CAMERA_PROJECTION = 1, + + EVAS_3D_STATE_LIGHT_AMBIENT = 1, + EVAS_3D_STATE_LIGHT_DIFFUSE, + EVAS_3D_STATE_LIGHT_SPECULAR, + EVAS_3D_STATE_LIGHT_SPOT_DIR, + EVAS_3D_STATE_LIGHT_SPOT_EXP, + EVAS_3D_STATE_LIGHT_SPOT_CUTOFF, + EVAS_3D_STATE_LIGHT_ATTENUATION, + + EVAS_3D_STATE_NODE_TRANSFORM = 1, + EVAS_3D_STATE_NODE_MESH_GEOMETRY, + EVAS_3D_STATE_NODE_MESH_MATERIAL, + EVAS_3D_STATE_NODE_MESH_FRAME, + EVAS_3D_STATE_NODE_MESH_SHADE_MODE, + EVAS_3D_STATE_NODE_MESH_MATERIAL_ID, + EVAS_3D_STATE_NODE_LIGHT, + EVAS_3D_STATE_NODE_CAMERA, + EVAS_3D_STATE_NODE_PARENT, + EVAS_3D_STATE_NODE_MEMBER, +} Evas_3D_State; + + /** * Flags for Mouse Button events */ @@ -5469,6 +5534,9 @@ EAPI const Eina_List *evas_font_path_global_list(void) EINA_WARN_UNUSED_R */ typedef double Evas_Real; + +typedef Eo Evas_3D_Object; + /** * @typedef Evas_3D_Scene * @@ -5742,7 +5810,7 @@ EAPI void evas_3d_scene_del(Evas_3D_Scene *scene) EINA_ARG_NONNULL * * @ingroup Evas_3D_Scene */ -EAPI Evas *evas_3d_scene_evas_get(const Evas_3D_Scene *scene) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); +//EAPI Evas *evas_3d_scene_evas_get(const Evas_3D_Scene *scene) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); /** * Set the root node of a scene. @@ -5904,7 +5972,7 @@ EAPI Evas_3D_Node_Type evas_3d_node_type_get(const Evas_3D_Node *node) EINA_WAR * * @ingroup Evas_3D_Node */ -EAPI Evas *evas_3d_node_evas_get(const Evas_3D_Node *node) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); +//EAPI Evas *evas_3d_node_evas_get(const Evas_3D_Node *node) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); /** * Add a member node to the given node. @@ -6355,7 +6423,7 @@ EAPI void evas_3d_camera_del(Evas_3D_Camera *camera) EINA_ARG_NONN * * @ingroup Evas_3D_Camera */ -EAPI Evas *evas_3d_camera_evas_get(const Evas_3D_Camera *camera) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); +//EAPI Evas *evas_3d_camera_evas_get(const Evas_3D_Camera *camera) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); /** * Set the projection matrix of the given camera. @@ -6465,7 +6533,7 @@ EAPI void evas_3d_light_del(Evas_3D_Light *light) EINA_ARG_NONNULL * * @ingroup Evas_3D_Light */ -EAPI Evas *evas_3d_light_evas_get(const Evas_3D_Light *light) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); +//EAPI Evas *evas_3d_light_evas_get(const Evas_3D_Light *light) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); /** * Set the directional flag of the given light. @@ -6738,7 +6806,7 @@ EAPI void evas_3d_mesh_del(Evas_3D_Mesh *mesh) EINA_ARG_NONNULL(1) * * @ingroup Evas_3D_Mesh */ -EAPI Evas *evas_3d_mesh_evas_get(const Evas_3D_Mesh *mesh) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); +//EAPI Evas *evas_3d_mesh_evas_get(const Evas_3D_Mesh *mesh) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); /** * Set the shade mode of the given mesh. @@ -7111,7 +7179,7 @@ EAPI void evas_3d_texture_del(Evas_3D_Texture *texture) EINA_ARG_N * * @ingroup Evas_3D_Texture */ -EAPI Evas *evas_3d_texture_evas_get(const Evas_3D_Texture *texture) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); +//EAPI Evas *evas_3d_texture_evas_get(const Evas_3D_Texture *texture) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); /** * Set the data of the given texture. @@ -7307,7 +7375,7 @@ EAPI void evas_3d_material_del(Evas_3D_Material *material) EINA_AR * * @ingroup Evas_3D_Material */ -EAPI Evas *evas_3d_material_evas_get(const Evas_3D_Material *material) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); +//EAPI Evas *evas_3d_material_evas_get(const Evas_3D_Material *material) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1); /** * Set the material attribute enable flag of the given material. diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h index cd3f017..382b0ef 100644 --- a/src/lib/evas/Evas_Eo.h +++ b/src/lib/evas/Evas_Eo.h @@ -223,3 +223,5 @@ EAPI extern const Eo_Event_Description _EVAS_CANVAS_EVENT_RENDER_POST; #include "canvas/evas_3d_node.eo.h" #include "canvas/evas_3d_scene.eo.h" + +#include "canvas/evas_3d_object.eo.h" diff --git a/src/lib/evas/canvas/evas_3d_camera.c b/src/lib/evas/canvas/evas_3d_camera.c index a9370c5..6607c04 100644 --- a/src/lib/evas/canvas/evas_3d_camera.c +++ b/src/lib/evas/canvas/evas_3d_camera.c @@ -10,43 +10,28 @@ #define MY_CLASS EO_EVAS_3D_CAMERA_CLASS -static void -_camera_free(Evas_3D_Object *obj) -{ - Evas_3D_Camera_Data *pd = (Evas_3D_Camera_Data *)obj; - - if (pd->nodes) - eina_hash_free(pd->nodes); - - //free(pd); -} static Eina_Bool _camera_node_change_notify(const Eina_Hash *hash EINA_UNUSED, const void *key, void *data EINA_UNUSED, void *fdata) { Evas_3D_Node *n = *(Evas_3D_Node **)key; - Evas_3D_Node_Data *pdnode = eo_data_scope_get(n, EO_EVAS_3D_NODE_CLASS); - evas_3d_object_change(&pdnode->base, EVAS_3D_STATE_NODE_CAMERA, (Evas_3D_Object *)fdata); + evas_3d_object_change(n, EVAS_3D_STATE_NODE_CAMERA, (Evas_3D_Object *)fdata); return EINA_TRUE; } -static void -_camera_change(Evas_3D_Object *obj, Evas_3D_State state EINA_UNUSED, - Evas_3D_Object *ref EINA_UNUSED) +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) { - Evas_3D_Camera_Data *pd = (Evas_3D_Camera_Data *)obj; - if (pd->nodes) eina_hash_foreach(pd->nodes, _camera_node_change_notify, obj); } -static const Evas_3D_Object_Func camera_func = +EOLIAN static void +_eo_evas_3d_camera_eo_evas_3d_object_update_notify(Eo *obj EINA_UNUSED, Evas_3D_Camera_Data *pd EINA_UNUSED) { - _camera_free, - _camera_change, - NULL, -}; + +} void evas_3d_camera_node_add(Evas_3D_Camera *camera, Evas_3D_Node *node) @@ -89,35 +74,19 @@ evas_3d_camera_node_del(Evas_3D_Camera *camera, Evas_3D_Node *node) eina_hash_set(pd->nodes, &node, (const void *)(count - 1)); } -// Evas_3D_Camera * -// evas_3d_camera_new(Evas *e) -// { -// Evas_3D_Camera *camera = NULL; - -// camera = (Evas_3D_Camera *)calloc(1, sizeof(Evas_3D_Camera)); - -// if (camera == NULL) -// { -// ERR("Failed to allocate memory."); -// return NULL; -// } - -// evas_3d_object_init(&camera->base, e, EVAS_3D_OBJECT_TYPE_CAMERA, &camera_func); -// return camera; -// } EOLIAN static void -_eo_evas_3d_camera_eo_base_constructor(Eo *obj, Evas_3D_Camera_Data *pd) +_eo_evas_3d_camera_eo_base_constructor(Eo *obj, Evas_3D_Camera_Data *pd EINA_UNUSED) { - Eo *e; eo_do_super(obj, MY_CLASS, eo_constructor()); - eo_do(obj, e = eo_parent_get()); - evas_3d_object_init(&pd->base, e, EVAS_3D_OBJECT_TYPE_CAMERA, &camera_func); + 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) { - evas_3d_object_unreference(&pd->base); + //evas_3d_object_unreference(&pd->base); + if (pd->nodes) + eina_hash_free(pd->nodes); } EAPI Evas_3D_Camera * @@ -132,17 +101,11 @@ evas_3d_camera_add(Evas *e) //return evas_3d_camera_new(e); } -EOLIAN static Evas * -_eo_evas_3d_camera_evas_common_interface_evas_get(Eo *obj EINA_UNUSED, Evas_3D_Camera_Data *pd) -{ - return pd->base.evas; -} - EOLIAN static void -_eo_evas_3d_camera_projection_matrix_set(Eo *obj EINA_UNUSED, 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(&pd->base, EVAS_3D_STATE_CAMERA_PROJECTION, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_CAMERA_PROJECTION, NULL); } EOLIAN static void @@ -152,7 +115,7 @@ _eo_evas_3d_camera_projection_matrix_get(Eo *obj EINA_UNUSED, Evas_3D_Camera_Dat } EOLIAN static void -_eo_evas_3d_camera_projection_perspective_set(Eo *obj EINA_UNUSED, 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; @@ -161,21 +124,21 @@ _eo_evas_3d_camera_projection_perspective_set(Eo *obj EINA_UNUSED, Evas_3D_Camer xmax = ymax * aspect; evas_mat4_frustum_set(&pd->projection, -xmax, xmax, -ymax, ymax, near, far); - evas_3d_object_change(&pd->base, EVAS_3D_STATE_CAMERA_PROJECTION, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_CAMERA_PROJECTION, NULL); } EOLIAN static void -_eo_evas_3d_camera_projection_frustum_set(Eo *obj EINA_UNUSED, 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(&pd->base, EVAS_3D_STATE_CAMERA_PROJECTION, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_CAMERA_PROJECTION, NULL); } EOLIAN static void -_eo_evas_3d_camera_projection_ortho_set(Eo *obj EINA_UNUSED, 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(&pd->base, EVAS_3D_STATE_CAMERA_PROJECTION, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_CAMERA_PROJECTION, NULL); } #include "canvas/evas_3d_camera.eo.c" diff --git a/src/lib/evas/canvas/evas_3d_camera.eo b/src/lib/evas/canvas/evas_3d_camera.eo index e856f97..4667436 100755 --- a/src/lib/evas/canvas/evas_3d_camera.eo +++ b/src/lib/evas/canvas/evas_3d_camera.eo @@ -1,4 +1,4 @@ -class EO_Evas_3D_Camera (Eo_Base, Evas_Common_Interface) +class EO_Evas_3D_Camera (EO_Evas_3D_Object, Evas_Common_Interface) { legacy_prefix: evas_3d_camera; data: Evas_3D_Camera_Data; @@ -102,7 +102,8 @@ class EO_Evas_3D_Camera (Eo_Base, Evas_Common_Interface) implements { Eo_Base::constructor; Eo_Base::destructor; - Evas_Common_Interface::evas::get; + EO_Evas_3D_Object::update_notify; + EO_Evas_3D_Object::change_notify; } } diff --git a/src/lib/evas/canvas/evas_3d_light.c b/src/lib/evas/canvas/evas_3d_light.c index 658c077..7cf2966 100644 --- a/src/lib/evas/canvas/evas_3d_light.c +++ b/src/lib/evas/canvas/evas_3d_light.c @@ -11,43 +11,28 @@ #define MY_CLASS EO_EVAS_3D_LIGHT_CLASS -static void -_light_free(Evas_3D_Object *obj) -{ - Evas_3D_Light_Data *light = (Evas_3D_Light_Data *)obj; - - if (light->nodes) - eina_hash_free(light->nodes); - - //free(light); -} static Eina_Bool _light_node_change_notify(const Eina_Hash *hash EINA_UNUSED, const void *key, void *data EINA_UNUSED, void *fdata) { Evas_3D_Node *n = *(Evas_3D_Node **)key; - Evas_3D_Node_Data *pdnode = eo_data_scope_get(n, EO_EVAS_3D_NODE_CLASS); - evas_3d_object_change(&pdnode->base, EVAS_3D_STATE_NODE_LIGHT, (Evas_3D_Object *)fdata); + evas_3d_object_change(n, EVAS_3D_STATE_NODE_LIGHT, (Evas_3D_Object *)fdata); return EINA_TRUE; } -static void -_light_change(Evas_3D_Object *obj, Evas_3D_State state EINA_UNUSED, - Evas_3D_Object *ref EINA_UNUSED) +EOLIAN static void +_eo_evas_3d_light_eo_evas_3d_object_change_notify(Eo *obj, Evas_3D_Light_Data *pd, Evas_3D_State state EINA_UNUSED, Evas_3D_Object *ref EINA_UNUSED) { - Evas_3D_Light_Data *light = (Evas_3D_Light_Data *)obj; - - if (light->nodes) - eina_hash_foreach(light->nodes, _light_node_change_notify, obj); + if (pd->nodes) + eina_hash_foreach(pd->nodes, _light_node_change_notify, obj); } -static const Evas_3D_Object_Func light_func = +EOLIAN static void +_eo_evas_3d_light_eo_evas_3d_object_update_notify(Eo *obj EINA_UNUSED, Evas_3D_Light_Data *pd EINA_UNUSED) { - _light_free, - _light_change, - NULL, -}; + +} void evas_3d_light_node_add(Evas_3D_Light *light, Evas_3D_Node *node) @@ -104,10 +89,8 @@ evas_3d_light_add(Evas *e) EOLIAN static void _eo_evas_3d_light_eo_base_constructor(Eo *obj, Evas_3D_Light_Data *pd) { - Eo *e; eo_do_super(obj, MY_CLASS, eo_constructor()); - eo_do(obj, e = eo_parent_get()); - evas_3d_object_init(&pd->base, e, EVAS_3D_OBJECT_TYPE_LIGHT, &light_func); + eo_do(obj, eo_evas_3d_object_type_set(EVAS_3D_OBJECT_TYPE_LIGHT)); evas_color_set(&pd->ambient, 0.0, 0.0, 0.0, 1.0); evas_color_set(&pd->diffuse, 1.0, 1.0, 1.0, 1.0); evas_color_set(&pd->specular, 1.0, 1.0, 1.0, 1.0); @@ -124,22 +107,18 @@ _eo_evas_3d_light_eo_base_constructor(Eo *obj, Evas_3D_Light_Data *pd) EOLIAN static void _eo_evas_3d_light_eo_base_destructor(Eo *obj EINA_UNUSED, Evas_3D_Light_Data *pd) { - evas_3d_object_unreference(&pd->base); + if (pd->nodes) + eina_hash_free(pd->nodes); } -EOLIAN static Evas * -_eo_evas_3d_light_evas_common_interface_evas_get(Eo *obj EINA_UNUSED, Evas_3D_Light_Data *pd) -{ - return pd->base.evas; -} EOLIAN static void -_eo_evas_3d_light_directional_set(Eo *obj EINA_UNUSED, Evas_3D_Light_Data *pd, Eina_Bool directional) +_eo_evas_3d_light_directional_set(Eo *obj, Evas_3D_Light_Data *pd, Eina_Bool directional) { if (pd->directional != directional) { pd->directional = directional; - evas_3d_object_change(&pd->base, EVAS_3D_STATE_ANY, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_ANY, NULL); } } @@ -150,14 +129,14 @@ _eo_evas_3d_light_directional_get(Eo *obj EINA_UNUSED, Evas_3D_Light_Data *pd) } EOLIAN static void -_eo_evas_3d_light_ambient_set(Eo *obj EINA_UNUSED, Evas_3D_Light_Data *pd, Evas_Real r, Evas_Real g, Evas_Real b, Evas_Real a) +_eo_evas_3d_light_ambient_set(Eo *obj, Evas_3D_Light_Data *pd, Evas_Real r, Evas_Real g, Evas_Real b, Evas_Real a) { pd->ambient.r = r; pd->ambient.g = g; pd->ambient.b = b; pd->ambient.a = a; - evas_3d_object_change(&pd->base, EVAS_3D_STATE_LIGHT_AMBIENT, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_LIGHT_AMBIENT, NULL); } EOLIAN static void @@ -170,14 +149,14 @@ _eo_evas_3d_light_ambient_get(Eo *obj EINA_UNUSED, Evas_3D_Light_Data *pd, Evas_ } EOLIAN static void -_eo_evas_3d_light_diffuse_set(Eo *obj EINA_UNUSED, Evas_3D_Light_Data *pd, Evas_Real r, Evas_Real g, Evas_Real b, Evas_Real a) +_eo_evas_3d_light_diffuse_set(Eo *obj, Evas_3D_Light_Data *pd, Evas_Real r, Evas_Real g, Evas_Real b, Evas_Real a) { pd->diffuse.r = r; pd->diffuse.g = g; pd->diffuse.b = b; pd->diffuse.a = a; - evas_3d_object_change(&pd->base, EVAS_3D_STATE_LIGHT_DIFFUSE, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_LIGHT_DIFFUSE, NULL); } EOLIAN static void @@ -190,14 +169,14 @@ _eo_evas_3d_light_diffuse_get(Eo *obj EINA_UNUSED, Evas_3D_Light_Data *pd, Evas_ } EOLIAN static void -_eo_evas_3d_light_specular_set(Eo *obj EINA_UNUSED, Evas_3D_Light_Data *pd, Evas_Real r, Evas_Real g, Evas_Real b, Evas_Real a) +_eo_evas_3d_light_specular_set(Eo *obj, Evas_3D_Light_Data *pd, Evas_Real r, Evas_Real g, Evas_Real b, Evas_Real a) { pd->specular.r = r; pd->specular.g = g; pd->specular.b = b; pd->specular.a = a; - evas_3d_object_change(&pd->base, EVAS_3D_STATE_LIGHT_SPECULAR, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_LIGHT_SPECULAR, NULL); } EOLIAN static void @@ -210,10 +189,10 @@ _eo_evas_3d_light_specular_get(Eo *obj EINA_UNUSED, Evas_3D_Light_Data *pd, Evas } EOLIAN static void -_eo_evas_3d_light_spot_exponent_set(Eo *obj EINA_UNUSED, Evas_3D_Light_Data *pd, Evas_Real exponent) +_eo_evas_3d_light_spot_exponent_set(Eo *obj, Evas_3D_Light_Data *pd, Evas_Real exponent) { pd->spot_exp = exponent; - evas_3d_object_change(&pd->base, EVAS_3D_STATE_LIGHT_SPOT_EXP, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_LIGHT_SPOT_EXP, NULL); } EOLIAN static Evas_Real @@ -223,11 +202,11 @@ _eo_evas_3d_light_spot_exponent_get(Eo *obj EINA_UNUSED, Evas_3D_Light_Data *pd) } EOLIAN static void -_eo_evas_3d_light_spot_cutoff_set(Eo *obj EINA_UNUSED, Evas_3D_Light_Data *pd, Evas_Real cutoff) +_eo_evas_3d_light_spot_cutoff_set(Eo *obj, Evas_3D_Light_Data *pd, Evas_Real cutoff) { pd->spot_cutoff = cutoff; pd->spot_cutoff_cos = cos(cutoff * M_PI / 180.0); - evas_3d_object_change(&pd->base, EVAS_3D_STATE_LIGHT_SPOT_CUTOFF, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_LIGHT_SPOT_CUTOFF, NULL); } EOLIAN static Evas_Real @@ -237,12 +216,12 @@ _eo_evas_3d_light_spot_cutoff_get(Eo *obj EINA_UNUSED, Evas_3D_Light_Data *pd) } EOLIAN static void -_eo_evas_3d_light_attenuation_set(Eo *obj EINA_UNUSED, Evas_3D_Light_Data *pd, Evas_Real constant, Evas_Real linear, Evas_Real quadratic) +_eo_evas_3d_light_attenuation_set(Eo *obj, Evas_3D_Light_Data *pd, Evas_Real constant, Evas_Real linear, Evas_Real quadratic) { pd->atten_const = constant; pd->atten_linear = linear; pd->atten_quad = quadratic; - evas_3d_object_change(&pd->base, EVAS_3D_STATE_LIGHT_ATTENUATION, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_LIGHT_ATTENUATION, NULL); } EOLIAN static void @@ -254,12 +233,12 @@ _eo_evas_3d_light_attenuation_get(Eo *obj EINA_UNUSED, Evas_3D_Light_Data *pd, E } EOLIAN static void -_eo_evas_3d_light_attenuation_enable_set(Eo *obj EINA_UNUSED, Evas_3D_Light_Data *pd, Eina_Bool enable) +_eo_evas_3d_light_attenuation_enable_set(Eo *obj, Evas_3D_Light_Data *pd, Eina_Bool enable) { if (pd->enable_attenuation != enable) { pd->enable_attenuation = enable; - evas_3d_object_change(&pd->base, EVAS_3D_STATE_LIGHT_ATTENUATION, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_LIGHT_ATTENUATION, NULL); } } diff --git a/src/lib/evas/canvas/evas_3d_light.eo b/src/lib/evas/canvas/evas_3d_light.eo index 079c521..f7bd325 100755 --- a/src/lib/evas/canvas/evas_3d_light.eo +++ b/src/lib/evas/canvas/evas_3d_light.eo @@ -1,4 +1,4 @@ -class EO_Evas_3D_LIGHT (Eo_Base, Evas_Common_Interface) +class EO_Evas_3D_LIGHT (EO_Evas_3D_Object, Evas_Common_Interface) { legacy_prefix: evas_3d_light; data: Evas_3D_Light_Data; @@ -258,7 +258,8 @@ class EO_Evas_3D_LIGHT (Eo_Base, Evas_Common_Interface) implements { Eo_Base::constructor; Eo_Base::destructor; - Evas_Common_Interface::evas::get; + EO_Evas_3D_Object::update_notify; + EO_Evas_3D_Object::change_notify; } } diff --git a/src/lib/evas/canvas/evas_3d_material.c b/src/lib/evas/canvas/evas_3d_material.c index 70a4c84..8dfe00c 100644 --- a/src/lib/evas/canvas/evas_3d_material.c +++ b/src/lib/evas/canvas/evas_3d_material.c @@ -10,75 +10,38 @@ #define MY_CLASS EO_EVAS_3D_MATERIAL_CLASS -static void -_material_free(Evas_3D_Object *obj) -{ - int i; - Evas_3D_Material_Data *material = (Evas_3D_Material_Data *)obj; - - if (material->meshes) - eina_hash_free(material->meshes); - - for (i = 0; i < EVAS_3D_MATERIAL_ATTRIB_COUNT; i++) - { - if (material->attribs[i].texture) - { - //@FIXME - //evas_3d_texture_material_del(material->attribs[i].texture, material); - Evas_3D_Texture_Data *pd = eo_data_scope_get(material->attribs[i].texture, EO_EVAS_3D_TEXTURE_CLASS); - evas_3d_object_unreference(&pd->base); - } - } - - //free(material); -} - static Eina_Bool _material_mesh_change_notify(const Eina_Hash *hash EINA_UNUSED, const void *key, void *data EINA_UNUSED, void *fdata) { Evas_3D_Mesh *m = *(Evas_3D_Mesh **)key; - Evas_3D_Mesh_Data *pdmesh = eo_data_scope_get(m, EO_EVAS_3D_MESH_CLASS); - evas_3d_object_change(&pdmesh->base, EVAS_3D_STATE_MESH_MATERIAL, (Evas_3D_Object *)fdata); + evas_3d_object_change(m, EVAS_3D_STATE_MESH_MATERIAL, (Evas_3D_Object *)fdata); return EINA_TRUE; } -static void -_material_change(Evas_3D_Object *obj, Evas_3D_State state EINA_UNUSED, - Evas_3D_Object *ref EINA_UNUSED) +EOLIAN static void +_eo_evas_3d_material_eo_evas_3d_object_change_notify(Eo *obj, Evas_3D_Material_Data *pd, Evas_3D_State state EINA_UNUSED, Evas_3D_Object *ref EINA_UNUSED) { - Evas_3D_Material_Data *material = (Evas_3D_Material_Data *)obj; - - if (material->meshes) - eina_hash_foreach(material->meshes, _material_mesh_change_notify, obj); + if (pd->meshes) + eina_hash_foreach(pd->meshes, _material_mesh_change_notify, obj); } -static void -_material_update(Evas_3D_Object *obj) +EOLIAN static void +_eo_evas_3d_material_eo_evas_3d_object_update_notify(Eo *obj EINA_UNUSED, Evas_3D_Material_Data *pd) { int i; - Evas_3D_Material_Data *material = (Evas_3D_Material_Data *)obj; - for (i = 0; i < EVAS_3D_MATERIAL_ATTRIB_COUNT; i++) { - if (material->attribs[i].enable) + if (pd->attribs[i].enable) { - if (material->attribs[i].texture) + if (pd->attribs[i].texture) { - Evas_3D_Texture_Data *pd = eo_data_scope_get(material->attribs[i].texture, EO_EVAS_3D_TEXTURE_CLASS); - evas_3d_object_update(&pd->base); + evas_3d_object_update(pd->attribs[i].texture); } } } } -static const Evas_3D_Object_Func material_func = -{ - _material_free, - _material_change, - _material_update, -}; - void evas_3d_material_mesh_add(Evas_3D_Material *material, Evas_3D_Mesh *mesh) { @@ -136,10 +99,8 @@ evas_3d_material_add(Evas *e) EOLIAN static void _eo_evas_3d_material_eo_base_constructor(Eo *obj EINA_UNUSED, Evas_3D_Material_Data *pd) { - Eo *e; eo_do_super(obj, MY_CLASS, eo_constructor()); - eo_do(obj, e = eo_parent_get()); - evas_3d_object_init(&pd->base, e, EVAS_3D_OBJECT_TYPE_MATERIAL, &material_func); + eo_do(obj, eo_evas_3d_object_type_set(EVAS_3D_OBJECT_TYPE_MATERIAL)); evas_color_set(&pd->attribs[EVAS_3D_MATERIAL_AMBIENT].color, 0.2, 0.2, 0.2, 1.0); evas_color_set(&pd->attribs[EVAS_3D_MATERIAL_DIFFUSE].color, 0.8, 0.8, 0.8, 1.0); @@ -149,15 +110,21 @@ _eo_evas_3d_material_eo_base_constructor(Eo *obj EINA_UNUSED, Evas_3D_Material_D } EOLIAN static void -_eo_evas_3d_material_eo_base_destructor(Eo *obj EINA_UNUSED, Evas_3D_Material_Data *pd) +_eo_evas_3d_material_eo_base_destructor(Eo *obj, Evas_3D_Material_Data *pd) { - evas_3d_object_unreference(&pd->base); -} + int i; -EOLIAN static Evas * -_eo_evas_3d_material_evas_common_interface_evas_get(Eo *obj EINA_UNUSED, Evas_3D_Material_Data *pd) -{ - return pd->base.evas; + if (pd->meshes) + eina_hash_free(pd->meshes); + + for (i = 0; i < EVAS_3D_MATERIAL_ATTRIB_COUNT; i++) + { + if (pd->attribs[i].texture) + { + evas_3d_texture_material_del(pd->attribs[i].texture, obj); + //eo_unref(pd->attribs[i].texture); + } + } } EOLIAN static void @@ -173,10 +140,10 @@ _eo_evas_3d_material_enable_get(Eo *obj EINA_UNUSED, Evas_3D_Material_Data *pd, } EOLIAN static void -_eo_evas_3d_material_color_set(Eo *obj EINA_UNUSED, Evas_3D_Material_Data *pd, Evas_3D_Material_Attrib attrib, Evas_Real r, Evas_Real g, Evas_Real b, Evas_Real a) +_eo_evas_3d_material_color_set(Eo *obj, Evas_3D_Material_Data *pd, Evas_3D_Material_Attrib attrib, Evas_Real r, Evas_Real g, Evas_Real b, Evas_Real a) { evas_color_set(&pd->attribs[attrib].color, r, g, b, a); - evas_3d_object_change(&pd->base, EVAS_3D_STATE_MATERIAL_COLOR, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_MATERIAL_COLOR, NULL); } EOLIAN static void @@ -208,17 +175,15 @@ _eo_evas_3d_material_texture_set(Eo *obj, Evas_3D_Material_Data *pd, Evas_3D_Mat if (pd->attribs[attrib].texture) { evas_3d_texture_material_del(pd->attribs[attrib].texture, obj); - Evas_3D_Texture_Data *pdt = eo_data_scope_get(pd->attribs[attrib].texture, EO_EVAS_3D_TEXTURE_CLASS); - evas_3d_object_unreference(&pdt->base); + eo_unref(pd->attribs[attrib].texture); } pd->attribs[attrib].texture = texture; evas_3d_texture_material_add(texture, obj); - Evas_3D_Texture_Data *pdt = eo_data_scope_get(texture, EO_EVAS_3D_TEXTURE_CLASS); - evas_3d_object_reference(&pdt->base); + eo_ref(texture); } - evas_3d_object_change(&pd->base, EVAS_3D_STATE_MATERIAL_TEXTURE, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_MATERIAL_TEXTURE, NULL); } EOLIAN static Evas_3D_Texture * diff --git a/src/lib/evas/canvas/evas_3d_material.eo b/src/lib/evas/canvas/evas_3d_material.eo index 9f52a1b..38933d6 100755 --- a/src/lib/evas/canvas/evas_3d_material.eo +++ b/src/lib/evas/canvas/evas_3d_material.eo @@ -1,4 +1,4 @@ -class EO_Evas_3D_Material (Eo_Base, Evas_Common_Interface) +class EO_Evas_3D_Material (EO_Evas_3D_Object, Evas_Common_Interface) { legacy_prefix: evas_3d_material; data: Evas_3D_Material_Data; @@ -150,7 +150,8 @@ class EO_Evas_3D_Material (Eo_Base, Evas_Common_Interface) implements { Eo_Base::constructor; Eo_Base::destructor; - Evas_Common_Interface::evas::get; + EO_Evas_3D_Object::update_notify; + EO_Evas_3D_Object::change_notify; } } diff --git a/src/lib/evas/canvas/evas_3d_mesh.c b/src/lib/evas/canvas/evas_3d_mesh.c index 2145679..1acde43 100644 --- a/src/lib/evas/canvas/evas_3d_mesh.c +++ b/src/lib/evas/canvas/evas_3d_mesh.c @@ -36,8 +36,7 @@ evas_3d_mesh_frame_free(Evas_3D_Mesh_Frame *frame) if (frame->material) { evas_3d_material_mesh_del(frame->material, frame->mesh); - Evas_3D_Material_Data *pd = eo_data_scope_get(frame->material, EO_EVAS_3D_MATERIAL_CLASS); - evas_3d_object_unreference(&pd->base); + eo_unref(frame->mesh); } for (i = 0; i < EVAS_3D_VERTEX_ATTRIB_COUNT; i++) @@ -103,21 +102,12 @@ _mesh_fini(Evas_3D_Mesh_Data *pd) eina_hash_free(pd->nodes); } -static void -_mesh_free(Evas_3D_Object *obj) -{ - Evas_3D_Mesh_Data *mesh = (Evas_3D_Mesh_Data *)obj; - _mesh_fini(mesh); - //ree(mesh); -} - static Eina_Bool _mesh_node_geometry_change_notify(const Eina_Hash *hash EINA_UNUSED, const void *key, void *data EINA_UNUSED, void *fdata) { Evas_3D_Node *n = *(Evas_3D_Node **)key; - Evas_3D_Node_Data *pdnode = eo_data_scope_get(n, EO_EVAS_3D_NODE_CLASS); - evas_3d_object_change(&pdnode->base, EVAS_3D_STATE_NODE_MESH_GEOMETRY, (Evas_3D_Object *)fdata); + evas_3d_object_change(n, EVAS_3D_STATE_NODE_MESH_GEOMETRY, (Evas_3D_Object *)fdata); return EINA_TRUE; } @@ -126,51 +116,40 @@ _mesh_node_material_change_notify(const Eina_Hash *hash EINA_UNUSED, const void void *data EINA_UNUSED, void *fdata) { Evas_3D_Node *n = *(Evas_3D_Node **)key; - Evas_3D_Node_Data *pdnode = eo_data_scope_get(n, EO_EVAS_3D_NODE_CLASS); - evas_3d_object_change(&pdnode->base, EVAS_3D_STATE_NODE_MESH_MATERIAL, (Evas_3D_Object *)fdata); + evas_3d_object_change(n, EVAS_3D_STATE_NODE_MESH_MATERIAL, (Evas_3D_Object *)fdata); return EINA_TRUE; } static void -_mesh_change(Evas_3D_Object *obj, Evas_3D_State state, Evas_3D_Object *ref EINA_UNUSED) +_eo_evas_3d_mesh_eo_evas_3d_object_change_notify(Eo *obj, Evas_3D_Mesh_Data *pd, Evas_3D_State state, Evas_3D_Object *ref EINA_UNUSED) { - Evas_3D_Mesh_Data *mesh = (Evas_3D_Mesh_Data *)obj; - if (state == EVAS_3D_STATE_MESH_MATERIAL) { - if (mesh->nodes) - eina_hash_foreach(mesh->nodes, _mesh_node_material_change_notify, obj); + if (pd->nodes) + eina_hash_foreach(pd->nodes, _mesh_node_material_change_notify, obj); } else { - if (mesh->nodes) - eina_hash_foreach(mesh->nodes, _mesh_node_geometry_change_notify, obj); + if (pd->nodes) + eina_hash_foreach(pd->nodes, _mesh_node_geometry_change_notify, obj); } } -static void -_mesh_update(Evas_3D_Object *obj) +EOLIAN static void +_eo_evas_3d_mesh_eo_evas_3d_object_update_notify(Eo *obj EINA_UNUSED, Evas_3D_Mesh_Data *pd) { Eina_List *l; Evas_3D_Mesh_Frame *f; - Evas_3D_Mesh_Data *mesh = (Evas_3D_Mesh_Data *)obj; - EINA_LIST_FOREACH(mesh->frames, l, f) + EINA_LIST_FOREACH(pd->frames, l, f) { if (f->material) { - Evas_3D_Material_Data *pdm = eo_data_scope_get(f->material, EO_EVAS_3D_MATERIAL_CLASS); - evas_3d_object_update(&pdm->base); + evas_3d_object_update(f->material); } } } -static const Evas_3D_Object_Func mesh_func = -{ - _mesh_free, - _mesh_change, - _mesh_update, -}; void evas_3d_mesh_node_add(Evas_3D_Mesh *mesh, Evas_3D_Node *node) @@ -227,23 +206,16 @@ evas_3d_mesh_add(Evas *e) EOLIAN static void _eo_evas_3d_mesh_eo_base_constructor(Eo *obj, Evas_3D_Mesh_Data *pd) { - Eo *e; eo_do_super(obj, MY_CLASS, eo_constructor()); - eo_do(obj, e = eo_parent_get()); - evas_3d_object_init(&pd->base, e, EVAS_3D_OBJECT_TYPE_MESH, &mesh_func); + eo_do (obj, eo_evas_3d_object_type_set(EVAS_3D_OBJECT_TYPE_MESH)); _mesh_init(pd); } EOLIAN static void _eo_evas_3d_mesh_eo_base_destructor(Eo *obj EINA_UNUSED, Evas_3D_Mesh_Data *pd) { - evas_3d_object_unreference(&pd->base); -} - -EOLIAN static Evas * - _eo_evas_3d_mesh_evas_common_interface_evas_get(Eo *obj EINA_UNUSED, Evas_3D_Mesh_Data *pd) -{ - return pd->base.evas; + //evas_3d_object_unreference(&pd->base); + _mesh_fini(pd); } EOLIAN static void @@ -252,7 +224,7 @@ _eo_evas_3d_mesh_shade_mode_set(Eo *obj EINA_UNUSED, Evas_3D_Mesh_Data *pd, Evas if (pd->shade_mode != mode) { pd->shade_mode = mode; - evas_3d_object_change(&pd->base, EVAS_3D_STATE_MESH_SHADE_MODE, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_MESH_SHADE_MODE, NULL); } } @@ -263,10 +235,10 @@ _eo_evas_3d_mesh_shade_mode_get(Eo *obj EINA_UNUSED, Evas_3D_Mesh_Data *pd) } EOLIAN static void -_eo_evas_3d_mesh_vertex_count_set(Eo *obj EINA_UNUSED, Evas_3D_Mesh_Data *pd, unsigned int count) +_eo_evas_3d_mesh_vertex_count_set(Eo *obj, Evas_3D_Mesh_Data *pd, unsigned int count) { pd->vertex_count = count; - evas_3d_object_change(&pd->base, EVAS_3D_STATE_MESH_VERTEX_COUNT, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_MESH_VERTEX_COUNT, NULL); } EOLIAN static int @@ -293,11 +265,11 @@ _eo_evas_3d_mesh_frame_add(Eo *obj, Evas_3D_Mesh_Data *pd, int frame) f->frame = frame; pd->frames = eina_list_append(pd->frames, f); - evas_3d_object_change(&pd->base, EVAS_3D_STATE_MESH_FRAME, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_MESH_FRAME, NULL); } EOLIAN static void -_eo_evas_3d_mesh_frame_del(Eo *obj EINA_UNUSED, Evas_3D_Mesh_Data *pd, int frame) +_eo_evas_3d_mesh_frame_del(Eo *obj, Evas_3D_Mesh_Data *pd, int frame) { Evas_3D_Mesh_Frame *f = evas_3d_mesh_frame_find(pd, frame); @@ -309,7 +281,7 @@ _eo_evas_3d_mesh_frame_del(Eo *obj EINA_UNUSED, Evas_3D_Mesh_Data *pd, int frame pd->frames = eina_list_remove(pd->frames, f); evas_3d_mesh_frame_free(f); - evas_3d_object_change(&pd->base, EVAS_3D_STATE_MESH_FRAME, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_MESH_FRAME, NULL); } EOLIAN static void @@ -329,14 +301,12 @@ _eo_evas_3d_mesh_frame_material_set(Eo *obj, Evas_3D_Mesh_Data *pd, int frame, E if (f->material) { evas_3d_material_mesh_del(f->material, obj); - Evas_3D_Material_Data *pdm = eo_data_scope_get(f->material, EO_EVAS_3D_MATERIAL_CLASS); - evas_3d_object_unreference(&pdm->base); + eo_unref(f->material); } f->material = material; - Evas_3D_Material_Data *pdm = eo_data_scope_get(material, EO_EVAS_3D_MATERIAL_CLASS); - evas_3d_object_reference(&pdm->base); - evas_3d_object_change(&pd->base, EVAS_3D_STATE_MESH_MATERIAL, NULL); + eo_ref(material); + evas_3d_object_change(obj, EVAS_3D_STATE_MESH_MATERIAL, NULL); evas_3d_material_mesh_add(material, obj); } @@ -355,7 +325,7 @@ _eo_evas_3d_mesh_frame_material_get(Eo *obj EINA_UNUSED, Evas_3D_Mesh_Data *pd, } EOLIAN static void -_eo_evas_3d_mesh_frame_vertex_data_set(Eo *obj EINA_UNUSED, Evas_3D_Mesh_Data *pd, int frame, Evas_3D_Vertex_Attrib attrib, int stride, const void *data) +_eo_evas_3d_mesh_frame_vertex_data_set(Eo *obj, Evas_3D_Mesh_Data *pd, int frame, Evas_3D_Vertex_Attrib attrib, int stride, const void *data) { Evas_3D_Mesh_Frame *f = evas_3d_mesh_frame_find(pd, frame); int element_count; @@ -401,11 +371,11 @@ _eo_evas_3d_mesh_frame_vertex_data_set(Eo *obj EINA_UNUSED, Evas_3D_Mesh_Data *p f->vertices[attrib].owns_data = EINA_FALSE; f->vertices[attrib].element_count = element_count; - evas_3d_object_change(&pd->base, EVAS_3D_STATE_MESH_VERTEX_DATA, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_MESH_VERTEX_DATA, NULL); } EOLIAN static void -_eo_evas_3d_mesh_frame_vertex_data_copy_set(Eo *obj EINA_UNUSED, Evas_3D_Mesh_Data *pd, int frame, Evas_3D_Vertex_Attrib attrib, int stride, const void *data) +_eo_evas_3d_mesh_frame_vertex_data_copy_set(Eo *obj, Evas_3D_Mesh_Data *pd, int frame, Evas_3D_Vertex_Attrib attrib, int stride, const void *data) { Evas_3D_Mesh_Frame *f = evas_3d_mesh_frame_find(pd, frame); Evas_3D_Vertex_Buffer *vb; @@ -528,7 +498,7 @@ _eo_evas_3d_mesh_frame_vertex_data_copy_set(Eo *obj EINA_UNUSED, Evas_3D_Mesh_Da } } - evas_3d_object_change(&pd->base, EVAS_3D_STATE_MESH_VERTEX_DATA, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_MESH_VERTEX_DATA, NULL); } EOLIAN static void * @@ -587,7 +557,7 @@ _eo_evas_3d_mesh_frame_vertex_stride_get(Eo *obj EINA_UNUSED, Evas_3D_Mesh_Data } EOLIAN static void -_eo_evas_3d_mesh_index_data_set(Eo *obj EINA_UNUSED, Evas_3D_Mesh_Data *pd, Evas_3D_Index_Format format, int count, const void *indices) +_eo_evas_3d_mesh_index_data_set(Eo *obj, Evas_3D_Mesh_Data *pd, Evas_3D_Index_Format format, int count, const void *indices) { if (pd->owns_indices && pd->indices) free(pd->indices); @@ -598,7 +568,7 @@ _eo_evas_3d_mesh_index_data_set(Eo *obj EINA_UNUSED, Evas_3D_Mesh_Data *pd, Evas pd->indices = (void *)indices; pd->owns_indices = EINA_FALSE; - evas_3d_object_change(&pd->base, EVAS_3D_STATE_MESH_INDEX_DATA, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_MESH_INDEX_DATA, NULL); } EOLIAN static void @@ -682,10 +652,10 @@ _eo_evas_3d_mesh_index_data_unmap(Eo *obj EINA_UNUSED, Evas_3D_Mesh_Data *pd) } EOLIAN static void -_eo_evas_3d_mesh_vertex_assembly_set(Eo *obj EINA_UNUSED, Evas_3D_Mesh_Data *pd, Evas_3D_Vertex_Assembly assembly) +_eo_evas_3d_mesh_vertex_assembly_set(Eo *obj, Evas_3D_Mesh_Data *pd, Evas_3D_Vertex_Assembly assembly) { pd->assembly = assembly; - evas_3d_object_change(&pd->base, EVAS_3D_STATE_MESH_VERTEX_ASSEMBLY, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_MESH_VERTEX_ASSEMBLY, NULL); } EOLIAN static Evas_3D_Vertex_Assembly diff --git a/src/lib/evas/canvas/evas_3d_mesh.eo b/src/lib/evas/canvas/evas_3d_mesh.eo index 77a772c..9ca5aed 100755 --- a/src/lib/evas/canvas/evas_3d_mesh.eo +++ b/src/lib/evas/canvas/evas_3d_mesh.eo @@ -1,4 +1,4 @@ -class EO_Evas_3D_Mesh (Eo_Base, Evas_Common_Interface) +class EO_Evas_3D_Mesh (EO_Evas_3D_Object, Evas_Common_Interface) { legacy_prefix: evas_3d_mesh; data: Evas_3D_Mesh_Data; @@ -382,7 +382,8 @@ class EO_Evas_3D_Mesh (Eo_Base, Evas_Common_Interface) implements { Eo_Base::constructor; Eo_Base::destructor; - Evas_Common_Interface::evas::get; + EO_Evas_3D_Object::update_notify; + EO_Evas_3D_Object::change_notify; } } diff --git a/src/lib/evas/canvas/evas_3d_node.c b/src/lib/evas/canvas/evas_3d_node.c index 117c3d4..b854521 100644 --- a/src/lib/evas/canvas/evas_3d_node.c +++ b/src/lib/evas/canvas/evas_3d_node.c @@ -46,8 +46,7 @@ _node_scene_root_change_notify(const Eina_Hash *hash EINA_UNUSED, const void *ke void *data EINA_UNUSED, void *fdata) { Evas_3D_Scene *s = *(Evas_3D_Scene **)key; - Evas_3D_Scene_Data *pd_scene = eo_data_scope_get(s, EO_EVAS_3D_SCENE_CLASS); - evas_3d_object_change(&pd_scene->base, EVAS_3D_STATE_SCENE_ROOT_NODE, (Evas_3D_Object *)fdata); + evas_3d_object_change(s, EVAS_3D_STATE_SCENE_ROOT_NODE, (Evas_3D_Object *)fdata); return EINA_TRUE; } @@ -56,15 +55,13 @@ _node_scene_camera_change_notify(const Eina_Hash *hash EINA_UNUSED, const void * void *data EINA_UNUSED, void *fdata) { Evas_3D_Scene *s = *(Evas_3D_Scene **)key; - Evas_3D_Scene_Data *pd_scene = eo_data_scope_get(s, EO_EVAS_3D_SCENE_CLASS); - evas_3d_object_change(&pd_scene->base, EVAS_3D_STATE_SCENE_CAMERA_NODE, (Evas_3D_Object *)fdata); + evas_3d_object_change(s, EVAS_3D_STATE_SCENE_CAMERA_NODE, (Evas_3D_Object *)fdata); return EINA_TRUE; } -static void -_node_change(Evas_3D_Object *obj, Evas_3D_State state EINA_UNUSED, Evas_3D_Object *ref EINA_UNUSED) +EOLIAN static void +_eo_evas_3d_node_eo_evas_3d_object_change_notify(Eo *obj, Evas_3D_Node_Data *pd, Evas_3D_State state EINA_UNUSED , Evas_3D_Object *ref EINA_UNUSED) { - Evas_3D_Node_Data *pd = (Evas_3D_Node_Data *)obj; Eina_List *l; Evas_3D_Node *n; @@ -78,15 +75,13 @@ _node_change(Evas_3D_Object *obj, Evas_3D_State state EINA_UNUSED, Evas_3D_Objec /* Notify parent that a member has changed. */ if (pd->parent) { - Evas_3D_Node_Data *pdparent = eo_data_scope_get(pd->parent, MY_CLASS); - evas_3d_object_change(&pdparent->base, EVAS_3D_STATE_NODE_MEMBER, obj); + evas_3d_object_change(pd->parent, EVAS_3D_STATE_NODE_MEMBER, obj); } /* Notify members that the parent has changed. */ EINA_LIST_FOREACH(pd->members, l, n) { - Evas_3D_Node_Data *pdmember = eo_data_scope_get(n, MY_CLASS); - evas_3d_object_change(&pdmember->base, EVAS_3D_STATE_NODE_PARENT, obj); + evas_3d_object_change(n, EVAS_3D_STATE_NODE_PARENT, obj); } } @@ -94,8 +89,8 @@ static Eina_Bool _node_transform_update(Evas_3D_Node *node, void *data EINA_UNUSED) { Evas_3D_Node_Data *pd = eo_data_scope_get(node, MY_CLASS); - if (evas_3d_object_dirty_get(&pd->base, EVAS_3D_STATE_NODE_TRANSFORM) || - evas_3d_object_dirty_get(&pd->base, EVAS_3D_STATE_NODE_PARENT)) + if (evas_3d_object_dirty_get(node, EVAS_3D_STATE_NODE_TRANSFORM) || + evas_3d_object_dirty_get(node, EVAS_3D_STATE_NODE_PARENT)) { if (pd->parent) { @@ -179,16 +174,14 @@ _node_item_update(Evas_3D_Node *node, void *data EINA_UNUSED) { if (pd->data.camera.camera) { - Evas_3D_Camera_Data *pdcam = eo_data_scope_get(pd->data.camera.camera, EO_EVAS_3D_CAMERA_CLASS); - evas_3d_object_update(&pdcam->base); + evas_3d_object_update(pd->data.camera.camera); } } else if (pd->type == EVAS_3D_NODE_TYPE_LIGHT) { if (pd->data.light.light) { - Evas_3D_Light_Data *pdlt = eo_data_scope_get(pd->data.light.light, EO_EVAS_3D_LIGHT_CLASS); - evas_3d_object_update(&pdlt->base); + evas_3d_object_update(pd->data.light.light); } } else if (pd->type == EVAS_3D_NODE_TYPE_MESH) @@ -197,8 +190,7 @@ _node_item_update(Evas_3D_Node *node, void *data EINA_UNUSED) Evas_3D_Mesh *m; EINA_LIST_FOREACH(pd->data.mesh.meshes, l, m) { - Evas_3D_Mesh_Data *pdmesh = eo_data_scope_get(m, EO_EVAS_3D_MESH_CLASS); - evas_3d_object_update(&pdmesh->base); + evas_3d_object_update(m); } } @@ -209,10 +201,10 @@ static Eina_Bool _node_aabb_update(Evas_3D_Node *node, void *data EINA_UNUSED) { Evas_3D_Node_Data *pd = eo_data_scope_get(node, EO_EVAS_3D_NODE_CLASS); - if (evas_3d_object_dirty_get(&pd->base, EVAS_3D_STATE_NODE_TRANSFORM) || - evas_3d_object_dirty_get(&pd->base, EVAS_3D_STATE_NODE_MESH_GEOMETRY) || - evas_3d_object_dirty_get(&pd->base, EVAS_3D_STATE_NODE_MESH_FRAME) || - evas_3d_object_dirty_get(&pd->base, EVAS_3D_STATE_NODE_MEMBER)) + if (evas_3d_object_dirty_get(node, EVAS_3D_STATE_NODE_TRANSFORM) || + evas_3d_object_dirty_get(node, EVAS_3D_STATE_NODE_MESH_GEOMETRY) || + evas_3d_object_dirty_get(node, EVAS_3D_STATE_NODE_MESH_FRAME) || + evas_3d_object_dirty_get(node, EVAS_3D_STATE_NODE_MEMBER)) { Eina_List *l; Evas_3D_Node *n; @@ -236,39 +228,38 @@ _node_aabb_update(Evas_3D_Node *node, void *data EINA_UNUSED) } static Eina_Bool -_node_update_done(Evas_3D_Node *node, void *data EINA_UNUSED) +_node_update_done(Evas_3D_Node *obj, void *data EINA_UNUSED) { - Evas_3D_Node_Data *pd = eo_data_scope_get(node, EO_EVAS_3D_NODE_CLASS); - evas_3d_object_update_done(&pd->base); + //@FIXME + Evas_3D_Object_Data *pdobject = eo_data_scope_get(obj, EO_EVAS_3D_OBJECT_CLASS); + memset(&pdobject->dirty[0], 0x00, sizeof(Eina_Bool) * EVAS_3D_STATE_MAX); return EINA_TRUE; } -static void -_node_update(Evas_3D_Object *obj) +EOLIAN static void +_eo_evas_3d_node_eo_evas_3d_object_update_notify(Eo *obj, Evas_3D_Node_Data *pd EINA_UNUSED) { - Evas_3D_Node_Data *pd = (Evas_3D_Node_Data *)obj; - /* Update transform. */ - evas_3d_node_tree_traverse(pd->hack_this, EVAS_3D_TREE_TRAVERSE_LEVEL_ORDER, EINA_FALSE, + evas_3d_node_tree_traverse(obj, EVAS_3D_TREE_TRAVERSE_LEVEL_ORDER, EINA_FALSE, _node_transform_update, NULL); /* Update AABB. */ - evas_3d_node_tree_traverse(pd->hack_this, EVAS_3D_TREE_TRAVERSE_POST_ORDER, EINA_FALSE, + evas_3d_node_tree_traverse(obj, EVAS_3D_TREE_TRAVERSE_POST_ORDER, EINA_FALSE, _node_aabb_update, NULL); /* Update node item. */ - evas_3d_node_tree_traverse(pd->hack_this, EVAS_3D_TREE_TRAVERSE_ANY_ORDER, EINA_FALSE, + evas_3d_node_tree_traverse(obj, EVAS_3D_TREE_TRAVERSE_ANY_ORDER, EINA_FALSE, _node_item_update, NULL); /* Mark all nodes in the tree as up-to-date. */ - evas_3d_node_tree_traverse(pd->hack_this, EVAS_3D_TREE_TRAVERSE_ANY_ORDER, EINA_FALSE, + evas_3d_node_tree_traverse(obj, EVAS_3D_TREE_TRAVERSE_ANY_ORDER, EINA_FALSE, _node_update_done, NULL); } static void _node_free(Evas_3D_Object *obj) { - Evas_3D_Node_Data *pd = (Evas_3D_Node_Data *)obj; + Evas_3D_Node_Data *pd = eo_data_scope_get(obj, MY_CLASS); if (pd->members) { @@ -277,8 +268,7 @@ _node_free(Evas_3D_Object *obj) EINA_LIST_FOREACH(pd->members, l, n) { - Evas_3D_Node_Data *pdmember = eo_data_scope_get(n, EO_EVAS_3D_NODE_CLASS); - evas_3d_object_unreference(&pdmember->base); + eo_unref(n); } eina_list_free(pd->members); @@ -292,8 +282,7 @@ _node_free(Evas_3D_Object *obj) EINA_LIST_FOREACH(pd->data.mesh.meshes, l, m) { //evas_3d_mesh_node_del(m, node); - Evas_3D_Mesh_Data *pdmesh = eo_data_scope_get(m, EO_EVAS_3D_MESH_CLASS); - evas_3d_object_unreference(&pdmesh->base); + eo_unref(m); } eina_list_free(pd->data.mesh.meshes); @@ -311,13 +300,6 @@ _node_free(Evas_3D_Object *obj) //free(node); } -static const Evas_3D_Object_Func node_func = -{ - _node_free, - _node_change, - _node_update, -}; - void evas_3d_node_scene_root_add(Evas_3D_Node *node, Evas_3D_Scene *scene) { @@ -640,11 +622,9 @@ evas_3d_node_add(Evas *e, Evas_3D_Node_Type type) EOLIAN static void _eo_evas_3d_node_constructor(Eo *obj, Evas_3D_Node_Data *pd, Evas_3D_Node_Type type) { - Eo *e; eo_do_super(obj, MY_CLASS, eo_constructor()); - eo_do(obj, e = eo_parent_get()); - evas_3d_object_init(&pd->base, e, EVAS_3D_OBJECT_TYPE_NODE, &node_func); + eo_do(obj, eo_evas_3d_object_type_set(EVAS_3D_OBJECT_TYPE_NODE)); evas_vec3_set(&pd->position, 0.0, 0.0, 0.0); evas_vec4_set(&pd->orientation, 0.0, 0.0, 0.0, 0.0); @@ -658,7 +638,6 @@ _eo_evas_3d_node_constructor(Eo *obj, Evas_3D_Node_Data *pd, Evas_3D_Node_Type t pd->orientation_inherit = EINA_TRUE; pd->scale_inherit = EINA_TRUE; pd->data.mesh.node_meshes = 0; - pd->hack_this = obj; evas_box3_set(&pd->aabb, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); @@ -670,7 +649,7 @@ _eo_evas_3d_node_constructor(Eo *obj, Evas_3D_Node_Data *pd, Evas_3D_Node_Type t if (pd->data.mesh.node_meshes == NULL) { ERR("Failed to create node mesh table."); - _node_free(&pd->base); + _node_free(obj); } } } @@ -683,9 +662,9 @@ _eo_evas_3d_node_eo_base_constructor(Eo *obj, Evas_3D_Node_Data *pd EINA_UNUSED) } EOLIAN static void -_eo_evas_3d_node_eo_base_destructor(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd) +_eo_evas_3d_node_eo_base_destructor(Eo *obj, Evas_3D_Node_Data *pd EINA_UNUSED) { - evas_3d_object_unreference(&pd->base); + eo_unref(obj); } EOLIAN static Evas_3D_Node_Type @@ -694,12 +673,6 @@ _eo_evas_3d_node_type_get(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd) return pd->type; } -EOLIAN static Evas * -_eo_evas_3d_node_evas_common_interface_evas_get(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd) -{ - return pd->base.evas; -} - EOLIAN static void _eo_evas_3d_node_member_add(Eo *obj, Evas_3D_Node_Data *pd, Evas_3D_Node *member) { @@ -719,12 +692,12 @@ _eo_evas_3d_node_member_add(Eo *obj, Evas_3D_Node_Data *pd, Evas_3D_Node *member pdmemberparent->members = eina_list_remove(pdmemberparent->members, member); /* Mark changed. */ - evas_3d_object_change(&pdmemberparent->base, EVAS_3D_STATE_NODE_MEMBER, NULL); + evas_3d_object_change(pdmember->parent, EVAS_3D_STATE_NODE_MEMBER, NULL); } else { /* Should get a new reference. */ - evas_3d_object_reference(&pdmember->base); + eo_ref(member); } /* Add the member node. */ @@ -732,8 +705,8 @@ _eo_evas_3d_node_member_add(Eo *obj, Evas_3D_Node_Data *pd, Evas_3D_Node *member pdmember->parent = obj; /* Mark changed. */ - evas_3d_object_change(&pdmember->base, EVAS_3D_STATE_NODE_PARENT, NULL); - evas_3d_object_change(&pd->base, EVAS_3D_STATE_NODE_MEMBER, NULL); + evas_3d_object_change(member, EVAS_3D_STATE_NODE_PARENT, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_NODE_MEMBER, NULL); } EOLIAN static void @@ -751,11 +724,11 @@ _eo_evas_3d_node_member_del(Eo *obj, Evas_3D_Node_Data *pd, Evas_3D_Node *member pdmember->parent = NULL; /* Mark modified object as changed. */ - evas_3d_object_change(&pd->base, EVAS_3D_STATE_NODE_MEMBER, NULL); - evas_3d_object_change(&pdmember->base, EVAS_3D_STATE_NODE_PARENT, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_NODE_MEMBER, NULL); + evas_3d_object_change(member, EVAS_3D_STATE_NODE_PARENT, NULL); /* Decrease reference count. */ - evas_3d_object_unreference(&pdmember->base); + eo_unref(member); } EOLIAN static Evas_3D_Node * @@ -771,28 +744,28 @@ _eo_evas_3d_node_member_list_get(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd) } EOLIAN static void -_eo_evas_3d_node_position_set(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd, Evas_Real x, Evas_Real y, Evas_Real z) +_eo_evas_3d_node_position_set(Eo *obj, Evas_3D_Node_Data *pd, Evas_Real x, Evas_Real y, Evas_Real z) { pd->position.x = x; pd->position.y = y; pd->position.z = z; - evas_3d_object_change(&pd->base, EVAS_3D_STATE_NODE_TRANSFORM, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_NODE_TRANSFORM, NULL); } EOLIAN static void -_eo_evas_3d_node_orientation_set(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd, Evas_Real x, Evas_Real y, Evas_Real z, Evas_Real w) +_eo_evas_3d_node_orientation_set(Eo *obj, Evas_3D_Node_Data *pd, Evas_Real x, Evas_Real y, Evas_Real z, Evas_Real w) { pd->orientation.x = x; pd->orientation.y = y; pd->orientation.z = z; pd->orientation.w = w; - evas_3d_object_change(&pd->base, EVAS_3D_STATE_NODE_TRANSFORM, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_NODE_TRANSFORM, NULL); } EOLIAN static void -_eo_evas_3d_node_orientation_angle_axis_set(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd, +_eo_evas_3d_node_orientation_angle_axis_set(Eo *obj, Evas_3D_Node_Data *pd, Evas_Real angle, Evas_Real x, Evas_Real y, Evas_Real z) { Evas_Real half_angle = 0.5 * DEGREE_TO_RADIAN(angle); @@ -807,21 +780,21 @@ _eo_evas_3d_node_orientation_angle_axis_set(Eo *obj EINA_UNUSED, Evas_3D_Node_Da pd->orientation.y = s * axis.y; pd->orientation.z = s * axis.z; - evas_3d_object_change(&pd->base, EVAS_3D_STATE_NODE_TRANSFORM, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_NODE_TRANSFORM, NULL); } EOLIAN static void -_eo_evas_3d_node_scale_set(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd, Evas_Real x, Evas_Real y, Evas_Real z) +_eo_evas_3d_node_scale_set(Eo *obj, Evas_3D_Node_Data *pd, Evas_Real x, Evas_Real y, Evas_Real z) { pd->scale.x = x; pd->scale.y = y; pd->scale.z = z; - evas_3d_object_change(&pd->base, EVAS_3D_STATE_NODE_TRANSFORM, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_NODE_TRANSFORM, NULL); } EOLIAN static void -_eo_evas_3d_node_position_get(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd, Evas_3D_Space space, +_eo_evas_3d_node_position_get(Eo *obj, Evas_3D_Node_Data *pd, Evas_3D_Space space, Evas_Real *x, Evas_Real *y, Evas_Real *z) { if (space == EVAS_3D_SPACE_LOCAL) @@ -838,7 +811,7 @@ _eo_evas_3d_node_position_get(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd, Evas_3 } else if (space == EVAS_3D_SPACE_WORLD) { - evas_3d_object_update((Evas_3D_Object *)&pd->base); + evas_3d_object_update(obj); if (x) *x = pd->position_world.x; if (y) *y = pd->position_world.y; @@ -847,7 +820,7 @@ _eo_evas_3d_node_position_get(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd, Evas_3 } EOLIAN static void -_eo_evas_3d_node_orientation_get(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd, Evas_3D_Space space, +_eo_evas_3d_node_orientation_get(Eo *obj, Evas_3D_Node_Data *pd, Evas_3D_Space space, Evas_Real *x, Evas_Real *y, Evas_Real *z, Evas_Real *w) { if (space == EVAS_3D_SPACE_LOCAL) @@ -866,7 +839,7 @@ _eo_evas_3d_node_orientation_get(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd, Eva } else if (space == EVAS_3D_SPACE_WORLD) { - evas_3d_object_update((Evas_3D_Object *)&pd->base); + evas_3d_object_update(obj); if (x) *x = pd->orientation_world.x; if (y) *y = pd->orientation_world.y; @@ -877,7 +850,7 @@ _eo_evas_3d_node_orientation_get(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd, Eva } EOLIAN static void -_eo_evas_3d_node_scale_get(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd, Evas_3D_Space space, +_eo_evas_3d_node_scale_get(Eo *obj, Evas_3D_Node_Data *pd, Evas_3D_Space space, Evas_Real *x, Evas_Real *y, Evas_Real *z) { if (space == EVAS_3D_SPACE_LOCAL) @@ -894,7 +867,7 @@ _eo_evas_3d_node_scale_get(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd, Evas_3D_S } else if (space == EVAS_3D_SPACE_WORLD) { - evas_3d_object_update((Evas_3D_Object *)&pd->base); + evas_3d_object_update(obj); if (x) *x = pd->scale_world.x; if (y) *y = pd->scale_world.y; @@ -903,24 +876,24 @@ _eo_evas_3d_node_scale_get(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd, Evas_3D_S } EOLIAN static void -_eo_evas_3d_node_position_inherit_set(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd, Eina_Bool inherit) +_eo_evas_3d_node_position_inherit_set(Eo *obj, Evas_3D_Node_Data *pd, Eina_Bool inherit) { pd->position_inherit = inherit; - evas_3d_object_change(&pd->base, EVAS_3D_STATE_NODE_TRANSFORM, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_NODE_TRANSFORM, NULL); } EOLIAN static void -_eo_evas_3d_node_orientation_inherit_set(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd, Eina_Bool inherit) +_eo_evas_3d_node_orientation_inherit_set(Eo *obj, Evas_3D_Node_Data *pd, Eina_Bool inherit) { pd->orientation_inherit = inherit; - evas_3d_object_change(&pd->base, EVAS_3D_STATE_NODE_TRANSFORM, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_NODE_TRANSFORM, NULL); } EOLIAN static void -_eo_evas_3d_node_scale_inherit_set(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd, Eina_Bool inherit) +_eo_evas_3d_node_scale_inherit_set(Eo *obj, Evas_3D_Node_Data *pd, Eina_Bool inherit) { pd->scale_inherit = inherit; - evas_3d_object_change(&pd->base, EVAS_3D_STATE_NODE_TRANSFORM, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_NODE_TRANSFORM, NULL); } EOLIAN static Eina_Bool @@ -942,7 +915,7 @@ _eo_evas_3d_node_scale_inherit_get(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd) } EOLIAN static void -_eo_evas_3d_node_look_at_set(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd, +_eo_evas_3d_node_look_at_set(Eo *obj, Evas_3D_Node_Data *pd, Evas_3D_Space target_space, Evas_Real tx, Evas_Real ty, Evas_Real tz, Evas_3D_Space up_space, Evas_Real ux, Evas_Real uy, Evas_Real uz) { @@ -1048,7 +1021,7 @@ _eo_evas_3d_node_look_at_set(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd, pd->orientation.y = (y.z + z.y) * s; } - evas_3d_object_change(&pd->base, EVAS_3D_STATE_NODE_TRANSFORM, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_NODE_TRANSFORM, NULL); } EOLIAN static void @@ -1067,19 +1040,17 @@ _eo_evas_3d_node_camera_set(Eo *obj, Evas_3D_Node_Data *pd, Evas_3D_Camera *came { /* Detach previous camera object. */ evas_3d_camera_node_del(pd->data.camera.camera, obj); - Evas_3D_Camera_Data *pdcamera = eo_data_scope_get(pd->data.camera.camera, EO_EVAS_3D_CAMERA_CLASS); - evas_3d_object_unreference(&pdcamera->base); + eo_unref(pd->data.camera.camera); } pd->data.camera.camera = camera; - Evas_3D_Camera_Data *pdcamera = eo_data_scope_get(camera, EO_EVAS_3D_CAMERA_CLASS); - evas_3d_object_reference(&pdcamera->base); + eo_ref(camera); /* Register change notification on the camera for this node. */ evas_3d_camera_node_add(camera, obj); /* Mark changed. */ - evas_3d_object_change(&pd->base, EVAS_3D_STATE_NODE_CAMERA, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_NODE_CAMERA, NULL); } EOLIAN static Evas_3D_Camera * @@ -1102,21 +1073,19 @@ _eo_evas_3d_node_light_set(Eo *obj, Evas_3D_Node_Data *pd, Evas_3D_Light *light) if (pd->data.light.light) { - Evas_3D_Light_Data *pdl = eo_data_scope_get(pd->data.light.light, EO_EVAS_3D_LIGHT_CLASS); /* Detach previous light object. */ evas_3d_light_node_del(pd->data.light.light, obj); - evas_3d_object_unreference(&pdl->base); + eo_unref(pd->data.light.light); } pd->data.light.light = light; - Evas_3D_Light_Data *pdl = eo_data_scope_get(light, EO_EVAS_3D_LIGHT_CLASS); - evas_3d_object_reference(&pdl->base); + eo_ref(light); /* Register change notification on the light for this node. */ evas_3d_light_node_add(light, obj); /* Mark changed. */ - evas_3d_object_change(&pd->base, EVAS_3D_STATE_NODE_LIGHT, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_NODE_LIGHT, NULL); } EOLIAN static Evas_3D_Light * @@ -1126,7 +1095,7 @@ _eo_evas_3d_node_light_get(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd) } EOLIAN static void -_eo_evas_3d_node_mesh_add(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd, Evas_3D_Mesh *mesh) +_eo_evas_3d_node_mesh_add(Eo *obj, Evas_3D_Node_Data *pd, Evas_3D_Mesh *mesh) { Evas_3D_Node_Mesh *nm = NULL; @@ -1157,15 +1126,14 @@ _eo_evas_3d_node_mesh_add(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd, Evas_3D_Me } pd->data.mesh.meshes = eina_list_append(pd->data.mesh.meshes, mesh); - Evas_3D_Mesh_Data *pdmesh = eo_data_scope_get(mesh, EO_EVAS_3D_MESH_CLASS); - evas_3d_object_reference(&pdmesh->base); + eo_ref(mesh); /* Register change notification. */ evas_3d_mesh_node_add(mesh, obj); /* Mark changed. */ - evas_3d_object_change(&pd->base, EVAS_3D_STATE_NODE_MESH_GEOMETRY, NULL); - evas_3d_object_change(&pd->base, EVAS_3D_STATE_NODE_MESH_MATERIAL, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_NODE_MESH_GEOMETRY, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_NODE_MESH_MATERIAL, NULL); } EOLIAN static void @@ -1185,11 +1153,10 @@ _eo_evas_3d_node_mesh_del(Eo *obj, Evas_3D_Node_Data *pd, Evas_3D_Mesh *mesh) pd->data.mesh.meshes = eina_list_remove(pd->data.mesh.meshes, mesh); evas_3d_mesh_node_del(mesh, obj); - Evas_3D_Mesh_Data *pdmesh = eo_data_scope_get(mesh, EO_EVAS_3D_MESH_CLASS); - evas_3d_object_unreference(&pdmesh->base); + eo_unref(mesh); - evas_3d_object_change(&pd->base, EVAS_3D_STATE_NODE_MESH_GEOMETRY, NULL); - evas_3d_object_change(&pd->base, EVAS_3D_STATE_NODE_MESH_MATERIAL, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_NODE_MESH_GEOMETRY, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_NODE_MESH_MATERIAL, NULL); } EOLIAN static const Eina_List * @@ -1199,7 +1166,7 @@ _eo_evas_3d_node_mesh_list_get(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd) } EOLIAN static void -_eo_evas_3d_node_mesh_frame_set(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd, Evas_3D_Mesh *mesh, int frame) +_eo_evas_3d_node_mesh_frame_set(Eo *obj, Evas_3D_Node_Data *pd, Evas_3D_Mesh *mesh, int frame) { Evas_3D_Node_Mesh *nm = NULL; @@ -1216,7 +1183,7 @@ _eo_evas_3d_node_mesh_frame_set(Eo *obj EINA_UNUSED, Evas_3D_Node_Data *pd, Evas } nm->frame = frame; - evas_3d_object_change(&pd->base, EVAS_3D_STATE_NODE_MESH_FRAME, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_NODE_MESH_FRAME, NULL); } EOLIAN static int diff --git a/src/lib/evas/canvas/evas_3d_node.eo b/src/lib/evas/canvas/evas_3d_node.eo index c578b3e..fff231e 100755 --- a/src/lib/evas/canvas/evas_3d_node.eo +++ b/src/lib/evas/canvas/evas_3d_node.eo @@ -1,4 +1,4 @@ -class EO_Evas_3D_Node (Eo_Base, Evas_Common_Interface) +class EO_Evas_3D_Node (EO_Evas_3D_Object, Evas_Common_Interface) { legacy_prefix: evas_3d_node; data: Evas_3D_Node_Data; @@ -543,6 +543,7 @@ class EO_Evas_3D_Node (Eo_Base, Evas_Common_Interface) implements { Eo_Base::constructor; Eo_Base::destructor; - Evas_Common_Interface::evas::get; + EO_Evas_3D_Object::update_notify; + EO_Evas_3D_Object::change_notify; } } diff --git a/src/lib/evas/canvas/evas_3d_object.c b/src/lib/evas/canvas/evas_3d_object.c index 75bd241..07386fe 100644 --- a/src/lib/evas/canvas/evas_3d_object.c +++ b/src/lib/evas/canvas/evas_3d_object.c @@ -1,129 +1,68 @@ #include "evas_common_private.h" #include "evas_private.h" -#define REF_COUNT_CHECK(obj) \ - do { \ - if ((obj)->ref_count < 1) \ - { \ - ERR("Invalid reference count.") +#include "Eo.h" -#define REF_COUNT_CHECK_END() \ - } \ - } while (0) +#define MY_CLASS EO_EVAS_3D_OBJECT_CLASS -#define OBJ_TYPE_CHECK(obj, type) \ - do { \ - if ((obj)->type != type) \ - { \ - ERR("3D object type check failed.") - -#define OBJ_TYPE_CHECK_END() \ - } \ - } while (0) - -void -evas_3d_object_init(Evas_3D_Object *obj, - Evas *e, Evas_3D_Object_Type type, const Evas_3D_Object_Func *func) -{ - obj->evas = e; - obj->type = type; - obj->ref_count = 1; - obj->func = *func; - memset(&obj->dirty[0], 0x00, sizeof(Eina_Bool) * EVAS_3D_STATE_MAX); -} - -void -evas_3d_object_reference(Evas_3D_Object *obj) +EOLIAN static void +_eo_evas_3d_object_eo_base_constructor(Eo *obj, Evas_3D_Object_Data *pd) { - REF_COUNT_CHECK(obj); - return; - REF_COUNT_CHECK_END(); - - obj->ref_count++; + Eo *e = NULL; + eo_do_super(obj, MY_CLASS, eo_constructor()); + eo_do(obj, e = eo_parent_get()); + pd->evas = e; + pd->type = EVAS_3D_OBJECT_TYPE_INVALID; + memset(&pd->dirty[0], 0x00, sizeof(Eina_Bool) * EVAS_3D_STATE_MAX); } -void -evas_3d_object_unreference(Evas_3D_Object *obj) -{ - if (obj->ref_count < 1) - { - printf("gotcha\n"); - } - - REF_COUNT_CHECK(obj); - return; - REF_COUNT_CHECK_END(); - obj->ref_count--; - - if (obj->ref_count == 0) - obj->func.free(obj); -} - -int -evas_3d_object_reference_count_get(const Evas_3D_Object *obj) +EOLIAN static Evas * + _eo_evas_3d_object_evas_common_interface_evas_get(Eo *obj EINA_UNUSED, Evas_3D_Object_Data *pd) { - REF_COUNT_CHECK(obj); - return 0; - REF_COUNT_CHECK_END(); - - return obj->ref_count; + return pd->evas; } -Evas * -evas_3d_object_evas_get(const Evas_3D_Object *obj) +EOLIAN static void +_eo_evas_3d_object_type_set(Eo *obj EINA_UNUSED, Evas_3D_Object_Data *pd, Evas_3D_Object_Type type) { - REF_COUNT_CHECK(obj); - return NULL; - REF_COUNT_CHECK_END(); - - return obj->evas; + pd->type = type; } -Evas_3D_Object_Type -evas_3d_object_type_get(const Evas_3D_Object *obj) +EOLIAN static Evas_3D_Object_Type +_eo_evas_3d_object_type_get(Eo *obj EINA_UNUSED, Evas_3D_Object_Data *pd) { - REF_COUNT_CHECK(obj); - return EVAS_3D_OBJECT_TYPE_INVALID; - REF_COUNT_CHECK_END(); - - return obj->type; + return pd->type; } -Eina_Bool -evas_3d_object_dirty_get(const Evas_3D_Object *obj, Evas_3D_State state) +EOLIAN static Eina_Bool +_eo_evas_3d_object_dirty_get(Eo *obj EINA_UNUSED, Evas_3D_Object_Data *pd, Evas_3D_State state) { - return obj->dirty[state]; + return pd->dirty[state]; } -void -evas_3d_object_change(Evas_3D_Object *obj, Evas_3D_State state, Evas_3D_Object *ref) +EOLIAN static void +_eo_evas_3d_object_change(Eo *obj, Evas_3D_Object_Data *pd, Evas_3D_State state, Evas_3D_Object *ref) { /* Skip already dirty properties. */ - if (obj->dirty[state]) + if (pd->dirty[state]) return; - obj->dirty[state] = EINA_TRUE; - obj->dirty[EVAS_3D_STATE_ANY] = EINA_TRUE; + pd->dirty[state] = EINA_TRUE; + pd->dirty[EVAS_3D_STATE_ANY] = EINA_TRUE; - if (obj->func.change) - obj->func.change(obj, state, ref); + eo_do(obj, eo_evas_3d_object_change_notify(state, ref)); } -void -evas_3d_object_update(Evas_3D_Object *obj) +EOLIAN static void +_eo_evas_3d_object_update(Eo *obj, Evas_3D_Object_Data *pd) { - if (!obj->dirty[EVAS_3D_STATE_ANY]) + if (!pd->dirty[EVAS_3D_STATE_ANY]) return; - if (obj->func.update) - obj->func.update(obj); + eo_do(obj, eo_evas_3d_object_update_notify()); - evas_3d_object_update_done(obj); + memset(&pd->dirty[0], 0x00, sizeof(Eina_Bool) * EVAS_3D_STATE_MAX); } -void -evas_3d_object_update_done(Evas_3D_Object *obj) -{ - memset(&obj->dirty[0], 0x00, sizeof(Eina_Bool) * EVAS_3D_STATE_MAX); -} +#include "canvas/evas_3d_object.eo.c" diff --git a/src/lib/evas/canvas/evas_3d_object.eo b/src/lib/evas/canvas/evas_3d_object.eo new file mode 100755 index 0000000..02bce86 --- /dev/null +++ b/src/lib/evas/canvas/evas_3d_object.eo @@ -0,0 +1,74 @@ +class EO_Evas_3D_Object (Eo_Base, Evas_Common_Interface) +{ + legacy_prefix: evas_3d_object; + data: Evas_3D_Object_Data; + methods { + change { + /*@ + Notify the object regarding its state change. + */ + params { + @in Evas_3D_State state; /*@ State that is changed */ + @in Evas_3D_Object *ref; /*@ The Object that caused the change */ + } + } + type_get { + /*@ + Returns the type of the object. + */ + const; + return Evas_3D_Object_Type; + } + + type_set { + /*@ + Returns the type of the object. + */ + params{ + @in Evas_3D_Object_Type type; + } + } + + dirty_get { + /*@ + Returns the status of a particular state of the object. + */ + const; + return Eina_Bool; + params { + @in Evas_3D_State state; /*@ State whose status is being asked */ + } + } + + update { + /*@ + Update request for the object. + */ + } + update_notify { + /*@ + Pure virtual update_notify function.. + Update request for the object. + */ + } + + change_notify { + /*@ + Pure virtual change_notify function.. + Update request for the object. + */ + params { + @in Evas_3D_State state; /*@ State that is changed */ + @in Evas_3D_Object *ref; /*@ The Object that caused the change */ + } + } + } + + implements { + Eo_Base::constructor; + Evas_Common_Interface::evas::get; + virtual::update_notify; + virtual::change_notify; + } + +} diff --git a/src/lib/evas/canvas/evas_3d_scene.c b/src/lib/evas/canvas/evas_3d_scene.c index 2f32ec2..e1e45b8 100644 --- a/src/lib/evas/canvas/evas_3d_scene.c +++ b/src/lib/evas/canvas/evas_3d_scene.c @@ -29,70 +29,32 @@ evas_3d_scene_data_fini(Evas_3D_Scene_Public_Data *data) } static void -_scene_change(Evas_3D_Object *obj, Evas_3D_State state EINA_UNUSED, Evas_3D_Object *ref EINA_UNUSED) +_eo_evas_3d_scene_eo_evas_3d_object_change_notify(Eo *obj EINA_UNUSED, Evas_3D_Scene_Data *pd, Evas_3D_State state EINA_UNUSED, Evas_3D_Object *ref EINA_UNUSED) { - Evas_3D_Scene_Data *scene = (Evas_3D_Scene_Data *)obj; Eina_List *l; Evas_Object *eo; - EINA_LIST_FOREACH(scene->images, l, eo) + EINA_LIST_FOREACH(pd->images, l, eo) { Evas_Object_Protected_Data *obj = eo_data_scope_get(eo, EVAS_OBJ_CLASS); evas_object_change(eo, obj); } } -static void -_scene_update(Evas_3D_Object *obj) -{ - Evas_3D_Scene_Data *scene = (Evas_3D_Scene_Data *)obj; - - if (scene->root_node) - { - Evas_3D_Node_Data *pd_root_node = eo_data_scope_get(scene->root_node, EO_EVAS_3D_NODE_CLASS); - evas_3d_object_update(&pd_root_node->base); - } - - if (scene->camera_node) - { - Evas_3D_Node_Data *pd_camera_node = eo_data_scope_get(scene->camera_node, EO_EVAS_3D_NODE_CLASS); - evas_3d_object_update(&pd_camera_node->base); - } -} - -static void -_scene_free(Evas_3D_Object *obj) +EOLIAN static void +_eo_evas_3d_scene_eo_evas_3d_object_update_notify(Eo *obj EINA_UNUSED, Evas_3D_Scene_Data *pd) { - Evas_3D_Scene_Data *scene = (Evas_3D_Scene_Data *)obj; - - if (scene->root_node) + if (pd->root_node) { - Evas_3D_Node_Data *pd_root_node = eo_data_scope_get(scene->root_node, EO_EVAS_3D_NODE_CLASS); - //@FIXME - evas_3d_node_scene_root_del(scene->root_node, scene->hack_this); - evas_3d_object_unreference(&pd_root_node->base); + evas_3d_object_update(pd->root_node); } - if (scene->camera_node) + if (pd->camera_node) { - Evas_3D_Node_Data *pd_camera_node = eo_data_scope_get(scene->camera_node, EO_EVAS_3D_NODE_CLASS); - evas_3d_node_scene_camera_del(scene->camera_node, scene->hack_this); - evas_3d_object_unreference(&pd_camera_node->base); + evas_3d_object_update(pd->camera_node); } - - if (scene->images) - eina_list_free(scene->images); - eo_del(scene->hack_this); - //free(scene); } -static const Evas_3D_Object_Func scene_func = -{ - _scene_free, - _scene_change, - _scene_update, -}; - EAPI Evas_3D_Scene * evas_3d_scene_add(Evas *e) { @@ -107,25 +69,17 @@ evas_3d_scene_add(Evas *e) EOLIAN static void _eo_evas_3d_scene_eo_base_constructor(Eo *obj, Evas_3D_Scene_Data *pd) { - Eo *e; eo_do_super(obj, MY_CLASS, eo_constructor()); - eo_do(obj, e = eo_parent_get()); - evas_3d_object_init(&pd->base, e, EVAS_3D_OBJECT_TYPE_SCENE, &scene_func); + eo_do(obj, eo_evas_3d_object_type_set(EVAS_3D_OBJECT_TYPE_SCENE)); evas_color_set(&pd->bg_color, 0.0, 0.0, 0.0, 0.0); } EOLIAN static void -_eo_evas_3d_scene_eo_base_destructor(Eo *obj EINA_UNUSED, Evas_3D_Scene_Data *pd) +_eo_evas_3d_scene_eo_base_destructor(Eo *obj EINA_UNUSED, Evas_3D_Scene_Data *pd EINA_UNUSED) { //evas_3d_object_unreference(&pd->base); } -EOLIAN static Evas * -_eo_evas_3d_scene_evas_common_interface_evas_get(Eo *obj EINA_UNUSED, Evas_3D_Scene_Data *pd) -{ - return pd->base.evas; -} - EOLIAN static void _eo_evas_3d_scene_root_node_set(Eo *obj, Evas_3D_Scene_Data *pd, Evas_3D_Node *node) { @@ -134,21 +88,19 @@ _eo_evas_3d_scene_root_node_set(Eo *obj, Evas_3D_Scene_Data *pd, Evas_3D_Node *n if (pd->root_node) { - Evas_3D_Node_Data *pd_root_node = eo_data_scope_get(pd->root_node, EO_EVAS_3D_NODE_CLASS); evas_3d_node_scene_root_del(pd->root_node, obj); - evas_3d_object_unreference(&pd_root_node->base); + eo_unref(pd->root_node); } pd->root_node = node; if (node) { - Evas_3D_Node_Data *pd_node = eo_data_scope_get(node, EO_EVAS_3D_NODE_CLASS); - evas_3d_object_reference(&pd_node->base); + eo_ref(node); evas_3d_node_scene_root_add(node, obj); } - evas_3d_object_change(&pd->base, EVAS_3D_STATE_SCENE_ROOT_NODE, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_SCENE_ROOT_NODE, NULL); } EOLIAN static Evas_3D_Node * @@ -165,21 +117,19 @@ _eo_evas_3d_scene_camera_node_set(Eo *obj, Evas_3D_Scene_Data *pd, Evas_3D_Node if (pd->camera_node) { - Evas_3D_Node_Data *pd_camera_node = eo_data_scope_get(pd->camera_node, EO_EVAS_3D_NODE_CLASS); evas_3d_node_scene_camera_del(pd->camera_node, obj); - evas_3d_object_unreference(&pd_camera_node->base); + eo_unref(pd->camera_node); } pd->camera_node = node; if (node) { - Evas_3D_Node_Data *pd_node = eo_data_scope_get(node, EO_EVAS_3D_NODE_CLASS); - evas_3d_object_reference(&pd_node->base); + eo_unref(node); evas_3d_node_scene_camera_add(node, obj); } - evas_3d_object_change(&pd->base, EVAS_3D_STATE_SCENE_CAMERA_NODE, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_SCENE_CAMERA_NODE, NULL); } EOLIAN static Evas_3D_Node * @@ -193,7 +143,7 @@ _eo_evas_3d_scene_size_set(Eo *obj EINA_UNUSED, Evas_3D_Scene_Data *pd, int w, i { pd->w = w; pd->h = h; - evas_3d_object_change(&pd->base, EVAS_3D_STATE_SCENE_SIZE, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_SCENE_SIZE, NULL); } EOLIAN static void @@ -208,7 +158,7 @@ _eo_evas_3d_scene_background_color_set(Eo *obj EINA_UNUSED, Evas_3D_Scene_Data * Evas_Real r, Evas_Real g, Evas_Real b, Evas_Real a) { evas_color_set(&pd->bg_color, r, g, b, a); - evas_3d_object_change(&pd->base, EVAS_3D_STATE_SCENE_BACKGROUND_COLOR, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_SCENE_BACKGROUND_COLOR, NULL); } EOLIAN static void @@ -611,7 +561,7 @@ _eo_evas_3d_scene_pick(Eo *obj EINA_UNUSED, Evas_3D_Scene_Data *pd, Evas_Real x, data.t = 0.0; /* Update the scene graph. */ - evas_3d_object_update((Evas_3D_Object *)&pd->base); + evas_3d_object_update((Evas_3D_Object *)obj); Evas_3D_Node_Data *pd_camera_node = eo_data_scope_get(pd->camera_node, EO_EVAS_3D_NODE_CLASS); Evas_3D_Camera_Data *pd_camera = eo_data_scope_get(pd_camera_node->data.camera.camera, EO_EVAS_3D_CAMERA_CLASS); evas_mat4_multiply(&data.matrix_vp, @@ -636,4 +586,4 @@ _eo_evas_3d_scene_pick(Eo *obj EINA_UNUSED, Evas_3D_Scene_Data *pd, Evas_Real x, return EINA_TRUE; } -#include "canvas/evas_3d_scene.eo.c" \ No newline at end of file +#include "canvas/evas_3d_scene.eo.c" diff --git a/src/lib/evas/canvas/evas_3d_scene.eo b/src/lib/evas/canvas/evas_3d_scene.eo index 887ff38..03ead12 100755 --- a/src/lib/evas/canvas/evas_3d_scene.eo +++ b/src/lib/evas/canvas/evas_3d_scene.eo @@ -1,4 +1,4 @@ -class EO_Evas_3D_Scene (Eo_Base, Evas_Common_Interface) +class EO_Evas_3D_Scene (EO_Evas_3D_Object, Evas_Common_Interface) { legacy_prefix: evas_3d_scene; data: Evas_3D_Scene_Data; @@ -139,7 +139,8 @@ class EO_Evas_3D_Scene (Eo_Base, Evas_Common_Interface) implements { Eo_Base::constructor; Eo_Base::destructor; - Evas_Common_Interface::evas::get; + EO_Evas_3D_Object::update_notify; + EO_Evas_3D_Object::change_notify; } } diff --git a/src/lib/evas/canvas/evas_3d_texture.c b/src/lib/evas/canvas/evas_3d_texture.c index 1805091..f36f2e4 100644 --- a/src/lib/evas/canvas/evas_3d_texture.c +++ b/src/lib/evas/canvas/evas_3d_texture.c @@ -58,22 +58,24 @@ _texture_proxy_unset(Evas_3D_Texture_Data *texture) } static inline void -_texture_proxy_subrender(Evas_3D_Texture_Data *texture) +_texture_proxy_subrender(Evas_3D_Texture *obj) { /* Code taken from _proxy_subrender() in file evas_object_image.c */ - - Evas_Public_Data *e = eo_data_scope_get(texture->base.evas, EVAS_CLASS); + Eo *evas = NULL; + eo_do(obj, evas = evas_common_evas_get()); + Evas_Public_Data *e = eo_data_scope_get(evas, EVAS_CLASS); + Evas_3D_Texture_Data *pd = eo_data_scope_get(obj, MY_CLASS); Evas_Object_Protected_Data *source; void *ctx, *image; int w, h; Eina_Bool is_image; - if (!texture->source) + if (!pd->source) return; - source = eo_data_scope_get(texture->source, EVAS_OBJ_CLASS); + source = eo_data_scope_get(pd->source, EVAS_OBJ_CLASS); - is_image = eo_isa(texture->source, EVAS_OBJ_IMAGE_CLASS); + is_image = eo_isa(pd->source, EVAS_OBJ_IMAGE_CLASS); EINA_COW_WRITE_BEGIN(evas_object_proxy_cow, source->proxy, Evas_Object_Proxy_Data, proxy_write) { @@ -81,7 +83,7 @@ _texture_proxy_subrender(Evas_3D_Texture_Data *texture) if (is_image) { - image = source->func->engine_data_get(texture->source); + image = source->func->engine_data_get(pd->source); e->engine.func->image_size_get(e->engine.data.output, image, &w, &h); } else @@ -124,7 +126,7 @@ _texture_proxy_subrender(Evas_3D_Texture_Data *texture) if (is_image) { - void *image = source->func->engine_data_get(texture->source); + void *image = source->func->engine_data_get(pd->source); if (image) { @@ -141,11 +143,11 @@ _texture_proxy_subrender(Evas_3D_Texture_Data *texture) Evas_Proxy_Render_Data proxy_render_data = { .eo_proxy = NULL, .proxy_obj = NULL, - .eo_src = texture->source, + .eo_src = pd->source, .source_clip = EINA_FALSE }; - evas_render_mapped(e, texture->source, source, ctx, proxy_write->surface, + evas_render_mapped(e, pd->source, source, ctx, proxy_write->surface, -source->cur->geometry.x, -source->cur->geometry.y, 1, 0, 0, e->output.w, e->output.h, @@ -165,71 +167,62 @@ _texture_proxy_subrender(Evas_3D_Texture_Data *texture) } static void -_texture_fini(Evas_3D_Texture_Data *texture) +_texture_fini(Evas_3D_Texture *obj) { - if (texture->engine_data) + Eo *evas = NULL; + eo_do(obj, evas = evas_common_evas_get()); + Evas_3D_Texture_Data *pd = eo_data_scope_get(obj, MY_CLASS); + if (pd->engine_data) { - Evas_Public_Data *e = eo_data_scope_get(texture->base.evas, EVAS_CLASS); - e->engine.func->texture_free(e->engine.data.output, texture->engine_data); - texture->engine_data = NULL; + Evas_Public_Data *e = eo_data_scope_get(evas, EVAS_CLASS); + e->engine.func->texture_free(e->engine.data.output, pd->engine_data); + pd->engine_data = NULL; } - if (texture->materials) + if (pd->materials) { - eina_hash_free(texture->materials); - texture->materials = NULL; + eina_hash_free(pd->materials); + pd->materials = NULL; } - if (texture->source) + if (pd->source) { - _texture_proxy_unset(texture); + _texture_proxy_unset(pd); } } -static void -_texture_free(Evas_3D_Object *obj) -{ - Evas_3D_Texture_Data *texture = (Evas_3D_Texture_Data *)obj; - - _texture_fini(texture); - //free(texture); -} - static Eina_Bool _texture_material_change_notify(const Eina_Hash *hash EINA_UNUSED, const void *key, void *data EINA_UNUSED, void *fdata) { Evas_3D_Material *m = *(Evas_3D_Material **)key; - Evas_3D_Material_Data *pdm = eo_data_scope_get(m, EO_EVAS_3D_MATERIAL_CLASS); - evas_3d_object_change(&pdm->base, EVAS_3D_STATE_MATERIAL_TEXTURE, (Evas_3D_Object *)fdata); + evas_3d_object_change(m, EVAS_3D_STATE_MATERIAL_TEXTURE, (Evas_3D_Object *)fdata); return EINA_TRUE; } -static void -_texture_change(Evas_3D_Object *obj, Evas_3D_State state EINA_UNUSED, - Evas_3D_Object *ref EINA_UNUSED) +EOLIAN static void +_eo_evas_3d_texture_eo_evas_3d_object_change_notify(Eo *obj, Evas_3D_Texture_Data *pd, Evas_3D_State state EINA_UNUSED, Evas_3D_Object *ref EINA_UNUSED) { - Evas_3D_Texture_Data *texture = (Evas_3D_Texture_Data *)obj; - if (texture->materials) - eina_hash_foreach(texture->materials, _texture_material_change_notify, obj); + if (pd->materials) + eina_hash_foreach(pd->materials, _texture_material_change_notify, obj); } -static void -_texture_update(Evas_3D_Object *obj) +EOLIAN static void +_eo_evas_3d_texture_eo_evas_3d_object_update_notify(Eo *obj, Evas_3D_Texture_Data *pd) { - Evas_3D_Texture_Data *texture = (Evas_3D_Texture_Data *)obj; - - if (texture->source) + if (pd->source) { - Evas_Public_Data *e = eo_data_scope_get(texture->base.evas, EVAS_CLASS); - Evas_Object_Protected_Data *src = eo_data_scope_get(texture->source, EVAS_OBJ_CLASS); + Eo *evas = NULL; + eo_do(obj, evas = evas_common_evas_get()); + Evas_Public_Data *e = eo_data_scope_get(evas, EVAS_CLASS); + Evas_Object_Protected_Data *src = eo_data_scope_get(pd->source, EVAS_OBJ_CLASS); - if (texture->engine_data == NULL) + if (pd->engine_data == NULL) { - texture->engine_data = e->engine.func->texture_new(e->engine.data.output); + pd->engine_data = e->engine.func->texture_new(e->engine.data.output); - if (texture->engine_data == NULL) + if (pd->engine_data == NULL) { ERR("Failed to create engine-side texture object."); return; @@ -238,28 +231,21 @@ _texture_update(Evas_3D_Object *obj) if (src->proxy->surface && !src->proxy->redraw) { - e->engine.func->texture_image_set(e->engine.data.output, texture->engine_data, + e->engine.func->texture_image_set(e->engine.data.output, pd->engine_data, src->proxy->surface); return; } - texture->proxy_rendering = EINA_TRUE; - _texture_proxy_subrender(texture); + pd->proxy_rendering = EINA_TRUE; + _texture_proxy_subrender(obj); - e->engine.func->texture_image_set(e->engine.data.output, texture->engine_data, + e->engine.func->texture_image_set(e->engine.data.output, pd->engine_data, src->proxy->surface); - texture->proxy_rendering = EINA_FALSE; + pd->proxy_rendering = EINA_FALSE; } } -static const Evas_3D_Object_Func texture_func = -{ - _texture_free, - _texture_change, - _texture_update, -}; - void evas_3d_texture_material_add(Evas_3D_Texture *texture, Evas_3D_Material *material) { @@ -301,22 +287,6 @@ evas_3d_texture_material_del(Evas_3D_Texture *texture, Evas_3D_Material *materia eina_hash_set(pd->materials, &material, (const void *)(count - 1)); } -// Evas_3D_Texture * -// evas_3d_texture_new(Evas *e) -// { -// Evas_3D_Texture *texture = NULL; - -// texture = (Evas_3D_Texture *)calloc(1, sizeof(Evas_3D_Texture_Data)); - -// if (texture == NULL) -// { -// ERR("Failed to allocate memory."); -// return NULL; -// } - -// evas_3d_object_init(&texture->base, e, EVAS_3D_OBJECT_TYPE_TEXTURE, &texture_func); -// return texture; -// } EAPI Evas_3D_Texture * evas_3d_texture_add(Evas *e) @@ -327,36 +297,30 @@ evas_3d_texture_add(Evas *e) Evas_Object *eo_obj = eo_add(MY_CLASS, e); eo_unref(eo_obj); return eo_obj; - //return evas_3d_texture_new(e); } EOLIAN static void -_eo_evas_3d_texture_eo_base_constructor(Eo *obj, Evas_3D_Texture_Data *pd) +_eo_evas_3d_texture_eo_base_constructor(Eo *obj, Evas_3D_Texture_Data *pd EINA_UNUSED) { - Eo *e; eo_do_super(obj, MY_CLASS, eo_constructor()); - eo_do(obj, e = eo_parent_get()); - evas_3d_object_init(&pd->base, e, EVAS_3D_OBJECT_TYPE_CAMERA, &texture_func); + eo_do(obj, eo_evas_3d_object_type_set(EVAS_3D_OBJECT_TYPE_TEXTURE)); } EOLIAN static void -_eo_evas_3d_texture_eo_base_destructor(Eo *obj EINA_UNUSED, Evas_3D_Texture_Data *pd) -{ - evas_3d_object_unreference(&pd->base); -} - -EOLIAN static Evas * -_eo_evas_3d_texture_evas_common_interface_evas_get(Eo *obj EINA_UNUSED, Evas_3D_Texture_Data *pd) +_eo_evas_3d_texture_eo_base_destructor(Eo *obj, Evas_3D_Texture_Data *pd EINA_UNUSED) { - return pd->base.evas; + //evas_3d_object_unreference(&pd->base); + _texture_fini(obj); } EOLIAN static void _eo_evas_3d_texture_data_set(Eo *obj EINA_UNUSED, Evas_3D_Texture_Data *pd, Evas_3D_Color_Format color_format, Evas_3D_Pixel_Format pixel_format, int w, int h, const void *data) { - Evas_Public_Data *e = eo_data_scope_get(pd->base.evas, EVAS_CLASS); + Eo *evas = NULL; + eo_do(obj, evas = evas_common_evas_get()); + Evas_Public_Data *e = eo_data_scope_get(evas, EVAS_CLASS); if (pd->engine_data == NULL) pd->engine_data = e->engine.func->texture_new(e->engine.data.output); @@ -364,35 +328,39 @@ _eo_evas_3d_texture_data_set(Eo *obj EINA_UNUSED, Evas_3D_Texture_Data *pd, Evas e->engine.func->texture_data_set(e->engine.data.output, pd->engine_data, color_format, pixel_format, w, h, data); - evas_3d_object_change(&pd->base, EVAS_3D_STATE_TEXTURE_DATA, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_TEXTURE_DATA, NULL); } EOLIAN static void -_eo_evas_3d_texture_file_set(Eo *obj EINA_UNUSED, Evas_3D_Texture_Data *pd, const char *file, const char *key) +_eo_evas_3d_texture_file_set(Eo *obj, Evas_3D_Texture_Data *pd, const char *file, const char *key) { - Evas_Public_Data *e = eo_data_scope_get(pd->base.evas, EVAS_CLASS); + Eo *evas = NULL; + eo_do(obj, evas = evas_common_evas_get()); + Evas_Public_Data *e = eo_data_scope_get(evas, EVAS_CLASS); if (pd->engine_data == NULL) pd->engine_data = e->engine.func->texture_new(e->engine.data.output); e->engine.func->texture_file_set(e->engine.data.output, pd->engine_data, file, key); - evas_3d_object_change(&pd->base, EVAS_3D_STATE_TEXTURE_DATA, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_TEXTURE_DATA, NULL); } EAPI void _eo_evas_3d_texture_source_set(Eo *obj , Evas_3D_Texture_Data *pd, Evas_Object *source) { + Eo *evas = NULL; + eo_do(obj, evas = evas_common_evas_get()); Evas_Object_Protected_Data *src; if (source == pd->source) return; - _texture_fini(pd); + _texture_fini(obj); if (source == NULL) return; - if (evas_object_evas_get(source) != pd->base.evas) + if (evas_object_evas_get(source) != evas) { ERR("Not matching canvas."); return; @@ -413,7 +381,7 @@ _eo_evas_3d_texture_source_set(Eo *obj , Evas_3D_Texture_Data *pd, Evas_Object * } _texture_proxy_set(obj, source, src); - evas_3d_object_change(&pd->base, EVAS_3D_STATE_TEXTURE_DATA, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_TEXTURE_DATA, NULL); } EOLIAN static void @@ -454,45 +422,57 @@ EOLIAN static Evas_3D_Color_Format _eo_evas_3d_texture_color_format_get(Eo *obj EINA_UNUSED, Evas_3D_Texture_Data *pd) { Evas_3D_Color_Format format; - Evas_Public_Data *e = eo_data_scope_get(pd->base.evas, EVAS_CLASS); + Eo *evas = NULL; + eo_do(obj, evas = evas_common_evas_get()); + Evas_Public_Data *e = eo_data_scope_get(evas, EVAS_CLASS); e->engine.func->texture_color_format_get(e->engine.data.output, pd->engine_data, &format); return format; } EOLIAN static void -_eo_evas_3d_texture_size_get(Eo *obj EINA_UNUSED, Evas_3D_Texture_Data *pd, int *w, int *h) +_eo_evas_3d_texture_size_get(Eo *obj, Evas_3D_Texture_Data *pd, int *w, int *h) { - Evas_Public_Data *e = eo_data_scope_get(pd->base.evas, EVAS_CLASS); + Eo *evas = NULL; + eo_do(obj, evas = evas_common_evas_get()); + Evas_Public_Data *e = eo_data_scope_get(evas, EVAS_CLASS); e->engine.func->texture_size_get(e->engine.data.output, pd->engine_data, w, h); } EOLIAN static void -_eo_evas_3d_texture_wrap_set(Eo *obj EINA_UNUSED, Evas_3D_Texture_Data *pd, Evas_3D_Wrap_Mode s, Evas_3D_Wrap_Mode t) +_eo_evas_3d_texture_wrap_set(Eo *obj, Evas_3D_Texture_Data *pd, Evas_3D_Wrap_Mode s, Evas_3D_Wrap_Mode t) { - Evas_Public_Data *e = eo_data_scope_get(pd->base.evas, EVAS_CLASS); + Eo *evas = NULL; + eo_do(obj, evas = evas_common_evas_get()); + Evas_Public_Data *e = eo_data_scope_get(evas, EVAS_CLASS); e->engine.func->texture_wrap_set(e->engine.data.output, pd->engine_data, s, t); - evas_3d_object_change(&pd->base, EVAS_3D_STATE_TEXTURE_WRAP, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_TEXTURE_WRAP, NULL); } EOLIAN static void -_eo_evas_3d_texture_wrap_get(Eo *obj EINA_UNUSED, Evas_3D_Texture_Data *pd, Evas_3D_Wrap_Mode *s, Evas_3D_Wrap_Mode *t) +_eo_evas_3d_texture_wrap_get(Eo *obj, Evas_3D_Texture_Data *pd, Evas_3D_Wrap_Mode *s, Evas_3D_Wrap_Mode *t) { - Evas_Public_Data *e = eo_data_scope_get(pd->base.evas, EVAS_CLASS); + Eo *evas = NULL; + eo_do(obj, evas = evas_common_evas_get()); + Evas_Public_Data *e = eo_data_scope_get(evas, EVAS_CLASS); e->engine.func->texture_wrap_get(e->engine.data.output, pd->engine_data, s, t); } EOLIAN static void -_eo_evas_3d_texture_filter_set(Eo *obj EINA_UNUSED, Evas_3D_Texture_Data *pd, Evas_3D_Texture_Filter min, Evas_3D_Texture_Filter mag) +_eo_evas_3d_texture_filter_set(Eo *obj, Evas_3D_Texture_Data *pd, Evas_3D_Texture_Filter min, Evas_3D_Texture_Filter mag) { - Evas_Public_Data *e = eo_data_scope_get(pd->base.evas, EVAS_CLASS); + Eo *evas = NULL; + eo_do(obj, evas = evas_common_evas_get()); + Evas_Public_Data *e = eo_data_scope_get(evas, EVAS_CLASS); e->engine.func->texture_filter_set(e->engine.data.output, pd->engine_data, min, mag); - evas_3d_object_change(&pd->base, EVAS_3D_STATE_TEXTURE_FILTER, NULL); + evas_3d_object_change(obj, EVAS_3D_STATE_TEXTURE_FILTER, NULL); } EOLIAN static void _eo_evas_3d_texture_filter_get(Eo *obj EINA_UNUSED, Evas_3D_Texture_Data *pd, Evas_3D_Texture_Filter *min, Evas_3D_Texture_Filter *mag) { - Evas_Public_Data *e = eo_data_scope_get(pd->base.evas, EVAS_CLASS); + Eo *evas = NULL; + eo_do(obj, evas = evas_common_evas_get()); + Evas_Public_Data *e = eo_data_scope_get(evas, EVAS_CLASS); e->engine.func->texture_filter_get(e->engine.data.output, pd->engine_data, min, mag); } diff --git a/src/lib/evas/canvas/evas_3d_texture.eo b/src/lib/evas/canvas/evas_3d_texture.eo index 5e55eca..a7e6cae 100755 --- a/src/lib/evas/canvas/evas_3d_texture.eo +++ b/src/lib/evas/canvas/evas_3d_texture.eo @@ -1,4 +1,4 @@ -class EO_Evas_3D_Texture (Eo_Base, Evas_Common_Interface) +class EO_Evas_3D_Texture (EO_Evas_3D_Object, Evas_Common_Interface) { legacy_prefix: evas_3d_texture; data : Evas_3D_Texture_Data; @@ -193,7 +193,8 @@ class EO_Evas_3D_Texture (Eo_Base, Evas_Common_Interface) implements { Eo_Base::constructor; Eo_Base::destructor; - Evas_Common_Interface::evas::get; + EO_Evas_3D_Object::update_notify; + EO_Evas_3D_Object::change_notify; } } diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c index 7d406e5..b28cf1e 100644 --- a/src/lib/evas/canvas/evas_object_image.c +++ b/src/lib/evas/canvas/evas_object_image.c @@ -2430,7 +2430,7 @@ _3d_set(Evas_Object *eo_obj, Evas_3D_Scene *scene) data->surface = NULL; data->w = 0; data->h = 0; - evas_3d_object_reference(&pd_scene->base); + eo_ref(scene); } EINA_COW_WRITE_END(evas_object_3d_cow, obj->data_3d, data); @@ -2453,8 +2453,7 @@ _3d_unset(Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, Evas Evas_3D_Scene_Data *pd_scene = eo_data_scope_get(o->cur->scene, EO_EVAS_3D_SCENE_CLASS); EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write) pd_scene->images = eina_list_remove(pd_scene->images, eo_obj); - Evas_3D_Scene_Data *pd_scene_state_write = eo_data_scope_get(state_write->scene, EO_EVAS_3D_SCENE_CLASS); - evas_3d_object_unreference(&pd_scene_state_write->base); + eo_unref(state_write->scene); state_write->scene = NULL; EINA_COW_IMAGE_STATE_WRITE_END(o, state_write); } @@ -2542,7 +2541,7 @@ _3d_render(Evas *eo_e, Evas_Object *eo_obj EINA_UNUSED, Evas_Object_Protected_Da scene_data.camera_node = pd_scene->camera_node; /* Phase 1 - Update scene graph tree. */ - evas_3d_object_update(&pd_scene->base); + evas_3d_object_update(scene); /* Phase 2 - Do frustum culling and get visible model nodes. */ evas_3d_node_tree_traverse(pd_scene->root_node, EVAS_3D_TREE_TRAVERSE_LEVEL_ORDER, EINA_TRUE, @@ -3375,8 +3374,8 @@ evas_object_image_render_pre(Evas_Object *eo_obj, else if (o->cur->scene) { Evas_3D_Scene *scene = o->cur->scene; - Evas_3D_Scene_Data *pd_scene = eo_data_scope_get(scene, EO_EVAS_3D_SCENE_CLASS); - if (evas_3d_object_dirty_get(&pd_scene->base, EVAS_3D_STATE_ANY)) + //Evas_3D_Scene_Data *pd_scene = eo_data_scope_get(scene, EO_EVAS_3D_SCENE_CLASS); + if (evas_3d_object_dirty_get(scene, EVAS_3D_STATE_ANY)) { evas_object_render_pre_prev_cur_add(&e->clip_changes, eo_obj, obj); goto done; diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c index 94b4a26..f317806 100644 --- a/src/lib/evas/canvas/evas_object_main.c +++ b/src/lib/evas/canvas/evas_object_main.c @@ -246,8 +246,7 @@ evas_object_change(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj) } EINA_LIST_FOREACH(obj->proxy->proxy_textures, l, texture) { - Evas_3D_Texture_Data *pd = eo_data_scope_get(texture, EO_EVAS_3D_TEXTURE_CLASS); - evas_3d_object_change(&pd->base, EVAS_3D_STATE_TEXTURE_DATA, NULL); + evas_3d_object_change(texture, EVAS_3D_STATE_TEXTURE_DATA, NULL); } if (obj->smart.parent) { diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h index e71a5fd..123e489 100644 --- a/src/lib/evas/include/evas_private.h +++ b/src/lib/evas/include/evas_private.h @@ -57,7 +57,7 @@ typedef struct _Evas_Object_Protected_Data Evas_Object_Protected_Data; #define EVAS_3D_VERTEX_ATTRIB_COUNT 5 #define EVAS_3D_MATERIAL_ATTRIB_COUNT 5 -typedef struct _Evas_3D_Object Evas_3D_Object; +typedef struct _Evas_3D_Object Evas_3D_Object_Data; typedef struct _Evas_3D_Scene_Public_Data Evas_3D_Scene_Public_Data; typedef struct _Evas_3D_Vertex_Buffer Evas_3D_Vertex_Buffer; typedef struct _Evas_3D_Mesh_Frame Evas_3D_Mesh_Frame; @@ -79,68 +79,6 @@ typedef struct _Evas_3D_Texture Evas_3D_Texture_Data; typedef Eina_Bool (*Evas_3D_Node_Func)(Evas_3D_Node *, void *data); -typedef enum _Evas_3D_Object_Type -{ - EVAS_3D_OBJECT_TYPE_INVALID = 0, - EVAS_3D_OBJECT_TYPE_SCENE, - EVAS_3D_OBJECT_TYPE_NODE, - EVAS_3D_OBJECT_TYPE_CAMERA, - EVAS_3D_OBJECT_TYPE_LIGHT, - EVAS_3D_OBJECT_TYPE_MODEL, - EVAS_3D_OBJECT_TYPE_MESH, - EVAS_3D_OBJECT_TYPE_TEXTURE, - EVAS_3D_OBJECT_TYPE_MATERIAL, -} Evas_3D_Object_Type; - -typedef enum _Evas_3D_State -{ - EVAS_3D_STATE_MAX = 16, - - EVAS_3D_STATE_ANY = 0, - - EVAS_3D_STATE_SCENE_ROOT_NODE = 1, - EVAS_3D_STATE_SCENE_CAMERA_NODE, - EVAS_3D_STATE_SCENE_BACKGROUND_COLOR, - EVAS_3D_STATE_SCENE_SIZE, - - EVAS_3D_STATE_TEXTURE_DATA = 1, - EVAS_3D_STATE_TEXTURE_WRAP, - EVAS_3D_STATE_TEXTURE_FILTER, - - EVAS_3D_STATE_MATERIAL_ID = 1, - EVAS_3D_STATE_MATERIAL_COLOR, - EVAS_3D_STATE_MATERIAL_TEXTURE, - - EVAS_3D_STATE_MESH_VERTEX_COUNT = 1, - EVAS_3D_STATE_MESH_FRAME, - EVAS_3D_STATE_MESH_MATERIAL, - EVAS_3D_STATE_MESH_TRANSFORM, - EVAS_3D_STATE_MESH_VERTEX_DATA, - EVAS_3D_STATE_MESH_INDEX_DATA, - EVAS_3D_STATE_MESH_VERTEX_ASSEMBLY, - EVAS_3D_STATE_MESH_SHADE_MODE, - - EVAS_3D_STATE_CAMERA_PROJECTION = 1, - - EVAS_3D_STATE_LIGHT_AMBIENT = 1, - EVAS_3D_STATE_LIGHT_DIFFUSE, - EVAS_3D_STATE_LIGHT_SPECULAR, - EVAS_3D_STATE_LIGHT_SPOT_DIR, - EVAS_3D_STATE_LIGHT_SPOT_EXP, - EVAS_3D_STATE_LIGHT_SPOT_CUTOFF, - EVAS_3D_STATE_LIGHT_ATTENUATION, - - EVAS_3D_STATE_NODE_TRANSFORM = 1, - EVAS_3D_STATE_NODE_MESH_GEOMETRY, - EVAS_3D_STATE_NODE_MESH_MATERIAL, - EVAS_3D_STATE_NODE_MESH_FRAME, - EVAS_3D_STATE_NODE_MESH_SHADE_MODE, - EVAS_3D_STATE_NODE_MESH_MATERIAL_ID, - EVAS_3D_STATE_NODE_LIGHT, - EVAS_3D_STATE_NODE_CAMERA, - EVAS_3D_STATE_NODE_PARENT, - EVAS_3D_STATE_NODE_MEMBER, -} Evas_3D_State; typedef enum _Evas_3D_Node_Traverse_Type { @@ -156,32 +94,20 @@ typedef enum _Evas_3D_Tree_Traverse_Type EVAS_3D_TREE_TRAVERSE_LEVEL_ORDER, } Evas_3D_Tree_Traverse_Type; -struct _Evas_3D_Object_Func -{ - void (*free)(Evas_3D_Object *obj); - void (*change)(Evas_3D_Object *obj, Evas_3D_State state, Evas_3D_Object *ref); - void (*update)(Evas_3D_Object *obj); -}; struct _Evas_3D_Object { Evas *evas; Evas_3D_Object_Type type; - int ref_count; - Evas_3D_Object_Func func; Eina_Bool dirty[EVAS_3D_STATE_MAX]; }; struct _Evas_3D_Scene { - Evas_3D_Object base; - Evas_3D_Node *root_node; Evas_3D_Node *camera_node; - //@FIXME - Evas_3D_Scene *hack_this; Evas_Color bg_color; void *surface; @@ -198,12 +124,8 @@ struct _Evas_3D_Node_Mesh struct _Evas_3D_Node { - Evas_3D_Object base; - Eina_List *members; Evas_3D_Node *parent; - //@FIXME - Evas_3D_Node *hack_this; Evas_Vec3 position; Evas_Vec4 orientation; @@ -249,16 +171,12 @@ struct _Evas_3D_Node struct _Evas_3D_Camera { - Evas_3D_Object base; - Evas_Mat4 projection; Eina_Hash *nodes; }; struct _Evas_3D_Light { - Evas_3D_Object base; - Evas_Color ambient; Evas_Color diffuse; Evas_Color specular; @@ -312,8 +230,6 @@ struct _Evas_3D_Mesh_Frame struct _Evas_3D_Mesh { - Evas_3D_Object base; - Evas_3D_Shade_Mode shade_mode; int vertex_count; @@ -334,8 +250,6 @@ struct _Evas_3D_Mesh struct _Evas_3D_Texture { - Evas_3D_Object base; - /* List of materials using this texture. */ Eina_Hash *materials; @@ -350,8 +264,6 @@ struct _Evas_3D_Texture struct _Evas_3D_Material { - Evas_3D_Object base; - struct { Eina_Bool enable; Evas_Color color;