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 = \
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}
*/
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
*/
*/
typedef double Evas_Real;
+
+typedef Eo Evas_3D_Object;
+
/**
* @typedef Evas_3D_Scene
*
*
* @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.
*
* @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.
*
* @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.
*
* @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.
*
* @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.
*
* @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.
*
* @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.
#include "canvas/evas_3d_node.eo.h"
#include "canvas/evas_3d_scene.eo.h"
+
+#include "canvas/evas_3d_object.eo.h"
#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)
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 *
//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
}
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;
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"
-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;
implements {
Eo_Base::constructor;
Eo_Base::destructor;
- Evas_Common_Interface::evas::get;
+ EO_Evas_3D_Object::update_notify;
+ EO_Evas_3D_Object::change_notify;
}
}
#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)
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);
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);
}
}
}
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
}
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
}
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
}
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
}
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
}
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
}
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);
}
}
-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;
implements {
Eo_Base::constructor;
Eo_Base::destructor;
- Evas_Common_Interface::evas::get;
+ EO_Evas_3D_Object::update_notify;
+ EO_Evas_3D_Object::change_notify;
}
}
#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)
{
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);
}
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
}
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
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 *
-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;
implements {
Eo_Base::constructor;
Eo_Base::destructor;
- Evas_Common_Interface::evas::get;
+ EO_Evas_3D_Object::update_notify;
+ EO_Evas_3D_Object::change_notify;
}
}
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++)
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;
}
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)
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
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);
}
}
}
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
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);
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
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);
}
}
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;
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;
}
}
- 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 *
}
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);
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
}
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
-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;
implements {
Eo_Base::constructor;
Eo_Base::destructor;
- Evas_Common_Interface::evas::get;
+ EO_Evas_3D_Object::update_notify;
+ EO_Evas_3D_Object::change_notify;
}
}
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;
}
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;
/* 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);
}
}
_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)
{
{
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)
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);
}
}
_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;
}
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)
{
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);
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);
//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)
{
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);
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);
if (pd->data.mesh.node_meshes == NULL)
{
ERR("Failed to create node mesh table.");
- _node_free(&pd->base);
+ _node_free(obj);
}
}
}
}
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
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)
{
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. */
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
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 *
}
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);
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)
}
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;
}
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)
}
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;
}
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)
}
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;
}
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
}
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)
{
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
{
/* 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 *
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 *
}
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;
}
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
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 *
}
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;
}
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
-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;
implements {
Eo_Base::constructor;
Eo_Base::destructor;
- Evas_Common_Interface::evas::get;
+ EO_Evas_3D_Object::update_notify;
+ EO_Evas_3D_Object::change_notify;
}
}
#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"
--- /dev/null
+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;
+ }
+
+}
}
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)
{
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)
{
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 *
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 *
{
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
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
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,
return EINA_TRUE;
}
-#include "canvas/evas_3d_scene.eo.c"
\ No newline at end of file
+#include "canvas/evas_3d_scene.eo.c"
-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;
implements {
Eo_Base::constructor;
Eo_Base::destructor;
- Evas_Common_Interface::evas::get;
+ EO_Evas_3D_Object::update_notify;
+ EO_Evas_3D_Object::change_notify;
}
}
}
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)
{
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
if (is_image)
{
- void *image = source->func->engine_data_get(texture->source);
+ void *image = source->func->engine_data_get(pd->source);
if (image)
{
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,
}
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;
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)
{
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)
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);
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;
}
_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
_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);
}
-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;
implements {
Eo_Base::constructor;
Eo_Base::destructor;
- Evas_Common_Interface::evas::get;
+ EO_Evas_3D_Object::update_notify;
+ EO_Evas_3D_Object::change_notify;
}
}
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);
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);
}
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,
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;
}
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)
{
#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;
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
{
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;
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;
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;
struct _Evas_3D_Mesh
{
- Evas_3D_Object base;
-
Evas_3D_Shade_Mode shade_mode;
int vertex_count;
struct _Evas_3D_Texture
{
- Evas_3D_Object base;
-
/* List of materials using this texture. */
Eina_Hash *materials;
struct _Evas_3D_Material
{
- Evas_3D_Object base;
-
struct {
Eina_Bool enable;
Evas_Color color;