summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas/evas_3d_mesh.eo
blob: 43ce023af87f2461ad6b68307168baf59fa4c268 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
class Evas_3D_Mesh (Evas_3D_Object, Evas.Common_Interface)
{
   legacy_prefix: null;
   data: Evas_3D_Mesh_Data;

   methods {
      file_set {
         /**
          * Load mesh data from file.
          *
          * Loading a mesh from existing file is supported. Currently, only MD2 and OBJ file
          * formats are supported.
          *
          * @ingroup Evas_3D_Mesh
          */
         params {
            @in Evas_3D_Mesh_File_Type type; /*@ The type of the mesh file. */
            @in const(char)* file; /*@ Path to the mesh file. */
            @in const(char)* key; /*@ Key in the mesh file. */
         }
      }

      save {
         /**
          * Save mesh data to file.
          *
          * Saving a mesh to file is supported. Currently, only OBJ file
          * format is supported.
          *
          * @ingroup Evas_3D_Mesh
          */
         params {
            @in Evas_3D_Mesh_File_Type type; /*@ The type of the mesh file. */
            @in const(char)* file; /*@ Path to the mesh file. */
            @in const(char)* key; /*@ Key in the mesh file. */
         }
      }

      frame_vertex_data_set {
         /*@
           Set the vertex data of the key frame of the given mesh.

           This function make evas read from the given buffer whenever it requires.
           If you want to release the buffer after calling this functions, use
           evas_3d_mesh_frame_vertex_data_copy_set() instead.

           After setting the vertex data, further modifications should be protected
           by map/unmap pair.

           @see evas_3d_mesh_frame_vertex_data_copy_set()
           @see evas_3d_mesh_frame_vertex_data_map()
           @see evas_3d_mesh_frame_vertex_data_unmap()

           @ingroup Evas_3D_Mesh
          */
         params {
            @in int frame; /*@ The number of the key frame. */
            @in Evas_3D_Vertex_Attrib attrib; /*@ Vertex attribute ID. */
            @in int stride; /*@ Stride to go to the next vertex (in bytes). */
            @in const(void)* data; /*@ Pointer to the vertex data buffer. */
         }
      }

      frame_vertex_data_copy_set {
         /*@
           Set the vertex data of the key frame of the given mesh by copying from a buffer.
           This function allocates internal vertex buffer and copy from the given
           buffer. So you can release the buffer. If you want to modify the vertex data
           use evas_3d_mesh_frame_vertex_data_map(). After finishing the modifications,
           you should call evas_3d_mesh_frame_vertex_data_unmap().

           @see evas_3d_mesh_frame_vertex_data_set()
           @see evas_3d_mesh_frame_vertex_data_map()
           @see evas_3d_mesh_frame_vertex_data_unmap()

           @ingroup Evas_3D_Mesh
          */
         params {
            @in int frame; /*@ The number of the key frame. */
            @in Evas_3D_Vertex_Attrib attrib; /*@ Vertex attribute ID. */
            @in int stride; /*@ Stride to go to the next vertex (in bytes). */
            @in const(void)* data; /*@ Pointer to the vertex data buffer. */
         }
      }

      frame_vertex_data_map {
         /*@
           Map the vertex buffer of the key frame of the given mesh.

           After manipulating the mapped buffer, evas_3d_mesh_frame_vertex_data_unmap()
           should be called to properly download the data to the engine. If the data
           was set using evas_3d_mesh_frame_vertex_data_set(), pointer to the original
           buffer will be returned. Otherwise, the returned pointer can differ every
           time calling this function.

           @see evas_3d_mesh_frame_vertex_data_unmap()
           @return Starting address of the mapped vertex buffer.

           @ingroup Evas_3D_Mesh
          */

         return void *;
         params {
            @in int frame; /*@ The number of the key frame. */
            @in Evas_3D_Vertex_Attrib attrib; /*@ Vertex attribute ID. */
         }
      }

      frame_vertex_data_unmap {
         /*
           Unmap the vertex buffer of the key frame of the given mesh.

           @see evas_3d_mesh_frame_vertex_data_map()

           @ingroup Evas_3D_Mesh
          */

         params {
            @in int frame; /*@ The number of the key frame. */
            @in Evas_3D_Vertex_Attrib attrib; /*@ Vertex attribute ID. */
         }
      }

      frame_vertex_stride_get {
         /*
           Get the vertex buffer stride of the key frame of the given mesh.

           This function returns valid stride only when the vertex buffer is mapped.
           If the data was set with evas_3d_mesh_frame_vertex_data_set(), the original
           stride will be returned unchanged.

           @see evas_3d_mesh_frame_vertex_data_map()

           @return           Stride to go to the next vertex (in bytes).

           @ingroup Evas_3D_Mesh
          */
         const;
         return int ;
         params {
            @in int frame; /*@ The number of the key frame. */
            @in Evas_3D_Vertex_Attrib attrib; /*@ Vertex attribute ID. */
         }
      }

      index_data_set {
         /*
           Set the vertex index data of the given mesh.

           When the index data is set, Evas 3D assembles vertices using the index data.
           If you want to free the data buffer, use evas_3d_mesh_index_data_copy_set().
           Further modifications should be made within map/unmap pair.

           @see evas_3d_mesh_index_data_copy_set()
           @see evas_3d_mesh_index_data_map()
           @see evas_3d_mesh_index_data_unmap()

           @ingroup Evas_3D_Mesh
          */
         params {
            @in Evas_3D_Index_Format format; /*@ Vertex index data format. */
            @in int count; /*@ Vertex index count. */
            @in const(void)* indices; /*@ Pointer to the index data. */
         }
      }


      index_data_copy_set {
         /*
           Set the vertex index data of the given mesh by copying from a buffer.

           This function allocates internal index buffer any copy data from the given
           buffer. Futher modifications can be made within map/unmap pair.

           @see evas_3d_mesh_index_data_set()

           @ingroup Evas_3D_Mesh
          */
         return void ;
         params {
            @in Evas_3D_Index_Format format; /*@ Vertex index data format. */
            @in int count; /*@ Vertex index count. */
            @in const(void)* indices; /*@ Pointer to the index data. */
         }
      }

      index_format_get {
         /*
           Get the format of the index data of the given mesh.


           Returns valid format only when the index buffer is mapped. First map the
           index buffer and then query the properties of the mapped buffer. If the index
           data was set by evas_3d_mesh_index_data_set(), the original format will be
           returned. Otherwise the format can differ every time you call the
           evas_3d_mesh_index_data_map() function.

           @see evas_3d_mesh_index_data_map()

           @return           Format of the index data.

           @ingroup Evas_3D_Mesh
          */
          const;
         return Evas_3D_Index_Format ;
      }

      index_count_get {
         /*
           Get the count of the index data of the given mesh.

           This function returns the index count of the last called data_set function.

           @see evas_3d_mesh_index_data_set()
           @see evas_3d_mesh_index_data_copy_set()

           @return           Index data count.

           @ingroup Evas_3D_Mesh
          */
          const;
         return int ;
      }

      index_data_map {
         /*
           Map the index buffer of the given mesh.

           evas_3d_mesh_index_data_unmap() should be called after modifications. If the
           data was set using evas_3d_mesh_index_data_set(), the original pointer will
           be returned, otherwise, the returned pointer may differ every time you call
           this function.

           @see evas_3d_mesh_index_data_unmap()

           @return           Pointer to the mapped buffer.

           @ingroup Evas_3D_Mesh
          */
         return void * ;
      }

      index_data_unmap {
         /*
           Unmap the index buffer of the given mesh.

           @see evas_3d_mesh_index_data_map()

           @ingroup Evas_3D_Mesh
          */
      }

      frame_add {
         /*
           Add a key frame to the given mesh.

           @param mesh    The given mesh.
           @param frame   The number of the key frame to be added.

           If specified frame is already exist, error message will be generated.

           @ingroup Evas_3D_Mesh
          */
         params {
            @in int frame; /*@ The number of the key frame to be added. */
         }
      }

      frame_del {
         /*
           Delete a key frame from the given mesh.

           @param mesh    The given mesh.
           @param frame   The number of the key frame to be deleted.

           @see evas_3d_mesh_frame_add()

           @ingroup Evas_3D_Mesh
          */
         params {
            @in int frame; /*@ The number of the key frame to be added. */
         }
      }

      vertex_count_set {
         /*@
           Set the vertex count of the given mesh.

           Each key frame should have same vertex count to be properly interpolated.
           Key frames have their own vertex data and the data should have more vertices
           than the mesh's vertex count.

           Default vertex count is 0.

           @ingroup Evas_3D_Mesh
          */
         params {
            @in uint count; /*@ Vertex count.*/
         }
      }

      vertex_count_get {
         /*@
           Get the vertex count of the given mesh.

           @see evas_3d_mesh_vertex_count_set()

           @ingroup Evas_3D_Mesh
          */
          const;
          return int;
      }

   }
   properties {
      shade_mode {
         set {
            /**
             * Set the shade mode of the given mesh.
             *
             * Default shade mode is EVAS_3D_SHADE_MODE_VERTEX_COLOR.
             *
             * @ingroup Evas_3D_Mesh
             */
         }
         get {
            /**
             * Get the shade mode of the given mesh.
             *
             * @see eavs_3d_mesh_shade_mode_set()
             *
             * @ingroup Evas_3D_Mesh
             */
         }
         values {
            Evas_3D_Shade_Mode mode; /*@ The shade mode.*/
         }
      }

      frame_material {
         set {
            /**
              Set the material of the key frame of the given mesh.

              Setting different materials for each key frame is useful for doing animations
              like GIF images or color changing animationas.

              @ingroup Evas_3D_Mesh
             */
         }
         get {
            /**
              Get the material of the key frame of the given mesh.

              @see evas_3d_mesh_frame_material_set()

              @ingroup Evas_3D_Mesh
             */
         }
         keys {
            int frame; /*@ The number of the key frame.*/
         }
         values {
            Evas_3D_Material *material; /*@ The material to be set to the key frame.*/
         }
      }

      vertex_assembly {
         set {
            /*
              Set the vertex assembly of the given mesh.

              Vertex assembly defines how the engine organizes vertices into geometric
              primitives.

              Default vertex assembly is EVAS_3D_VERTEX_ASSEMBLY_TRIANGLES.

              @ingroup Evas_3D_Mesh
             */
         }
         get {
            /*
              Get the vertex assembly of the given mesh.

              @see evas_3d_mesh_vertex_assembly_set()

              @return  The vertex assembly.

              @ingroup Evas_3D_Mesh
             */
         }
         values {
            Evas_3D_Vertex_Assembly assembly; /*@ Vertex assembly.*/
         }
      }

   }
   implements {
      Eo.Base.constructor;
      Eo.Base.destructor;
      Evas_3D_Object.update_notify;
      Evas_3D_Object.change_notify;
   }

}