v0.4.1
Fast, portable C library for geometry input/output
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Modules
amf_document.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (c) 2017, Fougue Ltd. <http://www.fougue.pro>
3 ** All rights reserved.
4 **
5 ** Redistribution and use in source and binary forms, with or without
6 ** modification, are permitted provided that the following conditions
7 ** are met:
8 **
9 ** 1. Redistributions of source code must retain the above copyright
10 ** notice, this list of conditions and the following disclaimer.
11 **
12 ** 2. Redistributions in binary form must reproduce the above
13 ** copyright notice, this list of conditions and the following
14 ** disclaimer in the documentation and/or other materials provided
15 ** with the distribution.
16 **
17 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 ****************************************************************************/
29 
37 #pragma once
38 
39 #include "amf_global.h"
40 
41 #include "../gmio_core/endian.h"
42 #include "../gmio_core/memblock.h"
43 #include "../gmio_core/vecgeom.h"
44 
45 #include <stddef.h>
46 
49  const char* type;
50  const char* data;
51 };
52 
55  double r;
56  double g;
57  double b;
58  double a;
59  const char* r_formula;
60  const char* g_formula;
61  const char* b_formula;
62  const char* a_formula;
63 };
64 
66  uint32_t id; /* XML:integer */
68  uint32_t composite_count;
69  uint32_t metadata_count;
70 };
71 
77  uint32_t materialid; /* XML:nonNegativeInteger, required */
78  double value;
79  const char* value_formula;
80 };
81 
85  bool has_normal;
86  struct gmio_vec3d normal; /* XML:NegOneToOne: -1 <= coord <= 1 */
87  bool has_color;
88  struct gmio_amf_color color; /* XML:Color */
89  uint32_t metadata_count;
90 };
91 
93 struct gmio_amf_edge {
94  uint32_t v1; /* XML:nonNegativeInteger */
95  uint32_t v2; /* XML:nonNegativeInteger */
96  /* Direction vectors */
97  struct gmio_vec3d d1; /* XML:NegOneToOne: -1 <= coord <= 1 */
98  struct gmio_vec3d d2; /* XML:NegOneToOne: -1 <= coord <= 1 */
99 };
100 
102  uint32_t rtexid; /* XML:nonNegativeInteger */
103  uint32_t gtexid; /* XML:nonNegativeInteger */
104  uint32_t btexid; /* XML:nonNegativeInteger */
105  uint32_t atexid; /* XML:nonNegativeInteger */
106  struct gmio_vec3d utex; /* XML:Coords : any value */
107  struct gmio_vec3d vtex; /* XML:Coords : any value */
108  bool has_wtex;
109  struct gmio_vec3d wtex; /* XML:Coords : any value */
110 };
111 
113  uint32_t v1; /* XML:nonNegativeInteger */
114  uint32_t v2; /* XML:nonNegativeInteger */
115  uint32_t v3; /* XML:nonNegativeInteger */
117  struct gmio_amf_texmap texmap; /* XML:TexMap */
118  bool has_color;
119  struct gmio_amf_color color; /* XML:Color */
120 };
121 
125 };
126 
129  uint32_t materialid; /* XML:nonNegativeInteger */
131  uint32_t triangle_count;
132  uint32_t metadata_count;
133  bool has_color;
134  struct gmio_amf_color color; /* XML:Color */
135 };
136 
139  uint32_t vertex_count;
140  uint32_t edge_count;
141  uint32_t volume_count;
142 };
143 
146  uint32_t id; /* XML:integer */
147  uint32_t mesh_count;
148  uint32_t metadata_count;
149  bool has_color;
150  struct gmio_amf_color color; /* XML:Color */
151 };
152 
155  uint32_t id; /* XML:integer */
156  uint32_t instance_count;
157  uint32_t metadata_count;
158 };
159 
162 {
163  uint32_t objectid; /* XML:nonNegativeInteger */
164  struct gmio_vec3d delta; /* Any value */
165  struct gmio_vec3d rot;
166 };
167 
170 };
171 
173  uint32_t id; /* XML:integer */
174  uint32_t width; /* XML:nonNegativeInteger */
175  uint32_t height; /* XML:nonNegativeInteger */
176  uint32_t depth; /* XML:nonNegativeInteger */
177  bool tiled;
180 };
181 
190 };
191 
199 };
200 
206 };
207 
211  uint32_t object_index;
213  uint32_t mesh_index;
215  uint32_t value;
218 };
219 
227  const void* cookie;
228 
230 
232  uint32_t object_count;
233 
235  uint32_t material_count;
236 
238  uint32_t texture_count;
239 
242 
244  uint32_t metadata_count;
245 
261  const void* cookie,
262  enum gmio_amf_document_element element,
263  uint32_t element_index,
264  void* ptr_element);
265 
282  const void* cookie,
283  enum gmio_amf_document_element element,
284  uint32_t element_index,
285  uint32_t metadata_index,
286  struct gmio_amf_metadata* ptr_metadata);
287 
290  const void* cookie,
291  uint32_t object_index,
292  uint32_t mesh_index,
293  struct gmio_amf_mesh* ptr_mesh);
294 
307  const void* cookie,
308  const struct gmio_amf_object_mesh_element_index* element_index,
309  void* ptr_element);
310 
317  const void* cookie,
318  const struct gmio_amf_object_mesh_element_index* mesh_element_index,
319  uint32_t metadata_index,
320  struct gmio_amf_metadata* ptr_metadata);
321 
324  const void* cookie,
325  const struct gmio_amf_object_mesh_element_index* volume_index,
326  uint32_t triangle_index,
327  struct gmio_amf_triangle* ptr_triangle);
328 
335  const void* cookie,
336  uint32_t material_index,
337  uint32_t composite_index,
338  struct gmio_amf_composite* ptr_composite);
339 
346  const void* cookie,
347  uint32_t constellation_index,
348  uint32_t instance_index,
349  struct gmio_amf_instance* ptr_instance);
350 };
351 
uint32_t mesh_index
Index of the mesh that owns element.
Definition: amf_document.h:213
struct gmio_amf_texmap texmap
Definition: amf_document.h:117
bool has_normal
Definition: amf_document.h:85
void(* func_get_document_element)(const void *cookie, enum gmio_amf_document_element element, uint32_t element_index, void *ptr_element)
Function that retrieves the i-th document sub-element.
Definition: amf_document.h:260
gmio_amf_document_element
The direct elements of an AMF document(ie inside ...)
Definition: amf_document.h:193
uint32_t width
Definition: amf_document.h:174
uint32_t metadata_count
Definition: amf_document.h:157
Definition: amf_document.h:169
Global declarations for the AMF module.
Definition: amf_document.h:197
Provides an interface for accessing the underlying(hidden) user AMF data.
Definition: amf_document.h:224
uint32_t id
Definition: amf_document.h:66
const char * r_formula
Definition: amf_document.h:59
uint32_t material_count
Number of materials in the document.
Definition: amf_document.h:235
Definition: amf_document.h:172
struct gmio_amf_color color
Definition: amf_document.h:150
enum gmio_amf_mesh_element element_type
Type of the inner element.
Definition: amf_document.h:217
Definition: amf_document.h:123
Definition: amf_document.h:124
uint32_t rtexid
Definition: amf_document.h:102
Definition: amf_document.h:101
bool has_texmap
Definition: amf_document.h:116
struct gmio_vec3d coords
Definition: amf_document.h:84
struct gmio_amf_color color
Definition: amf_document.h:134
struct gmio_vec3d rot
Coordinates in degrees (-360 <= coord < 360)
Definition: amf_document.h:165
Combination of objects.
Definition: amf_document.h:154
void(* func_get_document_element_metadata)(const void *cookie, enum gmio_amf_document_element element, uint32_t element_index, uint32_t metadata_index, struct gmio_amf_metadata *ptr_metadata)
Optional function that retrieves the i-th metadata assigned to a document sub-element.
Definition: amf_document.h:281
uint32_t edge_count
Definition: amf_document.h:140
uint32_t object_count
Number of objects in the document, must be >= 1.
Definition: amf_document.h:232
Index of an element(vertex, edge or volume) within a mesh.
Definition: amf_document.h:209
uint32_t id
Definition: amf_document.h:146
bool tiled
Definition: amf_document.h:177
gmio_amf_mesh_element
The direct elements of an AMF mesh(ie inside ...)
Definition: amf_document.h:202
Definition: amf_document.h:65
uint32_t objectid
Definition: amf_document.h:163
Definition: amf_document.h:188
uint32_t v2
Definition: amf_document.h:114
uint32_t value
Index of the inner element.
Definition: amf_document.h:215
void(* func_get_material_composite)(const void *cookie, uint32_t material_index, uint32_t composite_index, struct gmio_amf_composite *ptr_composite)
Optional function that retrieves the i-th composite within a material element.
Definition: amf_document.h:334
Definition: amf_document.h:185
Volume or volumes of material.
Definition: amf_document.h:145
double b
Definition: amf_document.h:57
const char * data
UTF8-encoded.
Definition: amf_document.h:50
double a
Definition: amf_document.h:58
uint32_t triangle_count
Should be >= 4.
Definition: amf_document.h:131
double r
Definition: amf_document.h:55
uint32_t depth
Definition: amf_document.h:176
Definition: amf_document.h:186
gmio_amf_unit
Units supported by AMF.
Definition: amf_document.h:183
void(* func_get_object_mesh_element)(const void *cookie, const struct gmio_amf_object_mesh_element_index *element_index, void *ptr_element)
Function that retrieves the i-th sub-element of a mesh element.
Definition: amf_document.h:306
Definition: amf_document.h:203
void(* func_get_object_mesh_volume_triangle)(const void *cookie, const struct gmio_amf_object_mesh_element_index *volume_index, uint32_t triangle_index, struct gmio_amf_triangle *ptr_triangle)
Function that retrieves the i-th triangle within a mesh volume.
Definition: amf_document.h:323
enum gmio_amf_unit unit
Definition: amf_document.h:229
Definition: amf_document.h:187
uint32_t v2
Definition: amf_document.h:95
Vector of three double coords.
Definition: vecgeom.h:48
gmio_amf_volume_type
Definition: amf_document.h:122
uint32_t volume_count
Definition: amf_document.h:141
struct gmio_vec3d vtex
Definition: amf_document.h:107
double value
Governs the percent of material.
Definition: amf_document.h:78
uint32_t atexid
Definition: amf_document.h:105
Definition: amf_document.h:204
uint32_t id
Definition: amf_document.h:155
const char * b_formula
Definition: amf_document.h:61
uint32_t gtexid
Definition: amf_document.h:103
uint32_t mesh_count
Definition: amf_document.h:147
struct gmio_vec3d wtex
Definition: amf_document.h:109
Closed volume of an object.
Definition: amf_document.h:128
Triangular mesh referencing a set of vertices.
Definition: amf_document.h:138
void(* func_get_object_mesh)(const void *cookie, uint32_t object_index, uint32_t mesh_index, struct gmio_amf_mesh *ptr_mesh)
Function that retrieves the i-th mesh within an object element.
Definition: amf_document.h:289
uint32_t metadata_count
Definition: amf_document.h:89
uint32_t height
Definition: amf_document.h:175
void(* func_get_constellation_instance)(const void *cookie, uint32_t constellation_index, uint32_t instance_index, struct gmio_amf_instance *ptr_instance)
Optional function that retrieves the i-th instance within a constellation element.
Definition: amf_document.h:345
struct gmio_vec3d normal
Definition: amf_document.h:86
uint32_t v1
Definition: amf_document.h:94
enum gmio_amf_volume_type type
Definition: amf_document.h:130
const void * cookie
Opaque pointer on the user AMF document, passed as first argument to hook functions.
Definition: amf_document.h:227
struct gmio_amf_color color
Definition: amf_document.h:88
uint32_t metadata_count
Definition: amf_document.h:148
uint32_t metadata_count
Definition: amf_document.h:69
uint32_t materialid
Definition: amf_document.h:129
const char * a_formula
Definition: amf_document.h:62
bool has_color
Definition: amf_document.h:87
enum gmio_amf_texture_type type
Definition: amf_document.h:178
const char * g_formula
Definition: amf_document.h:60
struct gmio_vec3d utex
Definition: amf_document.h:106
bool has_color
Definition: amf_document.h:133
Definition: amf_document.h:205
uint32_t btexid
Definition: amf_document.h:104
uint32_t texture_count
Number of textures in the document.
Definition: amf_document.h:238
uint32_t v1
Definition: amf_document.h:113
uint32_t metadata_count
Number of direct metadata attached to the document.
Definition: amf_document.h:244
Edge within a mesh, for curved triangles.
Definition: amf_document.h:93
Definition: amf_document.h:184
Definition: amf_document.h:196
uint32_t metadata_count
Definition: amf_document.h:132
Proportion of the composition of another material.
Definition: amf_document.h:76
uint32_t id
Definition: amf_document.h:173
void(* func_get_object_mesh_element_metadata)(const void *cookie, const struct gmio_amf_object_mesh_element_index *mesh_element_index, uint32_t metadata_index, struct gmio_amf_metadata *ptr_metadata)
Optional function that retrieves the i-th metadata attached to a mesh element(only vertex or volume) ...
Definition: amf_document.h:316
Position of an object in a constellation.
Definition: amf_document.h:161
Definition: amf_document.h:189
const char * type
UTF8-encoded.
Definition: amf_document.h:49
Definition: amf_document.h:195
uint32_t vertex_count
Definition: amf_document.h:139
Basic memory block.
Definition: memblock.h:57
uint32_t composite_count
Definition: amf_document.h:68
bool has_color
Definition: amf_document.h:118
struct gmio_amf_color color
Definition: amf_document.h:119
uint32_t v3
Definition: amf_document.h:115
uint32_t object_index
Index of the object that owns the mesh.
Definition: amf_document.h:211
double g
Definition: amf_document.h:56
Vertex within a mesh.
Definition: amf_document.h:83
Addition information about an element(eg name, description, ...
Definition: amf_document.h:48
struct gmio_memblock binary_data
Will be converted to base64.
Definition: amf_document.h:179
gmio_amf_texture_type
Definition: amf_document.h:168
const char * value_formula
Definition: amf_document.h:79
uint32_t constellation_count
Number of constellations in the document.
Definition: amf_document.h:241
bool has_color
Definition: amf_document.h:149
uint32_t materialid
Definition: amf_document.h:77
uint32_t instance_count
Should be >= 2.
Definition: amf_document.h:156
bool has_wtex
Definition: amf_document.h:108
Definition: amf_document.h:198
Red, green, blue and alpha channels as numbers or formulas in [0,1].
Definition: amf_document.h:54
struct gmio_vec3d delta
Definition: amf_document.h:164
Definition: amf_document.h:112
struct gmio_vec3d d1
Definition: amf_document.h:97
struct gmio_amf_color color
Definition: amf_document.h:67
Definition: amf_document.h:194
struct gmio_vec3d d2
Definition: amf_document.h:98
Fougue © 2017