-
Notifications
You must be signed in to change notification settings - Fork 0
/
fbx.h
62 lines (53 loc) · 1.89 KB
/
fbx.h
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
#ifndef FBX_H
#define FBX_H
#include <stdbool.h>
#include <stdint.h>
#define FBX_NODE_NAME_MAX 0xFF
struct FBXNode;
struct FBXNodeProperty;
struct FBXNodeList;
typedef struct FBXNode FBXNode;
typedef struct FBXNodeProperty FBXNodeProperty;
typedef struct FBXNodeList FBXNodeList;
struct FBXNodeList {
size_t length;
size_t capacity;
struct FBXNode *nodes;
};
struct FBXNode {
uint32_t end_offset;
uint32_t properties_count;
uint32_t properties_list_length;
uint8_t name_length;
char name[FBX_NODE_NAME_MAX];
struct FBXNodeList *subnodes;
};
struct FBXNodeProperty {
uint8_t type;
union {
struct { int16_t value; } Y; // i16
struct { bool value; } C; // u8
struct { int32_t value; } I; // i32
struct { float value; } F; // f32
struct { double value; } D; // f64
struct { int64_t value; } L; // i64
struct { int length; int encoding; int compressed_length; float *value; } f; // f32[]
struct { int length; int encoding; int compressed_length; double *value; } d; // f64[]
struct { int length; int encoding; int compressed_length; int64_t *value; } l; // i64[]
struct { int length; int encoding; int compressed_length; int32_t *value; } i; // i32[]
struct { int length; int encoding; int compressed_length; bool *value; } b; // u8[]
struct { int length; char *value; } S; // string
struct { int length; uint8_t *value; } R; // raw
void *value;
};
};
/**
* Parses an .FBX file and returns a list of root nodes
*
* @param path Pointer to a null-terminated string specifying the path to the .FBX file
*
* @return If successful, returns a pointer to an FBXNodeList containing the root nodes of the parsed .FBX file
* If an error occurs at any step or if the file isn't a valid .FBX file, it returns NULL
*/
FBXNodeList *FBX_Parse(const char *path);
#endif