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
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
//! This module contains all the OpenGEX structures as specified. The module tries to stay as close
//! to the OpenGEX structures as possible.
//!
//! Some of the documentation might be subjected to copyright by Eric Lengyel. For more detailed
//! documentation, please go to http://opengex.org.
use HashMap;
use Default;
use Arc;
use VecMap;
/// The Material structure contains information about a material. Material structures are
/// referenced by geometry nodes through `Arc<Material>` structures belonging to `GeometryNode`
/// structures.
/// A Color structure must contain an RGB or RGBA color value.
/// The Param structure contains just a float. While the OpenGEX specification defines a Param as a
/// key-value pair, this is better implemented through a HashMap. See ParamMap.
pub type Param = f32;
/// This is a map of different Param structures, for convenience.
pub type ParamMap = ;
/// The Name structure holds the name of a node, morph target, material, or animation clip.
pub type Name = String;
/// The Texture structure holds information about a single texture map, and how it is accessed with
/// texture coordinates.
/// Helper enum to contain all different kinds of Transformations.
/// The Transform structure holds one or more 4 x 4 transformation matrices. In the cases that a
/// Transform structure is contained inside any type of node structure, a Texture structure, or a
/// Skin structure, it must contain a single matrix. In the case that a Transform structure is
/// contained inside a Skeleton structure, is must contain an array of matrices with one entry for
/// each bone referenced by the skeleton.
///
/// When contained inside a node structure, a Transform structure can be the target of a track
/// stored inside an Animation structure.
;
/// The Translation structure holds a translation transformation in one of several possible
/// variants.
///
/// There are different variants of this type of tranformation, one for each "kind".
///
/// When contained inside a node structure, a Translation structure can be the target of a track
/// stored inside an Animation structure.
/// The Rotation structure represents a rotation along one of several axes.
///
/// There are different variants of this type of tranformation, one for each "kind".
///
/// When contained inside a node structure, a Rotation structure can be the target of a track
/// stored in an Animation structure.
/// The Scale structure represents a scale transformation in one of several possible variants.
///
/// There are different variants of this type of tranformation, one for each "kind".
///
/// When contained inside a node structure, a Scale structure can be the target of a strack stored
/// inside an Animation structure.
/// The Animation structure contains animation data for a single node in a scene. Each animation
/// structure is directly contained inside a node structure or Texture structure. Each animation
/// structure contains the data needed to modify its sibling Transformation structures or sibling
/// MorphWeight structures over time.
///
/// More detailed information can be found in the official OpenGEX specification.
/// The Track structure contains animation key data for a single Transformation or MorphWeight
/// structure.
/// Enum wrapping over all possible animation track targets.
/// The Time structure contains key time data in an animation track.
///
/// There are two different kinds of this structure; one for every curve kind.
///
/// The variants in this enum contain vectors. One vector item represents on key time.
/// The Value structure contains key value data in an animation track.
///
/// There are two different kinds of this structure; one for every curve kind.
///
/// The variants in this enum contain vectors. One vector item represents on key value.
/// A MorphWeight structure holds a single morph weight for a GeometryNode structure, that
/// references a GeometryObject strucure containing vertex data for multiple morph targets.
///
/// A MorphWeight structure can be the target of a track stored inside an Animation structure.
/// The Atten structure specifies an attenuation function for a light object.
/// A helper enum representing different kinds of attenuation functions.
/// A helper enum representing different kinds of curves for an attenuation function.
///
/// For exact formulas, please refer to the offical OpenGEX documentation.
/// Helper enum to represent all different types of Nodes.
/// Macro to do away with the redundancy of the different kinds of Node structures. The common Node
/// properties are placed at the start of the generated structure.
///
/// The common properties are:
/// * `name`: An optional name of the node.
/// * `transformations`: A vector of local transformations to be applied to the node.
/// * `animations`: A vector of animations that can be applied to the node.
/// * `children`: A vector of child nodes part of this node.
) => ,*
}
)
}
node!
node!
node!
node!
node!
/// The `GeometryObject` structure contains data for a geometry object. Multiple `GeometryNode`
/// structures may reference a single `GeometryObject`. This allows a scene to contain multiple
/// instances of the same geometry with different transforms and materials.
///
/// The `colors` and `textures` properties are for application-specfic use.
/// A `CameraObject` structure contains data for a camera object.
/// The LightObject struture contains data for a light object. Multiple LightNode structures may
/// reference a single LightObject. This allows a scene to contain multiple instances of the same
/// light, with different transformations.
/// This is an helper-enum representing all different types of lights that a LightObject can emit.
/// The `Morph` structure holds information about a morph target belonging to a `GeometryObject`
/// structure.
/// A `Mesh` structure cotains data for a single geometric mesh. Each mesh typically contains
/// several arrays of per-vertex data, and one or more index arrays.
///
/// A mesh may contain vertex data for multiple morph targets. The morph target to which the vertex
/// array belongs is determined by the value op its `morph` property.
/// Helper enum for the `Mesh` structure, representing different geometric primitives supported by
/// OpenGEX.
///
/// In the documentation, `n` refers to the number of indices if an `IndexArray` structure is
/// present, and otherwise, the number of vertices in every `VertexArray` structure. Primitives are
/// indexed by the letter `i`, starting at zero.