-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathglTFSceneKit-Bridging-Header.h
69 lines (57 loc) · 2.55 KB
/
glTFSceneKit-Bridging-Header.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
63
64
65
66
67
68
69
//
// glTFSceneKit.h
// glTFSceneKit
//
// Created by Volodymyr Boichentsov on 17/05/2018.
//
#ifndef glTFSceneKit_h
#define glTFSceneKit_h
#include <stdbool.h>
typedef enum {
DAttributeVertex = 0, // draco::GeometryAttribute::POSITION
DAttributeNormal, // draco::GeometryAttribute::NORMAL
DAttributeColor, // draco::GeometryAttribute::COLOR
DAttributeTexCoord, // draco::GeometryAttribute::TEX_COORD
DAttributeGeneric, // у на tangent, но это draco::GeometryAttribute::GENERIC
DAttributeCount
} DAttribute;
struct DAttributeDescriptor {
DAttribute name;
short size;
};
#if __cplusplus
extern "C" {
#endif
/**
Encode mesh from float buffer (vertices) and indices to compressed data - buffer vector<char>.
Array initializes inside and should be deleted by hands
@param vertices - geometryData
@param vertLength - length of vertices
@param indices - indexData
@param indicesLength - length of indexData
@param elements - array with bufferElements by order
@param elemCount - size of elements
@param quantization - affects encodig/decoding time, model quality and buffer size.
14 - optimal value, smaller then 10 gives losses in geometry.
@param bufferOut - output - encoded buffer
@param bufferOutLength - output length of bufferOut
*/
bool draco_encode(float *vertices, unsigned long vertLength, unsigned int* indices, unsigned long indicesLength, struct DAttributeDescriptor *elements, const short elemCount, int quantization, char** bufferOut, unsigned long *bufferOutLength);
/**
Decode Buffer and write mesh to vertex and index arrays
Arrays initializes inside and should be deleted by hands
@param buffer - input buffer data - char*
@param bufferLength - input buffer length
@param verticesOut - output vertices data - float*
@param vertLength - output length of verticesOut
@param indicesOut - output indices data - unsigned int*
@param indLength - output length of indicesOut
@param descriptorOut- output array with bufferElements by order
@param descriptorOutLength - size of descriptorOut
return false on error
*/
bool draco_decode(const char* buffer, unsigned long bufferLength, float** verticesOut, unsigned long* vertLength, unsigned int** indicesOut, unsigned long *indLength, struct DAttributeDescriptor** descriptorOut, unsigned long *descriptorOutLength, bool triangleStrip);
#if __cplusplus
}
#endif
#endif /* glTFSceneKit_h */