summaryrefslogtreecommitdiff
path: root/src/lib/evas/common3d/save_load/evas_model_load_save_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/evas/common3d/save_load/evas_model_load_save_common.c')
-rw-r--r--src/lib/evas/common3d/save_load/evas_model_load_save_common.c24
1 files changed, 9 insertions, 15 deletions
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 190ba59..42fd47c 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