forked from enlightenment/efl
evas: Update evas_3d_utils, replace Evas_Vec.
Summary: Change Evas_Vec2(3) to Eina_Vector2(3). Reviewers: cedric, Hermet, jpeg Subscribers: jpeg Differential Revision: https://phab.enlightenment.org/D3686
This commit is contained in:
parent
a1584c8a5d
commit
780ec5d029
|
@ -163,7 +163,7 @@ _evas_canvas3d_camera_node_visible_get(Eo *obj EINA_UNUSED, Evas_Canvas3D_Camera
|
||||||
Eina_Quaternion planes[6];
|
Eina_Quaternion planes[6];
|
||||||
Evas_Canvas3D_Node_Data *pd_node = eo_data_scope_get(node, EVAS_CANVAS3D_NODE_CLASS);
|
Evas_Canvas3D_Node_Data *pd_node = eo_data_scope_get(node, EVAS_CANVAS3D_NODE_CLASS);
|
||||||
Evas_Canvas3D_Node_Data *pd_camera = eo_data_scope_get(camera_node, EVAS_CANVAS3D_NODE_CLASS);
|
Evas_Canvas3D_Node_Data *pd_camera = eo_data_scope_get(camera_node, EVAS_CANVAS3D_NODE_CLASS);
|
||||||
Evas_Vec3 central_point;
|
Eina_Vector3 central_point;
|
||||||
|
|
||||||
if (!node || pd_node->type != EVAS_CANVAS3D_NODE_TYPE_MESH)
|
if (!node || pd_node->type != EVAS_CANVAS3D_NODE_TYPE_MESH)
|
||||||
{
|
{
|
||||||
|
|
|
@ -924,7 +924,7 @@ _evas_canvas3d_mesh_from_primitive_set(Eo *obj,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
evas_canvas3d_mesh_interpolate_position_get(Evas_Vec3 *out, const Evas_Canvas3D_Vertex_Buffer *pos0, const Evas_Canvas3D_Vertex_Buffer *pos1,
|
evas_canvas3d_mesh_interpolate_position_get(Eina_Vector3 *out, const Evas_Canvas3D_Vertex_Buffer *pos0, const Evas_Canvas3D_Vertex_Buffer *pos1,
|
||||||
Evas_Real weight, int index)
|
Evas_Real weight, int index)
|
||||||
{
|
{
|
||||||
if (pos1->data == NULL)
|
if (pos1->data == NULL)
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
Evas_Canvas3D_Mesh_Frame *evas_canvas3d_mesh_frame_find(Evas_Canvas3D_Mesh_Data *pd, int frame);
|
Evas_Canvas3D_Mesh_Frame *evas_canvas3d_mesh_frame_find(Evas_Canvas3D_Mesh_Data *pd, int frame);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_look_at_set(Evas_Canvas3D_Node_Data *pd, Evas_Vec3 *target, Evas_Vec3 *up);
|
_look_at_set(Evas_Canvas3D_Node_Data *pd, Eina_Vector3 *target, Eina_Vector3 *up);
|
||||||
|
|
||||||
static Eina_Stringshare *
|
static Eina_Stringshare *
|
||||||
_generate_unic_color_key(Evas_Color *color, Evas_Color *bg_color, Evas_Canvas3D_Node *node, Evas_Canvas3D_Mesh *mesh,
|
_generate_unic_color_key(Evas_Color *color, Evas_Color *bg_color, Evas_Canvas3D_Node *node, Evas_Canvas3D_Mesh *mesh,
|
||||||
|
@ -240,7 +240,7 @@ _node_transform_update(Evas_Canvas3D_Node *node, void *data EINA_UNUSED)
|
||||||
if (pd->parent)
|
if (pd->parent)
|
||||||
{
|
{
|
||||||
Evas_Canvas3D_Node_Data *pdparent = eo_data_scope_get(pd->parent, MY_CLASS);
|
Evas_Canvas3D_Node_Data *pdparent = eo_data_scope_get(pd->parent, MY_CLASS);
|
||||||
const Evas_Vec3 *scale_parent = &pdparent->scale_world;
|
const Eina_Vector3 *scale_parent = &pdparent->scale_world;
|
||||||
const Eina_Quaternion *orientation_parent = &pdparent->orientation_world;
|
const Eina_Quaternion *orientation_parent = &pdparent->orientation_world;
|
||||||
|
|
||||||
/* Orienatation */
|
/* Orienatation */
|
||||||
|
@ -256,17 +256,17 @@ _node_transform_update(Evas_Canvas3D_Node *node, void *data EINA_UNUSED)
|
||||||
|
|
||||||
/* Scale */
|
/* Scale */
|
||||||
if (pd->scale_inherit)
|
if (pd->scale_inherit)
|
||||||
evas_vec3_multiply(&pd->scale_world, scale_parent, &pd->scale);
|
eina_vector3_multiply(&pd->scale_world, scale_parent, &pd->scale);
|
||||||
else
|
else
|
||||||
pd->scale_world = pd->scale;
|
pd->scale_world = pd->scale;
|
||||||
|
|
||||||
/* Position */
|
/* Position */
|
||||||
if (pd->position_inherit)
|
if (pd->position_inherit)
|
||||||
{
|
{
|
||||||
evas_vec3_multiply(&pd->position_world, &pd->position, scale_parent);
|
eina_vector3_multiply(&pd->position_world, &pd->position, scale_parent);
|
||||||
evas_vec3_quaternion_rotate(&pd->position_world, &pd->position_world,
|
eina_vector3_quaternion_rotate(&pd->position_world, &pd->position_world,
|
||||||
orientation_parent);
|
orientation_parent);
|
||||||
evas_vec3_add(&pd->position_world, &pd->position_world,
|
eina_vector3_add(&pd->position_world, &pd->position_world,
|
||||||
&pdparent->position_world);
|
&pdparent->position_world);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -314,16 +314,16 @@ _node_transform_update(Evas_Canvas3D_Node *node, void *data EINA_UNUSED)
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_node_billboard_update(Evas_Canvas3D_Node *node, void *data EINA_UNUSED)
|
_node_billboard_update(Evas_Canvas3D_Node *node, void *data EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Evas_Vec3 target;
|
Eina_Vector3 target;
|
||||||
Evas_Vec3 up;
|
Eina_Vector3 up;
|
||||||
Evas_Canvas3D_Node_Data *pd_node = eo_data_scope_get(node, MY_CLASS);
|
Evas_Canvas3D_Node_Data *pd_node = eo_data_scope_get(node, MY_CLASS);
|
||||||
if (pd_node->billboard_target)
|
if (pd_node->billboard_target)
|
||||||
{
|
{
|
||||||
Evas_Canvas3D_Node_Data *pd_target = eo_data_scope_get(pd_node->billboard_target,
|
Evas_Canvas3D_Node_Data *pd_target = eo_data_scope_get(pd_node->billboard_target,
|
||||||
MY_CLASS);
|
MY_CLASS);
|
||||||
evas_vec3_set(&target, pd_target->position.x, pd_target->position.y,
|
eina_vector3_set(&target, pd_target->position.x, pd_target->position.y,
|
||||||
pd_target->position.z);
|
pd_target->position.z);
|
||||||
evas_vec3_set(&up, 0, 1, 0);
|
eina_vector3_set(&up, 0, 1, 0);
|
||||||
|
|
||||||
_look_at_set(pd_node, &target, &up);
|
_look_at_set(pd_node, &target, &up);
|
||||||
|
|
||||||
|
@ -383,13 +383,13 @@ _node_item_update(Evas_Canvas3D_Node *node, void *data EINA_UNUSED)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_pack_meshes_vertex_data(Evas_Canvas3D_Node *node, Evas_Vec3 **vertices, int *count)
|
_pack_meshes_vertex_data(Evas_Canvas3D_Node *node, Eina_Vector3 **vertices, int *count)
|
||||||
{
|
{
|
||||||
const Eina_List *m, *l;
|
const Eina_List *m, *l;
|
||||||
Evas_Canvas3D_Mesh *mesh;
|
Evas_Canvas3D_Mesh *mesh;
|
||||||
int j;
|
int j;
|
||||||
int frame;
|
int frame;
|
||||||
Evas_Vec3 *it;
|
Eina_Vector3 *it;
|
||||||
Evas_Canvas3D_Vertex_Buffer pos0, pos1;
|
Evas_Canvas3D_Vertex_Buffer pos0, pos1;
|
||||||
Evas_Real pos_weight;
|
Evas_Real pos_weight;
|
||||||
|
|
||||||
|
@ -410,7 +410,7 @@ _pack_meshes_vertex_data(Evas_Canvas3D_Node *node, Evas_Vec3 **vertices, int *co
|
||||||
*count += pos0.size / pos0.stride;
|
*count += pos0.size / pos0.stride;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*vertices = (Evas_Vec3*)malloc(*count * sizeof(Evas_Vec3));
|
*vertices = (Eina_Vector3*)malloc(*count * sizeof(Eina_Vector3));
|
||||||
it = *vertices;
|
it = *vertices;
|
||||||
if(!*vertices)
|
if(!*vertices)
|
||||||
{
|
{
|
||||||
|
@ -446,13 +446,13 @@ _update_node_shapes(Evas_Canvas3D_Node *node)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int count;
|
int count;
|
||||||
Evas_Vec3 *vertices = NULL;
|
Eina_Vector3 *vertices = NULL;
|
||||||
Evas_Canvas3D_Node_Data *pd = eo_data_scope_get(node, EVAS_CANVAS3D_NODE_CLASS);
|
Evas_Canvas3D_Node_Data *pd = eo_data_scope_get(node, EVAS_CANVAS3D_NODE_CLASS);
|
||||||
Eina_Bool transform_orientation_dirty;
|
Eina_Bool transform_orientation_dirty;
|
||||||
Eina_Bool transform_position_dirty;
|
Eina_Bool transform_position_dirty;
|
||||||
Eina_Bool transform_scale_dirty;
|
Eina_Bool transform_scale_dirty;
|
||||||
Eina_Bool mesh_geom_dirty;
|
Eina_Bool mesh_geom_dirty;
|
||||||
Evas_Vec3 position = pd->position_world;
|
Eina_Vector3 position = pd->position_world;
|
||||||
|
|
||||||
if (pd->type != EVAS_CANVAS3D_NODE_TYPE_MESH)
|
if (pd->type != EVAS_CANVAS3D_NODE_TYPE_MESH)
|
||||||
{
|
{
|
||||||
|
@ -482,15 +482,15 @@ _update_node_shapes(Evas_Canvas3D_Node *node)
|
||||||
calculate_box(&pd->obb, count, vertices);
|
calculate_box(&pd->obb, count, vertices);
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
evas_vec3_homogeneous_position_transform(&vertices[i], &vertices[i], &pd->data.mesh.matrix_local_to_world);
|
eina_vector3_homogeneous_position_transform(&vertices[i], &pd->data.mesh.matrix_local_to_world, &vertices[i]);
|
||||||
}
|
}
|
||||||
calculate_box(&pd->aabb, count, vertices);
|
calculate_box(&pd->aabb, count, vertices);
|
||||||
if (transform_position_dirty || transform_scale_dirty || mesh_geom_dirty)
|
if (transform_position_dirty || transform_scale_dirty || mesh_geom_dirty)
|
||||||
{
|
{
|
||||||
calculate_sphere(&pd->bsphere, count, vertices);
|
calculate_sphere(&pd->bsphere, count, vertices);
|
||||||
}
|
}
|
||||||
evas_vec3_homogeneous_position_transform(&pd->obb.p0, &pd->obb.p0, &pd->data.mesh.matrix_local_to_world);
|
eina_vector3_homogeneous_position_transform(&pd->obb.p0, &pd->data.mesh.matrix_local_to_world, &pd->obb.p0);
|
||||||
evas_vec3_homogeneous_position_transform(&pd->obb.p0, &pd->obb.p0, &pd->data.mesh.matrix_local_to_world);
|
eina_vector3_homogeneous_position_transform(&pd->obb.p0, &pd->data.mesh.matrix_local_to_world, &pd->obb.p0);
|
||||||
}
|
}
|
||||||
free(vertices);
|
free(vertices);
|
||||||
|
|
||||||
|
@ -1032,13 +1032,13 @@ _evas_canvas3d_node_constructor(Eo *obj, Evas_Canvas3D_Node_Data *pd, Evas_Canva
|
||||||
{
|
{
|
||||||
eo_do(obj, evas_canvas3d_object_type_set(EVAS_CANVAS3D_OBJECT_TYPE_NODE));
|
eo_do(obj, evas_canvas3d_object_type_set(EVAS_CANVAS3D_OBJECT_TYPE_NODE));
|
||||||
|
|
||||||
evas_vec3_set(&pd->position, 0.0, 0.0, 0.0);
|
eina_vector3_set(&pd->position, 0.0, 0.0, 0.0);
|
||||||
eina_quaternion_set(&pd->orientation, 0.0, 0.0, 0.0, 1.0);
|
eina_quaternion_set(&pd->orientation, 0.0, 0.0, 0.0, 1.0);
|
||||||
evas_vec3_set(&pd->scale, 1.0, 1.0, 1.0);
|
eina_vector3_set(&pd->scale, 1.0, 1.0, 1.0);
|
||||||
|
|
||||||
evas_vec3_set(&pd->position_world, 0.0, 0.0, 0.0);
|
eina_vector3_set(&pd->position_world, 0.0, 0.0, 0.0);
|
||||||
eina_quaternion_set(&pd->orientation_world, 0.0, 0.0, 0.0, 1.0);
|
eina_quaternion_set(&pd->orientation_world, 0.0, 0.0, 0.0, 1.0);
|
||||||
evas_vec3_set(&pd->scale_world, 1.0, 1.0, 1.0);
|
eina_vector3_set(&pd->scale_world, 1.0, 1.0, 1.0);
|
||||||
|
|
||||||
pd->position_inherit = EINA_TRUE;
|
pd->position_inherit = EINA_TRUE;
|
||||||
pd->orientation_inherit = EINA_TRUE;
|
pd->orientation_inherit = EINA_TRUE;
|
||||||
|
@ -1176,10 +1176,10 @@ _evas_canvas3d_node_orientation_angle_axis_set(Eo *obj, Evas_Canvas3D_Node_Data
|
||||||
{
|
{
|
||||||
Evas_Real half_angle = 0.5 * DEGREE_TO_RADIAN(angle);
|
Evas_Real half_angle = 0.5 * DEGREE_TO_RADIAN(angle);
|
||||||
Evas_Real s = sin(half_angle);
|
Evas_Real s = sin(half_angle);
|
||||||
Evas_Vec3 axis;
|
Eina_Vector3 axis;
|
||||||
|
|
||||||
evas_vec3_set(&axis, x, y, z);
|
eina_vector3_set(&axis, x, y, z);
|
||||||
evas_vec3_normalize(&axis, &axis);
|
eina_vector3_normalize(&axis, &axis);
|
||||||
|
|
||||||
pd->orientation.w = cos(half_angle);
|
pd->orientation.w = cos(half_angle);
|
||||||
pd->orientation.x = s * axis.x;
|
pd->orientation.x = s * axis.x;
|
||||||
|
@ -1321,18 +1321,18 @@ _evas_canvas3d_node_scale_inherit_get(Eo *obj EINA_UNUSED, Evas_Canvas3D_Node_Da
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_look_at_set(Evas_Canvas3D_Node_Data *pd, Evas_Vec3 *target, Evas_Vec3 *up)
|
_look_at_set(Evas_Canvas3D_Node_Data *pd, Eina_Vector3 *target, Eina_Vector3 *up)
|
||||||
{
|
{
|
||||||
Evas_Vec3 x, y, z;
|
Eina_Vector3 x, y, z;
|
||||||
|
|
||||||
evas_vec3_subtract(&z, &pd->position, target);
|
eina_vector3_subtract(&z, &pd->position, target);
|
||||||
evas_vec3_normalize(&z, &z);
|
eina_vector3_normalize(&z, &z);
|
||||||
|
|
||||||
evas_vec3_cross_product(&x, up, &z);
|
eina_vector3_cross_product(&x, up, &z);
|
||||||
evas_vec3_normalize(&x, &x);
|
eina_vector3_normalize(&x, &x);
|
||||||
|
|
||||||
evas_vec3_cross_product(&y, &z, &x);
|
eina_vector3_cross_product(&y, &z, &x);
|
||||||
evas_vec3_normalize(&y, &y);
|
eina_vector3_normalize(&y, &y);
|
||||||
|
|
||||||
/* Below matrix to quaternion conversion code taken from
|
/* Below matrix to quaternion conversion code taken from
|
||||||
* http://fabiensanglard.net/doom3_documentation/37726-293748.pdf
|
* http://fabiensanglard.net/doom3_documentation/37726-293748.pdf
|
||||||
|
@ -1386,8 +1386,8 @@ _evas_canvas3d_node_look_at_set(Eo *obj, Evas_Canvas3D_Node_Data *pd,
|
||||||
Evas_Canvas3D_Space target_space, Evas_Real tx, Evas_Real ty, Evas_Real tz,
|
Evas_Canvas3D_Space target_space, Evas_Real tx, Evas_Real ty, Evas_Real tz,
|
||||||
Evas_Canvas3D_Space up_space, Evas_Real ux, Evas_Real uy, Evas_Real uz)
|
Evas_Canvas3D_Space up_space, Evas_Real ux, Evas_Real uy, Evas_Real uz)
|
||||||
{
|
{
|
||||||
Evas_Vec3 target;
|
Eina_Vector3 target;
|
||||||
Evas_Vec3 up;
|
Eina_Vector3 up;
|
||||||
|
|
||||||
/* Target position in parent space. */
|
/* Target position in parent space. */
|
||||||
if (target_space == EVAS_CANVAS3D_SPACE_LOCAL)
|
if (target_space == EVAS_CANVAS3D_SPACE_LOCAL)
|
||||||
|
@ -1397,7 +1397,7 @@ _evas_canvas3d_node_look_at_set(Eo *obj, Evas_Canvas3D_Node_Data *pd,
|
||||||
}
|
}
|
||||||
else if (target_space == EVAS_CANVAS3D_SPACE_PARENT)
|
else if (target_space == EVAS_CANVAS3D_SPACE_PARENT)
|
||||||
{
|
{
|
||||||
evas_vec3_set(&target, tx, ty, tz);
|
eina_vector3_set(&target, tx, ty, tz);
|
||||||
}
|
}
|
||||||
else if (target_space == EVAS_CANVAS3D_SPACE_WORLD)
|
else if (target_space == EVAS_CANVAS3D_SPACE_WORLD)
|
||||||
{
|
{
|
||||||
|
@ -1413,13 +1413,13 @@ _evas_canvas3d_node_look_at_set(Eo *obj, Evas_Canvas3D_Node_Data *pd,
|
||||||
|
|
||||||
if (up_space == EVAS_CANVAS3D_SPACE_LOCAL)
|
if (up_space == EVAS_CANVAS3D_SPACE_LOCAL)
|
||||||
{
|
{
|
||||||
evas_vec3_set(&up, ux, uy, uz);
|
eina_vector3_set(&up, ux, uy, uz);
|
||||||
//ERR("TODO:");
|
//ERR("TODO:");
|
||||||
//return;
|
//return;
|
||||||
}
|
}
|
||||||
else if (up_space == EVAS_CANVAS3D_SPACE_PARENT)
|
else if (up_space == EVAS_CANVAS3D_SPACE_PARENT)
|
||||||
{
|
{
|
||||||
evas_vec3_set(&up, ux, uy, uz);
|
eina_vector3_set(&up, ux, uy, uz);
|
||||||
}
|
}
|
||||||
else if (up_space == EVAS_CANVAS3D_SPACE_WORLD)
|
else if (up_space == EVAS_CANVAS3D_SPACE_WORLD)
|
||||||
{
|
{
|
||||||
|
|
|
@ -176,14 +176,14 @@ static inline Eina_Bool
|
||||||
_pick_data_triangle_add(Evas_Canvas3D_Pick_Data *data, const Evas_Ray3 *ray,
|
_pick_data_triangle_add(Evas_Canvas3D_Pick_Data *data, const Evas_Ray3 *ray,
|
||||||
const Evas_Triangle3 *tri)
|
const Evas_Triangle3 *tri)
|
||||||
{
|
{
|
||||||
Evas_Vec3 e1, e2, tvec, pvec, qvec;
|
Eina_Vector3 e1, e2, tvec, pvec, qvec;
|
||||||
Evas_Real det, inv_det, u, v, t;
|
Evas_Real det, inv_det, u, v, t;
|
||||||
|
|
||||||
evas_vec3_subtract(&e1, &tri->p1, &tri->p0);
|
eina_vector3_subtract(&e1, &tri->p1, &tri->p0);
|
||||||
evas_vec3_subtract(&e2, &tri->p2, &tri->p0);
|
eina_vector3_subtract(&e2, &tri->p2, &tri->p0);
|
||||||
|
|
||||||
evas_vec3_cross_product(&pvec, &ray->dir, &e2);
|
eina_vector3_cross_product(&pvec, &ray->dir, &e2);
|
||||||
det = evas_vec3_dot_product(&e1, &pvec);
|
det = eina_vector3_dot_product(&e1, &pvec);
|
||||||
|
|
||||||
/* If determinant is near zero, ray lies in plane of triangle. */
|
/* If determinant is near zero, ray lies in plane of triangle. */
|
||||||
if (det > -0.0000001 && det < 0.0000001)
|
if (det > -0.0000001 && det < 0.0000001)
|
||||||
|
@ -192,25 +192,25 @@ _pick_data_triangle_add(Evas_Canvas3D_Pick_Data *data, const Evas_Ray3 *ray,
|
||||||
inv_det = 1.0 / det;
|
inv_det = 1.0 / det;
|
||||||
|
|
||||||
/* Calculate distance from p0 to ray origin. */
|
/* Calculate distance from p0 to ray origin. */
|
||||||
evas_vec3_subtract(&tvec, &ray->org, &tri->p0);
|
eina_vector3_subtract(&tvec, &ray->org, &tri->p0);
|
||||||
|
|
||||||
/* Calculate U parameter and test bounds. */
|
/* Calculate U parameter and test bounds. */
|
||||||
u = evas_vec3_dot_product(&tvec, &pvec) * inv_det;
|
u = eina_vector3_dot_product(&tvec, &pvec) * inv_det;
|
||||||
|
|
||||||
if (u < 0.0 || u > 1.0)
|
if (u < 0.0 || u > 1.0)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
||||||
/* Prepare to tst V parameter. */
|
/* Prepare to tst V parameter. */
|
||||||
evas_vec3_cross_product(&qvec, &tvec, &e1);
|
eina_vector3_cross_product(&qvec, &tvec, &e1);
|
||||||
|
|
||||||
/* Calculate V parameter and test bounds. */
|
/* Calculate V parameter and test bounds. */
|
||||||
v = evas_vec3_dot_product(&ray->dir, &qvec) * inv_det;
|
v = eina_vector3_dot_product(&ray->dir, &qvec) * inv_det;
|
||||||
|
|
||||||
if (v < 0.0 || u + v > 1.0)
|
if (v < 0.0 || u + v > 1.0)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
||||||
/* Calculate T parameter and test bounds. */
|
/* Calculate T parameter and test bounds. */
|
||||||
t = evas_vec3_dot_product(&e2, &qvec) * inv_det;
|
t = eina_vector3_dot_product(&e2, &qvec) * inv_det;
|
||||||
|
|
||||||
if (t >= 0.0 && t <= 1.0)
|
if (t >= 0.0 && t <= 1.0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,7 +30,7 @@ void
|
||||||
_set_vec3_vertex_data(Evas_Canvas3D_Mesh *mesh,
|
_set_vec3_vertex_data(Evas_Canvas3D_Mesh *mesh,
|
||||||
int frame,
|
int frame,
|
||||||
int vcount,
|
int vcount,
|
||||||
Evas_Vec3 *data,
|
Eina_Vector3 *data,
|
||||||
Evas_Canvas3D_Vertex_Attrib attr)
|
Evas_Canvas3D_Vertex_Attrib attr)
|
||||||
{
|
{
|
||||||
float *address, *out;
|
float *address, *out;
|
||||||
|
@ -56,7 +56,7 @@ void
|
||||||
_set_vec2_vertex_data(Evas_Canvas3D_Mesh *mesh,
|
_set_vec2_vertex_data(Evas_Canvas3D_Mesh *mesh,
|
||||||
int frame,
|
int frame,
|
||||||
int vcount,
|
int vcount,
|
||||||
Evas_Vec2 *data,
|
Eina_Vector2 *data,
|
||||||
Evas_Canvas3D_Vertex_Attrib attr)
|
Evas_Canvas3D_Vertex_Attrib attr)
|
||||||
{
|
{
|
||||||
float *address, *out;
|
float *address, *out;
|
||||||
|
@ -99,7 +99,7 @@ _generate_indices(unsigned short *indices, int a, int b)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_primitives_vec3_copy(Evas_Vec3 *dst, const Evas_Vec3 *src)
|
_primitives_vec3_copy(Eina_Vector3 *dst, const Eina_Vector3 *src)
|
||||||
{
|
{
|
||||||
dst->x = src->x;
|
dst->x = src->x;
|
||||||
dst->y = src->y;
|
dst->y = src->y;
|
||||||
|
@ -107,7 +107,7 @@ _primitives_vec3_copy(Evas_Vec3 *dst, const Evas_Vec3 *src)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_primitives_vec3_subtract(Evas_Vec3 *out, const Evas_Vec3 *a, const Evas_Vec3 *b)
|
_primitives_vec3_subtract(Eina_Vector3 *out, const Eina_Vector3 *a, const Eina_Vector3 *b)
|
||||||
{
|
{
|
||||||
out->x = a->x - b->x;
|
out->x = a->x - b->x;
|
||||||
out->y = a->y - b->y;
|
out->y = a->y - b->y;
|
||||||
|
@ -115,9 +115,9 @@ _primitives_vec3_subtract(Evas_Vec3 *out, const Evas_Vec3 *a, const Evas_Vec3 *b
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_primitives_vec3_cross_product(Evas_Vec3 *out, const Evas_Vec3 *a, const Evas_Vec3 *b)
|
_primitives_vec3_cross_product(Eina_Vector3 *out, const Eina_Vector3 *a, const Eina_Vector3 *b)
|
||||||
{
|
{
|
||||||
Evas_Vec3 tmp;
|
Eina_Vector3 tmp;
|
||||||
|
|
||||||
tmp.x = a->y * b->z - a->z * b->y;
|
tmp.x = a->y * b->z - a->z * b->y;
|
||||||
tmp.y = a->z * b->x - a->x * b->z;
|
tmp.y = a->z * b->x - a->x * b->z;
|
||||||
|
@ -127,7 +127,7 @@ _primitives_vec3_cross_product(Evas_Vec3 *out, const Evas_Vec3 *a, const Evas_Ve
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_primitives_vec3_normalize(Evas_Vec3 *out)
|
_primitives_vec3_normalize(Eina_Vector3 *out)
|
||||||
{
|
{
|
||||||
Evas_Real size = out->x * out->x + out->y *out->y + out->z * out->z;
|
Evas_Real size = out->x * out->x + out->y *out->y + out->z * out->z;
|
||||||
size = sqrt(size);
|
size = sqrt(size);
|
||||||
|
@ -144,7 +144,7 @@ evas_common_set_model_from_primitive(Evas_Canvas3D_Mesh *model,
|
||||||
Evas_Real ratio = primitive->ratio;
|
Evas_Real ratio = primitive->ratio;
|
||||||
int precision = primitive->precision;
|
int precision = primitive->precision;
|
||||||
Evas_Canvas3D_Surface_Func *surface = primitive->surface;
|
Evas_Canvas3D_Surface_Func *surface = primitive->surface;
|
||||||
Evas_Vec2 tex_scale = primitive->tex_scale;
|
Eina_Vector2 tex_scale = primitive->tex_scale;
|
||||||
Evas_Canvas3D_Primitive_Mode mode = primitive->mode;
|
Evas_Canvas3D_Primitive_Mode mode = primitive->mode;
|
||||||
|
|
||||||
switch (primitive->form)
|
switch (primitive->form)
|
||||||
|
|
|
@ -10,10 +10,10 @@
|
||||||
#include "evas_private.h"
|
#include "evas_private.h"
|
||||||
|
|
||||||
#define ALLOCATE_VERTEX_DATA \
|
#define ALLOCATE_VERTEX_DATA \
|
||||||
Evas_Vec3 *vertices = malloc(sizeof(Evas_Vec3) * vcount); \
|
Eina_Vector3 *vertices = malloc(sizeof(Eina_Vector3) * vcount); \
|
||||||
Evas_Vec3 *normals = malloc(sizeof(Evas_Vec3) * vcount); \
|
Eina_Vector3 *normals = malloc(sizeof(Eina_Vector3) * vcount); \
|
||||||
Evas_Vec2 *tex_coord = malloc(sizeof(Evas_Vec2) * vcount); \
|
Eina_Vector2 *tex_coord = malloc(sizeof(Eina_Vector2) * vcount); \
|
||||||
Evas_Vec3 *tangents = malloc(sizeof(Evas_Vec3) * vcount); \
|
Eina_Vector3 *tangents = malloc(sizeof(Eina_Vector3) * vcount); \
|
||||||
unsigned short *indices = malloc(sizeof(short) * icount);
|
unsigned short *indices = malloc(sizeof(short) * icount);
|
||||||
|
|
||||||
#define SET_VERTEX_DATA(frame) \
|
#define SET_VERTEX_DATA(frame) \
|
||||||
|
@ -56,13 +56,13 @@
|
||||||
12, 3, 15, vcount);
|
12, 3, 15, vcount);
|
||||||
|
|
||||||
void _generate_indices(unsigned short *indices, int count, int width);
|
void _generate_indices(unsigned short *indices, int count, int width);
|
||||||
void _set_vec3_vertex_data(Evas_Canvas3D_Mesh *mesh, int frame, int vcount, Evas_Vec3 *data, Evas_Canvas3D_Vertex_Attrib attr);
|
void _set_vec3_vertex_data(Evas_Canvas3D_Mesh *mesh, int frame, int vcount, Eina_Vector3 *data, Evas_Canvas3D_Vertex_Attrib attr);
|
||||||
void _set_vec2_vertex_data(Evas_Canvas3D_Mesh *mesh, int frame, int vcount, Evas_Vec2 *data, Evas_Canvas3D_Vertex_Attrib attr);
|
void _set_vec2_vertex_data(Evas_Canvas3D_Mesh *mesh, int frame, int vcount, Eina_Vector2 *data, Evas_Canvas3D_Vertex_Attrib attr);
|
||||||
void _set_vertex_data_from_array(Evas_Canvas3D_Mesh *mesh, int frame, const float *data, Evas_Canvas3D_Vertex_Attrib attr, int start, int attr_count, int line, int vcount);
|
void _set_vertex_data_from_array(Evas_Canvas3D_Mesh *mesh, int frame, const float *data, Evas_Canvas3D_Vertex_Attrib attr, int start, int attr_count, int line, int vcount);
|
||||||
|
|
||||||
void _primitives_vec3_copy(Evas_Vec3 *dst, const Evas_Vec3 *src);
|
void _primitives_vec3_copy(Eina_Vector3 *dst, const Eina_Vector3 *src);
|
||||||
void _primitives_vec3_subtract(Evas_Vec3 *out, const Evas_Vec3 *a, const Evas_Vec3 *b);
|
void _primitives_vec3_subtract(Eina_Vector3 *out, const Eina_Vector3 *a, const Eina_Vector3 *b);
|
||||||
void _primitives_vec3_cross_product(Evas_Vec3 *out, const Evas_Vec3 *a, const Evas_Vec3 *b);
|
void _primitives_vec3_cross_product(Eina_Vector3 *out, const Eina_Vector3 *a, const Eina_Vector3 *b);
|
||||||
void _primitives_vec3_normalize(Evas_Vec3 *out);
|
void _primitives_vec3_normalize(Eina_Vector3 *out);
|
||||||
|
|
||||||
#endif //PRIMITIVE_COMMON
|
#endif //PRIMITIVE_COMMON
|
||||||
|
|
|
@ -4,7 +4,7 @@ void
|
||||||
_set_default_cone(Evas_Canvas3D_Mesh *mesh,
|
_set_default_cone(Evas_Canvas3D_Mesh *mesh,
|
||||||
int frame,
|
int frame,
|
||||||
int p,
|
int p,
|
||||||
Evas_Vec2 tex_scale)
|
Eina_Vector2 tex_scale)
|
||||||
{
|
{
|
||||||
int vcount, icount, vccount, i, j, num;
|
int vcount, icount, vccount, i, j, num;
|
||||||
double dfi, fi, sinfi, cosfi, nplane, nz;
|
double dfi, fi, sinfi, cosfi, nplane, nz;
|
||||||
|
@ -66,7 +66,7 @@ void
|
||||||
_set_cone_without_base(Evas_Canvas3D_Mesh *mesh,
|
_set_cone_without_base(Evas_Canvas3D_Mesh *mesh,
|
||||||
int frame,
|
int frame,
|
||||||
int p,
|
int p,
|
||||||
Evas_Vec2 tex_scale)
|
Eina_Vector2 tex_scale)
|
||||||
{
|
{
|
||||||
int vcount, icount, vccount, i;
|
int vcount, icount, vccount, i;
|
||||||
double dfi, fi, sinfi, cosfi, nplane, nz;
|
double dfi, fi, sinfi, cosfi, nplane, nz;
|
||||||
|
@ -117,7 +117,7 @@ evas_model_set_from_cone_primitive(Evas_Canvas3D_Mesh *mesh,
|
||||||
int frame,
|
int frame,
|
||||||
Evas_Canvas3D_Primitive_Mode mode,
|
Evas_Canvas3D_Primitive_Mode mode,
|
||||||
int p,
|
int p,
|
||||||
Evas_Vec2 tex_scale)
|
Eina_Vector2 tex_scale)
|
||||||
{
|
{
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,7 @@ void
|
||||||
_set_default_cylinder(Evas_Canvas3D_Mesh *mesh,
|
_set_default_cylinder(Evas_Canvas3D_Mesh *mesh,
|
||||||
int frame,
|
int frame,
|
||||||
int p,
|
int p,
|
||||||
Evas_Vec2 tex_scale)
|
Eina_Vector2 tex_scale)
|
||||||
{
|
{
|
||||||
int vcount, icount, vccount, i, j, num;
|
int vcount, icount, vccount, i, j, num;
|
||||||
icount = p * 30;
|
icount = p * 30;
|
||||||
|
@ -67,7 +67,7 @@ void
|
||||||
_set_cylinder_without_bases(Evas_Canvas3D_Mesh *mesh,
|
_set_cylinder_without_bases(Evas_Canvas3D_Mesh *mesh,
|
||||||
int frame,
|
int frame,
|
||||||
int p,
|
int p,
|
||||||
Evas_Vec2 tex_scale)
|
Eina_Vector2 tex_scale)
|
||||||
{
|
{
|
||||||
int vcount, icount, vccount, i;
|
int vcount, icount, vccount, i;
|
||||||
icount = p * 6;
|
icount = p * 6;
|
||||||
|
@ -113,7 +113,7 @@ evas_model_set_from_cylinder_primitive(Evas_Canvas3D_Mesh *mesh,
|
||||||
int frame,
|
int frame,
|
||||||
Evas_Canvas3D_Primitive_Mode mode,
|
Evas_Canvas3D_Primitive_Mode mode,
|
||||||
int p,
|
int p,
|
||||||
Evas_Vec2 tex_scale)
|
Eina_Vector2 tex_scale)
|
||||||
{
|
{
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,7 @@ void
|
||||||
_set_default_sphere(Evas_Canvas3D_Mesh *mesh,
|
_set_default_sphere(Evas_Canvas3D_Mesh *mesh,
|
||||||
int frame,
|
int frame,
|
||||||
int p,
|
int p,
|
||||||
Evas_Vec2 tex_scale)
|
Eina_Vector2 tex_scale)
|
||||||
{
|
{
|
||||||
int vcount, icount, vccount, i, j;
|
int vcount, icount, vccount, i, j;
|
||||||
icount = p * p * 6;
|
icount = p * p * 6;
|
||||||
|
@ -55,7 +55,7 @@ void
|
||||||
_set_sphere_with_alternative_uv(Evas_Canvas3D_Mesh *mesh,
|
_set_sphere_with_alternative_uv(Evas_Canvas3D_Mesh *mesh,
|
||||||
int frame,
|
int frame,
|
||||||
int p,
|
int p,
|
||||||
Evas_Vec2 tex_scale)
|
Eina_Vector2 tex_scale)
|
||||||
{
|
{
|
||||||
int vcount, icount, vccount, i, j;
|
int vcount, icount, vccount, i, j;
|
||||||
|
|
||||||
|
@ -115,9 +115,9 @@ _set_sphere_with_alternative_uv(Evas_Canvas3D_Mesh *mesh,
|
||||||
/* Triangulation of sphere mesh in appliance with buffer of indices. */
|
/* Triangulation of sphere mesh in appliance with buffer of indices. */
|
||||||
for (i = 0; i < icount; i += 3)
|
for (i = 0; i < icount; i += 3)
|
||||||
{
|
{
|
||||||
Evas_Vec3 e1, e2;
|
Eina_Vector3 e1, e2;
|
||||||
float du1, du2, dv1, dv2, f;
|
float du1, du2, dv1, dv2, f;
|
||||||
Evas_Vec3 tangent;
|
Eina_Vector3 tangent;
|
||||||
int num0, num1, num2;
|
int num0, num1, num2;
|
||||||
|
|
||||||
num0 = indices[i + 0];
|
num0 = indices[i + 0];
|
||||||
|
@ -166,7 +166,7 @@ evas_model_set_from_sphere_primitive(Evas_Canvas3D_Mesh *mesh,
|
||||||
int frame,
|
int frame,
|
||||||
Evas_Canvas3D_Primitive_Mode mode,
|
Evas_Canvas3D_Primitive_Mode mode,
|
||||||
int p,
|
int p,
|
||||||
Evas_Vec2 tex_scale)
|
Eina_Vector2 tex_scale)
|
||||||
{
|
{
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,7 +5,7 @@ evas_model_set_from_torus_primitive(Evas_Canvas3D_Mesh *mesh,
|
||||||
int frame,
|
int frame,
|
||||||
Evas_Real ratio,
|
Evas_Real ratio,
|
||||||
int p,
|
int p,
|
||||||
Evas_Vec2 tex_scale)
|
Eina_Vector2 tex_scale)
|
||||||
{
|
{
|
||||||
int vcount, icount, vccount, i, j;
|
int vcount, icount, vccount, i, j;
|
||||||
icount = p * p * 6;
|
icount = p * p * 6;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#include "../primitive_common.h"
|
#include "../primitive_common.h"
|
||||||
|
|
||||||
Evas_Vec3 _get_func_normal(Evas_Canvas3D_Surface_Func *func, Evas_Real x, Evas_Real y)
|
Eina_Vector3 _get_func_normal(Evas_Canvas3D_Surface_Func *func, Evas_Real x, Evas_Real y)
|
||||||
{
|
{
|
||||||
Evas_Vec3 v00, v01, v10, d1, d2, normal;
|
Eina_Vector3 v00, v01, v10, d1, d2, normal;
|
||||||
|
|
||||||
func(&v00.x, &v00.y, &v00.z, x, y);
|
func(&v00.x, &v00.y, &v00.z, x, y);
|
||||||
func(&v01.x, &v01.y, &v01.z, x, y + 0.01);
|
func(&v01.x, &v01.y, &v01.z, x, y + 0.01);
|
||||||
|
@ -18,10 +18,10 @@ Evas_Vec3 _get_func_normal(Evas_Canvas3D_Surface_Func *func, Evas_Real x, Evas_R
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_normalize(Evas_Vec3 *vertices, Evas_Vec3 *normals, int vcount)
|
_normalize(Eina_Vector3 *vertices, Eina_Vector3 *normals, int vcount)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
Evas_Vec3 min, max;
|
Eina_Vector3 min, max;
|
||||||
min = max = vertices[0];
|
min = max = vertices[0];
|
||||||
|
|
||||||
#define CHECK_MIN_AND_MAX(coord) \
|
#define CHECK_MIN_AND_MAX(coord) \
|
||||||
|
@ -54,7 +54,7 @@ evas_model_set_from_surface_primitive(Evas_Canvas3D_Mesh *mesh,
|
||||||
int frame,
|
int frame,
|
||||||
Evas_Canvas3D_Surface_Func func,
|
Evas_Canvas3D_Surface_Func func,
|
||||||
int p,
|
int p,
|
||||||
Evas_Vec2 tex_scale)
|
Eina_Vector2 tex_scale)
|
||||||
{
|
{
|
||||||
int vcount, icount, vccount, i, j, num;
|
int vcount, icount, vccount, i, j, num;
|
||||||
icount = p * p * 6;
|
icount = p * p * 6;
|
||||||
|
|
|
@ -79,7 +79,7 @@ void
|
||||||
evas_model_set_from_terrain_primitive(Evas_Canvas3D_Mesh *mesh,
|
evas_model_set_from_terrain_primitive(Evas_Canvas3D_Mesh *mesh,
|
||||||
int frame,
|
int frame,
|
||||||
int p,
|
int p,
|
||||||
Evas_Vec2 tex_scale)
|
Eina_Vector2 tex_scale)
|
||||||
{
|
{
|
||||||
evas_model_set_from_surface_primitive(mesh, frame, _perlin_terrain, p, tex_scale);
|
evas_model_set_from_surface_primitive(mesh, frame, _perlin_terrain, p, tex_scale);
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -247,13 +247,13 @@ struct _Evas_Canvas3D_Node
|
||||||
Evas_Canvas3D_Node *parent;
|
Evas_Canvas3D_Node *parent;
|
||||||
Evas_Canvas3D_Node *billboard_target;
|
Evas_Canvas3D_Node *billboard_target;
|
||||||
|
|
||||||
Evas_Vec3 position;
|
Eina_Vector3 position;
|
||||||
Eina_Quaternion orientation;
|
Eina_Quaternion orientation;
|
||||||
Evas_Vec3 scale;
|
Eina_Vector3 scale;
|
||||||
|
|
||||||
Evas_Vec3 position_world;
|
Eina_Vector3 position_world;
|
||||||
Eina_Quaternion orientation_world;
|
Eina_Quaternion orientation_world;
|
||||||
Evas_Vec3 scale_world;
|
Eina_Vector3 scale_world;
|
||||||
|
|
||||||
Evas_Box3 aabb;
|
Evas_Box3 aabb;
|
||||||
Evas_Box3 obb;
|
Evas_Box3 obb;
|
||||||
|
@ -426,7 +426,7 @@ struct _Evas_Canvas3D_Primitive
|
||||||
int precision;
|
int precision;
|
||||||
Evas_Canvas3D_Surface_Func *surface;
|
Evas_Canvas3D_Surface_Func *surface;
|
||||||
|
|
||||||
Evas_Vec2 tex_scale;
|
Eina_Vector2 tex_scale;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Evas_Canvas3D_Scene_Public_Data
|
struct _Evas_Canvas3D_Scene_Public_Data
|
||||||
|
@ -1763,7 +1763,7 @@ void evas_canvas3d_light_node_del(Evas_Canvas3D_Light *light, Evas_Canvas3D_Node
|
||||||
/* Mesh functions. */
|
/* Mesh functions. */
|
||||||
void evas_canvas3d_mesh_node_add(Evas_Canvas3D_Mesh *mesh, Evas_Canvas3D_Node *node);
|
void evas_canvas3d_mesh_node_add(Evas_Canvas3D_Mesh *mesh, Evas_Canvas3D_Node *node);
|
||||||
void evas_canvas3d_mesh_node_del(Evas_Canvas3D_Mesh *mesh, Evas_Canvas3D_Node *node);
|
void evas_canvas3d_mesh_node_del(Evas_Canvas3D_Mesh *mesh, Evas_Canvas3D_Node *node);
|
||||||
void evas_canvas3d_mesh_interpolate_position_get(Evas_Vec3 *out, const Evas_Canvas3D_Vertex_Buffer *pos0, const Evas_Canvas3D_Vertex_Buffer *pos1, Evas_Real weight, int index);
|
void evas_canvas3d_mesh_interpolate_position_get(Eina_Vector3 *out, const Evas_Canvas3D_Vertex_Buffer *pos0, const Evas_Canvas3D_Vertex_Buffer *pos1, Evas_Real weight, int index);
|
||||||
void evas_canvas3d_mesh_interpolate_vertex_buffer_get(Evas_Canvas3D_Mesh *mesh, int frame, Evas_Canvas3D_Vertex_Attrib attrib, Evas_Canvas3D_Vertex_Buffer *buffer0, Evas_Canvas3D_Vertex_Buffer *buffer1, Evas_Real *weight);
|
void evas_canvas3d_mesh_interpolate_vertex_buffer_get(Evas_Canvas3D_Mesh *mesh, int frame, Evas_Canvas3D_Vertex_Attrib attrib, Evas_Canvas3D_Vertex_Buffer *buffer0, Evas_Canvas3D_Vertex_Buffer *buffer1, Evas_Real *weight);
|
||||||
void evas_canvas3d_mesh_file_md2_set(Evas_Canvas3D_Mesh *mesh, const char *file);
|
void evas_canvas3d_mesh_file_md2_set(Evas_Canvas3D_Mesh *mesh, const char *file);
|
||||||
void evas_canvas3d_mesh_save_obj(Evas_Canvas3D_Mesh *mesh, const char *file, Evas_Canvas3D_Mesh_Frame *f);
|
void evas_canvas3d_mesh_save_obj(Evas_Canvas3D_Mesh *mesh, const char *file, Evas_Canvas3D_Mesh_Frame *f);
|
||||||
|
@ -1818,12 +1818,12 @@ void evas_model_save_file_ply(const Evas_Canvas3D_Mesh *mesh, const char *file,
|
||||||
void evas_common_set_model_from_primitive(Evas_Canvas3D_Mesh *model, int frame, Evas_Canvas3D_Primitive_Data *primitive);
|
void evas_common_set_model_from_primitive(Evas_Canvas3D_Mesh *model, int frame, Evas_Canvas3D_Primitive_Data *primitive);
|
||||||
void evas_model_set_from_square_primitive(Evas_Canvas3D_Mesh *mesh, int frame);
|
void evas_model_set_from_square_primitive(Evas_Canvas3D_Mesh *mesh, int frame);
|
||||||
void evas_model_set_from_cube_primitive(Evas_Canvas3D_Mesh *mesh, int frame);
|
void evas_model_set_from_cube_primitive(Evas_Canvas3D_Mesh *mesh, int frame);
|
||||||
void evas_model_set_from_cylinder_primitive(Evas_Canvas3D_Mesh *mesh, int frame, Evas_Canvas3D_Primitive_Mode mode, int precision, Evas_Vec2 tex_scale);
|
void evas_model_set_from_cylinder_primitive(Evas_Canvas3D_Mesh *mesh, int frame, Evas_Canvas3D_Primitive_Mode mode, int precision, Eina_Vector2 tex_scale);
|
||||||
void evas_model_set_from_cone_primitive(Evas_Canvas3D_Mesh *mesh, int frame, Evas_Canvas3D_Primitive_Mode mode, int precision, Evas_Vec2 tex_scale);
|
void evas_model_set_from_cone_primitive(Evas_Canvas3D_Mesh *mesh, int frame, Evas_Canvas3D_Primitive_Mode mode, int precision, Eina_Vector2 tex_scale);
|
||||||
void evas_model_set_from_sphere_primitive(Evas_Canvas3D_Mesh *mesh, int frame, Evas_Canvas3D_Primitive_Mode mode, int precision, Evas_Vec2 tex_scale);
|
void evas_model_set_from_sphere_primitive(Evas_Canvas3D_Mesh *mesh, int frame, Evas_Canvas3D_Primitive_Mode mode, int precision, Eina_Vector2 tex_scale);
|
||||||
void evas_model_set_from_torus_primitive(Evas_Canvas3D_Mesh *mesh, int frame, Evas_Real ratio, int precision, Evas_Vec2 tex_scale);
|
void evas_model_set_from_torus_primitive(Evas_Canvas3D_Mesh *mesh, int frame, Evas_Real ratio, int precision, Eina_Vector2 tex_scale);
|
||||||
void evas_model_set_from_surface_primitive(Evas_Canvas3D_Mesh *mesh, int frame, Evas_Canvas3D_Surface_Func func, int precision, Evas_Vec2 tex_scale);
|
void evas_model_set_from_surface_primitive(Evas_Canvas3D_Mesh *mesh, int frame, Evas_Canvas3D_Surface_Func func, int precision, Eina_Vector2 tex_scale);
|
||||||
void evas_model_set_from_terrain_primitive(Evas_Canvas3D_Mesh *mesh, int frame, int precision, Evas_Vec2 tex_scale);
|
void evas_model_set_from_terrain_primitive(Evas_Canvas3D_Mesh *mesh, int frame, int precision, Eina_Vector2 tex_scale);
|
||||||
|
|
||||||
/* Filter functions */
|
/* Filter functions */
|
||||||
Eina_Bool evas_filter_object_render(Eo *eo_obj, Evas_Object_Protected_Data *obj, void *output, void *context, void *surface, int x, int y, Eina_Bool do_async, Eina_Bool alpha);
|
Eina_Bool evas_filter_object_render(Eo *eo_obj, Evas_Object_Protected_Data *obj, void *output, void *context, void *surface, int x, int y, Eina_Bool do_async, Eina_Bool alpha);
|
||||||
|
|
|
@ -899,7 +899,7 @@ _light_build(E3D_Draw_Data *data,
|
||||||
Evas_Canvas3D_Node_Data *pd_light_node = eo_data_scope_get(light, EVAS_CANVAS3D_NODE_CLASS);
|
Evas_Canvas3D_Node_Data *pd_light_node = eo_data_scope_get(light, EVAS_CANVAS3D_NODE_CLASS);
|
||||||
Evas_Canvas3D_Light *l = pd_light_node ? pd_light_node->data.light.light : NULL;
|
Evas_Canvas3D_Light *l = pd_light_node ? pd_light_node->data.light.light : NULL;
|
||||||
Evas_Canvas3D_Light_Data *pdl = l ? eo_data_scope_get(l, EVAS_CANVAS3D_LIGHT_CLASS) : NULL;
|
Evas_Canvas3D_Light_Data *pdl = l ? eo_data_scope_get(l, EVAS_CANVAS3D_LIGHT_CLASS) : NULL;
|
||||||
Evas_Vec3 pos, dir;
|
Eina_Vector3 pos, dir;
|
||||||
|
|
||||||
if (pdl == NULL)
|
if (pdl == NULL)
|
||||||
return;
|
return;
|
||||||
|
@ -910,12 +910,12 @@ _light_build(E3D_Draw_Data *data,
|
||||||
data->flags |= E3D_SHADER_FLAG_LIGHT_DIRECTIONAL;
|
data->flags |= E3D_SHADER_FLAG_LIGHT_DIRECTIONAL;
|
||||||
|
|
||||||
/* Negative Z. */
|
/* Negative Z. */
|
||||||
evas_vec3_set(&dir, 0.0, 0.0, 1.0);
|
eina_vector3_set(&dir, 0.0, 0.0, 1.0);
|
||||||
evas_vec3_quaternion_rotate(&dir, &dir, &pd_light_node->orientation);
|
eina_vector3_quaternion_rotate(&dir, &dir, &pd_light_node->orientation);
|
||||||
|
|
||||||
/* Transform to eye space. */
|
/* Transform to eye space. */
|
||||||
evas_vec3_homogeneous_direction_transform(&dir, &dir, matrix_eye);
|
eina_vector3_homogeneous_direction_transform(&dir, matrix_eye, &dir);
|
||||||
evas_vec3_normalize(&dir, &dir);
|
eina_vector3_normalize(&dir, &dir);
|
||||||
|
|
||||||
data->light.position.x = dir.x;
|
data->light.position.x = dir.x;
|
||||||
data->light.position.y = dir.y;
|
data->light.position.y = dir.y;
|
||||||
|
@ -924,8 +924,8 @@ _light_build(E3D_Draw_Data *data,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
evas_vec3_copy(&pos, &pd_light_node->position_world);
|
eina_vector3_copy(&pos, &pd_light_node->position_world);
|
||||||
evas_vec3_homogeneous_position_transform(&pos, &pos, matrix_eye);
|
eina_vector3_homogeneous_position_transform(&pos, matrix_eye, &pos);
|
||||||
|
|
||||||
data->light.position.x = pos.x;
|
data->light.position.x = pos.x;
|
||||||
data->light.position.y = pos.y;
|
data->light.position.y = pos.y;
|
||||||
|
@ -944,9 +944,9 @@ _light_build(E3D_Draw_Data *data,
|
||||||
if (pdl->spot_cutoff < 180.0)
|
if (pdl->spot_cutoff < 180.0)
|
||||||
{
|
{
|
||||||
data->flags |= E3D_SHADER_FLAG_LIGHT_SPOT;
|
data->flags |= E3D_SHADER_FLAG_LIGHT_SPOT;
|
||||||
evas_vec3_set(&dir, 0.0, 0.0, -1.0);
|
eina_vector3_set(&dir, 0.0, 0.0, -1.0);
|
||||||
evas_vec3_quaternion_rotate(&dir, &dir, &pd_light_node->orientation);
|
eina_vector3_quaternion_rotate(&dir, &dir, &pd_light_node->orientation);
|
||||||
evas_vec3_homogeneous_direction_transform(&dir, &dir, matrix_eye);
|
eina_vector3_homogeneous_direction_transform(&dir, matrix_eye, &dir);
|
||||||
|
|
||||||
data->light.spot_dir = dir;
|
data->light.spot_dir = dir;
|
||||||
data->light.spot_exp = pdl->spot_exp;
|
data->light.spot_exp = pdl->spot_exp;
|
||||||
|
|
|
@ -98,10 +98,10 @@ struct _E3D_Draw_Data
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
Eina_Quaternion position;
|
Eina_Quaternion position;
|
||||||
Evas_Vec3 spot_dir;
|
Eina_Vector3 spot_dir;
|
||||||
Evas_Real spot_exp;
|
Evas_Real spot_exp;
|
||||||
Evas_Real spot_cutoff_cos;
|
Evas_Real spot_cutoff_cos;
|
||||||
Evas_Vec3 atten;
|
Eina_Vector3 atten;
|
||||||
Evas_Color ambient;
|
Evas_Color ambient;
|
||||||
Evas_Color diffuse;
|
Evas_Color diffuse;
|
||||||
Evas_Color specular;
|
Evas_Color specular;
|
||||||
|
|
Loading…
Reference in New Issue