forked from enlightenment/efl
evas-3d: fix primitives
Summary: There were warnings after adding primitive in the same frame more then once, the check was added to avoid it @fix Reviewers: cedric, raster, Hermet Subscribers: cedric, artem.popov Differential Revision: https://phab.enlightenment.org/D3090 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This commit is contained in:
parent
4290567fd6
commit
0dd60ced44
|
@ -306,6 +306,17 @@ _evas_canvas3d_mesh_vertex_count_get(Eo *obj EINA_UNUSED, Evas_Canvas3D_Mesh_Dat
|
|||
return pd->vertex_count;
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_evas_canvas3d_mesh_frame_exist(Eo *obj EINA_UNUSED, Evas_Canvas3D_Mesh_Data *pd, int frame)
|
||||
{
|
||||
Evas_Canvas3D_Mesh_Frame *f = evas_canvas3d_mesh_frame_find(pd, frame);
|
||||
|
||||
if (f)
|
||||
return EINA_TRUE;
|
||||
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_evas_canvas3d_mesh_frame_add(Eo *obj, Evas_Canvas3D_Mesh_Data *pd, int frame)
|
||||
{
|
||||
|
|
|
@ -156,6 +156,14 @@ class Evas.Canvas3D.Mesh (Evas.Canvas3D.Object, Evas.Common_Interface, Efl.File)
|
|||
]]
|
||||
}
|
||||
|
||||
frame_exist {
|
||||
[[Returns EINA_TRUE if frame was added and EINA_FALSE in other case.]]
|
||||
params {
|
||||
@in frame: int; [[Frame number.]]
|
||||
}
|
||||
return: Eina_Bool;
|
||||
}
|
||||
|
||||
frame_add {
|
||||
[[Add a key frame to the given mesh.
|
||||
|
||||
|
|
|
@ -17,9 +17,14 @@
|
|||
unsigned short *indices = malloc(sizeof(short) * icount);
|
||||
|
||||
#define SET_VERTEX_DATA(frame) \
|
||||
Eina_Bool frame_exist; \
|
||||
eo_do(mesh, \
|
||||
frame_exist = evas_canvas3d_mesh_frame_exist(frame)); \
|
||||
if (!frame_exist) \
|
||||
eo_do(mesh, \
|
||||
evas_canvas3d_mesh_frame_add(frame)); \
|
||||
eo_do(mesh, \
|
||||
evas_canvas3d_mesh_vertex_count_set(vcount), \
|
||||
evas_canvas3d_mesh_frame_add(frame), \
|
||||
evas_canvas3d_mesh_index_data_copy_set(EVAS_CANVAS3D_INDEX_FORMAT_UNSIGNED_SHORT, \
|
||||
icount, &indices[0])); \
|
||||
_set_vec3_vertex_data(mesh, frame, vcount, vertices, EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION); \
|
||||
|
@ -29,9 +34,14 @@
|
|||
free(indices);
|
||||
|
||||
#define SET_VERTEX_DATA_FROM_ARRAY(mesh, frame, varray, vcount, indices, icount) \
|
||||
Eina_Bool frame_exist; \
|
||||
eo_do(mesh, \
|
||||
frame_exist = evas_canvas3d_mesh_frame_exist(frame)); \
|
||||
if (!frame_exist) \
|
||||
eo_do(mesh, \
|
||||
evas_canvas3d_mesh_frame_add(frame)); \
|
||||
eo_do(mesh, \
|
||||
evas_canvas3d_mesh_vertex_count_set(vcount), \
|
||||
evas_canvas3d_mesh_frame_add(frame), \
|
||||
evas_canvas3d_mesh_index_data_copy_set(EVAS_CANVAS3D_INDEX_FORMAT_UNSIGNED_SHORT, \
|
||||
icount, &indices[0])); \
|
||||
_set_vertex_data_from_array(mesh, frame, varray, EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION, \
|
||||
|
|
Loading…
Reference in New Issue