summaryrefslogtreecommitdiff
path: root/src/modules/evas/model_loaders/md2/evas_model_load_md2.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/evas/model_loaders/md2/evas_model_load_md2.c')
-rw-r--r--src/modules/evas/model_loaders/md2/evas_model_load_md2.c42
1 files changed, 18 insertions, 24 deletions
diff --git a/src/modules/evas/model_loaders/md2/evas_model_load_md2.c b/src/modules/evas/model_loaders/md2/evas_model_load_md2.c
index 530b4d5..40a2aa6 100644
--- a/src/modules/evas/model_loaders/md2/evas_model_load_md2.c
+++ b/src/modules/evas/model_loaders/md2/evas_model_load_md2.c
@@ -337,9 +337,8 @@ evas_model_load_file_md2(Evas_Canvas3D_Mesh *mesh, Eina_File *file)
337 s_scale = 1.0 / (float)(loader.skin_width - 1); 337 s_scale = 1.0 / (float)(loader.skin_width - 1);
338 t_scale = 1.0 / (float)(loader.skin_height - 1); 338 t_scale = 1.0 / (float)(loader.skin_height - 1);
339 339
340 eo_do(mesh, 340 evas_canvas3d_mesh_vertex_count_set(mesh, loader.triangle_count * 3);
341 evas_canvas3d_mesh_vertex_count_set(loader.triangle_count * 3), 341 evas_canvas3d_mesh_vertex_assembly_set(mesh, EVAS_CANVAS3D_VERTEX_ASSEMBLY_TRIANGLES);
342 evas_canvas3d_mesh_vertex_assembly_set(EVAS_CANVAS3D_VERTEX_ASSEMBLY_TRIANGLES));
343 342
344 /* Load frames */ 343 /* Load frames */
345 for (i = 0; i < loader.frame_count; i++) 344 for (i = 0; i < loader.frame_count; i++)
@@ -347,23 +346,19 @@ evas_model_load_file_md2(Evas_Canvas3D_Mesh *mesh, Eina_File *file)
347 const MD2_Frame *frame = (const MD2_Frame *)(loader.frames + loader.frame_size * i); 346 const MD2_Frame *frame = (const MD2_Frame *)(loader.frames + loader.frame_size * i);
348 int f = i * MD2_FRAME_SCALE; 347 int f = i * MD2_FRAME_SCALE;
349 348
350 eo_do(mesh, 349 /* Add a mesh frame. */
351 /* Add a mesh frame. */ 350 evas_canvas3d_mesh_frame_add(mesh, f);
352 evas_canvas3d_mesh_frame_add(f), 351 /* Allocate vertex buffer for the frame. */
353 352 evas_canvas3d_mesh_frame_vertex_data_copy_set(mesh, f, EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION, 0, NULL);
354 /* Allocate vertex buffer for the frame. */ 353 evas_canvas3d_mesh_frame_vertex_data_copy_set(mesh, f, EVAS_CANVAS3D_VERTEX_ATTRIB_NORMAL, 0, NULL);
355 evas_canvas3d_mesh_frame_vertex_data_copy_set(f, EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION, 0, NULL), 354 evas_canvas3d_mesh_frame_vertex_data_copy_set(mesh, f, EVAS_CANVAS3D_VERTEX_ATTRIB_TEXCOORD, 0, NULL);
356 evas_canvas3d_mesh_frame_vertex_data_copy_set(f, EVAS_CANVAS3D_VERTEX_ATTRIB_NORMAL, 0, NULL), 355 /* Map vertex buffer. */
357 evas_canvas3d_mesh_frame_vertex_data_copy_set(f, EVAS_CANVAS3D_VERTEX_ATTRIB_TEXCOORD, 0, NULL), 356 pos = (float *)evas_canvas3d_mesh_frame_vertex_data_map(mesh, f, EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION);
358 357 nor = (float *)evas_canvas3d_mesh_frame_vertex_data_map(mesh, f, EVAS_CANVAS3D_VERTEX_ATTRIB_NORMAL);
359 /* Map vertex buffer. */ 358 tex = (float *)evas_canvas3d_mesh_frame_vertex_data_map(mesh, f, EVAS_CANVAS3D_VERTEX_ATTRIB_TEXCOORD);
360 pos = (float *)evas_canvas3d_mesh_frame_vertex_data_map(f, EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION), 359 stride_pos = evas_canvas3d_mesh_frame_vertex_stride_get(mesh, f, EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION);
361 nor = (float *)evas_canvas3d_mesh_frame_vertex_data_map(f, EVAS_CANVAS3D_VERTEX_ATTRIB_NORMAL), 360 stride_nor = evas_canvas3d_mesh_frame_vertex_stride_get(mesh, f, EVAS_CANVAS3D_VERTEX_ATTRIB_NORMAL);
362 tex = (float *)evas_canvas3d_mesh_frame_vertex_data_map(f, EVAS_CANVAS3D_VERTEX_ATTRIB_TEXCOORD), 361 stride_tex = evas_canvas3d_mesh_frame_vertex_stride_get(mesh, f, EVAS_CANVAS3D_VERTEX_ATTRIB_TEXCOORD);
363
364 stride_pos = evas_canvas3d_mesh_frame_vertex_stride_get(f, EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION),
365 stride_nor = evas_canvas3d_mesh_frame_vertex_stride_get(f, EVAS_CANVAS3D_VERTEX_ATTRIB_NORMAL),
366 stride_tex = evas_canvas3d_mesh_frame_vertex_stride_get(f, EVAS_CANVAS3D_VERTEX_ATTRIB_TEXCOORD));
367 362
368 if (stride_pos == 0) 363 if (stride_pos == 0)
369 stride_pos = sizeof(float) * 3; 364 stride_pos = sizeof(float) * 3;
@@ -404,10 +399,9 @@ evas_model_load_file_md2(Evas_Canvas3D_Mesh *mesh, Eina_File *file)
404 } 399 }
405 400
406 /* Unmap vertex buffer. */ 401 /* Unmap vertex buffer. */
407 eo_do(mesh, 402 evas_canvas3d_mesh_frame_vertex_data_unmap(mesh, f, EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION);
408 evas_canvas3d_mesh_frame_vertex_data_unmap(f, EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION), 403 evas_canvas3d_mesh_frame_vertex_data_unmap(mesh, f, EVAS_CANVAS3D_VERTEX_ATTRIB_NORMAL);
409 evas_canvas3d_mesh_frame_vertex_data_unmap(f, EVAS_CANVAS3D_VERTEX_ATTRIB_NORMAL), 404 evas_canvas3d_mesh_frame_vertex_data_unmap(mesh, f, EVAS_CANVAS3D_VERTEX_ATTRIB_TEXCOORD);
410 evas_canvas3d_mesh_frame_vertex_data_unmap(f, EVAS_CANVAS3D_VERTEX_ATTRIB_TEXCOORD));
411 405
412 pd = eo_data_scope_get(mesh, EVAS_CANVAS3D_MESH_CLASS); 406 pd = eo_data_scope_get(mesh, EVAS_CANVAS3D_MESH_CLASS);
413 407