summaryrefslogtreecommitdiff
path: root/src/lib/evas/common3d
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2016-03-01 18:06:28 +0000
committerTom Hacohen <tom@stosb.com>2016-03-03 09:58:08 +0000
commitf21ade6123b9053fca8d1632644c48525a99d6e0 (patch)
treec5eb0445f471d21365a7a5a7b0ec7d279c11b398 /src/lib/evas/common3d
parent3faf3f3fc68a839f06b311c35ba020cb25e7c9c4 (diff)
Automatic migration to Eo4.
I just ran my script (email to follow) to migrate all of the EFL automatically. This commit is *only* the automatic conversion, so it can be easily reverted and re-run.
Diffstat (limited to 'src/lib/evas/common3d')
-rw-r--r--src/lib/evas/common3d/primitives/primitive_common.c30
-rw-r--r--src/lib/evas/common3d/primitives/primitive_common.h26
-rw-r--r--src/lib/evas/common3d/save_load/evas_model_load_save_common.c24
3 files changed, 31 insertions, 49 deletions
diff --git a/src/lib/evas/common3d/primitives/primitive_common.c b/src/lib/evas/common3d/primitives/primitive_common.c
index b80d1dc29b..1bea0682c6 100644
--- a/src/lib/evas/common3d/primitives/primitive_common.c
+++ b/src/lib/evas/common3d/primitives/primitive_common.c
@@ -11,10 +11,9 @@ void _set_vertex_data_from_array(Evas_Canvas3D_Mesh *mesh,
11{ 11{
12 float *address, *out; 12 float *address, *out;
13 int stride, i, j; 13 int stride, i, j;
14 eo_do(mesh, 14 evas_canvas3d_mesh_frame_vertex_data_copy_set(mesh, frame, attr, 0, NULL);
15 evas_canvas3d_mesh_frame_vertex_data_copy_set(frame, attr, 0, NULL), 15 address = (float *)evas_canvas3d_mesh_frame_vertex_data_map(mesh, frame, attr);
16 address = (float *)evas_canvas3d_mesh_frame_vertex_data_map(frame, attr), 16 stride = evas_canvas3d_mesh_frame_vertex_stride_get(mesh, frame, attr);
17 stride = evas_canvas3d_mesh_frame_vertex_stride_get(frame, attr));
18 if (stride == 0) stride = sizeof(float) * attr_count; 17 if (stride == 0) stride = sizeof(float) * attr_count;
19 for (i = 0; i < vcount; i++) 18 for (i = 0; i < vcount; i++)
20 { 19 {
@@ -22,8 +21,7 @@ void _set_vertex_data_from_array(Evas_Canvas3D_Mesh *mesh,
22 for (j = 0; j < attr_count; j++) 21 for (j = 0; j < attr_count; j++)
23 out[j] = data[start + (line * i) + j]; 22 out[j] = data[start + (line * i) + j];
24 } 23 }
25 eo_do(mesh, 24 evas_canvas3d_mesh_frame_vertex_data_unmap(mesh, frame, attr);
26 evas_canvas3d_mesh_frame_vertex_data_unmap(frame, attr));
27} 25}
28 26
29void 27void
@@ -35,10 +33,9 @@ _set_vec3_vertex_data(Evas_Canvas3D_Mesh *mesh,
35{ 33{
36 float *address, *out; 34 float *address, *out;
37 int stride, i; 35 int stride, i;
38 eo_do(mesh, 36 evas_canvas3d_mesh_frame_vertex_data_copy_set(mesh, frame, attr, 0, NULL);
39 evas_canvas3d_mesh_frame_vertex_data_copy_set(frame, attr, 0, NULL), 37 address = (float *)evas_canvas3d_mesh_frame_vertex_data_map(mesh, frame, attr);
40 address = (float *)evas_canvas3d_mesh_frame_vertex_data_map(frame, attr), 38 stride = evas_canvas3d_mesh_frame_vertex_stride_get(mesh, frame, attr);
41 stride = evas_canvas3d_mesh_frame_vertex_stride_get(frame, attr));
42 if (stride == 0) stride = sizeof(float) * 3; 39 if (stride == 0) stride = sizeof(float) * 3;
43 for (i = 0; i < vcount; i++) 40 for (i = 0; i < vcount; i++)
44 { 41 {
@@ -48,8 +45,7 @@ _set_vec3_vertex_data(Evas_Canvas3D_Mesh *mesh,
48 out[2] = data[i].z; 45 out[2] = data[i].z;
49 } 46 }
50 free(data); 47 free(data);
51 eo_do(mesh, 48 evas_canvas3d_mesh_frame_vertex_data_unmap(mesh, frame, attr);
52 evas_canvas3d_mesh_frame_vertex_data_unmap(frame, attr));
53} 49}
54 50
55void 51void
@@ -61,10 +57,9 @@ _set_vec2_vertex_data(Evas_Canvas3D_Mesh *mesh,
61{ 57{
62 float *address, *out; 58 float *address, *out;
63 int stride, i; 59 int stride, i;
64 eo_do(mesh, 60 evas_canvas3d_mesh_frame_vertex_data_copy_set(mesh, frame, attr, 0, NULL);
65 evas_canvas3d_mesh_frame_vertex_data_copy_set(frame, attr, 0, NULL), 61 address = (float *)evas_canvas3d_mesh_frame_vertex_data_map(mesh, frame, attr);
66 address = (float *)evas_canvas3d_mesh_frame_vertex_data_map(frame, attr), 62 stride = evas_canvas3d_mesh_frame_vertex_stride_get(mesh, frame, attr);
67 stride = evas_canvas3d_mesh_frame_vertex_stride_get(frame, attr));
68 if (stride == 0) stride = sizeof(float) * 2; 63 if (stride == 0) stride = sizeof(float) * 2;
69 for (i = 0; i < vcount; i++) 64 for (i = 0; i < vcount; i++)
70 { 65 {
@@ -73,8 +68,7 @@ _set_vec2_vertex_data(Evas_Canvas3D_Mesh *mesh,
73 out[1] = data[i].y; 68 out[1] = data[i].y;
74 } 69 }
75 free(data); 70 free(data);
76 eo_do(mesh, 71 evas_canvas3d_mesh_frame_vertex_data_unmap(mesh, frame, attr);
77 evas_canvas3d_mesh_frame_vertex_data_unmap(frame, attr));
78} 72}
79 73
80void 74void
diff --git a/src/lib/evas/common3d/primitives/primitive_common.h b/src/lib/evas/common3d/primitives/primitive_common.h
index 6c0dcf23f4..1cf4d916fb 100644
--- a/src/lib/evas/common3d/primitives/primitive_common.h
+++ b/src/lib/evas/common3d/primitives/primitive_common.h
@@ -18,15 +18,12 @@
18 18
19#define SET_VERTEX_DATA(frame) \ 19#define SET_VERTEX_DATA(frame) \
20 Eina_Bool frame_exist; \ 20 Eina_Bool frame_exist; \
21 eo_do(mesh, \ 21 frame_exist = evas_canvas3d_mesh_frame_exist(mesh, frame); \
22 frame_exist = evas_canvas3d_mesh_frame_exist(frame)); \
23 if (!frame_exist) \ 22 if (!frame_exist) \
24 eo_do(mesh, \ 23 evas_canvas3d_mesh_frame_add(mesh, frame); \
25 evas_canvas3d_mesh_frame_add(frame)); \ 24 evas_canvas3d_mesh_vertex_count_set(mesh, vcount); \
26 eo_do(mesh, \ 25 evas_canvas3d_mesh_index_data_copy_set(mesh, EVAS_CANVAS3D_INDEX_FORMAT_UNSIGNED_SHORT, \
27 evas_canvas3d_mesh_vertex_count_set(vcount), \ 26 icount, &indices[0]); \
28 evas_canvas3d_mesh_index_data_copy_set(EVAS_CANVAS3D_INDEX_FORMAT_UNSIGNED_SHORT, \
29 icount, &indices[0])); \
30 _set_vec3_vertex_data(mesh, frame, vcount, vertices, EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION); \ 27 _set_vec3_vertex_data(mesh, frame, vcount, vertices, EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION); \
31 _set_vec3_vertex_data(mesh, frame, vcount, normals, EVAS_CANVAS3D_VERTEX_ATTRIB_NORMAL); \ 28 _set_vec3_vertex_data(mesh, frame, vcount, normals, EVAS_CANVAS3D_VERTEX_ATTRIB_NORMAL); \
32 _set_vec2_vertex_data(mesh, frame, vcount, tex_coord, EVAS_CANVAS3D_VERTEX_ATTRIB_TEXCOORD); \ 29 _set_vec2_vertex_data(mesh, frame, vcount, tex_coord, EVAS_CANVAS3D_VERTEX_ATTRIB_TEXCOORD); \
@@ -35,15 +32,12 @@
35 32
36#define SET_VERTEX_DATA_FROM_ARRAY(mesh, frame, varray, vcount, indices, icount) \ 33#define SET_VERTEX_DATA_FROM_ARRAY(mesh, frame, varray, vcount, indices, icount) \
37 Eina_Bool frame_exist; \ 34 Eina_Bool frame_exist; \
38 eo_do(mesh, \ 35 frame_exist = evas_canvas3d_mesh_frame_exist(mesh, frame); \
39 frame_exist = evas_canvas3d_mesh_frame_exist(frame)); \
40 if (!frame_exist) \ 36 if (!frame_exist) \
41 eo_do(mesh, \ 37 evas_canvas3d_mesh_frame_add(mesh, frame); \
42 evas_canvas3d_mesh_frame_add(frame)); \ 38 evas_canvas3d_mesh_vertex_count_set(mesh, vcount); \
43 eo_do(mesh, \ 39 evas_canvas3d_mesh_index_data_copy_set(mesh, EVAS_CANVAS3D_INDEX_FORMAT_UNSIGNED_SHORT, \
44 evas_canvas3d_mesh_vertex_count_set(vcount), \ 40 icount, &indices[0]); \
45 evas_canvas3d_mesh_index_data_copy_set(EVAS_CANVAS3D_INDEX_FORMAT_UNSIGNED_SHORT, \
46 icount, &indices[0])); \
47 _set_vertex_data_from_array(mesh, frame, varray, EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION, \ 41 _set_vertex_data_from_array(mesh, frame, varray, EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION, \
48 0, 3, 15, vcount); \ 42 0, 3, 15, vcount); \
49 _set_vertex_data_from_array(mesh, frame, varray, EVAS_CANVAS3D_VERTEX_ATTRIB_NORMAL, \ 43 _set_vertex_data_from_array(mesh, frame, varray, EVAS_CANVAS3D_VERTEX_ATTRIB_NORMAL, \
diff --git a/src/lib/evas/common3d/save_load/evas_model_load_save_common.c b/src/lib/evas/common3d/save_load/evas_model_load_save_common.c
index 190ba5982c..42fd47cf66 100644
--- a/src/lib/evas/common3d/save_load/evas_model_load_save_common.c
+++ b/src/lib/evas/common3d/save_load/evas_model_load_save_common.c
@@ -48,9 +48,8 @@ evas_model_load_vertex_data_unmap(Evas_Canvas3D_Mesh *mesh,
48#define UNMAP_IF_EXIST(existence, vertex_data_type) \ 48#define UNMAP_IF_EXIST(existence, vertex_data_type) \
49 if (existence) \ 49 if (existence) \
50 { \ 50 { \
51 eo_do(mesh, \ 51 evas_canvas3d_mesh_frame_vertex_data_unmap(mesh, frame, \
52 evas_canvas3d_mesh_frame_vertex_data_unmap(frame, \ 52 vertex_data_type); \
53 vertex_data_type)); \
54 } 53 }
55 UNMAP_IF_EXIST(header.existence_of_positions, EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION) 54 UNMAP_IF_EXIST(header.existence_of_positions, EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION)
56 UNMAP_IF_EXIST(header.existence_of_normals, EVAS_CANVAS3D_VERTEX_ATTRIB_NORMAL) 55 UNMAP_IF_EXIST(header.existence_of_normals, EVAS_CANVAS3D_VERTEX_ATTRIB_NORMAL)
@@ -79,18 +78,16 @@ evas_model_load_vertex_data_to_mesh(Evas_Canvas3D_Mesh *mesh,
79 Evas_Model_Load_Save_Data map; 78 Evas_Model_Load_Save_Data map;
80 int i, j; 79 int i, j;
81 80
82 eo_do(mesh, 81 evas_canvas3d_mesh_vertex_count_set(mesh, header.vertices_count);
83 evas_canvas3d_mesh_vertex_count_set(header.vertices_count), 82 evas_canvas3d_mesh_vertex_assembly_set(mesh, EVAS_CANVAS3D_VERTEX_ASSEMBLY_TRIANGLES);
84 evas_canvas3d_mesh_vertex_assembly_set(EVAS_CANVAS3D_VERTEX_ASSEMBLY_TRIANGLES), 83 evas_canvas3d_mesh_frame_add(mesh, 0);
85 evas_canvas3d_mesh_frame_add(0));
86 84
87#define VERTEX_DATA_MAP(name, vertex_data_type, default_size) \ 85#define VERTEX_DATA_MAP(name, vertex_data_type, default_size) \
88 if (header.existence_of_##name) \ 86 if (header.existence_of_##name) \
89 { \ 87 { \
90 eo_do(mesh, \ 88 evas_canvas3d_mesh_frame_vertex_data_copy_set(mesh, 0, vertex_data_type, 0, NULL); \
91 evas_canvas3d_mesh_frame_vertex_data_copy_set(0, vertex_data_type, 0, NULL), \ 89 map.name = (float *)evas_canvas3d_mesh_frame_vertex_data_map(mesh, 0, vertex_data_type); \
92 map.name = (float *)evas_canvas3d_mesh_frame_vertex_data_map(0, vertex_data_type), \ 90 stride->name = evas_canvas3d_mesh_frame_vertex_stride_get(mesh, 0, vertex_data_type); \
93 stride->name = evas_canvas3d_mesh_frame_vertex_stride_get(0, vertex_data_type)); \
94 if (stride->name == 0) stride->name = sizeof(float) * default_size; \ 91 if (stride->name == 0) stride->name = sizeof(float) * default_size; \
95 } 92 }
96 VERTEX_DATA_MAP(positions, EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION, 3) 93 VERTEX_DATA_MAP(positions, EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION, 3)
@@ -125,10 +122,7 @@ evas_model_load_indices_data_to_mesh(Evas_Canvas3D_Mesh *mesh,
125 Evas_Model_Load_Save_Header header, 122 Evas_Model_Load_Save_Header header,
126 Evas_Model_Load_Save_Data data) 123 Evas_Model_Load_Save_Data data)
127{ 124{
128 eo_do(mesh, 125 evas_canvas3d_mesh_index_data_copy_set(mesh, EVAS_CANVAS3D_INDEX_FORMAT_UNSIGNED_SHORT, header.indices_count, data.indices);
129 evas_canvas3d_mesh_index_data_copy_set(EVAS_CANVAS3D_INDEX_FORMAT_UNSIGNED_SHORT,
130 header.indices_count,
131 data.indices));
132} 126}
133 127
134Eina_Bool 128Eina_Bool