summaryrefslogtreecommitdiff
path: root/src/modules/evas/model_loaders/eet/evas_model_load_eet.c
diff options
context:
space:
mode:
authorOleksandr Shcherbina <o.shcherbina@samsung.com>2015-06-17 16:31:14 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-06-17 17:52:17 +0200
commitd409df1caa38ae7eac87f85ff4113484bc5b2099 (patch)
tree2adcbeadf2f4b2e7f4e7ba327a574c6620c23663 /src/modules/evas/model_loaders/eet/evas_model_load_eet.c
parent9bf6f14a8a59195fe9be004aaff446c51474fc5d (diff)
evas: change interface evas_3d to evas_canvas3d
Summary: Regard to https://phab.enlightenment.org/T2479 it is need for right generation Eolian files Reviewers: cedric Subscribers: cedric, tasn Differential Revision: https://phab.enlightenment.org/D2711 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to '')
-rw-r--r--src/modules/evas/model_loaders/eet/evas_model_load_eet.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/src/modules/evas/model_loaders/eet/evas_model_load_eet.c b/src/modules/evas/model_loaders/eet/evas_model_load_eet.c
index 815b9f1d50..803846d244 100644
--- a/src/modules/evas/model_loaders/eet/evas_model_load_eet.c
+++ b/src/modules/evas/model_loaders/eet/evas_model_load_eet.c
@@ -7,33 +7,33 @@
7#include "evas_common_private.h" 7#include "evas_common_private.h"
8#include "evas_private.h" 8#include "evas_private.h"
9 9
10extern Evas_3D_File_Eet* eet_file; 10extern Evas_Canvas3D_File_Eet* eet_file;
11extern const char EVAS_3D_FILE_CACHE_FILE_ENTRY[]; 11extern const char EVAS_CANVAS3D_FILE_CACHE_FILE_ENTRY[];
12extern Eet_Data_Descriptor *_file_descriptor; 12extern Eet_Data_Descriptor *_file_descriptor;
13 13
14void 14void
15_set_geometry_to_mesh_from_eet_file(Evas_3D_Mesh *mesh, 15_set_geometry_to_mesh_from_eet_file(Evas_Canvas3D_Mesh *mesh,
16 Evas_3D_Mesh_Eet *eet_mesh) 16 Evas_Canvas3D_Mesh_Eet *eet_mesh)
17{ 17{
18 float *pos, *nor, *tex; 18 float *pos, *nor, *tex;
19 int stride_pos, stride_nor, stride_tex, j; 19 int stride_pos, stride_nor, stride_tex, j;
20 20
21 eo_do(mesh, 21 eo_do(mesh,
22 evas_3d_mesh_vertex_count_set(eet_mesh->geometries->vertices_count), 22 evas_canvas3d_mesh_vertex_count_set(eet_mesh->geometries->vertices_count),
23 evas_3d_mesh_vertex_assembly_set(EVAS_3D_VERTEX_ASSEMBLY_TRIANGLES), 23 evas_canvas3d_mesh_vertex_assembly_set(EVAS_CANVAS3D_VERTEX_ASSEMBLY_TRIANGLES),
24 evas_3d_mesh_frame_add(0), 24 evas_canvas3d_mesh_frame_add(0),
25 25
26 evas_3d_mesh_frame_vertex_data_copy_set(0, EVAS_3D_VERTEX_POSITION, 0, NULL), 26 evas_canvas3d_mesh_frame_vertex_data_copy_set(0, EVAS_CANVAS3D_VERTEX_POSITION, 0, NULL),
27 evas_3d_mesh_frame_vertex_data_copy_set(0, EVAS_3D_VERTEX_NORMAL, 0, NULL), 27 evas_canvas3d_mesh_frame_vertex_data_copy_set(0, EVAS_CANVAS3D_VERTEX_NORMAL, 0, NULL),
28 evas_3d_mesh_frame_vertex_data_copy_set(0, EVAS_3D_VERTEX_TEXCOORD, 0, NULL), 28 evas_canvas3d_mesh_frame_vertex_data_copy_set(0, EVAS_CANVAS3D_VERTEX_TEXCOORD, 0, NULL),
29 29
30 pos = (float *)evas_3d_mesh_frame_vertex_data_map(0, EVAS_3D_VERTEX_POSITION), 30 pos = (float *)evas_canvas3d_mesh_frame_vertex_data_map(0, EVAS_CANVAS3D_VERTEX_POSITION),
31 nor = (float *)evas_3d_mesh_frame_vertex_data_map(0, EVAS_3D_VERTEX_NORMAL), 31 nor = (float *)evas_canvas3d_mesh_frame_vertex_data_map(0, EVAS_CANVAS3D_VERTEX_NORMAL),
32 tex = (float *)evas_3d_mesh_frame_vertex_data_map(0, EVAS_3D_VERTEX_TEXCOORD), 32 tex = (float *)evas_canvas3d_mesh_frame_vertex_data_map(0, EVAS_CANVAS3D_VERTEX_TEXCOORD),
33 33
34 stride_pos = evas_3d_mesh_frame_vertex_stride_get(0, EVAS_3D_VERTEX_POSITION), 34 stride_pos = evas_canvas3d_mesh_frame_vertex_stride_get(0, EVAS_CANVAS3D_VERTEX_POSITION),
35 stride_nor = evas_3d_mesh_frame_vertex_stride_get(0, EVAS_3D_VERTEX_NORMAL), 35 stride_nor = evas_canvas3d_mesh_frame_vertex_stride_get(0, EVAS_CANVAS3D_VERTEX_NORMAL),
36 stride_tex = evas_3d_mesh_frame_vertex_stride_get(0, EVAS_3D_VERTEX_TEXCOORD)); 36 stride_tex = evas_canvas3d_mesh_frame_vertex_stride_get(0, EVAS_CANVAS3D_VERTEX_TEXCOORD));
37 37
38 if (stride_pos == 0) stride_pos = sizeof(float) * 3; 38 if (stride_pos == 0) stride_pos = sizeof(float) * 3;
39 if (stride_nor == 0) stride_nor = sizeof(float) * 3; 39 if (stride_nor == 0) stride_nor = sizeof(float) * 3;
@@ -62,71 +62,71 @@ _set_geometry_to_mesh_from_eet_file(Evas_3D_Mesh *mesh,
62 62
63 /* unmap vertex buffer */ 63 /* unmap vertex buffer */
64 eo_do(mesh, 64 eo_do(mesh,
65 evas_3d_mesh_frame_vertex_data_unmap(0, EVAS_3D_VERTEX_POSITION), 65 evas_canvas3d_mesh_frame_vertex_data_unmap(0, EVAS_CANVAS3D_VERTEX_POSITION),
66 evas_3d_mesh_frame_vertex_data_unmap(0, EVAS_3D_VERTEX_NORMAL), 66 evas_canvas3d_mesh_frame_vertex_data_unmap(0, EVAS_CANVAS3D_VERTEX_NORMAL),
67 evas_3d_mesh_frame_vertex_data_unmap(0, EVAS_3D_VERTEX_TEXCOORD)); 67 evas_canvas3d_mesh_frame_vertex_data_unmap(0, EVAS_CANVAS3D_VERTEX_TEXCOORD));
68} 68}
69 69
70void 70void
71_set_material_to_mesh_from_eet_file(Evas_3D_Mesh *mesh, 71_set_material_to_mesh_from_eet_file(Evas_Canvas3D_Mesh *mesh,
72 Evas_3D_Mesh_Eet *eet_mesh) 72 Evas_Canvas3D_Mesh_Eet *eet_mesh)
73{ 73{
74 Evas_3D_Object_Data *pd = eo_data_scope_get(mesh, EVAS_3D_OBJECT_CLASS); 74 Evas_Canvas3D_Object_Data *pd = eo_data_scope_get(mesh, EVAS_CANVAS3D_OBJECT_CLASS);
75 Eo *material = NULL; 75 Eo *material = NULL;
76 material = eo_add(EVAS_3D_MATERIAL_CLASS, pd->evas); 76 material = eo_add(EVAS_CANVAS3D_MATERIAL_CLASS, pd->evas);
77 77
78 eo_do(material, 78 eo_do(material,
79 evas_3d_material_enable_set(EVAS_3D_MATERIAL_AMBIENT, 79 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_AMBIENT,
80 !!(eet_mesh->materials->colors[0].a > 0)), 80 !!(eet_mesh->materials->colors[0].a > 0)),
81 evas_3d_material_enable_set(EVAS_3D_MATERIAL_DIFFUSE, 81 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_DIFFUSE,
82 !!(eet_mesh->materials->colors[1].a > 0)), 82 !!(eet_mesh->materials->colors[1].a > 0)),
83 evas_3d_material_enable_set(EVAS_3D_MATERIAL_SPECULAR, 83 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_SPECULAR,
84 !!(eet_mesh->materials->colors[2].a > 0)), 84 !!(eet_mesh->materials->colors[2].a > 0)),
85 evas_3d_material_enable_set(EVAS_3D_MATERIAL_NORMAL, EINA_TRUE), 85 evas_canvas3d_material_enable_set(EVAS_CANVAS3D_MATERIAL_NORMAL, EINA_TRUE),
86 evas_3d_material_color_set(EVAS_3D_MATERIAL_AMBIENT, 86 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_AMBIENT,
87 eet_mesh->materials->colors[0].r, 87 eet_mesh->materials->colors[0].r,
88 eet_mesh->materials->colors[0].g, 88 eet_mesh->materials->colors[0].g,
89 eet_mesh->materials->colors[0].b, 89 eet_mesh->materials->colors[0].b,
90 eet_mesh->materials->colors[0].a), 90 eet_mesh->materials->colors[0].a),
91 evas_3d_material_color_set(EVAS_3D_MATERIAL_DIFFUSE, 91 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_DIFFUSE,
92 eet_mesh->materials->colors[1].r, 92 eet_mesh->materials->colors[1].r,
93 eet_mesh->materials->colors[1].g, 93 eet_mesh->materials->colors[1].g,
94 eet_mesh->materials->colors[1].b, 94 eet_mesh->materials->colors[1].b,
95 eet_mesh->materials->colors[1].a), 95 eet_mesh->materials->colors[1].a),
96 evas_3d_material_color_set(EVAS_3D_MATERIAL_SPECULAR, 96 evas_canvas3d_material_color_set(EVAS_CANVAS3D_MATERIAL_SPECULAR,
97 eet_mesh->materials->colors[2].r, 97 eet_mesh->materials->colors[2].r,
98 eet_mesh->materials->colors[2].g, 98 eet_mesh->materials->colors[2].g,
99 eet_mesh->materials->colors[2].b, 99 eet_mesh->materials->colors[2].b,
100 eet_mesh->materials->colors[2].a), 100 eet_mesh->materials->colors[2].a),
101 evas_3d_material_shininess_set(eet_mesh->materials->shininess)); 101 evas_canvas3d_material_shininess_set(eet_mesh->materials->shininess));
102 102
103 eo_do(mesh, evas_3d_mesh_frame_material_set(0, material)); 103 eo_do(mesh, evas_canvas3d_mesh_frame_material_set(0, material));
104} 104}
105 105
106void 106void
107evas_model_load_file_eet(Evas_3D_Mesh *mesh, Eina_File *file) 107evas_model_load_file_eet(Evas_Canvas3D_Mesh *mesh, Eina_File *file)
108{ 108{
109 Eet_File *ef; 109 Eet_File *ef;
110 110
111 _evas_3d_eet_file_init(); 111 _evas_canvas3d_eet_file_init();
112 ef = eet_mmap(file); 112 ef = eet_mmap(file);
113 eet_file = eet_data_read(ef, 113 eet_file = eet_data_read(ef,
114 _file_descriptor, 114 _file_descriptor,
115 EVAS_3D_FILE_CACHE_FILE_ENTRY); 115 EVAS_CANVAS3D_FILE_CACHE_FILE_ENTRY);
116 116
117 eet_close(ef); 117 eet_close(ef);
118 118
119 if ((eet_file->mesh == NULL) || (eet_file->header == NULL)) 119 if ((eet_file->mesh == NULL) || (eet_file->header == NULL))
120 { 120 {
121 ERR("Reading of file is failed."); 121 ERR("Reading of file is failed.");
122 _evas_3d_eet_file_free(); 122 _evas_canvas3d_eet_file_free();
123 return; 123 return;
124 } 124 }
125 125
126 _set_geometry_to_mesh_from_eet_file(mesh, eet_file->mesh); 126 _set_geometry_to_mesh_from_eet_file(mesh, eet_file->mesh);
127 _set_material_to_mesh_from_eet_file(mesh, eet_file->mesh); 127 _set_material_to_mesh_from_eet_file(mesh, eet_file->mesh);
128 128
129 _evas_3d_eet_file_free(); 129 _evas_canvas3d_eet_file_free();
130} 130}
131 131
132 132