summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/examples/evas/resources/models/mesh_for_mmap.eetbin19706 -> 20213 bytes
-rw-r--r--src/lib/evas/canvas/evas_3d_eet.c13
-rw-r--r--src/lib/evas/include/evas_private.h9
-rw-r--r--src/modules/evas/model_savers/eet/evas_model_save_eet.c12
4 files changed, 25 insertions, 9 deletions
diff --git a/src/examples/evas/resources/models/mesh_for_mmap.eet b/src/examples/evas/resources/models/mesh_for_mmap.eet
index b4518f7187..53c2f777e8 100644
--- a/src/examples/evas/resources/models/mesh_for_mmap.eet
+++ b/src/examples/evas/resources/models/mesh_for_mmap.eet
Binary files differ
diff --git a/src/lib/evas/canvas/evas_3d_eet.c b/src/lib/evas/canvas/evas_3d_eet.c
index 1515f5a61b..7209433d2b 100644
--- a/src/lib/evas/canvas/evas_3d_eet.c
+++ b/src/lib/evas/canvas/evas_3d_eet.c
@@ -4,6 +4,7 @@
4 4
5Evas_3D_File_Eet* eet_file; 5Evas_3D_File_Eet* eet_file;
6const char EVAS_3D_FILE_CACHE_FILE_ENTRY[] = "evas_3d file"; 6const char EVAS_3D_FILE_CACHE_FILE_ENTRY[] = "evas_3d file";
7Eet_Data_Descriptor *_vec2_descriptor;
7Eet_Data_Descriptor *_vec3_descriptor; 8Eet_Data_Descriptor *_vec3_descriptor;
8Eet_Data_Descriptor *_vertex_descriptor; 9Eet_Data_Descriptor *_vertex_descriptor;
9Eet_Data_Descriptor *_geometry_descriptor; 10Eet_Data_Descriptor *_geometry_descriptor;
@@ -36,6 +37,8 @@ _evas_3d_eet_file_init(void)
36 37
37/* initialization of bonding between structure units in eet file */ 38/* initialization of bonding between structure units in eet file */
38 Eet_Data_Descriptor_Class eddc; 39 Eet_Data_Descriptor_Class eddc;
40 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Evas_3D_Vec2_Eet);
41 _vec2_descriptor = eet_data_descriptor_file_new(&eddc);
39 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Evas_3D_Vec3_Eet); 42 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Evas_3D_Vec3_Eet);
40 _vec3_descriptor = eet_data_descriptor_file_new(&eddc); 43 _vec3_descriptor = eet_data_descriptor_file_new(&eddc);
41 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Evas_3D_Vertex_Eet); 44 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Evas_3D_Vertex_Eet);
@@ -55,6 +58,13 @@ _evas_3d_eet_file_init(void)
55 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Evas_3D_File_Eet); 58 EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(&eddc, Evas_3D_File_Eet);
56 _file_descriptor = eet_data_descriptor_file_new(&eddc); 59 _file_descriptor = eet_data_descriptor_file_new(&eddc);
57 60
61/* Vec_2 */
62#define ADD_BASIC(member, eet_type) EET_DATA_DESCRIPTOR_ADD_BASIC \
63 (_vec2_descriptor, Evas_3D_Vec3_Eet, # member, member, eet_type);
64 ADD_BASIC(x, EET_T_FLOAT);
65 ADD_BASIC(y, EET_T_FLOAT);
66#undef ADD_BASIC
67
58/* Vec_3 */ 68/* Vec_3 */
59#define ADD_BASIC(member, eet_type) EET_DATA_DESCRIPTOR_ADD_BASIC \ 69#define ADD_BASIC(member, eet_type) EET_DATA_DESCRIPTOR_ADD_BASIC \
60 (_vec3_descriptor, Evas_3D_Vec3_Eet, # member, member, eet_type); 70 (_vec3_descriptor, Evas_3D_Vec3_Eet, # member, member, eet_type);
@@ -69,7 +79,7 @@ _evas_3d_eet_file_init(void)
69 EET_DATA_DESCRIPTOR_ADD_SUB_NESTED(_vertex_descriptor, Evas_3D_Vertex_Eet, 79 EET_DATA_DESCRIPTOR_ADD_SUB_NESTED(_vertex_descriptor, Evas_3D_Vertex_Eet,
70 "normal", normal, _vec3_descriptor); 80 "normal", normal, _vec3_descriptor);
71 EET_DATA_DESCRIPTOR_ADD_SUB_NESTED(_vertex_descriptor, Evas_3D_Vertex_Eet, 81 EET_DATA_DESCRIPTOR_ADD_SUB_NESTED(_vertex_descriptor, Evas_3D_Vertex_Eet,
72 "texcoord", texcoord, _vec3_descriptor); 82 "texcoord", texcoord, _vec2_descriptor);
73 83
74/* Geometry */ 84/* Geometry */
75 EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_geometry_descriptor, Evas_3D_Geometry_Eet, 85 EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(_geometry_descriptor, Evas_3D_Geometry_Eet,
@@ -151,6 +161,7 @@ _evas_3d_eet_descriptor_shutdown(void)
151{ 161{
152 eet_data_descriptor_free(_geometry_descriptor); 162 eet_data_descriptor_free(_geometry_descriptor);
153 eet_data_descriptor_free(_vertex_descriptor); 163 eet_data_descriptor_free(_vertex_descriptor);
164 eet_data_descriptor_free(_vec2_descriptor);
154 eet_data_descriptor_free(_vec3_descriptor); 165 eet_data_descriptor_free(_vec3_descriptor);
155 eet_data_descriptor_free(_color_descriptor); 166 eet_data_descriptor_free(_color_descriptor);
156 eet_data_descriptor_free(_material_descriptor); 167 eet_data_descriptor_free(_material_descriptor);
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index 03df174926..6896c1e308 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -76,6 +76,7 @@ typedef struct _Evas_3D_Material Evas_3D_Material_Data;
76typedef struct _Evas_3D_Texture Evas_3D_Texture_Data; 76typedef struct _Evas_3D_Texture Evas_3D_Texture_Data;
77 77
78/* Structs for mesh eet saver/loader */ 78/* Structs for mesh eet saver/loader */
79typedef struct _Evas_3D_Vec2_Eet Evas_3D_Vec2_Eet;
79typedef struct _Evas_3D_Vec3_Eet Evas_3D_Vec3_Eet; 80typedef struct _Evas_3D_Vec3_Eet Evas_3D_Vec3_Eet;
80typedef struct _Evas_3D_Vertex_Eet Evas_3D_Vertex_Eet; 81typedef struct _Evas_3D_Vertex_Eet Evas_3D_Vertex_Eet;
81typedef struct _Evas_3D_Geometry_Eet Evas_3D_Geometry_Eet; 82typedef struct _Evas_3D_Geometry_Eet Evas_3D_Geometry_Eet;
@@ -86,6 +87,12 @@ typedef struct _Evas_3D_Mesh_Eet Evas_3D_Mesh_Eet;
86typedef struct _Evas_3D_Header_Eet Evas_3D_Header_Eet; 87typedef struct _Evas_3D_Header_Eet Evas_3D_Header_Eet;
87typedef struct _Evas_3D_File_Eet Evas_3D_File_Eet; 88typedef struct _Evas_3D_File_Eet Evas_3D_File_Eet;
88 89
90struct _Evas_3D_Vec2_Eet
91{
92 float x;
93 float y;
94};
95
89struct _Evas_3D_Vec3_Eet 96struct _Evas_3D_Vec3_Eet
90{ 97{
91 float x; 98 float x;
@@ -97,7 +104,7 @@ struct _Evas_3D_Vertex_Eet
97{ 104{
98 Evas_3D_Vec3_Eet position; 105 Evas_3D_Vec3_Eet position;
99 Evas_3D_Vec3_Eet normal; 106 Evas_3D_Vec3_Eet normal;
100 Evas_3D_Vec3_Eet texcoord; 107 Evas_3D_Vec2_Eet texcoord;
101};//one point of mesh 108};//one point of mesh
102 109
103struct _Evas_3D_Geometry_Eet 110struct _Evas_3D_Geometry_Eet
diff --git a/src/modules/evas/model_savers/eet/evas_model_save_eet.c b/src/modules/evas/model_savers/eet/evas_model_save_eet.c
index e445dca249..9f4365b7e6 100644
--- a/src/modules/evas/model_savers/eet/evas_model_save_eet.c
+++ b/src/modules/evas/model_savers/eet/evas_model_save_eet.c
@@ -40,7 +40,7 @@ _set_geometry_to_eet_file_from_mesh(Evas_3D_Mesh_Data *mesh,
40 geometry->vertices_count = mesh->vertex_count; 40 geometry->vertices_count = mesh->vertex_count;
41 geometries[0] = mesh->vertex_count; 41 geometries[0] = mesh->vertex_count;
42 42
43#define SAVE_GEOMETRICS(a, component)\ 43#define SAVE_GEOMETRICS(a, component, command_for_z_component)\
44 vb = &f->vertices[a];\ 44 vb = &f->vertices[a];\
45 if (vb->data == NULL)\ 45 if (vb->data == NULL)\
46 {\ 46 {\
@@ -55,15 +55,13 @@ _set_geometry_to_eet_file_from_mesh(Evas_3D_Mesh_Data *mesh,
55 {\ 55 {\
56 vertices[i].component.x = src[0];\ 56 vertices[i].component.x = src[0];\
57 vertices[i].component.y = src[1];\ 57 vertices[i].component.y = src[1];\
58 vertices[i].component.z = src[2];\ 58 command_for_z_component\
59 src += f->vertices[a].element_count;\ 59 src += f->vertices[a].element_count;\
60 } 60 }
61
62 geometry->vertices = vertices; 61 geometry->vertices = vertices;
63 SAVE_GEOMETRICS(EVAS_3D_VERTEX_POSITION, position) 62 SAVE_GEOMETRICS(EVAS_3D_VERTEX_POSITION, position, vertices[i].position.z = src[2];)
64 SAVE_GEOMETRICS(EVAS_3D_VERTEX_NORMAL, normal) 63 SAVE_GEOMETRICS(EVAS_3D_VERTEX_NORMAL, normal, vertices[i].normal.z = src[2];)
65 SAVE_GEOMETRICS(EVAS_3D_VERTEX_TEXCOORD, texcoord) 64 SAVE_GEOMETRICS(EVAS_3D_VERTEX_TEXCOORD, texcoord,)
66
67#undef SAVE_GEOMETRICS 65#undef SAVE_GEOMETRICS
68 66
69 eet_mesh->geometries = geometry; 67 eet_mesh->geometries = geometry;