-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnsi.h
172 lines (146 loc) · 3.28 KB
/
nsi.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
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
#ifndef __nsi_h
#define __nsi_h
#include <stddef.h>
#ifdef _WIN32
#define DL_INTERFACE __declspec(dllimport)
#else
#define DL_INTERFACE
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef int NSIContext_t;
typedef const char* NSIHandle_t;
#define NSI_BAD_CONTEXT ((NSIContext_t)0)
#define NSI_SCENE_ROOT ".root"
#define NSI_SCENE_GLOBAL ".global"
#define NSI_ALL_NODES ".all"
#define NSI_ALL_ATTRIBUTES ".all"
#define NSI_VERSION 2
/* Type values for NSIParam_t.type */
enum NSIType_t
{
NSITypeInvalid = 0,
NSITypeFloat = 1,
NSITypeDouble = NSITypeFloat | 0x10,
NSITypeInteger = 2,
NSITypeString = 3,
NSITypeColor = 4,
NSITypePoint = 5,
NSITypeVector = 6,
NSITypeNormal = 7,
NSITypeMatrix = 8,
NSITypeDoubleMatrix = NSITypeMatrix | 0x10,
NSITypePointer = 9
};
static inline
size_t NSITypeSizeOf(unsigned t)
{
static const unsigned char sizes[] =
{
0, sizeof(float), sizeof(int), sizeof(char*),
3*sizeof(float), 3*sizeof(float), 3*sizeof(float), 3*sizeof(float),
16*sizeof(float), sizeof(void*), 0, 0,
0, 0, 0, 0,
0, sizeof(double), 0, 0,
0, 0, 0, 0,
16*sizeof(double)
};
return t <= 24 ? sizes[t] : 0;
}
/* Flag values for NSIParam_t.flags */
enum
{
NSIParamIsArray = 1,
NSIParamPerFace = 2,
NSIParamPerVertex = 4,
NSIParamInterpolateLinear = 8
};
/* Structure for optional parameters. */
struct NSIParam_t
{
const char *name;
const void *data;
int type;
int arraylength;
size_t count;
int flags;
};
/* Values for second parameter of NSIRenderStopped_t */
enum NSIStoppingStatus
{
NSIRenderCompleted = 0,
NSIRenderAborted = 1,
NSIRenderSynchronized = 2,
NSIRenderRestarted = 3
};
/* Error levels for the error callback. */
enum NSIErrorLevel
{
NSIErrMessage = 0,
NSIErrInfo = 1,
NSIErrWarning = 2,
NSIErrError = 3
};
/* Error handler callback type. */
typedef void (*NSIErrorHandler_t)(
void *userdata, int level, int code, const char *message );
/* Stopped callback type. */
typedef void (*NSIRenderStopped_t)(
void *userdata, NSIContext_t ctx, int status );
DL_INTERFACE NSIContext_t NSIBegin(
int nparams,
const struct NSIParam_t *params );
DL_INTERFACE void NSIEnd( NSIContext_t ctx );
DL_INTERFACE void NSICreate(
NSIContext_t ctx,
NSIHandle_t handle,
const char *type,
int nparams,
const struct NSIParam_t *params );
DL_INTERFACE void NSIDelete(
NSIContext_t ctx,
NSIHandle_t handle,
int nparams,
const struct NSIParam_t *params );
DL_INTERFACE void NSISetAttribute(
NSIContext_t ctx,
NSIHandle_t object,
int nparams,
const struct NSIParam_t *params );
DL_INTERFACE void NSISetAttributeAtTime(
NSIContext_t ctx,
NSIHandle_t object,
double time,
int nparams,
const struct NSIParam_t *params );
DL_INTERFACE void NSIDeleteAttribute(
NSIContext_t ctx,
NSIHandle_t object,
const char *name );
DL_INTERFACE void NSIConnect(
NSIContext_t ctx,
NSIHandle_t from,
const char *from_attr,
NSIHandle_t to,
const char *to_attr,
int nparams,
const struct NSIParam_t *params );
DL_INTERFACE void NSIDisconnect(
NSIContext_t ctx,
NSIHandle_t from,
const char *from_attr,
NSIHandle_t to,
const char *to_attr );
DL_INTERFACE void NSIEvaluate(
NSIContext_t ctx,
int nparams,
const struct NSIParam_t *params );
DL_INTERFACE void NSIRenderControl(
NSIContext_t ctx,
int nparams,
const struct NSIParam_t *params );
#ifdef __cplusplus
}
#endif
#endif