1 #pragma once
2 
3 #include <stdint.h>
4 #include <sys/types.h>
5 
6 typedef enum : uint32_t
7 {
8     RTW_NO_ERROR = 0,
9     RTW_UNKNOWN_ERROR = 1,
10     RTW_INVALID_ARGUMENT = 2,
11     RTW_INVALID_OPERATION = 3,
12     RTW_OUT_OF_MEMORY = 4,
13     RTW_UNSUPPORTED_DEVICE = 5,
14     RTW_VERSION_MISMATCH = 6,
15 } RTWError;
16 
17 typedef enum : uint32_t
18 {
19   RTW_FB_NONE,    //< framebuffer will not be mapped by application
20   RTW_FB_RGBA8,   //< one dword per pixel: rgb+alpha, each one byte
21   RTW_FB_SRGBA,   //< one dword per pixel: rgb (in sRGB space) + alpha, each one byte
22   RTW_FB_RGBA32F, //< one float4 per pixel: rgb+alpha, each one float
23 } RTWFrameBufferFormat;
24 
25 typedef enum : uint32_t
26 {
27     RTW_FB_COLOR = (1 << 0),
28     RTW_FB_DEPTH = (1 << 1),
29     RTW_FB_ACCUM = (1 << 2),
30     RTW_FB_VARIANCE = (1 << 3),
31     RTW_FB_NORMAL = (1 << 4),
32     RTW_FB_ALBEDO = (1 << 5),
33 } RTWFrameBufferChannel;
34 
35 // OSPRay events which can be waited on via ospWait()
36 typedef enum : uint32_t
37 {
38   RTW_NONE_FINISHED = 0,
39   RTW_WORLD_RENDERED = 10,
40   RTW_WORLD_COMMITTED = 20,
41   RTW_FRAME_FINISHED = 30,
42   RTW_TASK_FINISHED = 100000
43 } RTWSyncEvent;
44 
45 // OSPRay cell types definition for unstructured volumes, values are set to match VTK
46 typedef enum : uint8_t
47 {
48   RTW_TETRAHEDRON = 10,
49   RTW_HEXAHEDRON = 12,
50   RTW_WEDGE = 13,
51   RTW_PYRAMID = 14,
52   RTW_UNKNOWN_CELL_TYPE = 255
53 } RTWUnstructuredCellType;
54 
55 // OSPRay PerspectiveCamera stereo image modes
56 typedef enum : uint8_t
57 {
58   RTW_STEREO_NONE,
59   RTW_STEREO_LEFT,
60   RTW_STEREO_RIGHT,
61   RTW_STEREO_SIDE_BY_SIDE,
62   RTW_STEREO_UNKNOWN = 255
63 } RTWStereoMode;
64 
65 // OSPRay Curves geometry types
66 typedef enum : uint8_t
67 {
68   RTW_ROUND,
69   RTW_FLAT,
70   RTW_RIBBON,
71   RTW_UNKNOWN_CURVE_TYPE = 255
72 } RTWCurveType;
73 
74 // OSPRay Curves geometry bases
75 typedef enum : uint8_t
76 {
77   RTW_LINEAR,
78   RTW_BEZIER,
79   RTW_BSPLINE,
80   RTW_HERMITE,
81   RTW_CATMULL_ROM,
82   RTW_UNKNOWN_CURVE_BASIS = 255
83 } RTWCurveBasis;
84 
85 // AMR Volume rendering methods
86 typedef enum : uint8_t
87 {
88   RTW_AMR_CURRENT,
89   RTW_AMR_FINEST,
90   RTW_AMR_OCTANT
91 } RTWAMRMethod;
92 
93 typedef enum : uint32_t
94 {
95     RTW_TEXTURE_RGBA8,
96     RTW_TEXTURE_SRGBA,
97     RTW_TEXTURE_RGBA32F,
98     RTW_TEXTURE_RGB8,
99     RTW_TEXTURE_SRGB,
100     RTW_TEXTURE_RGB32F,
101     RTW_TEXTURE_R8,
102     RTW_TEXTURE_R32F,
103     RTW_TEXTURE_L8,
104     RTW_TEXTURE_RA8,
105     RTW_TEXTURE_LA8,
106     RTW_TEXTURE_RGBA16,
107     RTW_TEXTURE_RGB16,
108     RTW_TEXTURE_RA16,
109     RTW_TEXTURE_R16,
110     RTW_TEXTURE_FORMAT_INVALID = 255,
111 } RTWTextureFormat;
112 
113 typedef enum :uint32_t
114 {
115     RTW_TEXTURE_FILTER_BILINEAR = 0,
116     RTW_TEXTURE_FILTER_NEAREST
117 } RTWTextureFilter;
118 
119 typedef enum : uint32_t
120 {
121   // Object reference type.
122   RTW_DEVICE = 100,
123 
124   // Void pointer type.
125   RTW_VOID_PTR = 200,
126 
127   // Booleans, same size as RTW_INT.
128   RTW_BOOL = 250,
129 
130   // highest bit to represent objects/handles
131   RTW_OBJECT = 0x8000000,
132 
133   // object subtypes
134   RTW_DATA = 0x8000000 + 100,
135   RTW_CAMERA,
136   RTW_FRAMEBUFFER,
137   RTW_FUTURE,
138   RTW_GEOMETRIC_MODEL,
139   RTW_GEOMETRY,
140   RTW_GROUP,
141   RTW_IMAGE_OPERATION,
142   RTW_INSTANCE,
143   RTW_LIGHT,
144   RTW_MATERIAL,
145   RTW_RENDERER,
146   RTW_TEXTURE,
147   RTW_TRANSFER_FUNCTION,
148   RTW_VOLUME,
149   RTW_VOLUMETRIC_MODEL,
150   RTW_WORLD,
151 
152   // Pointer to a C-style NULL-terminated character string.
153   RTW_STRING = 1500,
154 
155   // Character scalar type.
156   RTW_CHAR = 2000,
157 
158   // Unsigned character scalar and vector types.
159   RTW_UCHAR = 2500, RTW_VEC2UC, RTW_VEC3UC, RTW_VEC4UC,
160   RTW_BYTE = 2500, //XXX RTW_UCHAR, ISPC issue #1246
161   RTW_RAW = 2500,  //XXX RTW_UCHAR, ISPC issue #1246
162 
163   // Signed 16-bit integer scalar.
164   RTW_SHORT = 3000,
165 
166   // Unsigned 16-bit integer scalar.
167   RTW_USHORT = 3500,
168 
169   // Signed 32-bit integer scalar and vector types.
170   RTW_INT = 4000, RTW_VEC2I, RTW_VEC3I, RTW_VEC4I,
171 
172   // Unsigned 32-bit integer scalar and vector types.
173   RTW_UINT = 4500, RTW_VEC2UI, RTW_VEC3UI, RTW_VEC4UI,
174 
175   // Signed 64-bit integer scalar and vector types.
176   RTW_LONG = 5000, RTW_VEC2L, RTW_VEC3L, RTW_VEC4L,
177 
178   // Unsigned 64-bit integer scalar and vector types.
179   RTW_ULONG = 5550, RTW_VEC2UL, RTW_VEC3UL, RTW_VEC4UL,
180 
181   // Single precision floating point scalar and vector types.
182   RTW_FLOAT = 6000, RTW_VEC2F, RTW_VEC3F, RTW_VEC4F,
183 
184   // Double precision floating point scalar type.
185   RTW_DOUBLE = 7000,
186 
187   // Signed 32-bit integer N-dimensional box types
188   RTW_BOX1I = 8000, RTW_BOX2I, RTW_BOX3I, RTW_BOX4I,
189 
190   // Single precision floating point N-dimensional box types
191   RTW_BOX1F = 10000, RTW_BOX2F, RTW_BOX3F, RTW_BOX4F,
192 
193   // Transformation types
194   RTW_LINEAR2F = 12000, RTW_LINEAR3F, RTW_AFFINE2F, RTW_AFFINE3F,
195 
196   // Guard value.
197   RTW_UNKNOWN = 9999999
198 } RTWDataType;
199 
200 typedef enum : uint32_t
201 {
202     RTW_BACKEND_OSPRAY = 1,
203     RTW_BACKEND_VISRTX = 2
204 } RTWBackendType;
205 
206 namespace rtw
207 {
208     struct vec2f { float x, y; };
209     struct vec2i { int x, y; };
210     struct vec3i { int x, y, z; };
211     struct vec3ui { unsigned int x, y, z; };
212     struct vec3f { float x, y, z; };
213     struct vec4f { float x, y, z, w; };
214     struct box3i { vec3i lower, upper; };
215     struct box3f { vec3f lower, upper; };
216     struct linear3f { vec3f vx, vy, vz; };
217     struct affine3f { linear3f l; vec3f p; };
218 }
219 
220 typedef struct RTWHandle
221 *RTWFrameBuffer,
222 *RTWRenderer,
223 *RTWCamera,
224 *RTWGroup,
225 *RTWInstance,
226 *RTWGeometricModel,
227 *RTWVolumetricModel,
228 *RTWWorld,
229 *RTWData,
230 *RTWGeometry,
231 *RTWMaterial,
232 *RTWLight,
233 *RTWVolume,
234 *RTWTransferFunction,
235 *RTWTexture,
236 *RTWObject;
237 
238 typedef RTWTexture RTWTexture2D;
239 
240 typedef enum : uint32_t
241 {
242     RTW_DEPTH_NORMALIZATION = 0,
243     RTW_OPENGL_INTEROP = 1,
244     RTW_ANIMATED_PARAMETERIZATION = 2,
245     RTW_INSTANCING = 3,
246     RTW_DENOISER = 4,
247     RTW_DEPTH_COMPOSITING = 5,
248 } RTWFeature;
249