summaryrefslogtreecommitdiff
path: root/src/modules/evas/model_savers
diff options
context:
space:
mode:
authorperepelits.m <perepelits.m@samsung.com>2015-12-29 13:28:55 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-12-29 13:28:56 +0900
commite6bba4d91c814b260c0b56feb77a7073942cc449 (patch)
tree4f0f1da7ddb149c9356b1b8cc1805a3d70751d2f /src/modules/evas/model_savers
parent1a9e42d124198c8acda28cd6e8239fdcc9384256 (diff)
[Evas] Refactor model's savers and loaders.
Summary: Move common part to a separated document. Make code more readable using smaller functions. (from Task T2713) Everything is OK with make check. Reviewers: cedric, raster, Hermet, stefan_schmidt Reviewed By: stefan_schmidt Subscribers: jpeg, artem.popov Differential Revision: https://phab.enlightenment.org/D3430
Diffstat (limited to 'src/modules/evas/model_savers')
-rw-r--r--src/modules/evas/model_savers/eet/evas_model_save_eet.c20
-rw-r--r--src/modules/evas/model_savers/obj/evas_model_save_obj.c239
-rw-r--r--src/modules/evas/model_savers/ply/evas_model_save_ply.c121
3 files changed, 235 insertions, 145 deletions
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 0ac7e66e44..183dadae3c 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
@@ -41,18 +41,17 @@ _set_geometry_to_eet_file_from_mesh(Evas_Canvas3D_Mesh_Data *mesh,
41 if (vb->data == NULL)\ 41 if (vb->data == NULL)\
42 {\ 42 {\
43 ERR("Reading of geometrics is failed.");\ 43 ERR("Reading of geometrics is failed.");\
44 free(vertices);\
45 free(geometry);\
46 free(geometries);\
47 return;\
48 }\ 44 }\
49 src = (float *)vb->data;\ 45 else\
50 for (i = 0; i < mesh->vertex_count; i++)\
51 {\ 46 {\
52 vertices[i].component.x = src[0];\ 47 src = (float *)vb->data;\
53 vertices[i].component.y = src[1];\ 48 for (i = 0; i < mesh->vertex_count; i++)\
54 command_for_z_component\ 49 {\
55 src += f->vertices[a].element_count;\ 50 vertices[i].component.x = src[0];\
51 vertices[i].component.y = src[1];\
52 command_for_z_component\
53 src += f->vertices[a].element_count;\
54 }\
56 } 55 }
57 geometry->vertices = vertices; 56 geometry->vertices = vertices;
58 SAVE_GEOMETRICS(EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION, position, vertices[i].position.z = src[2];) 57 SAVE_GEOMETRICS(EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION, position, vertices[i].position.z = src[2];)
@@ -190,4 +189,3 @@ evas_model_save_file_eet(const Evas_Canvas3D_Mesh *mesh,
190 189
191 _evas_canvas3d_eet_file_free(eet_file); 190 _evas_canvas3d_eet_file_free(eet_file);
192} 191}
193
diff --git a/src/modules/evas/model_savers/obj/evas_model_save_obj.c b/src/modules/evas/model_savers/obj/evas_model_save_obj.c
index d9be3dce44..09e5c723c6 100644
--- a/src/modules/evas/model_savers/obj/evas_model_save_obj.c
+++ b/src/modules/evas/model_savers/obj/evas_model_save_obj.c
@@ -1,86 +1,71 @@
1#ifdef HAVE_CONFIG_H 1#include "evas_model_load_save_common.h"
2# include "config.h" 2
3#endif 3static unsigned short*
4 4_init_obj_indices_data(Evas_Model_Load_Save_Header header)
5#include <stdlib.h> 5{
6#include <time.h> 6 unsigned short *i_data;
7#include "stdio.h" 7 int i = 0;
8#include "evas_common_private.h" 8
9#include "evas_private.h" 9 if (header.existence_of_positions) i++;
10 10 if (header.existence_of_normals) i++;
11#define OPEN_FILE(extension)\ 11 if (header.existence_of_tex_coords) i++;
12 FILE * _##extension##_file = fopen(_##extension##_file_name, "w+"); 12 i_data = calloc(header.vertices_count * i, sizeof(unsigned short));
13 13
14#define SAVE_GEOMETRICS(a, format) \ 14 return i_data;
15 vb = &f->vertices[a]; \ 15}
16 if (vb->data != NULL) \
17 { \
18 fprintf(_obj_file, "o %s\n",_obj_file_name); \
19 src = (float *)vb->data; \
20 for (i = 0; i < pd->vertex_count; i++) \
21 { \
22 fprintf(_obj_file, format, src[0], src[1]); \
23 if (a != EVAS_CANVAS3D_VERTEX_ATTRIB_TEXCOORD) \
24 fprintf(_obj_file, " %.4f", src[2]); \
25 fprintf(_obj_file, "\n"); \
26 src += f->vertices[a].element_count; \
27 } \
28 }
29 16
30static void 17static void
31_write_point(FILE * obj_file, 18_vertex_data_free_cb(void *data)
19{
20 eina_stringshare_del(data);
21}
22
23static void
24_write_point(FILE *obj_file,
32 int num, 25 int num,
33 int num_of_point, 26 int num_of_point,
34 Eina_Bool existence_of_normal, 27 Evas_Model_Load_Save_Header header,
35 Eina_Bool existence_of_tex_point) 28 unsigned short *i_data)
36{ 29{
37 if (num_of_point == 1) 30 if (num_of_point == 0)
38 fprintf(obj_file, "f "); 31 fprintf(obj_file, "f ");
39 32
40 if (existence_of_normal) 33 if (header.existence_of_normals)
41 { 34 {
42 if (existence_of_tex_point) 35 if (header.existence_of_tex_coords)
43 fprintf(obj_file, "%i/%i/%i ", num, num, num); 36 fprintf(obj_file, "%hu/%hu/%hu ", i_data[num],
37 i_data[num + header.vertices_count],
38 i_data[num + 2 * header.vertices_count]);
44 else 39 else
45 fprintf(obj_file, "%i//%i ", num, num); 40 fprintf(obj_file, "%hu//%hu ", i_data[num],
41 i_data[num + header.vertices_count]);
46 } 42 }
47 else 43 else
48 { 44 {
49 if (existence_of_tex_point) 45 if (header.existence_of_tex_coords)
50 fprintf(obj_file, "%i/%i ", num, num); 46 fprintf(obj_file, "%hu/%hu ", i_data[num],
47 i_data[num + header.vertices_count]);
51 else 48 else
52 fprintf(obj_file, "%i ", num); 49 fprintf(obj_file, "%hu ", i_data[num]);
53 } 50 }
54 51
55 if (num_of_point == 3) 52 if (num_of_point == 2)
56 fprintf(obj_file, "\n"); 53 fprintf(obj_file, "\n");
57} 54}
58 55
59static void 56static inline Eina_Bool
60_save_mesh(Evas_Canvas3D_Mesh_Data *pd, const char *_obj_file_name, Evas_Canvas3D_Mesh_Frame *f) 57_write_obj_header(FILE *file,
58 const char *_mtl_file_name)
61{ 59{
62 Evas_Canvas3D_Vertex_Buffer *vb;
63 time_t current_time; 60 time_t current_time;
64 char* c_time_string; 61 char* c_time_string;
65 int i;
66 float *src;
67 Eina_Bool existence_of_normal, existence_of_tex_point;
68 62
69 OPEN_FILE(obj)
70 if (!_obj_file)
71 {
72 ERR("File open '%s' for save failed", _obj_file_name);
73 return;
74 }
75 fprintf(_obj_file, "# Evas_3D saver OBJ v0.03 \n");//_obj_file created in macro
76 /* Adding time comment to .obj file. */
77 current_time = time(NULL); 63 current_time = time(NULL);
78 64
79 if (current_time == ((time_t)-1)) 65 if (current_time == ((time_t)-1))
80 { 66 {
81 ERR("Failure to compute the current time."); 67 ERR("Failure to compute the current time.");
82 fclose(_obj_file); 68 return EINA_FALSE;
83 return;
84 } 69 }
85 70
86 c_time_string = ctime(&current_time); 71 c_time_string = ctime(&current_time);
@@ -88,38 +73,117 @@ _save_mesh(Evas_Canvas3D_Mesh_Data *pd, const char *_obj_file_name, Evas_Canvas3
88 if (c_time_string == NULL) 73 if (c_time_string == NULL)
89 { 74 {
90 ERR("Failure to convert the current time."); 75 ERR("Failure to convert the current time.");
91 fclose(_obj_file); 76 return EINA_FALSE;
92 return; 77 }
78
79 fprintf(file, "# Evas_Canvas3D saver OBJ v0.03 \n");
80 fprintf(file, "# Current time is %s \n", c_time_string);
81 fprintf(file, "mtllib %s \n\n", _mtl_file_name);
82
83 return EINA_TRUE;
84}
85
86static inline void
87_write_obj_vertex_data(FILE *file,
88 Evas_Model_Load_Save_Header header,
89 Evas_Model_Load_Save_Data data,
90 unsigned short *i_data)
91{
92 int i, j;
93 int v = -1;
94 Eina_Stringshare *str, *cur_str, *cur_index;
95 unsigned short cur_hu;
96
97 eina_init();
98 Eina_Hash *vb;
99#define WRITE_OBJ_VERTEX_DATA(name, num, format) \
100 if (header.existence_of_##name) \
101 { \
102 cur_hu = 0; \
103 v++; \
104 vb = eina_hash_string_superfast_new(_vertex_data_free_cb); \
105 for (i = 0; i < header.vertices_count; i++) \
106 { \
107 str = eina_stringshare_printf(" "); \
108 for (j = 0; j < num; j++) \
109 str = eina_stringshare_printf("%s %f", str, \
110 data.name[i * num + j]); \
111 cur_index = eina_hash_find(vb, str); \
112 if (!cur_index) \
113 { \
114 cur_hu++; \
115 cur_str = eina_stringshare_printf("%hu", cur_hu); \
116 eina_hash_add(vb, str, cur_str); \
117 i_data[v * header.vertices_count + i] = cur_hu; \
118 fprintf(file, "%s%s\n", format, str); \
119 } \
120 else sscanf(cur_index, "%hu", \
121 i_data + v * header.vertices_count + i); \
122 } \
123 eina_hash_free(vb); \
93 } 124 }
125 WRITE_OBJ_VERTEX_DATA(positions, 3, "v")
126 WRITE_OBJ_VERTEX_DATA(tex_coords, 2, "vt")
127 WRITE_OBJ_VERTEX_DATA(normals, 3, "vn")
128#undef WRITE_OBJ_VERTEX_DATA
129 eina_shutdown();
130}
94 131
95 fprintf(_obj_file,"# Current time is %s \n", c_time_string); 132static inline void
96 fprintf(_obj_file,"mtllib %s.mtl \n\n", _obj_file_name); 133_write_obj_index_data(FILE *file,
134 Evas_Model_Load_Save_Header header,
135 Evas_Model_Load_Save_Data data,
136 unsigned short *i_data)
137{
138 int i;
139 int ic;
140 ic = header.indices_count ? header.indices_count : header.vertices_count;
141 for (i = 0; i < ic; i++)
142 _write_point(file, data.indices[i], i % 3, header, i_data);
143}
144
145static void
146_save_mesh(Evas_Canvas3D_Mesh_Data *pd,
147 const char *_obj_file_name,
148 const char *_mtl_file_name,
149 Evas_Canvas3D_Mesh_Frame *f)
150{
151 Evas_Model_Load_Save_Header header;
152 Evas_Model_Load_Save_Data data;
153 unsigned short *index_data;
97 154
98 /* Adding geometrics to file. */ 155 if (!evas_model_save_header_from_mesh(pd, f, &header)) return;
99 if (f == NULL) 156
157 index_data = _init_obj_indices_data(header);
158 if (index_data == NULL)
100 { 159 {
101 ERR("Not existing mesh frame."); 160 ERR("Allocation of index data is failed.");
102 fclose(_obj_file);
103 return; 161 return;
104 } 162 }
105 163
106 SAVE_GEOMETRICS(EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION, "v %.4f %.4f") 164 evas_model_save_data_from_mesh(pd, f, header, &data);
107 SAVE_GEOMETRICS(EVAS_CANVAS3D_VERTEX_ATTRIB_NORMAL, "vn %.4f %.4f")
108 SAVE_GEOMETRICS(EVAS_CANVAS3D_VERTEX_ATTRIB_TEXCOORD, "vt %.4f %.4f")
109 165
110 existence_of_normal = (f->vertices[EVAS_CANVAS3D_VERTEX_ATTRIB_NORMAL].data != NULL); 166 FILE * _obj_file = fopen(_obj_file_name, "w+");
111 existence_of_tex_point = (f->vertices[EVAS_CANVAS3D_VERTEX_ATTRIB_TEXCOORD].data != NULL); 167 if (!_obj_file)
168 {
169 ERR("File open '%s' for save failed", _obj_file_name);
170 free(index_data);
171 return;
172 }
112 173
113 fprintf(_obj_file,"usemtl Material\n s off\n"); 174 if (!_write_obj_header(_obj_file, _mtl_file_name))
114 for (i = 1; i <= pd->vertex_count; i++)//numeration of faces in .obj started from 1
115 { 175 {
116 _write_point(_obj_file, i, 1, existence_of_normal, existence_of_tex_point); 176 fclose(_obj_file);
117 i++; 177 free(index_data);
118 _write_point(_obj_file, i, 2, existence_of_normal, existence_of_tex_point); 178 return;
119 i++;
120 _write_point(_obj_file, i, 3, existence_of_normal, existence_of_tex_point);
121 } 179 }
180
181 _write_obj_vertex_data(_obj_file, header, data, index_data);
182 fprintf(_obj_file,"usemtl Material\n s off\n");
183 _write_obj_index_data(_obj_file, header, data, index_data);
122 fclose(_obj_file); 184 fclose(_obj_file);
185 free(index_data);
186 free(data.indices);
123} 187}
124 188
125static void 189static void
@@ -127,13 +191,13 @@ _save_material(Evas_Canvas3D_Mesh_Data *pd EINA_UNUSED,
127 const char *_mtl_file_name, 191 const char *_mtl_file_name,
128 Evas_Canvas3D_Material_Data *mat) 192 Evas_Canvas3D_Material_Data *mat)
129{ 193{
130 OPEN_FILE(mtl) 194 FILE * _mtl_file = fopen(_mtl_file_name, "w+");
131 if (!_mtl_file) 195 if (!_mtl_file)
132 { 196 {
133 ERR("File open '%s' for save failed", _mtl_file_name); 197 ERR("File open '%s' for save failed", _mtl_file_name);
134 return; 198 return;
135 } 199 }
136 fprintf(_mtl_file, "# Evas_3D saver OBJ v0.03 \n");//_mtl_file created in macro 200 fprintf(_mtl_file, "# Evas_Canvas3D saver OBJ v0.03 \n");//_mtl_file created in macro
137 fprintf(_mtl_file, "# Material Count: 1 \n\n"); 201 fprintf(_mtl_file, "# Material Count: 1 \n\n");
138 fprintf(_mtl_file, "newmtl Material \n"); 202 fprintf(_mtl_file, "newmtl Material \n");
139 fprintf(_mtl_file, "Ns 1.000000 \n");//exp factor for specular highlight 203 fprintf(_mtl_file, "Ns 1.000000 \n");//exp factor for specular highlight
@@ -157,7 +221,9 @@ _save_material(Evas_Canvas3D_Mesh_Data *pd EINA_UNUSED,
157} 221}
158 222
159void 223void
160evas_model_save_file_obj(const Evas_Canvas3D_Mesh *mesh, const char *_obj_file_name, Evas_Canvas3D_Mesh_Frame *f) 224evas_model_save_file_obj(const Evas_Canvas3D_Mesh *mesh,
225 const char *_obj_file_name,
226 Evas_Canvas3D_Mesh_Frame *f)
161{ 227{
162 int len; 228 int len;
163 char *_mtl_file_name, *_without_extention; 229 char *_mtl_file_name, *_without_extention;
@@ -166,18 +232,15 @@ evas_model_save_file_obj(const Evas_Canvas3D_Mesh *mesh, const char *_obj_file_n
166 len = strlen(_obj_file_name); 232 len = strlen(_obj_file_name);
167 _without_extention = (char *)malloc(len - 3); 233 _without_extention = (char *)malloc(len - 3);
168 _mtl_file_name = (char *)malloc(len + 1); 234 _mtl_file_name = (char *)malloc(len + 1);
235 eina_strlcpy(_without_extention, _obj_file_name, len - 3);
236 eina_str_join(_mtl_file_name, len + 1, '.', _without_extention, "mtl");
237 free(_without_extention);
169 238
170 Evas_Canvas3D_Mesh_Data *pd = eo_data_scope_get(mesh, EVAS_CANVAS3D_MESH_CLASS); 239 Evas_Canvas3D_Mesh_Data *pd = eo_data_scope_get(mesh, EVAS_CANVAS3D_MESH_CLASS);
171 _save_mesh(pd, _obj_file_name, f);
172
173 mat = eo_data_scope_get(f->material, EVAS_CANVAS3D_MATERIAL_CLASS); 240 mat = eo_data_scope_get(f->material, EVAS_CANVAS3D_MATERIAL_CLASS);
174 if (mat != NULL)
175 {
176 eina_strlcpy(_without_extention, _obj_file_name, len - 3);
177 eina_str_join(_mtl_file_name, len + 1, '.', _without_extention, "mtl");
178 _save_material(pd, _mtl_file_name, mat);
179 }
180 241
181 free(_without_extention); 242 if (mat != NULL) _save_material(pd, _mtl_file_name, mat);
243 _save_mesh(pd, _obj_file_name, _mtl_file_name, f);
244
182 free(_mtl_file_name); 245 free(_mtl_file_name);
183} 246}
diff --git a/src/modules/evas/model_savers/ply/evas_model_save_ply.c b/src/modules/evas/model_savers/ply/evas_model_save_ply.c
index 0be42f7f86..8da8f741ea 100644
--- a/src/modules/evas/model_savers/ply/evas_model_save_ply.c
+++ b/src/modules/evas/model_savers/ply/evas_model_save_ply.c
@@ -1,21 +1,80 @@
1#ifdef HAVE_CONFIG_H 1#include "evas_model_load_save_common.h"
2# include "config.h"
3#endif
4 2
5#include <stdlib.h> 3static inline void
6#include <time.h> 4_write_ply_header(FILE *file, Evas_Model_Load_Save_Header header)
7#include "stdio.h" 5{
8#include "math.h" 6 const char *pf = "property float", *puc = "property uchar";
9#include "evas_common_private.h" 7 fprintf(file, "ply\n" \
10#include "evas_private.h" 8 "format ascii 1.0\n" \
9 "comment Created by EFL evas_canvas3d_mesh_saver_ply.c version 2 " \
10 "(sub 0) - www.enlightenment.org, source file: ''\n");
11 fprintf(file, "element vertex %d\n", header.vertices_count);
12
13 if (header.existence_of_positions)
14 fprintf(file, "%s x\n%s y\n%s z\n", pf, pf, pf);
15 if (header.existence_of_normals)
16 fprintf(file, "%s nx\n%s ny\n%s nz\n", pf, pf, pf);
17 if (header.existence_of_tex_coords)
18 fprintf(file, "%s s\n%s t\n", pf, pf);
19 if (header.existence_of_colors)
20 fprintf(file, "%s red\n%s green\n%s blue\n", puc, puc, puc);
21
22 fprintf(file, "element face %d\n" \
23 "property list uchar uint vertex_indices\n" \
24 "end_header\n", header.indices_count / 3);
25}
26
27static inline void
28_write_ply_vertex_data(FILE *file,
29 Evas_Model_Load_Save_Header header,
30 Evas_Model_Load_Save_Data data)
31{
32 int i, j;
33 for (i = 0; i < header.vertices_count; i++)
34 {
35#define WRITE_PLY_VERTEX_DATA(name, num)\
36 if (header.existence_of_##name)\
37 for (j = 0; j < num; j++, data.name++)\
38 fprintf(file, "%f ", data.name[0]);
39 WRITE_PLY_VERTEX_DATA(positions, 3)
40 WRITE_PLY_VERTEX_DATA(normals, 3)
41 WRITE_PLY_VERTEX_DATA(tex_coords, 2)
42#undef WRITE_PLY_VERTEX_DATA
43
44 if (header.existence_of_colors)
45 {
46 for (j = 0; j < 3; j++, data.colors++)
47 fprintf(file, "%.0f ", round(data.colors[0] * 255));
48 data.colors++;
49 }
50 fprintf(file, "\n");
51 }
52}
53
54static inline void
55_write_ply_index_data(FILE *file,
56 Evas_Model_Load_Save_Header header,
57 Evas_Model_Load_Save_Data data)
58{
59 int i, triangles_count = header.indices_count / 3;
60 for (i = 0; i < triangles_count; i++, data.indices += 3)
61 fprintf(file, "3 %d %d %d\n", data.indices[0],
62 data.indices[1],
63 data.indices[2]);
64}
11 65
12void 66void
13evas_model_save_file_ply(const Evas_Canvas3D_Mesh *mesh, const char *file, Evas_Canvas3D_Mesh_Frame *f) 67evas_model_save_file_ply(const Evas_Canvas3D_Mesh *mesh,
68 const char *file,
69 Evas_Canvas3D_Mesh_Frame *f)
14{ 70{
15 float *src_pos, *src_nor, *src_tex, *src_col; 71 Evas_Model_Load_Save_Header header;
16 int i; 72 Evas_Model_Load_Save_Data data;
17 73
18 Evas_Canvas3D_Mesh_Data *pd = eo_data_scope_get(mesh, EVAS_CANVAS3D_MESH_CLASS); 74 Evas_Canvas3D_Mesh_Data *pd = eo_data_scope_get(mesh, EVAS_CANVAS3D_MESH_CLASS);
75 if (!evas_model_save_header_from_mesh(pd, f, &header)) return;
76 evas_model_save_data_from_mesh(pd, f, header, &data);
77
19 FILE *_ply_file = fopen(file, "w+"); 78 FILE *_ply_file = fopen(file, "w+");
20 if (!_ply_file) 79 if (!_ply_file)
21 { 80 {
@@ -23,40 +82,10 @@ evas_model_save_file_ply(const Evas_Canvas3D_Mesh *mesh, const char *file, Evas_
23 return; 82 return;
24 } 83 }
25 84
26 fprintf(_ply_file,"ply\nformat ascii 1.0\ncomment Created by EFL evas_canvas3d_mesh_saver_ply.c" \ 85 _write_ply_header(_ply_file, header);
27 "version 1 (sub 0) - www.enlightenment.org, source file: ''\n"); 86 _write_ply_vertex_data(_ply_file, header, data);
28 fprintf(_ply_file,"element vertex %d\n", pd->vertex_count); 87 _write_ply_index_data(_ply_file, header, data);
29 fprintf(_ply_file,"property float x\nproperty float y\nproperty float z\n" \
30 "property float nx\nproperty float ny\nproperty float nz\n" \
31 "property float s\nproperty float t\n" \
32 "property uchar red\nproperty uchar green\nproperty uchar blue\n");
33 fprintf(_ply_file,"element face %d\nproperty list uchar uint vertex_indices\nend_header\n",
34 pd->index_count / 3);
35
36 src_pos = (float*)(&f->vertices[EVAS_CANVAS3D_VERTEX_ATTRIB_POSITION])->data;
37 src_nor = (float*)(&f->vertices[EVAS_CANVAS3D_VERTEX_ATTRIB_NORMAL])->data;
38 src_tex = (float*)(&f->vertices[EVAS_CANVAS3D_VERTEX_ATTRIB_TEXCOORD])->data;
39 src_col = (float*)(&f->vertices[EVAS_CANVAS3D_VERTEX_ATTRIB_COLOR])->data;
40
41 for (i = 0; i < pd->vertex_count; i++)
42 {
43 fprintf(_ply_file,"%f %f %f %f %f %f %f %f %.0f %.0f %.0f\n",
44 src_pos[0], src_pos[1], src_pos[2],
45 src_nor[0], src_nor[1], src_nor[2],
46 src_tex[0], src_tex[1],
47 round(src_col[0] * 255), round(src_col[1] * 255), round(src_col[2] * 255));
48 src_pos += 3;
49 src_nor += 3;
50 src_tex += 2;
51 src_col += 4;
52 }
53
54 unsigned short* indices = (unsigned short*) pd->indices;
55
56 for (i = 0; i < pd->index_count / 3; i++)
57 {
58 fprintf(_ply_file,"3 %d %d %d\n", indices[3 * i], indices[3 * i + 1], indices[3 * i + 2]);
59 }
60 88
89 free(data.indices);
61 fclose(_ply_file); 90 fclose(_ply_file);
62} 91}