framework2

Форк
0
4429 строк · 150.4 Кб
1
#ifdef _WIN32
2
#pragma comment(lib, "opengl32.lib")
3
#pragma comment(lib, "Winmm.lib")
4
#pragma comment(lib, "Ws2_32.lib")
5
#pragma comment(lib, "Wldap32.lib")
6
#pragma comment(lib, "Crypt32.lib")
7
#pragma comment(lib, "of_v0.12.0_vs_release/libs/cairo/lib/vs/x64/zlib.lib")
8
#pragma comment(lib, "of_v0.12.0_vs_release/libs/glew/lib/vs/x64/glew32s.lib")
9
#pragma comment(lib, "glfw-3.3.8.bin.WIN64/lib-vc2019/glfw3dll.lib")
10
#pragma comment(lib, "of_v0.12.0_vs_release/libs/uriparser/lib/vs/x64/uriparser.lib")
11
#pragma comment(lib, "of_v0.12.0_vs_release/libs/FreeImage/lib/vs/x64/FreeImage.lib")
12
#pragma comment(lib, "of_v0.12.0_vs_release/libs/freetype/lib/vs/x64/libfreetype.lib")
13
#pragma comment(lib, "of_v0.12.0_vs_release/libs/curl/lib/vs/x64/libcurl.lib")
14
#pragma comment(lib, "of_v0.12.0_vs_release/libs/openssl/lib/vs/x64/libssl.lib")
15
#pragma comment(lib, "of_v0.12.0_vs_release/libs/openssl/lib/vs/x64/libcrypto.lib")
16
#pragma comment(lib, "of_v0.12.0_vs_release/libs/fmod/lib/vs/x64/fmod64_vc.lib")
17
#pragma comment(lib, "of_v0.12.0_vs_release/libs/tess2/lib/vs/x64/tess2.lib")
18
#ifdef _DEBUG
19
#pragma comment(lib, "src/pugixml/lib/vs/x64/Debug/pugixml.lib")
20
#pragma comment(lib, "ofxaddons/ofxFBX/libs/libfbxsdk_2019.5/lib/vs/x64/Debug/libxml2-md.lib")
21
#pragma comment(lib, "ofxaddons/ofxFBX/libs/libfbxsdk_2019.5/lib/vs/x64/Debug/libfbxsdk-md.lib")
22
#pragma comment(lib, "addons/ofxAssimpModelLoader/libs/assimp/lib/vs/x64/Debug/assimp-vc142-mtd.lib")
23
#pragma comment(lib, "of_v0.12.0_vs_release/libs/openFrameworksCompiled/lib/vs/x64/openframeworksLib_debug.lib")
24
#else  // #ifdef _DEBUG
25
#pragma comment(lib, "src/pugixml/lib/vs/x64/Release/pugixml.lib")
26
#pragma comment(lib, "ofxaddons/ofxFBX/libs/libfbxsdk_2019.5/lib/vs/x64/Release/libxml2-md.lib")
27
#pragma comment(lib, "ofxaddons/ofxFBX/libs/libfbxsdk_2019.5/lib/vs/x64/Release/libfbxsdk-md.lib")
28
#pragma comment(lib, "addons/ofxAssimpModelLoader/libs/assimp/lib/vs/x64/Release/assimp-vc142-mt.lib")
29
#pragma comment(lib, "of_v0.12.0_vs_release/libs/openFrameworksCompiled/lib/vs/x64/openframeworksLib.lib")
30
#endif // #ifdef _DEBUG
31
#endif // #ifdef _WIN32
32

33
#ifdef _WIN32
34
#ifdef _DEBUG
35
#if 0
36
// https://codeberg.org/redgpu/tracing
37
#pragma comment(lib, "../tracing/tracingdll.lib")
38
#include "../tracing/tracing.h"
39
#else
40
static inline void tracingSet(const char * label) {}
41
static inline void tracingEnd(const char * label) {}
42
static inline void tracingPrint() {}
43
#endif
44
#endif // #ifdef _DEBUG
45
#endif // #ifdef _WIN32
46

47
#include "ofMain.h"
48

49
#ifndef _WIN32
50
// https://stackoverflow.com/questions/4804298/how-to-convert-wstring-into-string
51
// https://stackoverflow.com/questions/15615136/is-codecvt-not-a-std-header/28875347#28875347
52

53
#include <boost/locale/encoding_utf.hpp>
54

55
static std::wstring s2ws(const std::string & str) {
56
  return boost::locale::conv::utf_to_utf<wchar_t>(str.c_str(), str.c_str() + str.size());
57
}
58

59
static std::string ws2s(const std::wstring & wstr) {
60
  return boost::locale::conv::utf_to_utf<char>(wstr.c_str(), wstr.c_str() + wstr.size());
61
}
62
#endif
63

64
#ifdef _WIN32
65
#define REDGPU_F_DECLSPEC extern "C" __declspec(dllexport)
66
#endif
67
#ifdef __linux__
68
#define REDGPU_F_DECLSPEC extern "C" __attribute__((visibility("default")))
69
#endif
70
#include "redgpu_f2.h"
71

72
#include "addons/ofxAssimpModelLoader/src/ofxAssimpModelLoader.h"
73
#include "ofxaddons/ofxFirstPersonCamera/src/ofxFirstPersonCamera.h"
74
#include "ofxaddons/ofxManipulator/src/ofxManipulator.h"
75
#include "ofxaddons/ofxRaccoonImGui/src/ofxRaccoonImGui.hpp"
76
#include "ofxaddons/ofxFBX/src/ofxFBX.h"
77
#include "ofxaddons/ofxPostProcessing/src/ofxPostProcessing.h"
78
#include "ofxaddons/ofxPostProcessingExtra/GenericPass.h"
79

80
#ifdef _WIN32
81
#include <atlbase.h> // For CA2W, CW2A
82
#endif
83

84
RedFEvents __REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events;
85

86
class ofApp : public ofBaseApp {
87
public:
88
  void setup           (void);
89
  void update          (void);
90
  void draw            (void);
91
  void exit            (void);
92

93
  void keyPressed      (ofKeyEventArgs &);
94
  void keyReleased     (ofKeyEventArgs &);
95

96
  void mouseMoved      (ofMouseEventArgs &);
97
  void mouseDragged    (ofMouseEventArgs &);
98
  void mousePressed    (ofMouseEventArgs &);
99
  void mouseReleased   (ofMouseEventArgs &);
100
  void mouseScrolled   (ofMouseEventArgs &);
101
  void mouseEntered    (ofMouseEventArgs &);
102
  void mouseExited     (ofMouseEventArgs &);
103

104
  void touchDown       (ofTouchEventArgs &);
105
  void touchMoved      (ofTouchEventArgs &);
106
  void touchUp         (ofTouchEventArgs &);
107
  void touchDoubleTap  (ofTouchEventArgs &);
108
  void touchCancelled  (ofTouchEventArgs &);
109

110
  void windowResized   (ofResizeEventArgs &);
111
  void dragged         (ofDragInfo &);
112
  void messageReceived (ofMessage &);
113
};
114

115
int ofAppMain2(int windowWidth, int windowHeight, RedFWindowMode windowMode, RedFBool32 useCustomOpenGLVersion, int glVersionMajor, int glVersionMinor, RedFBool32 windowIsDecorated, RedFBool32 windowIsResizable, int msaaSamples, uint64_t optionalSettingsCount, const void * optionalSettings) {
116
  ofGLFWWindowSettings settings;
117
  // https://forum.openframeworks.cc/t/setglversion-3-2-cant-use-oflinewidth/21664
118
  if (useCustomOpenGLVersion == 1) {
119
    settings.glVersionMajor = glVersionMajor;
120
    settings.glVersionMinor = glVersionMinor;
121
  }
122
  settings.setSize(windowWidth, windowHeight);
123
  settings.windowMode = (ofWindowMode)windowMode;
124
  settings.decorated  = windowIsDecorated;
125
  settings.resizable  = windowIsResizable;
126
  settings.numSamples = msaaSamples;
127

128
  std::shared_ptr<ofAppBaseWindow> window = ofCreateWindow(settings);
129
  std::shared_ptr<ofApp> app = make_shared<ofApp>();
130
  ofRunApp(window, app);
131

132
  return ofRunMainLoop();
133
}
134

135
void ofApp::setup(void) {
136
  if (__REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.setup != NULL) {
137
    __REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.setup();
138
  }
139
}
140

141
void ofApp::update(void) {
142
  if (__REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.update != NULL) {
143
    __REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.update();
144
  }
145
}
146

147
void ofApp::draw(void) {
148
  if (__REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.draw != NULL) {
149
    __REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.draw();
150
  }
151
}
152

153
void ofApp::exit(void) {
154
  if (__REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.exit != NULL) {
155
    __REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.exit();
156
  }
157
}
158

159
void ofApp::keyPressed(ofKeyEventArgs & key) {
160
  if (__REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.keyPressed != NULL) {
161
    ofKeyEventArgs args = key;
162
    void * p = &args;
163
    __REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.keyPressed((RedFHandleEventParametersKey)p);
164
  }
165
}
166

167
void ofApp::keyReleased(ofKeyEventArgs & key) {
168
  if (__REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.keyReleased != NULL) {
169
    ofKeyEventArgs args = key;
170
    void * p = &args;
171
    __REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.keyReleased((RedFHandleEventParametersKey)p);
172
  }
173
}
174

175
void ofApp::mouseMoved(ofMouseEventArgs & mouse) {
176
  if (__REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.mouseMoved != NULL) {
177
    ofMouseEventArgs args = mouse;
178
    void * p = &args;
179
    __REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.mouseMoved((RedFHandleEventParametersMouse)p);
180
  }
181
}
182

183
void ofApp::mouseDragged(ofMouseEventArgs & mouse) {
184
  if (__REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.mouseDragged != NULL) {
185
    ofMouseEventArgs args = mouse;
186
    void * p = &args;
187
    __REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.mouseDragged((RedFHandleEventParametersMouse)p);
188
  }
189
}
190

191
void ofApp::mousePressed(ofMouseEventArgs & mouse) {
192
  if (__REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.mousePressed != NULL) {
193
    ofMouseEventArgs args = mouse;
194
    void * p = &args;
195
    __REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.mousePressed((RedFHandleEventParametersMouse)p);
196
  }
197
}
198

199
void ofApp::mouseReleased(ofMouseEventArgs & mouse) {
200
  if (__REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.mouseReleased != NULL) {
201
    ofMouseEventArgs args = mouse;
202
    void * p = &args;
203
    __REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.mouseReleased((RedFHandleEventParametersMouse)p);
204
  }
205
}
206

207
void ofApp::mouseScrolled(ofMouseEventArgs & mouse) {
208
  if (__REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.mouseScrolled != NULL) {
209
    ofMouseEventArgs args = mouse;
210
    void * p = &args;
211
    __REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.mouseScrolled((RedFHandleEventParametersMouse)p);
212
  }
213
}
214

215
void ofApp::mouseEntered(ofMouseEventArgs & mouse) {
216
  if (__REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.mouseEntered != NULL) {
217
    ofMouseEventArgs args = mouse;
218
    void * p = &args;
219
    __REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.mouseEntered((RedFHandleEventParametersMouse)p);
220
  }
221
}
222

223
void ofApp::mouseExited(ofMouseEventArgs & mouse) {
224
  if (__REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.mouseExited != NULL) {
225
    ofMouseEventArgs args = mouse;
226
    void * p = &args;
227
    __REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.mouseExited((RedFHandleEventParametersMouse)p);
228
  }
229
}
230

231
void ofApp::touchDown(ofTouchEventArgs & touch) {
232
  if (__REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.touchDown != NULL) {
233
    ofTouchEventArgs args = touch;
234
    void * p = &args;
235
    __REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.touchDown(p);
236
  }
237
}
238

239
void ofApp::touchMoved(ofTouchEventArgs & touch) {
240
  if (__REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.touchMoved != NULL) {
241
    ofTouchEventArgs args = touch;
242
    void * p = &args;
243
    __REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.touchMoved(p);
244
  }
245
}
246

247
void ofApp::touchUp(ofTouchEventArgs & touch) {
248
  if (__REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.touchUp != NULL) {
249
    ofTouchEventArgs args = touch;
250
    void * p = &args;
251
    __REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.touchUp(p);
252
  }
253
}
254

255
void ofApp::touchDoubleTap(ofTouchEventArgs & touch) {
256
  if (__REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.touchDoubleTap != NULL) {
257
    ofTouchEventArgs args = touch;
258
    void * p = &args;
259
    __REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.touchDoubleTap(p);
260
  }
261
}
262

263
void ofApp::touchCancelled(ofTouchEventArgs & touch) {
264
  if (__REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.touchCancelled != NULL) {
265
    ofTouchEventArgs args = touch;
266
    void * p = &args;
267
    __REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.touchCancelled(p);
268
  }
269
}
270

271
void ofApp::windowResized(ofResizeEventArgs & window) {
272
  if (__REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.windowResized != NULL) {
273
    ofResizeEventArgs args = window;
274
    void * p = &args;
275
    __REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.windowResized((RedFHandleEventParametersResize)p);
276
  }
277
}
278

279
void ofApp::dragged(ofDragInfo & dragged) {
280
  if (__REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.dragged != NULL) {
281
    ofDragInfo args = dragged;
282
    void * p = &args;
283
    __REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.dragged((RedFHandleEventParametersDrag)p);
284
  }
285
}
286

287
void ofApp::messageReceived(ofMessage & message) {
288
  if (__REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.messageReceived != NULL) {
289
    ofMessage args = message;
290
    void * p = &args;
291
    __REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events.messageReceived(p);
292
  }
293
}
294

295
REDGPU_F_DECLSPEC int redFMain(const RedFEvents * events, int windowWidth, int windowHeight, RedFWindowMode windowMode, RedFBool32 useOpenGL32, RedFBool32 windowIsDecorated, RedFBool32 windowIsResizable, int msaaSamples, uint64_t optionalSettingsCount, const void * optionalSettings) {
296
  __REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events = {};
297
  if (events != NULL) {
298
    __REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events = events[0];
299
  }
300
  return ofAppMain2(windowWidth, windowHeight, windowMode, useOpenGL32, 3, 2, windowIsDecorated, windowIsResizable, msaaSamples, optionalSettingsCount, optionalSettings);
301
}
302

303
#ifdef _WIN32
304
  #define REDGPU_F_DECLARE_CREATE_AND_DESTROY_PROCEDURES(REDGPU_F_HANDLE_NAME, REDGPU_F_OF_NAME) \
305
    extern "C" __declspec(dllexport) RedFHandle##REDGPU_F_HANDLE_NAME * redFCreate##REDGPU_F_HANDLE_NAME(uint64_t count) { \
306
      if (count == 0) { return NULL; } \
307
      REDGPU_F_OF_NAME * allocation = new(std::nothrow) REDGPU_F_OF_NAME [count](); \
308
      if (allocation == NULL) { return NULL; } \
309
      uint64_t * handles = new(std::nothrow) uint64_t [1 + count]; \
310
      if (handles == NULL) { return NULL; } \
311
      handles[0] = (uint64_t)allocation; \
312
      for (uint64_t i = 0; i < count; i += 1) { handles[1 + i] = (uint64_t)(&allocation[i]); } \
313
      return (RedFHandle##REDGPU_F_HANDLE_NAME *)(&handles[1]); \
314
    } \
315
    extern "C" __declspec(dllexport) void redFDestroy##REDGPU_F_HANDLE_NAME(RedFHandle##REDGPU_F_HANDLE_NAME * handles) { \
316
      if (handles == NULL) { return; } \
317
      uint64_t * h = ((uint64_t *)handles) - 1; \
318
      REDGPU_F_OF_NAME * allocation = (REDGPU_F_OF_NAME *)(h[0]); \
319
      delete[] allocation; \
320
      delete[] h; \
321
    }
322
#endif
323
#ifdef __linux__
324
  #define REDGPU_F_DECLARE_CREATE_AND_DESTROY_PROCEDURES(REDGPU_F_HANDLE_NAME, REDGPU_F_OF_NAME) \
325
    extern "C" __attribute__((visibility("default"))) RedFHandle##REDGPU_F_HANDLE_NAME * redFCreate##REDGPU_F_HANDLE_NAME(uint64_t count) { \
326
      if (count == 0) { return NULL; } \
327
      REDGPU_F_OF_NAME * allocation = new(std::nothrow) REDGPU_F_OF_NAME [count](); \
328
      if (allocation == NULL) { return NULL; } \
329
      uint64_t * handles = new(std::nothrow) uint64_t [1 + count]; \
330
      if (handles == NULL) { return NULL; } \
331
      handles[0] = (uint64_t)allocation; \
332
      for (uint64_t i = 0; i < count; i += 1) { handles[1 + i] = (uint64_t)(&allocation[i]); } \
333
      return (RedFHandle##REDGPU_F_HANDLE_NAME *)(&handles[1]); \
334
    } \
335
    extern "C" __attribute__((visibility("default"))) void redFDestroy##REDGPU_F_HANDLE_NAME(RedFHandle##REDGPU_F_HANDLE_NAME * handles) { \
336
      if (handles == NULL) { return; } \
337
      uint64_t * h = ((uint64_t *)handles) - 1; \
338
      REDGPU_F_OF_NAME * allocation = (REDGPU_F_OF_NAME *)(h[0]); \
339
      delete[] allocation; \
340
      delete[] h; \
341
    }
342
#endif
343

344
// https://openframeworks.cc/documentation/utils/ofThread/
345
class RedFThread : public ofThread {
346
public:
347
  void threadedFunction() {
348
    if (procedure != 0) {
349
      procedure();
350
    }
351
  }
352

353
  void (*procedure)(void) = 0;
354
};
355

356
REDGPU_F_DECLARE_CREATE_AND_DESTROY_PROCEDURES(Node, ofNode)
357
REDGPU_F_DECLARE_CREATE_AND_DESTROY_PROCEDURES(Camera, ofCamera)
358
REDGPU_F_DECLARE_CREATE_AND_DESTROY_PROCEDURES(FirstPersonCamera, ofxFirstPersonCamera)
359
REDGPU_F_DECLARE_CREATE_AND_DESTROY_PROCEDURES(Mesh, ofMesh)
360
REDGPU_F_DECLARE_CREATE_AND_DESTROY_PROCEDURES(VboMesh, ofVboMesh)
361
REDGPU_F_DECLARE_CREATE_AND_DESTROY_PROCEDURES(Image, ofImage)
362
REDGPU_F_DECLARE_CREATE_AND_DESTROY_PROCEDURES(Fbo, ofFbo)
363
REDGPU_F_DECLARE_CREATE_AND_DESTROY_PROCEDURES(Light, ofLight)
364
REDGPU_F_DECLARE_CREATE_AND_DESTROY_PROCEDURES(Material, ofMaterial)
365
REDGPU_F_DECLARE_CREATE_AND_DESTROY_PROCEDURES(Shader, ofShader)
366
REDGPU_F_DECLARE_CREATE_AND_DESTROY_PROCEDURES(Manipulator, ofxManipulator)
367
REDGPU_F_DECLARE_CREATE_AND_DESTROY_PROCEDURES(Assimp, ofxAssimpModelLoader)
368
REDGPU_F_DECLARE_CREATE_AND_DESTROY_PROCEDURES(SoundPlayer, ofSoundPlayer)
369
REDGPU_F_DECLARE_CREATE_AND_DESTROY_PROCEDURES(Directory, ofDirectory)
370
REDGPU_F_DECLARE_CREATE_AND_DESTROY_PROCEDURES(Thread, RedFThread)
371
REDGPU_F_DECLARE_CREATE_AND_DESTROY_PROCEDURES(ThreadChannel, ofThreadChannel<void *>)
372
REDGPU_F_DECLARE_CREATE_AND_DESTROY_PROCEDURES(Fbx, ofxFBX)
373
REDGPU_F_DECLARE_CREATE_AND_DESTROY_PROCEDURES(PostProcessing, ofxPostProcessing)
374

375
REDGPU_F_DECLSPEC void redFSetEscapeQuitsApp(RedFBool32 quitOnEsc) {
376
  ofSetEscapeQuitsApp(quitOnEsc);
377
}
378

379
REDGPU_F_DECLSPEC void redFSetWindowShape(int width, int height) {
380
  ofSetWindowShape(width, height);
381
}
382

383
REDGPU_F_DECLSPEC void redFSetWindowPosition(int x, int y) {
384
  ofSetWindowPosition(x, y);
385
}
386

387
REDGPU_F_DECLSPEC void redFSetWindowTitle(const char * title) {
388
  std::string name = title;
389
  ofSetWindowTitle(name);
390
}
391

392
REDGPU_F_DECLSPEC void redFSetWindowTitleW(const wchar_t * title) {
393
  std::wstring wname = title;
394
  std::string name;
395
  if (!wname.empty()) {
396
#ifdef _WIN32
397
    name = CW2A(wname.c_str(), CP_UTF8);
398
#else
399
    name = ws2s(wname);
400
#endif
401
  }
402
  ofSetWindowTitle(name);
403
}
404

405
REDGPU_F_DECLSPEC void redFNodeCopyToNode(RedFHandleNode handle, RedFHandleNode to) {
406
  ofNode * source = (ofNode *)handle;
407
  ofNode * target = (ofNode *)to;
408
  const glm::vec3 s = source->getScale();
409
  const glm::quat r = source->getGlobalOrientation();
410
  const glm::vec3 t = source->getGlobalPosition();
411
  target->setScale(s);
412
  target->setGlobalOrientation(r);
413
  target->setGlobalPosition(t);
414
}
415

416
REDGPU_F_DECLSPEC void redFNodeCopyToManipulator(RedFHandleNode handle, RedFHandleManipulator to) {
417
  ofNode * source = (ofNode *)handle;
418
  ofxManipulator * target = (ofxManipulator *)to;
419
  const glm::vec3 s = source->getScale();
420
  const glm::quat r = source->getGlobalOrientation();
421
  const glm::vec3 t = source->getGlobalPosition();
422
  target->setScale(s);
423
  target->setRotation(r);
424
  target->setTranslation(t);
425
}
426

427
REDGPU_F_DECLSPEC void redFNodeDraw(RedFHandleNode handle) {
428
  ((ofNode *)handle)->draw();
429
}
430

431
REDGPU_F_DECLSPEC float redFNodeGetGlobalPositionX(RedFHandleNode handle) {
432
  return ((ofNode *)handle)->getGlobalPosition().x;
433
}
434

435
REDGPU_F_DECLSPEC float redFNodeGetGlobalPositionY(RedFHandleNode handle) {
436
  return ((ofNode *)handle)->getGlobalPosition().y;
437
}
438

439
REDGPU_F_DECLSPEC float redFNodeGetGlobalPositionZ(RedFHandleNode handle) {
440
  return ((ofNode *)handle)->getGlobalPosition().z;
441
}
442

443
REDGPU_F_DECLSPEC float redFNodeGetGlobalOrientationQuaternionX(RedFHandleNode handle) {
444
  return ((ofNode *)handle)->getGlobalOrientation().x;
445
}
446

447
REDGPU_F_DECLSPEC float redFNodeGetGlobalOrientationQuaternionY(RedFHandleNode handle) {
448
  return ((ofNode *)handle)->getGlobalOrientation().y;
449
}
450

451
REDGPU_F_DECLSPEC float redFNodeGetGlobalOrientationQuaternionZ(RedFHandleNode handle) {
452
  return ((ofNode *)handle)->getGlobalOrientation().z;
453
}
454

455
REDGPU_F_DECLSPEC float redFNodeGetGlobalOrientationQuaternionW(RedFHandleNode handle) {
456
  return ((ofNode *)handle)->getGlobalOrientation().w;
457
}
458

459
REDGPU_F_DECLSPEC float redFNodeGetScaleX(RedFHandleNode handle) {
460
  return ((ofNode *)handle)->getScale().x;
461
}
462

463
REDGPU_F_DECLSPEC float redFNodeGetScaleY(RedFHandleNode handle) {
464
  return ((ofNode *)handle)->getScale().y;
465
}
466

467
REDGPU_F_DECLSPEC float redFNodeGetScaleZ(RedFHandleNode handle) {
468
  return ((ofNode *)handle)->getScale().z;
469
}
470

471
REDGPU_F_DECLSPEC void redFNodeGetGlobalTransformMatrix(RedFHandleNode handle, void * outMat4) {
472
  glm::mat4 out = ((ofNode *)handle)->getGlobalTransformMatrix();
473
  float * outFloats = (float *)outMat4;
474
  float * p = glm::value_ptr(out);
475
  outFloats[0]  = p[0];
476
  outFloats[1]  = p[1];
477
  outFloats[2]  = p[2];
478
  outFloats[3]  = p[3];
479
  outFloats[4]  = p[4];
480
  outFloats[5]  = p[5];
481
  outFloats[6]  = p[6];
482
  outFloats[7]  = p[7];
483
  outFloats[8]  = p[8];
484
  outFloats[9]  = p[9];
485
  outFloats[10] = p[10];
486
  outFloats[11] = p[11];
487
  outFloats[12] = p[12];
488
  outFloats[13] = p[13];
489
  outFloats[14] = p[14];
490
  outFloats[15] = p[15];
491
}
492

493
REDGPU_F_DECLSPEC float redFNodeGetSideDirX(RedFHandleNode handle) {
494
  return ((ofNode *)handle)->getSideDir().x;
495
}
496

497
REDGPU_F_DECLSPEC float redFNodeGetSideDirY(RedFHandleNode handle) {
498
  return ((ofNode *)handle)->getSideDir().y;
499
}
500

501
REDGPU_F_DECLSPEC float redFNodeGetSideDirZ(RedFHandleNode handle) {
502
  return ((ofNode *)handle)->getSideDir().z;
503
}
504

505
REDGPU_F_DECLSPEC float redFNodeGetUpDirX(RedFHandleNode handle) {
506
  return ((ofNode *)handle)->getUpDir().x;
507
}
508

509
REDGPU_F_DECLSPEC float redFNodeGetUpDirY(RedFHandleNode handle) {
510
  return ((ofNode *)handle)->getUpDir().y;
511
}
512

513
REDGPU_F_DECLSPEC float redFNodeGetUpDirZ(RedFHandleNode handle) {
514
  return ((ofNode *)handle)->getUpDir().z;
515
}
516

517
REDGPU_F_DECLSPEC float redFNodeGetLookAtDirX(RedFHandleNode handle) {
518
  return ((ofNode *)handle)->getLookAtDir().x;
519
}
520

521
REDGPU_F_DECLSPEC float redFNodeGetLookAtDirY(RedFHandleNode handle) {
522
  return ((ofNode *)handle)->getLookAtDir().y;
523
}
524

525
REDGPU_F_DECLSPEC float redFNodeGetLookAtDirZ(RedFHandleNode handle) {
526
  return ((ofNode *)handle)->getLookAtDir().z;
527
}
528

529
REDGPU_F_DECLSPEC void redFNodeSetGlobalPosition(RedFHandleNode handle, float x, float y, float z) {
530
  ((ofNode *)handle)->setGlobalPosition(x, y, z);
531
}
532

533
REDGPU_F_DECLSPEC void redFNodeSetGlobalOrientationQuaternion(RedFHandleNode handle, float x, float y, float z, float w) {
534
  glm::quat q;
535
  q.x = x;
536
  q.y = y;
537
  q.z = z;
538
  q.w = w;
539
  ((ofNode *)handle)->setGlobalOrientation(q);
540
}
541

542
REDGPU_F_DECLSPEC void redFNodeSetScale(RedFHandleNode handle, float x, float y, float z) {
543
  ((ofNode *)handle)->setScale(x, y, z);
544
}
545

546
REDGPU_F_DECLSPEC void redFNodeLookAt(RedFHandleNode handle, float x, float y, float z, float upX, float upY, float upZ) {
547
  glm::vec3 p;
548
  p.x = x;
549
  p.y = y;
550
  p.z = z;
551
  glm::vec3 up;
552
  up.x = upX;
553
  up.y = upY;
554
  up.z = upZ;
555
  ((ofNode *)handle)->lookAt(p, up);
556
}
557

558
REDGPU_F_DECLSPEC void redFNodeRotateDeg(RedFHandleNode handle, float degrees, float axisX, float axisY, float axisZ) {
559
  if (axisX == 0 && axisY == 0 && axisZ == 0) {
560
    return;
561
  }
562
  ((ofNode *)handle)->rotateDeg(degrees, axisX, axisY, axisZ);
563
}
564

565
REDGPU_F_DECLSPEC RedFHandleNode redFCameraCastToNode(RedFHandleCamera handle) {
566
  return (RedFHandleNode)(void *)handle;
567
}
568

569
REDGPU_F_DECLSPEC void redFCameraSetFov(RedFHandleCamera handle, float fov) {
570
  ((ofCamera *)handle)->setFov(fov);
571
}
572

573
REDGPU_F_DECLSPEC void redFCameraSetNearClip(RedFHandleCamera handle, float nearDist) {
574
  ((ofCamera *)handle)->setNearClip(nearDist);
575
}
576

577
REDGPU_F_DECLSPEC void redFCameraSetFarClip(RedFHandleCamera handle, float farDist) {
578
  ((ofCamera *)handle)->setFarClip(farDist);
579
}
580

581
REDGPU_F_DECLSPEC void redFCameraSetLensOffset(RedFHandleCamera handle, float lensOffsetX, float lensOffsetY) {
582
  glm::vec2 lensOffset;
583
  lensOffset.x = lensOffsetX;
584
  lensOffset.y = lensOffsetY;
585
  ((ofCamera *)handle)->setLensOffset(lensOffset);
586
}
587

588
REDGPU_F_DECLSPEC void redFCameraSetAspectRatio(RedFHandleCamera handle, float aspectRatio) {
589
  ((ofCamera *)handle)->setAspectRatio(aspectRatio);
590
}
591

592
REDGPU_F_DECLSPEC void redFCameraSetForceAspectRatio(RedFHandleCamera handle, RedFBool32 forceAspectRatio) {
593
  ((ofCamera *)handle)->setForceAspectRatio(forceAspectRatio);
594
}
595

596
REDGPU_F_DECLSPEC float redFCameraGetFov(RedFHandleCamera handle) {
597
  return ((ofCamera *)handle)->getFov();
598
}
599

600
REDGPU_F_DECLSPEC float redFCameraGetNearClip(RedFHandleCamera handle) {
601
  return ((ofCamera *)handle)->getNearClip();
602
}
603

604
REDGPU_F_DECLSPEC float redFCameraGetFarClip(RedFHandleCamera handle) {
605
  return ((ofCamera *)handle)->getFarClip();
606
}
607

608
REDGPU_F_DECLSPEC void redFCameraGetLensOffset(RedFHandleCamera handle, void * outVec2) {
609
  glm::vec2 out = ((ofCamera *)handle)->getLensOffset();
610
  float * outFloats = (float *)outVec2;
611
  float * p = glm::value_ptr(out);
612
  outFloats[0] = p[0];
613
  outFloats[1] = p[1];
614
}
615

616
REDGPU_F_DECLSPEC RedFBool32 redFCameraGetForceAspectRatio(RedFHandleCamera handle) {
617
  return (RedFBool32)((ofCamera *)handle)->getForceAspectRatio();
618
}
619

620
REDGPU_F_DECLSPEC float redFCameraGetAspectRatio(RedFHandleCamera handle) {
621
  return ((ofCamera *)handle)->getAspectRatio();
622
}
623

624
REDGPU_F_DECLSPEC void redFCameraSetupPerspective(RedFHandleCamera handle, RedFBool32 vFlip, float fov, float nearDist, float farDist, float lensOffsetX, float lensOffsetY) {
625
  glm::vec2 lensOffset;
626
  lensOffset.x = lensOffsetX;
627
  lensOffset.y = lensOffsetY;
628
  ((ofCamera *)handle)->setupPerspective(vFlip, fov, nearDist, farDist, lensOffset);
629
}
630

631
REDGPU_F_DECLSPEC void redFCameraSetupOffAxisViewPortal(RedFHandleCamera handle, float topLeftX, float topLeftY, float topLeftZ, float bottomLeftX, float bottomLeftY, float bottomLeftZ, float bottomRightX, float bottomRightY, float bottomRightZ) {
632
  glm::vec3 topLeft;
633
  topLeft.x = topLeftX;
634
  topLeft.y = topLeftY;
635
  topLeft.z = topLeftZ;
636
  glm::vec3 bottomLeft;
637
  bottomLeft.x = bottomLeftX;
638
  bottomLeft.y = bottomLeftY;
639
  bottomLeft.z = bottomLeftZ;
640
  glm::vec3 bottomRight;
641
  bottomRight.x = bottomRightX;
642
  bottomRight.y = bottomRightY;
643
  bottomRight.z = bottomRightZ;
644
  ((ofCamera *)handle)->setupOffAxisViewPortal(topLeft, bottomLeft, bottomRight);
645
}
646

647
REDGPU_F_DECLSPEC void redFCameraSetVFlip(RedFHandleCamera handle, RedFBool32 vFlip) {
648
  ((ofCamera *)handle)->setVFlip(vFlip);
649
}
650

651
REDGPU_F_DECLSPEC RedFBool32 redFCameraIsVFlipped(RedFHandleCamera handle) {
652
  return (RedFBool32)((ofCamera *)handle)->isVFlipped();
653
}
654

655
REDGPU_F_DECLSPEC void redFCameraEnableOrtho(RedFHandleCamera handle) {
656
  ((ofCamera *)handle)->enableOrtho();
657
}
658

659
REDGPU_F_DECLSPEC void redFCameraDisableOrtho(RedFHandleCamera handle) {
660
  ((ofCamera *)handle)->disableOrtho();
661
}
662

663
REDGPU_F_DECLSPEC RedFBool32 redFCameraGetOrtho(RedFHandleCamera handle) {
664
  return (RedFBool32)((ofCamera *)handle)->getOrtho();
665
}
666

667
REDGPU_F_DECLSPEC float redFCameraGetImagePlaneDistance(RedFHandleCamera handle) {
668
  return ((ofCamera *)handle)->getImagePlaneDistance();
669
}
670

671
REDGPU_F_DECLSPEC void redFCameraBegin(RedFHandleCamera handle) {
672
  ((ofCamera *)handle)->begin();
673
}
674

675
REDGPU_F_DECLSPEC void redFCameraEnd(RedFHandleCamera handle) {
676
  ((ofCamera *)handle)->end();
677
}
678

679
REDGPU_F_DECLSPEC void redFCameraGetProjectionMatrix(RedFHandleCamera handle, void * outMat4) {
680
  glm::mat4 out = ((ofCamera *)handle)->getProjectionMatrix();
681
  float * outFloats = (float *)outMat4;
682
  float * p = glm::value_ptr(out);
683
  outFloats[0]  = p[0];
684
  outFloats[1]  = p[1];
685
  outFloats[2]  = p[2];
686
  outFloats[3]  = p[3];
687
  outFloats[4]  = p[4];
688
  outFloats[5]  = p[5];
689
  outFloats[6]  = p[6];
690
  outFloats[7]  = p[7];
691
  outFloats[8]  = p[8];
692
  outFloats[9]  = p[9];
693
  outFloats[10] = p[10];
694
  outFloats[11] = p[11];
695
  outFloats[12] = p[12];
696
  outFloats[13] = p[13];
697
  outFloats[14] = p[14];
698
  outFloats[15] = p[15];
699
}
700

701
REDGPU_F_DECLSPEC void redFCameraGetModelViewMatrix(RedFHandleCamera handle, void * outMat4) {
702
  glm::mat4 out = ((ofCamera *)handle)->getModelViewMatrix();
703
  float * outFloats = (float *)outMat4;
704
  float * p = glm::value_ptr(out);
705
  outFloats[0]  = p[0];
706
  outFloats[1]  = p[1];
707
  outFloats[2]  = p[2];
708
  outFloats[3]  = p[3];
709
  outFloats[4]  = p[4];
710
  outFloats[5]  = p[5];
711
  outFloats[6]  = p[6];
712
  outFloats[7]  = p[7];
713
  outFloats[8]  = p[8];
714
  outFloats[9]  = p[9];
715
  outFloats[10] = p[10];
716
  outFloats[11] = p[11];
717
  outFloats[12] = p[12];
718
  outFloats[13] = p[13];
719
  outFloats[14] = p[14];
720
  outFloats[15] = p[15];
721
}
722

723
REDGPU_F_DECLSPEC void redFCameraGetModelViewProjectionMatrix(RedFHandleCamera handle, void * outMat4) {
724
  glm::mat4 out = ((ofCamera *)handle)->getModelViewProjectionMatrix();
725
  float * outFloats = (float *)outMat4;
726
  float * p = glm::value_ptr(out);
727
  outFloats[0]  = p[0];
728
  outFloats[1]  = p[1];
729
  outFloats[2]  = p[2];
730
  outFloats[3]  = p[3];
731
  outFloats[4]  = p[4];
732
  outFloats[5]  = p[5];
733
  outFloats[6]  = p[6];
734
  outFloats[7]  = p[7];
735
  outFloats[8]  = p[8];
736
  outFloats[9]  = p[9];
737
  outFloats[10] = p[10];
738
  outFloats[11] = p[11];
739
  outFloats[12] = p[12];
740
  outFloats[13] = p[13];
741
  outFloats[14] = p[14];
742
  outFloats[15] = p[15];
743
}
744

745
REDGPU_F_DECLSPEC void redFCameraWorldToScreen(RedFHandleCamera handle, float worldX, float worldY, float worldZ, void * outVec3) {
746
  glm::vec3 world;
747
  world.x = worldX;
748
  world.y = worldY;
749
  world.z = worldZ;
750
  glm::vec3 out = ((ofCamera *)handle)->worldToScreen(world);
751
  float * outFloats = (float *)outVec3;
752
  float * p = glm::value_ptr(out);
753
  outFloats[0] = p[0];
754
  outFloats[1] = p[1];
755
  outFloats[2] = p[2];
756
}
757

758
REDGPU_F_DECLSPEC void redFCameraScreenToWorld(RedFHandleCamera handle, float screenX, float screenY, float screenZ, void * outVec3) {
759
  glm::vec3 screen;
760
  screen.x = screenX;
761
  screen.y = screenY;
762
  screen.z = screenZ;
763
  glm::vec3 out = ((ofCamera *)handle)->screenToWorld(screen);
764
  float * outFloats = (float *)outVec3;
765
  float * p = glm::value_ptr(out);
766
  outFloats[0] = p[0];
767
  outFloats[1] = p[1];
768
  outFloats[2] = p[2];
769
}
770

771
REDGPU_F_DECLSPEC void redFCameraWorldToCamera(RedFHandleCamera handle, float worldX, float worldY, float worldZ, void * outVec3) {
772
  glm::vec3 world;
773
  world.x = worldX;
774
  world.y = worldY;
775
  world.z = worldZ;
776
  glm::vec3 out = ((ofCamera *)handle)->worldToCamera(world);
777
  float * outFloats = (float *)outVec3;
778
  float * p = glm::value_ptr(out);
779
  outFloats[0] = p[0];
780
  outFloats[1] = p[1];
781
  outFloats[2] = p[2];
782
}
783

784
REDGPU_F_DECLSPEC void redFCameraCameraToWorld(RedFHandleCamera handle, float cameraX, float cameraY, float cameraZ, void * outVec3) {
785
  glm::vec3 camera;
786
  camera.x = cameraX;
787
  camera.y = cameraY;
788
  camera.z = cameraZ;
789
  glm::vec3 out = ((ofCamera *)handle)->cameraToWorld(camera);
790
  float * outFloats = (float *)outVec3;
791
  float * p = glm::value_ptr(out);
792
  outFloats[0] = p[0];
793
  outFloats[1] = p[1];
794
  outFloats[2] = p[2];
795
}
796

797
REDGPU_F_DECLSPEC void redFCameraDrawFrustum(RedFHandleCamera handle) {
798
  ((ofCamera *)handle)->drawFrustum();
799
}
800

801
REDGPU_F_DECLSPEC RedFHandleCamera redFFirstPersonCameraCastToCamera(RedFHandleFirstPersonCamera handle) {
802
  return (RedFHandleCamera)(void *)handle;
803
}
804

805
REDGPU_F_DECLSPEC RedFHandleNode redFFirstPersonCameraCastToNode(RedFHandleFirstPersonCamera handle) {
806
  return (RedFHandleNode)(void *)handle;
807
}
808

809
REDGPU_F_DECLSPEC void redFFirstPersonCameraBegin(RedFHandleFirstPersonCamera handle) {
810
  ((ofxFirstPersonCamera *)handle)->begin();
811
}
812

813
REDGPU_F_DECLSPEC void redFFirstPersonCameraEnd(RedFHandleFirstPersonCamera handle) {
814
  ((ofxFirstPersonCamera *)handle)->end();
815
}
816

817
REDGPU_F_DECLSPEC RedFBool32 redFFirstPersonCameraControlIsEnabled(RedFHandleFirstPersonCamera handle) {
818
  return ((ofxFirstPersonCamera *)handle)->isControlled() == true ? 1 : 0;
819
}
820

821
REDGPU_F_DECLSPEC void redFFirstPersonCameraControlToggle(RedFHandleFirstPersonCamera handle) {
822
  ((ofxFirstPersonCamera *)handle)->toggleControl();
823
}
824

825
REDGPU_F_DECLSPEC void redFFirstPersonCameraControlEnable(RedFHandleFirstPersonCamera handle) {
826
  ((ofxFirstPersonCamera *)handle)->enableControl();
827
}
828

829
REDGPU_F_DECLSPEC void redFFirstPersonCameraControlDisable(RedFHandleFirstPersonCamera handle) {
830
  ((ofxFirstPersonCamera *)handle)->disableControl();
831
}
832

833
REDGPU_F_DECLSPEC void redFFirstPersonCameraSetKeyUp(RedFHandleFirstPersonCamera handle, int key) {
834
  ((ofxFirstPersonCamera *)handle)->keyUp = key;
835
}
836

837
REDGPU_F_DECLSPEC void redFFirstPersonCameraSetKeyDown(RedFHandleFirstPersonCamera handle, int key) {
838
  ((ofxFirstPersonCamera *)handle)->keyDown = key;
839
}
840

841
REDGPU_F_DECLSPEC void redFFirstPersonCameraSetKeyLeft(RedFHandleFirstPersonCamera handle, int key) {
842
  ((ofxFirstPersonCamera *)handle)->keyLeft = key;
843
}
844

845
REDGPU_F_DECLSPEC void redFFirstPersonCameraSetKeyRight(RedFHandleFirstPersonCamera handle, int key) {
846
  ((ofxFirstPersonCamera *)handle)->keyRight = key;
847
}
848

849
REDGPU_F_DECLSPEC void redFFirstPersonCameraSetKeyForward(RedFHandleFirstPersonCamera handle, int key) {
850
  ((ofxFirstPersonCamera *)handle)->keyForward = key;
851
}
852

853
REDGPU_F_DECLSPEC void redFFirstPersonCameraSetKeyBackward(RedFHandleFirstPersonCamera handle, int key) {
854
  ((ofxFirstPersonCamera *)handle)->keyBackward = key;
855
}
856

857
REDGPU_F_DECLSPEC void redFFirstPersonCameraSetKeyRollLeft(RedFHandleFirstPersonCamera handle, int key) {
858
  ((ofxFirstPersonCamera *)handle)->keyRollLeft = key;
859
}
860

861
REDGPU_F_DECLSPEC void redFFirstPersonCameraSetKeyRollRight(RedFHandleFirstPersonCamera handle, int key) {
862
  ((ofxFirstPersonCamera *)handle)->keyRollRight = key;
863
}
864

865
REDGPU_F_DECLSPEC void redFFirstPersonCameraSetKeyRollReset(RedFHandleFirstPersonCamera handle, int key) {
866
  ((ofxFirstPersonCamera *)handle)->keyRollReset = key;
867
}
868

869
REDGPU_F_DECLSPEC void redFFirstPersonCameraSetMoveSpeed(RedFHandleFirstPersonCamera handle, float moveSpeed) {
870
  ((ofxFirstPersonCamera *)handle)->movespeed = moveSpeed;
871
}
872

873
REDGPU_F_DECLSPEC void redFFirstPersonCameraSetRollSpeed(RedFHandleFirstPersonCamera handle, float rollSpeed) {
874
  ((ofxFirstPersonCamera *)handle)->rollspeed = rollSpeed;
875
}
876

877
REDGPU_F_DECLSPEC void redFFirstPersonCameraSetSensitivity(RedFHandleFirstPersonCamera handle, float sensitivity) {
878
  ((ofxFirstPersonCamera *)handle)->sensitivity = sensitivity;
879
}
880

881
REDGPU_F_DECLSPEC void redFFirstPersonCameraSetUpVector(RedFHandleFirstPersonCamera handle, float x, float y, float z) {
882
  ((ofxFirstPersonCamera *)handle)->upvector.set(x, y, z);
883
}
884

885
REDGPU_F_DECLSPEC void redFMeshSetMode(RedFHandleMesh handle, RedFPrimitiveMode mode) {
886
  ofMesh * mesh = (ofMesh *)handle;
887
  mesh->setMode((ofPrimitiveMode)mode);
888
}
889

890
REDGPU_F_DECLSPEC RedFPrimitiveMode redFMeshGetMode(RedFHandleMesh handle) {
891
  ofMesh * mesh = (ofMesh *)handle;
892
  return (RedFPrimitiveMode)mesh->getMode();
893
}
894

895
REDGPU_F_DECLSPEC void redFMeshClear(RedFHandleMesh handle) {
896
  ofMesh * mesh = (ofMesh *)handle;
897
  mesh->clear();
898
}
899

900
// Mesh vertexes
901

902
REDGPU_F_DECLSPEC void redFMeshAddVertex(RedFHandleMesh handle, float vx, float vy, float vz) {
903
  ofMesh * mesh = (ofMesh *)handle;
904
  mesh->addVertex(glm::vec3(vx, vy, vz));
905
}
906

907
REDGPU_F_DECLSPEC void redFMeshAddVertices(RedFHandleMesh handle, void * vertVec3s, uint64_t vertVec3sCount) {
908
  ofMesh * mesh = (ofMesh *)handle;
909
  mesh->addVertices((glm::vec3 *)vertVec3s, vertVec3sCount);
910
}
911

912
REDGPU_F_DECLSPEC void redFMeshRemoveVertex(RedFHandleMesh handle, unsigned index) {
913
  ofMesh * mesh = (ofMesh *)handle;
914
  mesh->removeVertex((ofIndexType)index);
915
}
916

917
REDGPU_F_DECLSPEC void redFMeshClearVertices(RedFHandleMesh handle) {
918
  ofMesh * mesh = (ofMesh *)handle;
919
  mesh->clearVertices();
920
}
921

922
REDGPU_F_DECLSPEC void redFMeshSetVertex(RedFHandleMesh handle, unsigned index, float x, float y, float z) {
923
  ofMesh * mesh = (ofMesh *)handle;
924
  mesh->setVertex(index, glm::vec3(x, y, z));
925
}
926

927
REDGPU_F_DECLSPEC void redFMeshGetVertex(RedFHandleMesh handle, unsigned index, void * outVec3) {
928
  ofMesh * mesh = (ofMesh *)handle;
929
  glm::vec3 out = mesh->getVertex(index);
930
  float * outFloats = (float *)outVec3;
931
  float * p = glm::value_ptr(out);
932
  outFloats[0] = p[0];
933
  outFloats[1] = p[1];
934
  outFloats[2] = p[2];
935
}
936

937
REDGPU_F_DECLSPEC uint64_t redFMeshGetNumVertices(RedFHandleMesh handle) {
938
  ofMesh * mesh = (ofMesh *)handle;
939
  return mesh->getNumVertices();
940
}
941

942
REDGPU_F_DECLSPEC void * redFMeshGetVerticesPointer(RedFHandleMesh handle) {
943
  ofMesh * mesh = (ofMesh *)handle;
944
  return mesh->getVerticesPointer();
945
}
946

947
REDGPU_F_DECLSPEC RedFBool32 redFMeshHasVertices(RedFHandleMesh handle) {
948
  ofMesh * mesh = (ofMesh *)handle;
949
  return (RedFBool32)mesh->hasVertices();
950
}
951

952
REDGPU_F_DECLSPEC RedFBool32 redFMeshHaveVertsChanged(RedFHandleMesh handle) {
953
  ofMesh * mesh = (ofMesh *)handle;
954
  return 1; // (RedFBool32)mesh->haveVertsChanged();
955
}
956

957
REDGPU_F_DECLSPEC void redFMeshMergeDuplicateVertices(RedFHandleMesh handle) {
958
  ofMesh * mesh = (ofMesh *)handle;
959
  mesh->mergeDuplicateVertices();
960
}
961

962
REDGPU_F_DECLSPEC void redFMeshGetCentroid(RedFHandleMesh handle, void * outVec3) {
963
  ofMesh * mesh = (ofMesh *)handle;
964
  glm::vec3 out = mesh->getCentroid();
965
  float * outFloats = (float *)outVec3;
966
  float * p = glm::value_ptr(out);
967
  outFloats[0] = p[0];
968
  outFloats[1] = p[1];
969
  outFloats[2] = p[2];
970
}
971

972
// Mesh normals
973

974
REDGPU_F_DECLSPEC void redFMeshEnableNormals(RedFHandleMesh handle) {
975
  ofMesh * mesh = (ofMesh *)handle;
976
  mesh->enableNormals();
977
}
978

979
REDGPU_F_DECLSPEC void redFMeshDisableNormals(RedFHandleMesh handle) {
980
  ofMesh * mesh = (ofMesh *)handle;
981
  mesh->disableNormals();
982
}
983

984
REDGPU_F_DECLSPEC RedFBool32 redFMeshUsingNormals(RedFHandleMesh handle) {
985
  ofMesh * mesh = (ofMesh *)handle;
986
  return (RedFBool32)mesh->usingNormals();
987
}
988

989
REDGPU_F_DECLSPEC void redFMeshAddNormal(RedFHandleMesh handle, float nx, float ny, float nz) {
990
  ofMesh * mesh = (ofMesh *)handle;
991
  mesh->addNormal(glm::vec3(nx, ny, nz));
992
}
993

994
REDGPU_F_DECLSPEC void redFMeshAddNormals(RedFHandleMesh handle, void * normVec3s, uint64_t normVec3sCount) {
995
  ofMesh * mesh = (ofMesh *)handle;
996
  mesh->addNormals((glm::vec3 *)normVec3s, normVec3sCount);
997
}
998

999
REDGPU_F_DECLSPEC void redFMeshRemoveNormal(RedFHandleMesh handle, unsigned index) {
1000
  ofMesh * mesh = (ofMesh *)handle;
1001
  mesh->removeNormal(index);
1002
}
1003

1004
REDGPU_F_DECLSPEC void redFMeshClearNormals(RedFHandleMesh handle) {
1005
  ofMesh * mesh = (ofMesh *)handle;
1006
  mesh->clearNormals();
1007
}
1008

1009
REDGPU_F_DECLSPEC void redFMeshSetNormal(RedFHandleMesh handle, unsigned index, float x, float y, float z) {
1010
  ofMesh * mesh = (ofMesh *)handle;
1011
  mesh->setNormal(index, glm::vec3(x, y, z));
1012
}
1013

1014
REDGPU_F_DECLSPEC void redFMeshGetNormal(RedFHandleMesh handle, unsigned index, void * outVec3) {
1015
  ofMesh * mesh = (ofMesh *)handle;
1016
  glm::vec3 out = mesh->getNormal(index);
1017
  float * outFloats = (float *)outVec3;
1018
  float * p = glm::value_ptr(out);
1019
  outFloats[0] = p[0];
1020
  outFloats[1] = p[1];
1021
  outFloats[2] = p[2];
1022
}
1023

1024
REDGPU_F_DECLSPEC uint64_t redFMeshGetNumNormals(RedFHandleMesh handle) {
1025
  ofMesh * mesh = (ofMesh *)handle;
1026
  return mesh->getNumNormals();
1027
}
1028

1029
REDGPU_F_DECLSPEC void * redFMeshGetNormalsPointer(RedFHandleMesh handle) {
1030
  ofMesh * mesh = (ofMesh *)handle;
1031
  return mesh->getNormalsPointer();
1032
}
1033

1034
REDGPU_F_DECLSPEC RedFBool32 redFMeshHasNormals(RedFHandleMesh handle) {
1035
  ofMesh * mesh = (ofMesh *)handle;
1036
  return (RedFBool32)mesh->hasNormals();
1037
}
1038

1039
REDGPU_F_DECLSPEC RedFBool32 redFMeshHaveNormalsChanged(RedFHandleMesh handle) {
1040
  ofMesh * mesh = (ofMesh *)handle;
1041
  return 1; // (RedFBool32)mesh->haveNormalsChanged();
1042
}
1043

1044
REDGPU_F_DECLSPEC void redFMeshSmoothNormals(RedFHandleMesh handle, float angle) {
1045
  ofMesh * mesh = (ofMesh *)handle;
1046
  mesh->smoothNormals(angle);
1047
}
1048

1049
REDGPU_F_DECLSPEC void redFMeshFlatNormals(RedFHandleMesh handle) {
1050
  ofMesh * mesh = (ofMesh *)handle;
1051
  mesh->flatNormals();
1052
}
1053

1054
// Mesh colors
1055

1056
REDGPU_F_DECLSPEC void redFMeshEnableColors(RedFHandleMesh handle) {
1057
  ofMesh * mesh = (ofMesh *)handle;
1058
  mesh->enableColors();
1059
}
1060

1061
REDGPU_F_DECLSPEC void redFMeshDisableColors(RedFHandleMesh handle) {
1062
  ofMesh * mesh = (ofMesh *)handle;
1063
  mesh->disableColors();
1064
}
1065

1066
REDGPU_F_DECLSPEC RedFBool32 redFMeshUsingColors(RedFHandleMesh handle) {
1067
  ofMesh * mesh = (ofMesh *)handle;
1068
  return (RedFBool32)mesh->usingColors();
1069
}
1070

1071
REDGPU_F_DECLSPEC void redFMeshAddColor(RedFHandleMesh handle, float cr, float cg, float cb, float ca) {
1072
  ofMesh * mesh = (ofMesh *)handle;
1073
  mesh->addColor(ofFloatColor(cr, cg, cb, ca));
1074
}
1075

1076
REDGPU_F_DECLSPEC void redFMeshAddColors(RedFHandleMesh handle, void * colVec4s, uint64_t colVec4sCount) {
1077
  ofMesh * mesh = (ofMesh *)handle;
1078
  mesh->addColors((ofFloatColor *)colVec4s, colVec4sCount);
1079
}
1080

1081
REDGPU_F_DECLSPEC void redFMeshRemoveColor(RedFHandleMesh handle, unsigned index) {
1082
  ofMesh * mesh = (ofMesh *)handle;
1083
  mesh->removeColor(index);
1084
}
1085

1086
REDGPU_F_DECLSPEC void redFMeshClearColors(RedFHandleMesh handle) {
1087
  ofMesh * mesh = (ofMesh *)handle;
1088
  mesh->clearColors();
1089
}
1090

1091
REDGPU_F_DECLSPEC void redFMeshSetColor(RedFHandleMesh handle, unsigned index, float r, float g, float b, float a) {
1092
  ofMesh * mesh = (ofMesh *)handle;
1093
  mesh->setColor(index, ofFloatColor(r, g, b, a));
1094
}
1095

1096
REDGPU_F_DECLSPEC void redFMeshGetColor(RedFHandleMesh handle, unsigned index, void * outVec4) {
1097
  ofMesh * mesh = (ofMesh *)handle;
1098
  ofFloatColor out = mesh->getColor(index);
1099
  float * outFloats = (float *)outVec4;
1100
  outFloats[0] = out.r;
1101
  outFloats[1] = out.g;
1102
  outFloats[2] = out.b;
1103
  outFloats[3] = out.a;
1104
}
1105

1106
REDGPU_F_DECLSPEC uint64_t redFMeshGetNumColors(RedFHandleMesh handle) {
1107
  ofMesh * mesh = (ofMesh *)handle;
1108
  return mesh->getNumColors();
1109
}
1110

1111
REDGPU_F_DECLSPEC void * redFMeshGetColorsPointer(RedFHandleMesh handle) {
1112
  ofMesh * mesh = (ofMesh *)handle;
1113
  return mesh->getColorsPointer();
1114
}
1115

1116
REDGPU_F_DECLSPEC RedFBool32 redFMeshHasColors(RedFHandleMesh handle) {
1117
  ofMesh * mesh = (ofMesh *)handle;
1118
  return (RedFBool32)mesh->hasColors();
1119
}
1120

1121
REDGPU_F_DECLSPEC RedFBool32 redFMeshHaveColorsChanged(RedFHandleMesh handle) {
1122
  ofMesh * mesh = (ofMesh *)handle;
1123
  return 1; // (RedFBool32)mesh->haveColorsChanged();
1124
}
1125

1126
// Mesh texture coordinates
1127

1128
REDGPU_F_DECLSPEC void redFMeshEnableTextures(RedFHandleMesh handle) {
1129
  ofMesh * mesh = (ofMesh *)handle;
1130
  mesh->enableTextures();
1131
}
1132

1133
REDGPU_F_DECLSPEC void redFMeshDisableTextures(RedFHandleMesh handle) {
1134
  ofMesh * mesh = (ofMesh *)handle;
1135
  mesh->disableTextures();
1136
}
1137

1138
REDGPU_F_DECLSPEC RedFBool32 redFMeshUsingTextures(RedFHandleMesh handle) {
1139
  ofMesh * mesh = (ofMesh *)handle;
1140
  return (RedFBool32)mesh->usingTextures();
1141
}
1142

1143
REDGPU_F_DECLSPEC void redFMeshAddTexCoord(RedFHandleMesh handle, float tu, float tv) {
1144
  ofMesh * mesh = (ofMesh *)handle;
1145
  mesh->addTexCoord(glm::vec2(tu, tv));
1146
}
1147

1148
REDGPU_F_DECLSPEC void redFMeshAddTexCoords(RedFHandleMesh handle, void * texVec2s, uint64_t texVec2sCount) {
1149
  ofMesh * mesh = (ofMesh *)handle;
1150
  mesh->addTexCoords((glm::vec2 *)texVec2s, texVec2sCount);
1151
}
1152

1153
REDGPU_F_DECLSPEC void redFMeshRemoveTexCoord(RedFHandleMesh handle, unsigned index) {
1154
  ofMesh * mesh = (ofMesh *)handle;
1155
  mesh->removeTexCoord(index);
1156
}
1157

1158
REDGPU_F_DECLSPEC void redFMeshClearTexCoords(RedFHandleMesh handle) {
1159
  ofMesh * mesh = (ofMesh *)handle;
1160
  mesh->clearTexCoords();
1161
}
1162

1163
REDGPU_F_DECLSPEC void redFMeshSetTexCoord(RedFHandleMesh handle, unsigned index, float u, float v) {
1164
  ofMesh * mesh = (ofMesh *)handle;
1165
  mesh->setTexCoord(index, glm::vec2(u, v));
1166
}
1167

1168
REDGPU_F_DECLSPEC void redFMeshGetTexCoord(RedFHandleMesh handle, unsigned index, void * outVec2) {
1169
  ofMesh * mesh = (ofMesh *)handle;
1170
  glm::vec2 out = mesh->getTexCoord(index);
1171
  float * outFloats = (float *)outVec2;
1172
  float * p = glm::value_ptr(out);
1173
  outFloats[0] = p[0];
1174
  outFloats[1] = p[1];
1175
}
1176

1177
REDGPU_F_DECLSPEC uint64_t redFMeshGetNumTexCoords(RedFHandleMesh handle) {
1178
  ofMesh * mesh = (ofMesh *)handle;
1179
  return mesh->getNumTexCoords();
1180
}
1181

1182
REDGPU_F_DECLSPEC void * redFMeshGetTexCoordsPointer(RedFHandleMesh handle) {
1183
  ofMesh * mesh = (ofMesh *)handle;
1184
  return mesh->getTexCoordsPointer();
1185
}
1186

1187
REDGPU_F_DECLSPEC RedFBool32 redFMeshHasTexCoords(RedFHandleMesh handle) {
1188
  ofMesh * mesh = (ofMesh *)handle;
1189
  return (RedFBool32)mesh->hasTexCoords();
1190
}
1191

1192
REDGPU_F_DECLSPEC RedFBool32 redFMeshHaveTexCoordsChanged(RedFHandleMesh handle) {
1193
  ofMesh * mesh = (ofMesh *)handle;
1194
  return 1; // (RedFBool32)mesh->haveTexCoordsChanged();
1195
}
1196

1197
// Mesh indexes
1198

1199
REDGPU_F_DECLSPEC void redFMeshEnableIndices(RedFHandleMesh handle) {
1200
  ofMesh * mesh = (ofMesh *)handle;
1201
  mesh->enableIndices();
1202
}
1203

1204
REDGPU_F_DECLSPEC void redFMeshDisableIndices(RedFHandleMesh handle) {
1205
  ofMesh * mesh = (ofMesh *)handle;
1206
  mesh->disableIndices();
1207
}
1208

1209
REDGPU_F_DECLSPEC RedFBool32 redFMeshUsingIndices(RedFHandleMesh handle) {
1210
  ofMesh * mesh = (ofMesh *)handle;
1211
  return (RedFBool32)mesh->usingIndices();
1212
}
1213

1214
REDGPU_F_DECLSPEC void redFMeshAddIndex(RedFHandleMesh handle, unsigned index) {
1215
  ofMesh * mesh = (ofMesh *)handle;
1216
  mesh->addIndex((ofIndexType)index);
1217
}
1218

1219
REDGPU_F_DECLSPEC void redFMeshAddIndices(RedFHandleMesh handle, unsigned * indexes, uint64_t indexesCount) {
1220
  ofMesh * mesh = (ofMesh *)handle;
1221
  mesh->addIndices((ofIndexType *)indexes, indexesCount);
1222
}
1223

1224
REDGPU_F_DECLSPEC void redFMeshRemoveIndex(RedFHandleMesh handle, unsigned index) {
1225
  ofMesh * mesh = (ofMesh *)handle;
1226
  mesh->removeIndex(index);
1227
}
1228

1229
REDGPU_F_DECLSPEC void redFMeshClearIndices(RedFHandleMesh handle) {
1230
  ofMesh * mesh = (ofMesh *)handle;
1231
  mesh->clearIndices();
1232
}
1233

1234
REDGPU_F_DECLSPEC void redFMeshSetIndex(RedFHandleMesh handle, unsigned index, unsigned value) {
1235
  ofMesh * mesh = (ofMesh *)handle;
1236
  mesh->setIndex(index, (ofIndexType)value);
1237
}
1238

1239
REDGPU_F_DECLSPEC unsigned redFMeshGetIndex(RedFHandleMesh handle, unsigned index) {
1240
  ofMesh * mesh = (ofMesh *)handle;
1241
  return (unsigned)(ofIndexType)mesh->getIndex(index);
1242
}
1243

1244
REDGPU_F_DECLSPEC uint64_t redFMeshGetNumIndices(RedFHandleMesh handle) {
1245
  ofMesh * mesh = (ofMesh *)handle;
1246
  return mesh->getNumIndices();
1247
}
1248

1249
REDGPU_F_DECLSPEC unsigned * redFMeshGetIndexPointer(RedFHandleMesh handle) {
1250
  ofMesh * mesh = (ofMesh *)handle;
1251
  return (unsigned *)(ofIndexType *)mesh->getIndexPointer();
1252
}
1253

1254
REDGPU_F_DECLSPEC RedFBool32 redFMeshHasIndices(RedFHandleMesh handle) {
1255
  ofMesh * mesh = (ofMesh *)handle;
1256
  return (RedFBool32)mesh->hasIndices();
1257
}
1258

1259
REDGPU_F_DECLSPEC RedFBool32 redFMeshHaveIndicesChanged(RedFHandleMesh handle) {
1260
  ofMesh * mesh = (ofMesh *)handle;
1261
  return 1; // (RedFBool32)mesh->haveIndicesChanged();
1262
}
1263

1264
REDGPU_F_DECLSPEC void redFMeshSetupIndicesAuto(RedFHandleMesh handle) {
1265
  ofMesh * mesh = (ofMesh *)handle;
1266
  mesh->setupIndicesAuto();
1267
}
1268

1269
REDGPU_F_DECLSPEC void redFMeshAddTriangle(RedFHandleMesh handle, unsigned index1, unsigned index2, unsigned index3) {
1270
  ofMesh * mesh = (ofMesh *)handle;
1271
  mesh->addTriangle((ofIndexType)index1, (ofIndexType)index2, (ofIndexType)index3);
1272
}
1273

1274
REDGPU_F_DECLSPEC void redFMeshSetColorForIndices(RedFHandleMesh handle, unsigned startIndex, unsigned endIndex, float r, float g, float b, float a) {
1275
  ofMesh * mesh = (ofMesh *)handle;
1276
  mesh->setColorForIndices((ofIndexType)startIndex, (ofIndexType)endIndex, ofFloatColor(r, g, b, a));
1277
}
1278

1279
// Mesh draw
1280

1281
REDGPU_F_DECLSPEC void redFMeshDrawVertices(RedFHandleMesh handle) {
1282
  ofMesh * mesh = (ofMesh *)handle;
1283
  mesh->drawVertices();
1284
}
1285

1286
REDGPU_F_DECLSPEC void redFMeshDrawWireframe(RedFHandleMesh handle) {
1287
  ofMesh * mesh = (ofMesh *)handle;
1288
  mesh->drawWireframe();
1289
}
1290

1291
REDGPU_F_DECLSPEC void redFMeshDraw(RedFHandleMesh handle) {
1292
  ofMesh * mesh = (ofMesh *)handle;
1293
  mesh->draw();
1294
}
1295

1296
REDGPU_F_DECLSPEC void redFMeshDrawWithRenderMode(RedFHandleMesh handle, RedFPolyRenderMode renderMode) {
1297
  ofMesh * mesh = (ofMesh *)handle;
1298
  mesh->draw((ofPolyRenderMode)renderMode);
1299
}
1300

1301
REDGPU_F_DECLSPEC RedFHandleMesh redFVboMeshCastToMesh(RedFHandleVboMesh handle) {
1302
  return (RedFHandleMesh)(void *)handle;
1303
}
1304

1305
REDGPU_F_DECLSPEC void redFVboMeshSetMesh(RedFHandleVboMesh handle, RedFHandleMesh mesh) {
1306
  ofVboMesh * vboMesh = (ofVboMesh *)handle;
1307
  ofMesh * msh = (ofMesh *)mesh;
1308
  vboMesh[0] = msh[0];
1309
}
1310

1311
REDGPU_F_DECLSPEC void redFVboMeshSetUsage(RedFHandleVboMesh handle, int usageDefaultIsGlStaticDraw) {
1312
  ofVboMesh * vboMesh = (ofVboMesh *)handle;
1313
  vboMesh->setUsage(usageDefaultIsGlStaticDraw);
1314
}
1315

1316
REDGPU_F_DECLSPEC void redFVboMeshEnableColors(RedFHandleVboMesh handle) {
1317
  ofVboMesh * vboMesh = (ofVboMesh *)handle;
1318
  vboMesh->enableColors();
1319
}
1320

1321
REDGPU_F_DECLSPEC void redFVboMeshEnableTextures(RedFHandleVboMesh handle) {
1322
  ofVboMesh * vboMesh = (ofVboMesh *)handle;
1323
  vboMesh->enableTextures();
1324
}
1325

1326
REDGPU_F_DECLSPEC void redFVboMeshEnableNormals(RedFHandleVboMesh handle) {
1327
  ofVboMesh * vboMesh = (ofVboMesh *)handle;
1328
  vboMesh->enableNormals();
1329
}
1330

1331
REDGPU_F_DECLSPEC void redFVboMeshEnableIndices(RedFHandleVboMesh handle) {
1332
  ofVboMesh * vboMesh = (ofVboMesh *)handle;
1333
  vboMesh->enableIndices();
1334
}
1335

1336
REDGPU_F_DECLSPEC void redFVboMeshDisableColors(RedFHandleVboMesh handle) {
1337
  ofVboMesh * vboMesh = (ofVboMesh *)handle;
1338
  vboMesh->disableColors();
1339
}
1340

1341
REDGPU_F_DECLSPEC void redFVboMeshDisableTextures(RedFHandleVboMesh handle) {
1342
  ofVboMesh * vboMesh = (ofVboMesh *)handle;
1343
  vboMesh->disableTextures();
1344
}
1345

1346
REDGPU_F_DECLSPEC void redFVboMeshDisableNormals(RedFHandleVboMesh handle) {
1347
  ofVboMesh * vboMesh = (ofVboMesh *)handle;
1348
  vboMesh->disableNormals();
1349
}
1350

1351
REDGPU_F_DECLSPEC void redFVboMeshDisableIndices(RedFHandleVboMesh handle) {
1352
  ofVboMesh * vboMesh = (ofVboMesh *)handle;
1353
  vboMesh->disableIndices();
1354
}
1355

1356
REDGPU_F_DECLSPEC RedFBool32 redFVboMeshUsingColors(RedFHandleVboMesh handle) {
1357
  ofVboMesh * vboMesh = (ofVboMesh *)handle;
1358
  return (RedFBool32)vboMesh->usingColors();
1359
}
1360

1361
REDGPU_F_DECLSPEC RedFBool32 redFVboMeshUsingTextures(RedFHandleVboMesh handle) {
1362
  ofVboMesh * vboMesh = (ofVboMesh *)handle;
1363
  return (RedFBool32)vboMesh->usingTextures();
1364
}
1365

1366
REDGPU_F_DECLSPEC RedFBool32 redFVboMeshUsingNormals(RedFHandleVboMesh handle) {
1367
  ofVboMesh * vboMesh = (ofVboMesh *)handle;
1368
  return (RedFBool32)vboMesh->usingNormals();
1369
}
1370

1371
REDGPU_F_DECLSPEC RedFBool32 redFVboMeshUsingIndices(RedFHandleVboMesh handle) {
1372
  ofVboMesh * vboMesh = (ofVboMesh *)handle;
1373
  return (RedFBool32)vboMesh->usingIndices();
1374
}
1375

1376
REDGPU_F_DECLSPEC void redFVboMeshDrawInstanced(RedFHandleVboMesh handle, RedFPolyRenderMode renderMode, int primCount) {
1377
  ofVboMesh * vboMesh = (ofVboMesh *)handle;
1378
  vboMesh->drawInstanced((ofPolyRenderMode)renderMode, primCount);
1379
}
1380

1381
REDGPU_F_DECLSPEC void redFVboMeshDraw(RedFHandleVboMesh handle, RedFPolyRenderMode renderMode) {
1382
  ofVboMesh * vboMesh = (ofVboMesh *)handle;
1383
  vboMesh->draw((ofPolyRenderMode)renderMode);
1384
}
1385

1386
REDGPU_F_DECLSPEC void redFVboMeshUpdateVbo(RedFHandleVboMesh handle) {
1387
  ofVboMesh * vboMesh = (ofVboMesh *)handle;
1388
  vboMesh->getVbo();
1389
}
1390

1391
REDGPU_F_DECLSPEC void redFImageAllocate(RedFHandleImage handle, int w, int h, RedFImageType type) {
1392
  ofImage * image = (ofImage *)handle;
1393
  image->allocate(w, h, (ofImageType)type);
1394
}
1395

1396
REDGPU_F_DECLSPEC RedFBool32 redFImageIsAllocated(RedFHandleImage handle) {
1397
  ofImage * image = (ofImage *)handle;
1398
  return (RedFBool32)image->isAllocated();
1399
}
1400

1401
REDGPU_F_DECLSPEC int redFImageGetWidth(RedFHandleImage handle) {
1402
  ofImage * image = (ofImage *)handle;
1403
  return (int)image->getWidth();
1404
}
1405

1406
REDGPU_F_DECLSPEC int redFImageGetHeight(RedFHandleImage handle) {
1407
  ofImage * image = (ofImage *)handle;
1408
  return (int)image->getHeight();
1409
}
1410

1411
REDGPU_F_DECLSPEC int redFImageGetBitsPerPixel(RedFHandleImage handle) {
1412
  ofImage * image = (ofImage *)handle;
1413
  return (int)image->getPixels().getBitsPerPixel();
1414
}
1415

1416
REDGPU_F_DECLSPEC RedFImageType redFImageGetImageType(RedFHandleImage handle) {
1417
  ofImage * image = (ofImage *)handle;
1418
  return (RedFImageType)image->getImageType();
1419
}
1420

1421
REDGPU_F_DECLSPEC void * redFImageGetPixelsPointer(RedFHandleImage handle) {
1422
  ofImage * image = (ofImage *)handle;
1423
  return (void *)image->getPixels().getData();
1424
}
1425

1426
REDGPU_F_DECLSPEC void redFImageClear(RedFHandleImage handle) {
1427
  ofImage * image = (ofImage *)handle;
1428
  image->clear();
1429
}
1430

1431
REDGPU_F_DECLSPEC RedFBool32 redFImageLoad(RedFHandleImage handle, const char * fileName) {
1432
  ofImage * image = (ofImage *)handle;
1433
  std::string name = fileName;
1434
#ifdef __linux__
1435
#warning
1436
  std::string path = name;
1437
#else
1438
  std::filesystem::path path = name;
1439
#endif
1440
  return image->load(path);
1441
}
1442

1443
REDGPU_F_DECLSPEC RedFBool32 redFImageLoadFromMemory(RedFHandleImage handle, uint64_t imageMemoryBytesCount, const void * imageMemory) {
1444
  ofImage * image = (ofImage *)handle;
1445
  ofBuffer buffer;
1446
  buffer.set((const char *)imageMemory, imageMemoryBytesCount);
1447
  return image->load(buffer);
1448
}
1449

1450
REDGPU_F_DECLSPEC void redFImageSave(RedFHandleImage handle, const char * fileName) {
1451
  ofImage * image = (ofImage *)handle;
1452
  std::string name = fileName;
1453
#ifdef __linux__
1454
#warning
1455
  std::string path = name;
1456
#else
1457
  std::filesystem::path path = name;
1458
#endif
1459
  image->save(path);
1460
}
1461

1462
REDGPU_F_DECLSPEC void redFImageGrabScreen(RedFHandleImage handle, int x, int y, int w, int h) {
1463
  ofImage * image = (ofImage *)handle;
1464
  image->grabScreen(x, y, w, h);
1465
}
1466

1467
REDGPU_F_DECLSPEC void redFImageSetColor(RedFHandleImage handle, int x, int y, int r, int g, int b, int a) {
1468
  ofImage * image = (ofImage *)handle;
1469
  image->setColor(x, y, ofColor(r, g, b, a));
1470
}
1471

1472
REDGPU_F_DECLSPEC void redFImageGetColor(RedFHandleImage handle, int x, int y, unsigned char * outR, unsigned char * outG, unsigned char * outB, unsigned char * outA) {
1473
  ofImage * image = (ofImage *)handle;
1474
  ofColor color = image->getColor(x, y);
1475
  if (outR != NULL) { outR[0] = color.r; }
1476
  if (outG != NULL) { outG[0] = color.g; }
1477
  if (outB != NULL) { outB[0] = color.b; }
1478
  if (outA != NULL) { outA[0] = color.a; }
1479
}
1480

1481
REDGPU_F_DECLSPEC void redFImageResize(RedFHandleImage handle, int newWidth, int newHeight) {
1482
  ofImage * image = (ofImage *)handle;
1483
  image->resize(newWidth, newHeight);
1484
}
1485

1486
REDGPU_F_DECLSPEC void redFImageCrop(RedFHandleImage handle, int x, int y, int w, int h) {
1487
  ofImage * image = (ofImage *)handle;
1488
  image->crop(x, y, w, h);
1489
}
1490

1491
REDGPU_F_DECLSPEC void redFImageRotate90(RedFHandleImage handle, int rotation) {
1492
  ofImage * image = (ofImage *)handle;
1493
  image->rotate90(rotation);
1494
}
1495

1496
REDGPU_F_DECLSPEC void redFImageMirror(RedFHandleImage handle, RedFBool32 vertical, RedFBool32 horizontal) {
1497
  ofImage * image = (ofImage *)handle;
1498
  image->mirror(vertical, horizontal);
1499
}
1500

1501
REDGPU_F_DECLSPEC void redFImageSetTextureWrap(RedFHandleImage handle, int wrapModeHorizontal, int wrapModeVertical) {
1502
  ofImage * image = (ofImage *)handle;
1503
  image->getTexture().setTextureWrap(wrapModeHorizontal, wrapModeVertical);
1504
}
1505

1506
REDGPU_F_DECLSPEC void redFImageSetTextureMinMagFilter(RedFHandleImage handle, int minFilter, int magFilter) {
1507
  ofImage * image = (ofImage *)handle;
1508
  image->getTexture().setTextureMinMagFilter(minFilter, magFilter);
1509
}
1510

1511
REDGPU_F_DECLSPEC void redFImageSetTextureCompareModeFunc(RedFHandleImage handle, int compareMode, int compareFunc) {
1512
  ofImage * image = (ofImage *)handle;
1513
  unsigned textureTarget = image->getTexture().getTextureData().textureTarget;
1514
  unsigned textureId     = image->getTexture().getTextureData().textureID;
1515
  glBindTexture(textureTarget, textureId);
1516
  glTexParameteri(textureTarget, GL_TEXTURE_COMPARE_MODE, compareMode);
1517
  glTexParameteri(textureTarget, GL_TEXTURE_COMPARE_FUNC, compareFunc);
1518
  glBindTexture(textureTarget, 0);
1519
}
1520

1521
REDGPU_F_DECLSPEC void redFImageSetTextureMaxAnisotropy(RedFHandleImage handle, int maxAnisotropy) {
1522
  ofImage * image = (ofImage *)handle;
1523
  unsigned textureTarget = image->getTexture().getTextureData().textureTarget;
1524
  unsigned textureId     = image->getTexture().getTextureData().textureID;
1525
  glBindTexture(textureTarget, textureId);
1526
  glTexParameteri(textureTarget, GL_TEXTURE_MAX_ANISOTROPY_EXT, maxAnisotropy);
1527
  glBindTexture(textureTarget, 0);
1528
}
1529

1530
REDGPU_F_DECLSPEC void redFImageSetAnchorPercent(RedFHandleImage handle, float x, float y) {
1531
  ofImage * image = (ofImage *)handle;
1532
  image->setAnchorPercent(x, y);
1533
}
1534

1535
REDGPU_F_DECLSPEC void redFImageSetAnchorPoint(RedFHandleImage handle, float x, float y) {
1536
  ofImage * image = (ofImage *)handle;
1537
  image->setAnchorPoint(x, y);
1538
}
1539

1540
REDGPU_F_DECLSPEC void redFImageResetAnchor(RedFHandleImage handle) {
1541
  ofImage * image = (ofImage *)handle;
1542
  image->resetAnchor();
1543
}
1544

1545
REDGPU_F_DECLSPEC RedFBool32 redFImageHasMipmap(RedFHandleImage handle) {
1546
  ofImage * image = (ofImage *)handle;
1547
  return (RedFBool32)image->getTexture().hasMipmap();
1548
}
1549

1550
REDGPU_F_DECLSPEC void redFImageMipmapDisable(RedFHandleImage handle) {
1551
  ofImage * image = (ofImage *)handle;
1552
  image->getTexture().disableMipmap();
1553
}
1554

1555
REDGPU_F_DECLSPEC void redFImageMipmapEnable(RedFHandleImage handle) {
1556
  ofImage * image = (ofImage *)handle;
1557
  image->getTexture().enableMipmap();
1558
}
1559

1560
REDGPU_F_DECLSPEC void redFImageMipmapGenerate(RedFHandleImage handle) {
1561
  ofImage * image = (ofImage *)handle;
1562
  image->getTexture().generateMipmap();
1563
}
1564

1565
REDGPU_F_DECLSPEC void redFImageUpdate(RedFHandleImage handle) {
1566
  ofImage * image = (ofImage *)handle;
1567
  image->update();
1568
}
1569

1570
REDGPU_F_DECLSPEC void redFImageBind(RedFHandleImage handle) {
1571
  ofImage * image = (ofImage *)handle;
1572
  image->bind();
1573
}
1574

1575
REDGPU_F_DECLSPEC void redFImageUnbind(RedFHandleImage handle) {
1576
  ofImage * image = (ofImage *)handle;
1577
  image->unbind();
1578
}
1579

1580
REDGPU_F_DECLSPEC void redFImageDraw(RedFHandleImage handle, float x, float y, float z, float w, float h) {
1581
  ofImage * image = (ofImage *)handle;
1582
  image->draw(x, y, z, w, h);
1583
}
1584

1585
REDGPU_F_DECLSPEC void redFImageDrawSubsection(RedFHandleImage handle, float x, float y, float z, float w, float h, float sx, float sy, float sw, float sh) {
1586
  ofImage * image = (ofImage *)handle;
1587
  image->drawSubsection(x, y, z, w, h, sx, sy, sw, sh);
1588
}
1589

1590
REDGPU_F_DECLSPEC void redFFboAllocate(RedFHandleFbo handle, int width, int height, int numSamples, const RedFFboSettings * optionalSettings) {
1591
  ofFbo * fbo = (ofFbo *)handle;
1592
  if (optionalSettings == NULL) {
1593
    fbo->allocate(width, height, 0x1908, numSamples);
1594
  } else {
1595
    ofFbo::Settings fboSettings;
1596
    fboSettings.width                      = optionalSettings->width;
1597
    fboSettings.height                     = optionalSettings->height;
1598
    fboSettings.numColorbuffers            = optionalSettings->numColorbuffers;
1599
    for (int i = 0; i < fboSettings.numColorbuffers; i += 1) {
1600
      fboSettings.colorFormats.push_back(optionalSettings->colorFormats[i]);
1601
    }
1602
    fboSettings.useDepth                   = optionalSettings->useDepth;
1603
    fboSettings.useStencil                 = optionalSettings->useStencil;
1604
    fboSettings.depthStencilAsTexture      = optionalSettings->depthStencilAsTexture;
1605
    fboSettings.textureTarget              = optionalSettings->textureTarget;
1606
    fboSettings.internalformat             = optionalSettings->internalformat;
1607
    fboSettings.depthStencilInternalFormat = optionalSettings->depthStencilInternalFormat;
1608
    fboSettings.wrapModeHorizontal         = optionalSettings->wrapModeHorizontal;
1609
    fboSettings.wrapModeVertical           = optionalSettings->wrapModeVertical;
1610
    fboSettings.minFilter                  = optionalSettings->minFilter;
1611
    fboSettings.maxFilter                  = optionalSettings->maxFilter;
1612
    fboSettings.numSamples                 = optionalSettings->numSamples;
1613
    fbo->allocate(fboSettings);
1614
  }
1615
}
1616

1617
REDGPU_F_DECLSPEC RedFBool32 redFFboIsAllocated(RedFHandleFbo handle) {
1618
  ofFbo * fbo = (ofFbo *)handle;
1619
  return (RedFBool32)fbo->isAllocated();
1620
}
1621

1622
REDGPU_F_DECLSPEC void redFFboBegin(RedFHandleFbo handle, RedFBool32 setupScreenDefaultIs1) {
1623
  ofFbo * fbo = (ofFbo *)handle;
1624
  fbo->begin(setupScreenDefaultIs1 == 1 ? (OF_FBOMODE_PERSPECTIVE | OF_FBOMODE_MATRIXFLIP) : OF_FBOMODE_NODEFAULTS); // NOTE(Constantine): https://openframeworks.cc/documentation/gl/ofFbo/#show_begin
1625
}
1626

1627
REDGPU_F_DECLSPEC void redFFboActivateAllDrawBuffers(RedFHandleFbo handle) {
1628
  ofFbo * fbo = (ofFbo *)handle;
1629
  fbo->activateAllDrawBuffers();
1630
}
1631

1632
REDGPU_F_DECLSPEC void redFFboEnd(RedFHandleFbo handle) {
1633
  ofFbo * fbo = (ofFbo *)handle;
1634
  fbo->end();
1635
}
1636

1637
REDGPU_F_DECLSPEC void redFFboSetTextureWrap(RedFHandleFbo handle, int fboAttachmentPoint, int wrapModeHorizontal, int wrapModeVertical) {
1638
  ofFbo * fbo = (ofFbo *)handle;
1639
  fbo->getTexture(fboAttachmentPoint).setTextureWrap(wrapModeHorizontal, wrapModeVertical);
1640
}
1641

1642
REDGPU_F_DECLSPEC void redFFboSetTextureMinMagFilter(RedFHandleFbo handle, int fboAttachmentPoint, int minFilter, int magFilter) {
1643
  ofFbo * fbo = (ofFbo *)handle;
1644
  fbo->getTexture(fboAttachmentPoint).setTextureMinMagFilter(minFilter, magFilter);
1645
}
1646

1647
REDGPU_F_DECLSPEC void redFFboSetTextureCompareModeFunc(RedFHandleFbo handle, int fboAttachmentPoint, int compareMode, int compareFunc) {
1648
  ofFbo * fbo = (ofFbo *)handle;
1649
  unsigned textureTarget = fbo->getTexture(fboAttachmentPoint).getTextureData().textureTarget;
1650
  unsigned textureId     = fbo->getTexture(fboAttachmentPoint).getTextureData().textureID;
1651
  glBindTexture(textureTarget, textureId);
1652
  glTexParameteri(textureTarget, GL_TEXTURE_COMPARE_MODE, compareMode);
1653
  glTexParameteri(textureTarget, GL_TEXTURE_COMPARE_FUNC, compareFunc);
1654
  glBindTexture(textureTarget, 0);
1655
}
1656

1657
REDGPU_F_DECLSPEC void redFFboSetDepthTextureWrap(RedFHandleFbo handle, int wrapModeHorizontal, int wrapModeVertical) {
1658
  ofFbo * fbo = (ofFbo *)handle;
1659
  fbo->getDepthTexture().setTextureWrap(wrapModeHorizontal, wrapModeVertical);
1660
}
1661

1662
REDGPU_F_DECLSPEC void redFFboSetDepthTextureMinMagFilter(RedFHandleFbo handle, int minFilter, int magFilter) {
1663
  ofFbo * fbo = (ofFbo *)handle;
1664
  fbo->getDepthTexture().setTextureMinMagFilter(minFilter, magFilter);
1665
}
1666

1667
REDGPU_F_DECLSPEC void redFFboSetDepthTextureCompareModeFunc(RedFHandleFbo handle, int compareMode, int compareFunc) {
1668
  ofFbo * fbo = (ofFbo *)handle;
1669
  unsigned textureTarget = fbo->getDepthTexture().getTextureData().textureTarget;
1670
  unsigned textureId     = fbo->getDepthTexture().getTextureData().textureID;
1671
  glBindTexture(textureTarget, textureId);
1672
  glTexParameteri(textureTarget, GL_TEXTURE_COMPARE_MODE, compareMode);
1673
  glTexParameteri(textureTarget, GL_TEXTURE_COMPARE_FUNC, compareFunc);
1674
  glBindTexture(textureTarget, 0);
1675
}
1676

1677
REDGPU_F_DECLSPEC void redFFboSetDepthTextureRGToRGBASwizzles(RedFHandleFbo handle, RedFBool32 rToRGBSwizzles) {
1678
  ofFbo * fbo = (ofFbo *)handle;
1679
  fbo->getDepthTexture().setRGToRGBASwizzles(rToRGBSwizzles);
1680
}
1681

1682
REDGPU_F_DECLSPEC void redFFboBind(RedFHandleFbo handle, int fboAttachmentPoint) {
1683
  ofFbo * fbo = (ofFbo *)handle;
1684
  fbo->getTexture(fboAttachmentPoint).bind();
1685
  // NOTE(Constantine): For correct FBO binding, drawing and reading, don't forget to push and pop styles!
1686
}
1687

1688
REDGPU_F_DECLSPEC void redFFboUnbind(RedFHandleFbo handle, int fboAttachmentPoint) {
1689
  ofFbo * fbo = (ofFbo *)handle;
1690
  fbo->getTexture(fboAttachmentPoint).unbind();
1691
}
1692

1693
REDGPU_F_DECLSPEC void redFFboDraw(RedFHandleFbo handle, int fboAttachmentPoint, float x, float y, float width, float height) {
1694
  ofFbo * fbo = (ofFbo *)handle;
1695
  fbo->getTexture(fboAttachmentPoint).draw(x, y, width, height);
1696
}
1697

1698
REDGPU_F_DECLSPEC void redFFboDepthDraw(RedFHandleFbo handle, float x, float y, float width, float height) {
1699
  ofFbo * fbo = (ofFbo *)handle;
1700
  fbo->getDepthTexture().draw(x, y, width, height);
1701
}
1702

1703
REDGPU_F_DECLSPEC void redFFboReadToImage(RedFHandleFbo handle, int fboAttachmentPoint, RedFHandleImage image) {
1704
  ofFbo *   fbo = (ofFbo *)handle;
1705
  ofImage * img = (ofImage *)image;
1706
  ofPixels pixels;
1707
  fbo->readToPixels(pixels, fboAttachmentPoint);
1708
  img->setFromPixels(pixels);
1709
}
1710

1711
REDGPU_F_DECLSPEC void redFFboSave(RedFHandleFbo handle, int fboAttachmentPoint, const char * fileName) {
1712
  ofFbo * fbo = (ofFbo *)handle;
1713
  ofImage img;
1714
  ofPixels pixels;
1715
  fbo->readToPixels(pixels, fboAttachmentPoint);
1716
  img.setFromPixels(pixels);
1717
  std::string name = fileName;
1718
#ifdef __linux__
1719
#warning
1720
  std::string path = name;
1721
#else
1722
  std::filesystem::path path = name;
1723
#endif
1724
  img.save(path);
1725
}
1726

1727
REDGPU_F_DECLSPEC void redFFboClear(RedFHandleFbo handle) {
1728
  ofFbo * fbo = (ofFbo *)handle;
1729
  fbo->clear();
1730
}
1731

1732
REDGPU_F_DECLSPEC void redFFboClearColorBuffer(RedFHandleFbo handle, int bufferIndex, float r, float g, float b, float a) {
1733
  ofFbo * fbo = (ofFbo *)handle;
1734
  fbo->clearColorBuffer(bufferIndex, ofFloatColor(r, g, b, a));
1735
}
1736

1737
REDGPU_F_DECLSPEC void redFFboClearDepthBuffer(RedFHandleFbo handle, float depth) {
1738
  ofFbo * fbo = (ofFbo *)handle;
1739
  fbo->clearDepthBuffer(depth);
1740
}
1741

1742
REDGPU_F_DECLSPEC void redFFboClearStencilBuffer(RedFHandleFbo handle, int stencil) {
1743
  ofFbo * fbo = (ofFbo *)handle;
1744
  fbo->clearStencilBuffer(stencil);
1745
}
1746

1747
REDGPU_F_DECLSPEC void redFFboClearDepthStencilBuffer(RedFHandleFbo handle, float depth, int stencil) {
1748
  ofFbo * fbo = (ofFbo *)handle;
1749
  fbo->clearDepthStencilBuffer(depth, stencil);
1750
}
1751

1752
REDGPU_F_DECLSPEC RedFHandleNode redFLightCastToNode(RedFHandleLight handle) {
1753
  return (RedFHandleNode)(void *)handle;
1754
}
1755

1756
REDGPU_F_DECLSPEC void redFLightSetup(RedFHandleLight handle) {
1757
  ofLight * light = (ofLight *)handle;
1758
  light->setup();
1759
}
1760

1761
REDGPU_F_DECLSPEC void redFLightEnable(RedFHandleLight handle) {
1762
  ofLight * light = (ofLight *)handle;
1763
  light->enable();
1764
}
1765

1766
REDGPU_F_DECLSPEC void redFLightDisable(RedFHandleLight handle) {
1767
  ofLight * light = (ofLight *)handle;
1768
  light->disable();
1769
}
1770

1771
REDGPU_F_DECLSPEC RedFBool32 redFLightGetIsEnabled(RedFHandleLight handle) {
1772
  ofLight * light = (ofLight *)handle;
1773
  return (RedFBool32)light->getIsEnabled();
1774
}
1775

1776
REDGPU_F_DECLSPEC void redFLightSetDirectional(RedFHandleLight handle) {
1777
  ofLight * light = (ofLight *)handle;
1778
  light->setDirectional();
1779
}
1780

1781
REDGPU_F_DECLSPEC RedFBool32 redFLightGetIsDirectional(RedFHandleLight handle) {
1782
  ofLight * light = (ofLight *)handle;
1783
  return (RedFBool32)light->getIsDirectional();
1784
}
1785

1786
REDGPU_F_DECLSPEC void redFLightSetSpotlight(RedFHandleLight handle, float spotCutOffDefaultIs45, float exponentDefaultIs0) {
1787
  ofLight * light = (ofLight *)handle;
1788
  light->setSpotlight(spotCutOffDefaultIs45, exponentDefaultIs0);
1789
}
1790

1791
REDGPU_F_DECLSPEC RedFBool32 redFLightGetIsSpotlight(RedFHandleLight handle) {
1792
  ofLight * light = (ofLight *)handle;
1793
  return (RedFBool32)light->getIsSpotlight();
1794
}
1795

1796
REDGPU_F_DECLSPEC void redFLightSetSpotlightCutOff(RedFHandleLight handle, float spotCutOff) {
1797
  ofLight * light = (ofLight *)handle;
1798
  light->setSpotlightCutOff(spotCutOff);
1799
}
1800

1801
REDGPU_F_DECLSPEC float redFLightGetSpotlightCutOff(RedFHandleLight handle) {
1802
  ofLight * light = (ofLight *)handle;
1803
  return light->getSpotlightCutOff();
1804
}
1805

1806
REDGPU_F_DECLSPEC void redFLightSetSpotConcentration(RedFHandleLight handle, float exponent) {
1807
  ofLight * light = (ofLight *)handle;
1808
  light->setSpotConcentration(exponent);
1809
}
1810

1811
REDGPU_F_DECLSPEC float redFLightGetSpotConcentration(RedFHandleLight handle) {
1812
  ofLight * light = (ofLight *)handle;
1813
  return light->getSpotConcentration();
1814
}
1815

1816
REDGPU_F_DECLSPEC void redFLightSetPointLight(RedFHandleLight handle) {
1817
  ofLight * light = (ofLight *)handle;
1818
  return light->setPointLight();
1819
}
1820

1821
REDGPU_F_DECLSPEC RedFBool32 redFLightGetIsPointLight(RedFHandleLight handle) {
1822
  ofLight * light = (ofLight *)handle;
1823
  return (RedFBool32)light->getIsPointLight();
1824
}
1825

1826
REDGPU_F_DECLSPEC void redFLightSetAttenuation(RedFHandleLight handle, float constantDefaultIs1, float linearDefaultIs0, float quadraticDefaultIs0) {
1827
  ofLight * light = (ofLight *)handle;
1828
  light->setAttenuation(constantDefaultIs1, linearDefaultIs0, quadraticDefaultIs0);
1829
}
1830

1831
REDGPU_F_DECLSPEC float redFLightGetAttenuationConstant(RedFHandleLight handle) {
1832
  ofLight * light = (ofLight *)handle;
1833
  return light->getAttenuationConstant();
1834
}
1835

1836
REDGPU_F_DECLSPEC float redFLightGetAttenuationLinear(RedFHandleLight handle) {
1837
  ofLight * light = (ofLight *)handle;
1838
  return light->getAttenuationLinear();
1839
}
1840

1841
REDGPU_F_DECLSPEC float redFLightGetAttenuationQuadratic(RedFHandleLight handle) {
1842
  ofLight * light = (ofLight *)handle;
1843
  return light->getAttenuationQuadratic();
1844
}
1845

1846
REDGPU_F_DECLSPEC void redFLightSetAreaLight(RedFHandleLight handle, float width, float height) {
1847
  ofLight * light = (ofLight *)handle;
1848
  light->setAreaLight(width, height);
1849
}
1850

1851
REDGPU_F_DECLSPEC RedFBool32 redFLightGetIsAreaLight(RedFHandleLight handle) {
1852
  ofLight * light = (ofLight *)handle;
1853
  return (RedFBool32)light->getIsAreaLight();
1854
}
1855

1856
REDGPU_F_DECLSPEC RedFLightType redFLightGetType(RedFHandleLight handle) {
1857
  ofLight * light = (ofLight *)handle;
1858
  return (RedFLightType)light->getType();
1859
}
1860

1861
REDGPU_F_DECLSPEC void redFLightSetAmbientColor(RedFHandleLight handle, float r, float g, float b, float a) {
1862
  ofLight * light = (ofLight *)handle;
1863
  light->setAmbientColor(ofFloatColor(r, g, b, a));
1864
}
1865

1866
REDGPU_F_DECLSPEC void redFLightSetDiffuseColor(RedFHandleLight handle, float r, float g, float b, float a) {
1867
  ofLight * light = (ofLight *)handle;
1868
  light->setDiffuseColor(ofFloatColor(r, g, b, a));
1869
}
1870

1871
REDGPU_F_DECLSPEC void redFLightSetSpecularColor(RedFHandleLight handle, float r, float g, float b, float a) {
1872
  ofLight * light = (ofLight *)handle;
1873
  light->setSpecularColor(ofFloatColor(r, g, b, a));
1874
}
1875

1876
REDGPU_F_DECLSPEC void redFLightGetAmbientColor(RedFHandleLight handle, void * outVec4) {
1877
  ofLight * light = (ofLight *)handle;
1878
  ofFloatColor out = light->getAmbientColor();
1879
  float * outFloats = (float *)outVec4;
1880
  outFloats[0] = out.r;
1881
  outFloats[1] = out.g;
1882
  outFloats[2] = out.b;
1883
  outFloats[3] = out.a;
1884
}
1885

1886
REDGPU_F_DECLSPEC void redFLightGetDiffuseColor(RedFHandleLight handle, void * outVec4) {
1887
  ofLight * light = (ofLight *)handle;
1888
  ofFloatColor out = light->getDiffuseColor();
1889
  float * outFloats = (float *)outVec4;
1890
  outFloats[0] = out.r;
1891
  outFloats[1] = out.g;
1892
  outFloats[2] = out.b;
1893
  outFloats[3] = out.a;
1894
}
1895

1896
REDGPU_F_DECLSPEC void redFLightGetSpecularColor(RedFHandleLight handle, void * outVec4) {
1897
  ofLight * light = (ofLight *)handle;
1898
  ofFloatColor out = light->getSpecularColor();
1899
  float * outFloats = (float *)outVec4;
1900
  outFloats[0] = out.r;
1901
  outFloats[1] = out.g;
1902
  outFloats[2] = out.b;
1903
  outFloats[3] = out.a;
1904
}
1905

1906
REDGPU_F_DECLSPEC int redFLightGetLightID(RedFHandleLight handle) {
1907
  ofLight * light = (ofLight *)handle;
1908
  return light->getLightID();
1909
}
1910

1911
REDGPU_F_DECLSPEC void redFMaterialSetup(RedFHandleMaterial handle, const RedFMaterialSettings * settings) {
1912
  ofMaterial * material = (ofMaterial *)handle;
1913
  ofMaterialSettings s;
1914
  if (settings != NULL) {
1915
    s.diffuse.r  = settings->diffuse[0];
1916
    s.diffuse.g  = settings->diffuse[1];
1917
    s.diffuse.b  = settings->diffuse[2];
1918
    s.diffuse.a  = settings->diffuse[3];
1919
    s.ambient.r  = settings->ambient[0];
1920
    s.ambient.g  = settings->ambient[1];
1921
    s.ambient.b  = settings->ambient[2];
1922
    s.ambient.a  = settings->ambient[3];
1923
    s.specular.r = settings->specular[0];
1924
    s.specular.g = settings->specular[1];
1925
    s.specular.b = settings->specular[2];
1926
    s.specular.a = settings->specular[3];
1927
    s.emissive.r = settings->emissive[0];
1928
    s.emissive.g = settings->emissive[1];
1929
    s.emissive.b = settings->emissive[2];
1930
    s.emissive.a = settings->emissive[3];
1931
    s.shininess  = settings->shininess;
1932
    std::string postFragment   = settings->postFragment   != NULL ? settings->postFragment   : "";
1933
    std::string customUniforms = settings->customUniforms != NULL ? settings->customUniforms : "";
1934
    s.postFragment   = postFragment;
1935
    s.customUniforms = customUniforms;
1936
  }
1937
  material->setup(s);
1938
}
1939

1940
REDGPU_F_DECLSPEC void redFMaterialSetDiffuseColor(RedFHandleMaterial handle, float r, float g, float b, float a) {
1941
  ofMaterial * material = (ofMaterial *)handle;
1942
  material->setDiffuseColor(ofFloatColor(r, g, b, a));
1943
}
1944

1945
REDGPU_F_DECLSPEC void redFMaterialSetAmbientColor(RedFHandleMaterial handle, float r, float g, float b, float a) {
1946
  ofMaterial * material = (ofMaterial *)handle;
1947
  material->setAmbientColor(ofFloatColor(r, g, b, a));
1948
}
1949

1950
REDGPU_F_DECLSPEC void redFMaterialSetSpecularColor(RedFHandleMaterial handle, float r, float g, float b, float a) {
1951
  ofMaterial * material = (ofMaterial *)handle;
1952
  material->setSpecularColor(ofFloatColor(r, g, b, a));
1953
}
1954

1955
REDGPU_F_DECLSPEC void redFMaterialSetEmissiveColor(RedFHandleMaterial handle, float r, float g, float b, float a) {
1956
  ofMaterial * material = (ofMaterial *)handle;
1957
  material->setEmissiveColor(ofFloatColor(r, g, b, a));
1958
}
1959

1960
REDGPU_F_DECLSPEC void redFMaterialSetShininess(RedFHandleMaterial handle, float nShininess) {
1961
  ofMaterial * material = (ofMaterial *)handle;
1962
  material->setShininess(nShininess);
1963
}
1964

1965
REDGPU_F_DECLSPEC void redFMaterialGetDiffuseColor(RedFHandleMaterial handle, void * outVec4) {
1966
  ofMaterial * material = (ofMaterial *)handle;
1967
  ofFloatColor out = material->getDiffuseColor();
1968
  float * outFloats = (float *)outVec4;
1969
  outFloats[0] = out.r;
1970
  outFloats[1] = out.g;
1971
  outFloats[2] = out.b;
1972
  outFloats[3] = out.a;
1973
}
1974

1975
REDGPU_F_DECLSPEC void redFMaterialGetAmbientColor(RedFHandleMaterial handle, void * outVec4) {
1976
  ofMaterial * material = (ofMaterial *)handle;
1977
  ofFloatColor out = material->getAmbientColor();
1978
  float * outFloats = (float *)outVec4;
1979
  outFloats[0] = out.r;
1980
  outFloats[1] = out.g;
1981
  outFloats[2] = out.b;
1982
  outFloats[3] = out.a;
1983
}
1984

1985
REDGPU_F_DECLSPEC void redFMaterialGetSpecularColor(RedFHandleMaterial handle, void * outVec4) {
1986
  ofMaterial * material = (ofMaterial *)handle;
1987
  ofFloatColor out = material->getSpecularColor();
1988
  float * outFloats = (float *)outVec4;
1989
  outFloats[0] = out.r;
1990
  outFloats[1] = out.g;
1991
  outFloats[2] = out.b;
1992
  outFloats[3] = out.a;
1993
}
1994

1995
REDGPU_F_DECLSPEC void redFMaterialGetEmissiveColor(RedFHandleMaterial handle, void * outVec4) {
1996
  ofMaterial * material = (ofMaterial *)handle;
1997
  ofFloatColor out = material->getEmissiveColor();
1998
  float * outFloats = (float *)outVec4;
1999
  outFloats[0] = out.r;
2000
  outFloats[1] = out.g;
2001
  outFloats[2] = out.b;
2002
  outFloats[3] = out.a;
2003
}
2004

2005
REDGPU_F_DECLSPEC float redFMaterialGetShininess(RedFHandleMaterial handle) {
2006
  ofMaterial * material = (ofMaterial *)handle;
2007
  return material->getShininess();
2008
}
2009

2010
REDGPU_F_DECLSPEC void redFMaterialGetSettings(RedFHandleMaterial handle, RedFMaterialSettings * outSettings, char ** outPostFragment, char ** outCustomUniforms) {
2011
  ofMaterial * material = (ofMaterial *)handle;
2012
  ofMaterialSettings out = material->getSettings();
2013
  outSettings->diffuse[0]  = out.diffuse.r;
2014
  outSettings->diffuse[1]  = out.diffuse.g;
2015
  outSettings->diffuse[2]  = out.diffuse.b;
2016
  outSettings->diffuse[3]  = out.diffuse.a;
2017
  outSettings->ambient[0]  = out.ambient.r;
2018
  outSettings->ambient[1]  = out.ambient.g;
2019
  outSettings->ambient[2]  = out.ambient.b;
2020
  outSettings->ambient[3]  = out.ambient.a;
2021
  outSettings->specular[0] = out.specular.r;
2022
  outSettings->specular[1] = out.specular.g;
2023
  outSettings->specular[2] = out.specular.b;
2024
  outSettings->specular[3] = out.specular.a;
2025
  outSettings->emissive[0] = out.emissive.r;
2026
  outSettings->emissive[1] = out.emissive.g;
2027
  outSettings->emissive[2] = out.emissive.b;
2028
  outSettings->emissive[3] = out.emissive.a;
2029
  outSettings->shininess   = out.shininess;
2030
  if (out.postFragment == "") {
2031
    outSettings->postFragment = NULL;
2032
    if (outPostFragment != NULL) {
2033
      outPostFragment[0] = NULL;
2034
    }
2035
  } else {
2036
    char * postFragment = (char *)malloc(out.postFragment.size() + 1);
2037
    if (postFragment != NULL) {
2038
      std::copy(out.postFragment.begin(), out.postFragment.end(), postFragment);
2039
      postFragment[out.postFragment.size()] = 0;
2040
    }
2041
    outSettings->postFragment = (const char *)postFragment;
2042
    if (outPostFragment != NULL) {
2043
      outPostFragment[0] = postFragment;
2044
    }
2045
  }
2046
  if (out.customUniforms == "") {
2047
    outSettings->customUniforms = NULL;
2048
    if (outCustomUniforms != NULL) {
2049
      outCustomUniforms[0] = NULL;
2050
    }
2051
  } else {
2052
    char * customUniforms = (char *)malloc(out.customUniforms.size() + 1);
2053
    if (customUniforms != NULL) {
2054
      std::copy(out.customUniforms.begin(), out.customUniforms.end(), customUniforms);
2055
      customUniforms[out.customUniforms.size()] = 0;
2056
    }
2057
    outSettings->customUniforms = (const char *)customUniforms;
2058
    if (outCustomUniforms != NULL) {
2059
      outCustomUniforms[0] = customUniforms;
2060
    }
2061
  }
2062
}
2063

2064
REDGPU_F_DECLSPEC void redFMaterialSetCustomUniform4f(RedFHandleMaterial handle, const char * uniformName, float v0, float v1, float v2, float v3) {
2065
  ofMaterial * material = (ofMaterial *)handle;
2066
  std::string name = uniformName;
2067
  material->setCustomUniform4f(name, glm::vec4(v0, v1, v2, v3));
2068
}
2069

2070
REDGPU_F_DECLSPEC void redFMaterialSetCustomUniformMatrix4f(RedFHandleMaterial handle, const char * uniformName, void * mat4) {
2071
  ofMaterial * material = (ofMaterial *)handle;
2072
  std::string name = uniformName;
2073
  glm::mat4 m = glm::make_mat4((float *)mat4);
2074
  material->setCustomUniformMatrix4f(name, m);
2075
}
2076

2077
REDGPU_F_DECLSPEC void redFMaterialSetCustomUniformImage(RedFHandleMaterial handle, const char * uniformName, RedFHandleImage image, int textureLocation) {
2078
  ofMaterial * material = (ofMaterial *)handle;
2079
  ofImage * _image = (ofImage *)image;
2080
  std::string name = uniformName;
2081
  material->setCustomUniformTexture(name, _image->getTexture(), textureLocation);
2082
}
2083

2084
REDGPU_F_DECLSPEC void redFMaterialSetCustomUniformFbo(RedFHandleMaterial handle, const char * uniformName, RedFHandleFbo fbo, int fboAttachmentPoint, int textureLocation) {
2085
  ofMaterial * material = (ofMaterial *)handle;
2086
  ofFbo * _fbo = (ofFbo *)fbo;
2087
  std::string name = uniformName;
2088
  material->setCustomUniformTexture(name, _fbo->getTexture(fboAttachmentPoint), textureLocation);
2089
}
2090

2091
REDGPU_F_DECLSPEC void redFMaterialSetCustomUniformFboDepth(RedFHandleMaterial handle, const char * uniformName, RedFHandleFbo fbo, int textureLocation) {
2092
  ofMaterial * material = (ofMaterial *)handle;
2093
  ofFbo * _fbo = (ofFbo *)fbo;
2094
  std::string name = uniformName;
2095
  material->setCustomUniformTexture(name, _fbo->getDepthTexture(), textureLocation);
2096
}
2097

2098
REDGPU_F_DECLSPEC void redFMaterialBegin(RedFHandleMaterial handle) {
2099
  ofMaterial * material = (ofMaterial *)handle;
2100
  material->begin();
2101
}
2102

2103
REDGPU_F_DECLSPEC void redFMaterialEnd(RedFHandleMaterial handle) {
2104
  ofMaterial * material = (ofMaterial *)handle;
2105
  material->end();
2106
}
2107

2108
REDGPU_F_DECLSPEC RedFBool32 redFShaderLoad(RedFHandleShader handle, const char * vertexFileName, const char * fragmentFileName) {
2109
  ofShader * shader = (ofShader *)handle;
2110
  std::string vertName = vertexFileName;
2111
#ifdef __linux__
2112
#warning
2113
  std::string vertPath = vertName;
2114
#else
2115
  std::filesystem::path vertPath = vertName;
2116
#endif
2117
  std::string fragName = fragmentFileName;
2118
#ifdef __linux__
2119
#warning
2120
  std::string fragPath = fragName;
2121
#else
2122
  std::filesystem::path fragPath = fragName;
2123
#endif
2124
  return (RedFBool32)shader->load(vertPath, fragPath);
2125
}
2126

2127
REDGPU_F_DECLSPEC void redFShaderBegin(RedFHandleShader handle) {
2128
  ofShader * shader = (ofShader *)handle;
2129
  shader->begin();
2130
}
2131

2132
REDGPU_F_DECLSPEC void redFShaderSetUniform4f(RedFHandleShader handle, const char * uniformName, float v0, float v1, float v2, float v3) {
2133
  ofShader * shader = (ofShader *)handle;
2134
  std::string name = uniformName;
2135
  shader->setUniform4f(name, v0, v1, v2, v3);
2136
}
2137

2138
REDGPU_F_DECLSPEC void redFShaderSetUniform4fv(RedFHandleShader handle, const char * uniformName, void * v, int count) {
2139
  ofShader * shader = (ofShader *)handle;
2140
  std::string name = uniformName;
2141
  shader->setUniform4fv(name, (const float *)v, count);
2142
}
2143

2144
REDGPU_F_DECLSPEC void redFShaderSetUniformMatrix4f(RedFHandleShader handle, const char * uniformName, void * mat4) {
2145
  ofShader * shader = (ofShader *)handle;
2146
  std::string name = uniformName;
2147
  glm::mat4 m = glm::make_mat4((float *)mat4);
2148
  shader->setUniformMatrix4f(name, m);
2149
}
2150

2151
REDGPU_F_DECLSPEC void redFShaderSetUniformImage(RedFHandleShader handle, const char * uniformName, RedFHandleImage image, int textureLocation) {
2152
  ofShader * shader = (ofShader *)handle;
2153
  ofImage * _image = (ofImage *)image;
2154
  std::string name = uniformName;
2155
  shader->setUniformTexture(name, _image->getTexture(), textureLocation);
2156
}
2157

2158
REDGPU_F_DECLSPEC void redFShaderSetUniformFbo(RedFHandleShader handle, const char * uniformName, RedFHandleFbo fbo, int fboAttachmentPoint, int textureLocation) {
2159
  ofShader * shader = (ofShader *)handle;
2160
  ofFbo * _fbo = (ofFbo *)fbo;
2161
  std::string name = uniformName;
2162
  shader->setUniformTexture(name, _fbo->getTexture(fboAttachmentPoint), textureLocation);
2163
}
2164

2165
REDGPU_F_DECLSPEC void redFShaderSetUniformFboDepth(RedFHandleShader handle, const char * uniformName, RedFHandleFbo fbo, int textureLocation) {
2166
  ofShader * shader = (ofShader *)handle;
2167
  ofFbo * _fbo = (ofFbo *)fbo;
2168
  std::string name = uniformName;
2169
  shader->setUniformTexture(name, _fbo->getDepthTexture(), textureLocation);
2170
}
2171

2172
REDGPU_F_DECLSPEC void redFShaderEnd(RedFHandleShader handle) {
2173
  ofShader * shader = (ofShader *)handle;
2174
  shader->end();
2175
}
2176

2177
REDGPU_F_DECLSPEC void redFManipulatorCopyToNode(RedFHandleManipulator handle, RedFHandleNode to) {
2178
  ofxManipulator * source = (ofxManipulator *)handle;
2179
  ofNode * target = (ofNode *)to;
2180
  const glm::vec3 s = source->getScale();
2181
  const glm::quat r = source->getRotation();
2182
  const glm::vec3 t = source->getTranslation();
2183
  target->setScale(s);
2184
  target->setGlobalOrientation(r);
2185
  target->setGlobalPosition(t);
2186
}
2187

2188
REDGPU_F_DECLSPEC void redFManipulatorCopyToManipulator(RedFHandleManipulator handle, RedFHandleManipulator to) {
2189
  ofxManipulator * source = (ofxManipulator *)handle;
2190
  ofxManipulator * target = (ofxManipulator *)to;
2191
  const glm::vec3 s = source->getScale();
2192
  const glm::quat r = source->getRotation();
2193
  const glm::vec3 t = source->getTranslation();
2194
  target->setScale(s);
2195
  target->setRotation(r);
2196
  target->setTranslation(t);
2197
}
2198

2199
REDGPU_F_DECLSPEC void redFManipulatorDraw(RedFHandleManipulator handle, RedFHandleCamera camera) {
2200
  ofxManipulator * manipulator = (ofxManipulator *)handle;
2201
  ofCamera * cam = (ofCamera *)camera;
2202
  manipulator->draw(cam[0]);
2203
}
2204

2205
REDGPU_F_DECLSPEC void redFManipulatorGetMatrix(RedFHandleManipulator handle, void * outMat4) {
2206
  ofxManipulator * manipulator = (ofxManipulator *)handle;
2207
  glm::mat4 out = manipulator->getMatrix();
2208
  float * outFloats = (float *)outMat4;
2209
  float * p = glm::value_ptr(out);
2210
  outFloats[0]  = p[0];
2211
  outFloats[1]  = p[1];
2212
  outFloats[2]  = p[2];
2213
  outFloats[3]  = p[3];
2214
  outFloats[4]  = p[4];
2215
  outFloats[5]  = p[5];
2216
  outFloats[6]  = p[6];
2217
  outFloats[7]  = p[7];
2218
  outFloats[8]  = p[8];
2219
  outFloats[9]  = p[9];
2220
  outFloats[10] = p[10];
2221
  outFloats[11] = p[11];
2222
  outFloats[12] = p[12];
2223
  outFloats[13] = p[13];
2224
  outFloats[14] = p[14];
2225
  outFloats[15] = p[15];
2226
}
2227

2228
REDGPU_F_DECLSPEC void redFManipulatorGetScale(RedFHandleManipulator handle, void * outVec3) {
2229
  ofxManipulator * manipulator = (ofxManipulator *)handle;
2230
  glm::vec3 out = manipulator->getScale();
2231
  float * outFloats = (float *)outVec3;
2232
  float * p = glm::value_ptr(out);
2233
  outFloats[0] = p[0];
2234
  outFloats[1] = p[1];
2235
  outFloats[2] = p[2];
2236
}
2237

2238
REDGPU_F_DECLSPEC void redFManipulatorGetRotationQuaternion(RedFHandleManipulator handle, void * outVec4) {
2239
  ofxManipulator * manipulator = (ofxManipulator *)handle;
2240
  glm::quat out = manipulator->getRotation();
2241
  float * outFloats = (float *)outVec4;
2242
  float * p = glm::value_ptr(out);
2243
  outFloats[0] = p[0];
2244
  outFloats[1] = p[1];
2245
  outFloats[2] = p[2];
2246
  outFloats[3] = p[3];
2247
}
2248

2249
REDGPU_F_DECLSPEC void redFManipulatorGetRotationAxisAngleDeg(RedFHandleManipulator handle, void * outVec4) {
2250
  ofxManipulator * manipulator = (ofxManipulator *)handle;
2251
  float p[4] = {};
2252
  manipulator->getRotation().getRotate(p[3], p[0], p[1], p[2]);
2253
  float * outFloats = (float *)outVec4;
2254
  outFloats[0] = p[0];
2255
  outFloats[1] = p[1];
2256
  outFloats[2] = p[2];
2257
  outFloats[3] = p[3];
2258
}
2259

2260
REDGPU_F_DECLSPEC void redFManipulatorGetTranslation(RedFHandleManipulator handle, void * outVec3) {
2261
  ofxManipulator * manipulator = (ofxManipulator *)handle;
2262
  glm::vec3 out = manipulator->getTranslation();
2263
  float * outFloats = (float *)outVec3;
2264
  float * p = glm::value_ptr(out);
2265
  outFloats[0] = p[0];
2266
  outFloats[1] = p[1];
2267
  outFloats[2] = p[2];
2268
}
2269

2270
REDGPU_F_DECLSPEC void redFManipulatorSetScale(RedFHandleManipulator handle, float x, float y, float z) {
2271
  ofxManipulator * manipulator = (ofxManipulator *)handle;
2272
  manipulator->setScale(glm::vec3(x, y, z));
2273
}
2274

2275
REDGPU_F_DECLSPEC void redFManipulatorSetRotation(RedFHandleManipulator handle, float x, float y, float z, float w) {
2276
  ofxManipulator * manipulator = (ofxManipulator *)handle;
2277
  glm::quat q;
2278
  q.x = x;
2279
  q.y = y;
2280
  q.z = z;
2281
  q.w = w;
2282
  manipulator->setRotation(q);
2283
}
2284

2285
REDGPU_F_DECLSPEC void redFManipulatorSetTranslation(RedFHandleManipulator handle, float x, float y, float z) {
2286
  ofxManipulator * manipulator = (ofxManipulator *)handle;
2287
  manipulator->setTranslation(glm::vec3(x, y, z));
2288
}
2289

2290
REDGPU_F_DECLSPEC void redFManipulatorScale(RedFHandleManipulator handle, float x, float y, float z) {
2291
  ofxManipulator * manipulator = (ofxManipulator *)handle;
2292
  manipulator->scale(glm::vec3(x, y, z));
2293
}
2294

2295
REDGPU_F_DECLSPEC void redFManipulatorRotate(RedFHandleManipulator handle, float x, float y, float z, float w) {
2296
  ofxManipulator * manipulator = (ofxManipulator *)handle;
2297
  glm::quat q;
2298
  q.x = x;
2299
  q.y = y;
2300
  q.z = z;
2301
  q.w = w;
2302
  manipulator->rotate(q);
2303
}
2304

2305
REDGPU_F_DECLSPEC void redFManipulatorTranslate(RedFHandleManipulator handle, float x, float y, float z) {
2306
  ofxManipulator * manipulator = (ofxManipulator *)handle;
2307
  manipulator->translate(glm::vec3(x, y, z));
2308
}
2309

2310
REDGPU_F_DECLSPEC void redFManipulatorToggleScale(RedFHandleManipulator handle) {
2311
  ofxManipulator * manipulator = (ofxManipulator *)handle;
2312
  manipulator->toggleScale();
2313
}
2314

2315
REDGPU_F_DECLSPEC void redFManipulatorToggleRotation(RedFHandleManipulator handle) {
2316
  ofxManipulator * manipulator = (ofxManipulator *)handle;
2317
  manipulator->toggleRotation();
2318
}
2319

2320
REDGPU_F_DECLSPEC void redFManipulatorToggleTranslation(RedFHandleManipulator handle) {
2321
  ofxManipulator * manipulator = (ofxManipulator *)handle;
2322
  manipulator->toggleTranslation();
2323
}
2324

2325
REDGPU_F_DECLSPEC float redFManipulatorGetManipulatorScale(RedFHandleManipulator handle) {
2326
  ofxManipulator * manipulator = (ofxManipulator *)handle;
2327
  return manipulator->getManipulatorScale();
2328
}
2329

2330
REDGPU_F_DECLSPEC void redFManipulatorSetManipulatorScale(RedFHandleManipulator handle, float scale) {
2331
  ofxManipulator * manipulator = (ofxManipulator *)handle;
2332
  manipulator->setManipulatorScale(scale);
2333
}
2334

2335
REDGPU_F_DECLSPEC RedFManipulatorType redFManipulatorGetManipulatorType(RedFHandleManipulator handle) {
2336
  ofxManipulator * manipulator = (ofxManipulator *)handle;
2337
  return (RedFManipulatorType)manipulator->getManipulatorType();
2338
}
2339

2340
REDGPU_F_DECLSPEC void redFManipulatorSetManipulatorType(RedFHandleManipulator handle, RedFManipulatorType type) {
2341
  ofxManipulator * manipulator = (ofxManipulator *)handle;
2342
  manipulator->setManipulatorType((ofxManipulator::MANIPULATOR_TYPE)type);
2343
}
2344

2345
REDGPU_F_DECLSPEC void redFManipulatorSetManipulatorColors(RedFHandleManipulator handle, int xr, int xg, int xb, int xa, int yr, int yg, int yb, int ya, int zr, int zg, int zb, int za, int wr, int wg, int wb, int wa, int sr, int sg, int sb, int sa) {
2346
  ofxManipulator * manipulator = (ofxManipulator *)handle;
2347
  manipulator->setManipulatorColors(ofColor(xr, xg, xb, xa), ofColor(yr, yg, yb, ya), ofColor(zr, zg, zb, za), ofColor(wr, wg, wb, wa), ofColor(sr, sg, sb, sa));
2348
}
2349

2350
REDGPU_F_DECLSPEC RedFBool32 redFManipulatorIsEnabled(RedFHandleManipulator handle) {
2351
  ofxManipulator * manipulator = (ofxManipulator *)handle;
2352
  return (RedFBool32)manipulator->isEnabled();
2353
}
2354

2355
REDGPU_F_DECLSPEC void redFManipulatorEnable(RedFHandleManipulator handle) {
2356
  ofxManipulator * manipulator = (ofxManipulator *)handle;
2357
  manipulator->enable();
2358
}
2359

2360
REDGPU_F_DECLSPEC void redFManipulatorDisable(RedFHandleManipulator handle) {
2361
  ofxManipulator * manipulator = (ofxManipulator *)handle;
2362
  manipulator->disable();
2363
}
2364

2365
REDGPU_F_DECLSPEC RedFBool32 redFAssimpLoadModel(RedFHandleAssimp handle, const char * fileName, RedFBool32 optimize) {
2366
  ofxAssimpModelLoader * assimp = (ofxAssimpModelLoader *)handle;
2367
  std::string name = fileName;
2368
  return (RedFBool32)assimp->load(name, optimize == 1 ? ofxAssimpModelLoader::Flags::OPTIMIZE_HIGH : ofxAssimpModelLoader::Flags::OPTIMIZE_DEFAULT);
2369
}
2370

2371
REDGPU_F_DECLSPEC unsigned redFAssimpGetNumMeshes(RedFHandleAssimp handle) {
2372
  ofxAssimpModelLoader * assimp = (ofxAssimpModelLoader *)handle;
2373
  return assimp->getNumMeshes();
2374
}
2375

2376
REDGPU_F_DECLSPEC void redFAssimpGetMeshName(RedFHandleAssimp handle, unsigned index, uint64_t * outCharsCountIncludingNullTerminator, char * outChars) {
2377
  ofxAssimpModelLoader * assimp = (ofxAssimpModelLoader *)handle;
2378
  const std::vector<std::string> names = assimp->getMeshNames();
2379
  const std::string name = names[index];
2380
  if (outCharsCountIncludingNullTerminator != NULL) {
2381
    outCharsCountIncludingNullTerminator[0] = name.size() + 1;
2382
  }
2383
  if (outChars != NULL) {
2384
    std::copy(name.begin(), name.end(), outChars);
2385
    outChars[name.size()] = 0;
2386
  }
2387
}
2388

2389
REDGPU_F_DECLSPEC void redFAssimpGetMesh(RedFHandleAssimp handle, unsigned index, RedFHandleMesh replaceMesh) {
2390
  ofxAssimpModelLoader * assimp = (ofxAssimpModelLoader *)handle;
2391
  ofMesh * out = (ofMesh *)replaceMesh;
2392
  out[0] = assimp->getMesh(index);
2393
}
2394

2395
// EquiMap stubs for compatibility with REDGPU Framework 1
2396

2397
REDGPU_F_DECLSPEC RedFHandleEquiMap * redFCreateEquiMap(uint64_t count) {
2398
  RedFHandleEquiMap * allocation = new(std::nothrow) RedFHandleEquiMap [count]();
2399
  if (allocation == NULL) { return NULL; }
2400
  for (uint64_t i = 0; i < count; i += 1) {
2401
    allocation[i] = (RedFHandleEquiMap)(void *)1;
2402
  }
2403
  return allocation;
2404
}
2405

2406
REDGPU_F_DECLSPEC void redFDestroyEquiMap(RedFHandleEquiMap * handles) {
2407
  if (handles == NULL) { return; }
2408
  delete[] handles;
2409
}
2410

2411
REDGPU_F_DECLSPEC void redFEquiMapSetup(RedFHandleEquiMap handle, int size) {
2412
  volatile int nil = 0;
2413
}
2414

2415
REDGPU_F_DECLSPEC void redFEquiMapRender(RedFHandleEquiMap handle, void (*drawEquiScene)(void *), void * userData, float cubePosX, float cubePosY, float cubePosZ) {
2416
  volatile int nil = 0;
2417
}
2418

2419
REDGPU_F_DECLSPEC void redFEquiMapDraw(RedFHandleEquiMap handle, float x, float y, float w, float h) {
2420
  volatile int nil = 0;
2421
}
2422

2423
REDGPU_F_DECLSPEC RedFHandleImgui * redFCreateImgui(uint64_t count) {
2424
  RedFHandleImgui * allocation = new(std::nothrow) RedFHandleImgui [count]();
2425
  if (allocation == NULL) { return NULL; }
2426
  for (uint64_t i = 0; i < count; i += 1) {
2427
    allocation[i] = (RedFHandleImgui)(void *)1;
2428
  }
2429
  return allocation;
2430
}
2431

2432
REDGPU_F_DECLSPEC void redFDestroyImgui(RedFHandleImgui * handles) {
2433
  if (handles == NULL) { return; }
2434
  delete[] handles;
2435
}
2436

2437
REDGPU_F_DECLSPEC void redFImguiSetup(RedFHandleImgui handle) {
2438
  ofxRaccoonImGui::initialize();
2439
}
2440

2441
REDGPU_F_DECLSPEC void redFImguiBegin(RedFHandleImgui handle) {
2442
  ofxRaccoonImGui::beginGui();
2443
}
2444

2445
REDGPU_F_DECLSPEC void redFImguiEnd(RedFHandleImgui handle) {
2446
  ofxRaccoonImGui::endGui();
2447
}
2448

2449
REDGPU_F_DECLSPEC RedFBool32 redFSoundPlayerLoad(RedFHandleSoundPlayer handle, const char * fileName, RedFBool32 streamDefaultIs0) {
2450
  ofSoundPlayer * sound = (ofSoundPlayer *)handle;
2451
  std::string name = fileName;
2452
#ifdef __linux__
2453
#warning
2454
  std::string path = name;
2455
#else
2456
  std::filesystem::path path = name;
2457
#endif
2458
  return (RedFBool32)sound->load(path, streamDefaultIs0);
2459
}
2460

2461
REDGPU_F_DECLSPEC void redFSoundPlayerUnload(RedFHandleSoundPlayer handle) {
2462
  ofSoundPlayer * sound = (ofSoundPlayer *)handle;
2463
  sound->unload();
2464
}
2465

2466
REDGPU_F_DECLSPEC void redFSoundPlayerPlay(RedFHandleSoundPlayer handle) {
2467
  ofSoundPlayer * sound = (ofSoundPlayer *)handle;
2468
  sound->play();
2469
}
2470

2471
REDGPU_F_DECLSPEC void redFSoundPlayerStop(RedFHandleSoundPlayer handle) {
2472
  ofSoundPlayer * sound = (ofSoundPlayer *)handle;
2473
  sound->stop();
2474
}
2475

2476
REDGPU_F_DECLSPEC void redFSoundPlayerSetVolume(RedFHandleSoundPlayer handle, float volume0to1) {
2477
  ofSoundPlayer * sound = (ofSoundPlayer *)handle;
2478
  sound->setVolume(volume0to1);
2479
}
2480

2481
REDGPU_F_DECLSPEC void redFSoundPlayerSetPan(RedFHandleSoundPlayer handle, float panMinus1to1) {
2482
  ofSoundPlayer * sound = (ofSoundPlayer *)handle;
2483
  sound->setPan(panMinus1to1);
2484
}
2485

2486
REDGPU_F_DECLSPEC void redFSoundPlayerSetSpeed(RedFHandleSoundPlayer handle, float speedDefaultIs1) {
2487
  ofSoundPlayer * sound = (ofSoundPlayer *)handle;
2488
  sound->setSpeed(speedDefaultIs1);
2489
}
2490

2491
REDGPU_F_DECLSPEC void redFSoundPlayerSetPaused(RedFHandleSoundPlayer handle, RedFBool32 paused) {
2492
  ofSoundPlayer * sound = (ofSoundPlayer *)handle;
2493
  sound->setPaused(paused);
2494
}
2495

2496
REDGPU_F_DECLSPEC void redFSoundPlayerSetLoop(RedFHandleSoundPlayer handle, RedFBool32 loop) {
2497
  ofSoundPlayer * sound = (ofSoundPlayer *)handle;
2498
  sound->setLoop(loop);
2499
}
2500

2501
REDGPU_F_DECLSPEC void redFSoundPlayerSetMultiPlay(RedFHandleSoundPlayer handle, RedFBool32 multiplay) {
2502
  ofSoundPlayer * sound = (ofSoundPlayer *)handle;
2503
  sound->setMultiPlay(multiplay);
2504
}
2505

2506
REDGPU_F_DECLSPEC void redFSoundPlayerSetPosition(RedFHandleSoundPlayer handle, float percent0to1) {
2507
  ofSoundPlayer * sound = (ofSoundPlayer *)handle;
2508
  sound->setPosition(percent0to1);
2509
}
2510

2511
REDGPU_F_DECLSPEC void redFSoundPlayerSetPositionMS(RedFHandleSoundPlayer handle, int milliseconds) {
2512
  ofSoundPlayer * sound = (ofSoundPlayer *)handle;
2513
  sound->setPositionMS(milliseconds);
2514
}
2515

2516
REDGPU_F_DECLSPEC int redFSoundPlayerGetPositionMS(RedFHandleSoundPlayer handle) {
2517
  ofSoundPlayer * sound = (ofSoundPlayer *)handle;
2518
  return sound->getPositionMS();
2519
}
2520

2521
REDGPU_F_DECLSPEC float redFSoundPlayerGetPosition(RedFHandleSoundPlayer handle) {
2522
  ofSoundPlayer * sound = (ofSoundPlayer *)handle;
2523
  return sound->getPosition();
2524
}
2525

2526
REDGPU_F_DECLSPEC RedFBool32 redFSoundPlayerIsPlaying(RedFHandleSoundPlayer handle) {
2527
  ofSoundPlayer * sound = (ofSoundPlayer *)handle;
2528
  return (RedFBool32)sound->isPlaying();
2529
}
2530

2531
REDGPU_F_DECLSPEC float redFSoundPlayerGetSpeed(RedFHandleSoundPlayer handle) {
2532
  ofSoundPlayer * sound = (ofSoundPlayer *)handle;
2533
  return sound->getSpeed();
2534
}
2535

2536
REDGPU_F_DECLSPEC float redFSoundPlayerGetPan(RedFHandleSoundPlayer handle) {
2537
  ofSoundPlayer * sound = (ofSoundPlayer *)handle;
2538
  return sound->getPan();
2539
}
2540

2541
REDGPU_F_DECLSPEC float redFSoundPlayerGetVolume(RedFHandleSoundPlayer handle) {
2542
  ofSoundPlayer * sound = (ofSoundPlayer *)handle;
2543
  return sound->getVolume();
2544
}
2545

2546
REDGPU_F_DECLSPEC RedFBool32 redFSoundPlayerIsLoaded(RedFHandleSoundPlayer handle) {
2547
  ofSoundPlayer * sound = (ofSoundPlayer *)handle;
2548
  return (RedFBool32)sound->isLoaded();
2549
}
2550

2551
REDGPU_F_DECLSPEC void redFSoundSetVolume(float volume0to1) {
2552
  ofSoundSetVolume(volume0to1);
2553
}
2554

2555
REDGPU_F_DECLSPEC void redFSoundShutdown(void) {
2556
  ofSoundShutdown();
2557
}
2558

2559
REDGPU_F_DECLSPEC void redFSoundStopAll(void) {
2560
  ofSoundStopAll();
2561
}
2562

2563
REDGPU_F_DECLSPEC void redFSoundUpdate(void) {
2564
  ofSoundUpdate();
2565
}
2566

2567
REDGPU_F_DECLSPEC void redFDirectoryOpen(RedFHandleDirectory handle, const char * path) {
2568
  ofDirectory * dir = (ofDirectory *)handle;
2569
  std::string name = path;
2570
#ifdef __linux__
2571
#warning
2572
  std::string p = name;
2573
#else
2574
  std::filesystem::path p = name;
2575
#endif
2576
  dir->open(p);
2577
}
2578

2579
REDGPU_F_DECLSPEC void redFDirectoryOpenFromCurrentWorkingDirectory(RedFHandleDirectory handle, const char * path) {
2580
  ofDirectory * dir = (ofDirectory *)handle;
2581
  std::string name = path;
2582
#ifdef __linux__
2583
#warning
2584
  std::string p = name;
2585
#else
2586
  std::filesystem::path p = name;
2587
#endif
2588
  dir->openFromCWD(p);
2589
}
2590

2591
REDGPU_F_DECLSPEC void redFDirectoryClose(RedFHandleDirectory handle) {
2592
  ofDirectory * dir = (ofDirectory *)handle;
2593
  dir->close();
2594
}
2595

2596
REDGPU_F_DECLSPEC uint64_t redFDirectoryListDir(RedFHandleDirectory handle) {
2597
  ofDirectory * dir = (ofDirectory *)handle;
2598
  return dir->listDir();
2599
}
2600

2601
REDGPU_F_DECLSPEC RedFBool32 redFDirectoryCreate(RedFHandleDirectory handle, RedFBool32 recursiveDefaultIs0) {
2602
  ofDirectory * dir = (ofDirectory *)handle;
2603
  return (RedFBool32)dir->create(recursiveDefaultIs0);
2604
}
2605

2606
REDGPU_F_DECLSPEC RedFBool32 redFDirectoryExists(RedFHandleDirectory handle) {
2607
  ofDirectory * dir = (ofDirectory *)handle;
2608
  return (RedFBool32)dir->exists();
2609
}
2610

2611
REDGPU_F_DECLSPEC void redFDirectoryPath(RedFHandleDirectory handle, char ** outPath, uint64_t * outPathBytesCount) {
2612
  ofDirectory * dir = (ofDirectory *)handle;
2613
  std::string path = dir->path();
2614
  {
2615
    std::string s = path;
2616
    char * p = (char *)malloc(s.size() + 1);
2617
    if (p != NULL) {
2618
      std::copy(s.begin(), s.end(), p);
2619
      p[s.size()] = 0;
2620
    }
2621
    outPath[0] = p;
2622
  }
2623
  if (outPathBytesCount != NULL) {
2624
    outPathBytesCount[0] = path.size() + 1;
2625
  }
2626
}
2627

2628
REDGPU_F_DECLSPEC void redFDirectoryGetAbsolutePath(RedFHandleDirectory handle, char ** outAbsolutePath, uint64_t * outAbsolutePathBytesCount) {
2629
  ofDirectory * dir = (ofDirectory *)handle;
2630
  std::string absolute = dir->getAbsolutePath();
2631
  {
2632
    std::string s = absolute;
2633
    char * p = (char *)malloc(s.size() + 1);
2634
    if (p != NULL) {
2635
      std::copy(s.begin(), s.end(), p);
2636
      p[s.size()] = 0;
2637
    }
2638
    outAbsolutePath[0] = p;
2639
  }
2640
  if (outAbsolutePathBytesCount != NULL) {
2641
    outAbsolutePathBytesCount[0] = absolute.size() + 1;
2642
  }
2643
}
2644

2645
REDGPU_F_DECLSPEC RedFBool32 redFDirectoryCanRead(RedFHandleDirectory handle) {
2646
  ofDirectory * dir = (ofDirectory *)handle;
2647
  return (RedFBool32)dir->canRead();
2648
}
2649

2650
REDGPU_F_DECLSPEC RedFBool32 redFDirectoryCanWrite(RedFHandleDirectory handle) {
2651
  ofDirectory * dir = (ofDirectory *)handle;
2652
  return (RedFBool32)dir->canWrite();
2653
}
2654

2655
REDGPU_F_DECLSPEC RedFBool32 redFDirectoryCanExecute(RedFHandleDirectory handle) {
2656
  ofDirectory * dir = (ofDirectory *)handle;
2657
  return (RedFBool32)dir->canExecute();
2658
}
2659

2660
REDGPU_F_DECLSPEC RedFBool32 redFDirectoryIsDirectory(RedFHandleDirectory handle) {
2661
  ofDirectory * dir = (ofDirectory *)handle;
2662
  return (RedFBool32)dir->isDirectory();
2663
}
2664

2665
REDGPU_F_DECLSPEC RedFBool32 redFDirectoryIsHidden(RedFHandleDirectory handle) {
2666
  ofDirectory * dir = (ofDirectory *)handle;
2667
  return (RedFBool32)dir->isHidden();
2668
}
2669

2670
REDGPU_F_DECLSPEC void redFDirectorySetWriteable(RedFHandleDirectory handle, RedFBool32 writeableDefaultIs1) {
2671
  ofDirectory * dir = (ofDirectory *)handle;
2672
  dir->setWriteable(writeableDefaultIs1);
2673
}
2674

2675
REDGPU_F_DECLSPEC void redFDirectorySetReadable(RedFHandleDirectory handle, RedFBool32 readableDefaultIs1) {
2676
  ofDirectory * dir = (ofDirectory *)handle;
2677
  dir->setReadable(readableDefaultIs1);
2678
}
2679

2680
REDGPU_F_DECLSPEC void redFDirectorySetExecutable(RedFHandleDirectory handle, RedFBool32 executableDefaultIs1) {
2681
  ofDirectory * dir = (ofDirectory *)handle;
2682
  dir->setExecutable(executableDefaultIs1);
2683
}
2684

2685
REDGPU_F_DECLSPEC void redFDirectorySetShowHidden(RedFHandleDirectory handle, RedFBool32 showHidden) {
2686
  ofDirectory * dir = (ofDirectory *)handle;
2687
  dir->setShowHidden(showHidden);
2688
}
2689

2690
REDGPU_F_DECLSPEC RedFBool32 redFDirectoryCopyTo(RedFHandleDirectory handle, const char * path, RedFBool32 bRelativeToDataDefaultIs1, RedFBool32 overwriteDefaultIs0) {
2691
  ofDirectory * dir = (ofDirectory *)handle;
2692
  std::string name = path;
2693
#ifdef __linux__
2694
#warning
2695
  std::string p = name;
2696
#else
2697
  std::filesystem::path p = name;
2698
#endif
2699
  return (RedFBool32)dir->copyTo(p, bRelativeToDataDefaultIs1, overwriteDefaultIs0);
2700
}
2701

2702
REDGPU_F_DECLSPEC RedFBool32 redFDirectoryMoveTo(RedFHandleDirectory handle, const char * path, RedFBool32 bRelativeToDataDefaultIs1, RedFBool32 overwriteDefaultIs0) {
2703
  ofDirectory * dir = (ofDirectory *)handle;
2704
  std::string name = path;
2705
#ifdef __linux__
2706
#warning
2707
  std::string p = name;
2708
#else
2709
  std::filesystem::path p = name;
2710
#endif
2711
  return (RedFBool32)dir->moveTo(p, bRelativeToDataDefaultIs1, overwriteDefaultIs0);
2712
}
2713

2714
REDGPU_F_DECLSPEC RedFBool32 redFDirectoryRenameTo(RedFHandleDirectory handle, const char * path, RedFBool32 bRelativeToDataDefaultIs1, RedFBool32 overwriteDefaultIs0) {
2715
  ofDirectory * dir = (ofDirectory *)handle;
2716
  std::string name = path;
2717
#ifdef __linux__
2718
#warning
2719
  std::string p = name;
2720
#else
2721
  std::filesystem::path p = name;
2722
#endif
2723
  return (RedFBool32)dir->renameTo(p, bRelativeToDataDefaultIs1, overwriteDefaultIs0);
2724
}
2725

2726
REDGPU_F_DECLSPEC RedFBool32 redFDirectoryRemove(RedFHandleDirectory handle, RedFBool32 recursive) {
2727
  ofDirectory * dir = (ofDirectory *)handle;
2728
  return (RedFBool32)dir->remove(recursive);
2729
}
2730

2731
REDGPU_F_DECLSPEC void redFDirectoryAllowExt(RedFHandleDirectory handle, const char * extension) {
2732
  ofDirectory * dir = (ofDirectory *)handle;
2733
  std::string ext = extension;
2734
  dir->allowExt(ext);
2735
}
2736

2737
REDGPU_F_DECLSPEC void redFDirectoryGetOriginalDirectory(RedFHandleDirectory handle, char ** outOriginalDirectory, uint64_t * outOriginalDirectoryBytesCount) {
2738
  ofDirectory * dir = (ofDirectory *)handle;
2739
  std::string name = dir->getOriginalDirectory();
2740
  {
2741
    std::string s = name;
2742
    char * p = (char *)malloc(s.size() + 1);
2743
    if (p != NULL) {
2744
      std::copy(s.begin(), s.end(), p);
2745
      p[s.size()] = 0;
2746
    }
2747
    outOriginalDirectory[0] = p;
2748
  }
2749
  if (outOriginalDirectoryBytesCount != NULL) {
2750
    outOriginalDirectoryBytesCount[0] = name.size() + 1;
2751
  }
2752
}
2753

2754
REDGPU_F_DECLSPEC void redFDirectoryGetName(RedFHandleDirectory handle, uint64_t index, char ** outName, uint64_t * outNameBytesCount) {
2755
  ofDirectory * dir = (ofDirectory *)handle;
2756
  std::string name = dir->getName(index);
2757
  {
2758
    std::string s = name;
2759
    char * p = (char *)malloc(s.size() + 1);
2760
    if (p != NULL) {
2761
      std::copy(s.begin(), s.end(), p);
2762
      p[s.size()] = 0;
2763
    }
2764
    outName[0] = p;
2765
  }
2766
  if (outNameBytesCount != NULL) {
2767
    outNameBytesCount[0] = name.size() + 1;
2768
  }
2769
}
2770

2771
REDGPU_F_DECLSPEC void redFDirectoryGetPath(RedFHandleDirectory handle, uint64_t index, char ** outPath, uint64_t * outPathBytesCount) {
2772
  ofDirectory * dir = (ofDirectory *)handle;
2773
  std::string name = dir->getPath(index);
2774
  {
2775
    std::string s = name;
2776
    char * p = (char *)malloc(s.size() + 1);
2777
    if (p != NULL) {
2778
      std::copy(s.begin(), s.end(), p);
2779
      p[s.size()] = 0;
2780
    }
2781
    outPath[0] = p;
2782
  }
2783
  if (outPathBytesCount != NULL) {
2784
    outPathBytesCount[0] = name.size() + 1;
2785
  }
2786
}
2787

2788
REDGPU_F_DECLSPEC RedFBool32 redFDirectoryGetShowHidden(RedFHandleDirectory handle) {
2789
  ofDirectory * dir = (ofDirectory *)handle;
2790
  return (RedFBool32)dir->getShowHidden();
2791
}
2792

2793
REDGPU_F_DECLSPEC void redFDirectoryReset(RedFHandleDirectory handle) {
2794
  ofDirectory * dir = (ofDirectory *)handle;
2795
  dir->reset();
2796
}
2797

2798
REDGPU_F_DECLSPEC void redFDirectorySort(RedFHandleDirectory handle) {
2799
  ofDirectory * dir = (ofDirectory *)handle;
2800
  dir->sort();
2801
}
2802

2803
REDGPU_F_DECLSPEC void redFDirectorySortByDate(RedFHandleDirectory handle) {
2804
  ofDirectory * dir = (ofDirectory *)handle;
2805
  dir->sortByDate();
2806
}
2807

2808
REDGPU_F_DECLSPEC uint64_t redFDirectorySize(RedFHandleDirectory handle) {
2809
  ofDirectory * dir = (ofDirectory *)handle;
2810
  return dir->size();
2811
}
2812

2813
REDGPU_F_DECLSPEC uint64_t redFDirectoryGetFileCount(RedFHandleDirectory handle) {
2814
  ofDirectory * dir = (ofDirectory *)handle;
2815
  return dir->getFiles().size();
2816
}
2817

2818
REDGPU_F_DECLSPEC void redFDirectoryGetFilePath(RedFHandleDirectory handle, uint64_t index, char ** outPath, uint64_t * outPathBytesCount) {
2819
  ofDirectory * dir = (ofDirectory *)handle;
2820
  std::string name = dir->getFile(index).path();
2821
  {
2822
    std::string s = name;
2823
    char * p = (char *)malloc(s.size() + 1);
2824
    if (p != NULL) {
2825
      std::copy(s.begin(), s.end(), p);
2826
      p[s.size()] = 0;
2827
    }
2828
    outPath[0] = p;
2829
  }
2830
  if (outPathBytesCount != NULL) {
2831
    outPathBytesCount[0] = name.size() + 1;
2832
  }
2833
}
2834

2835
REDGPU_F_DECLSPEC void redFDirectoryGetFileExtension(RedFHandleDirectory handle, uint64_t index, char ** outExtension, uint64_t * outExtensionBytesCount) {
2836
  ofDirectory * dir = (ofDirectory *)handle;
2837
  std::string name = dir->getFile(index).getExtension();
2838
  {
2839
    std::string s = name;
2840
    char * p = (char *)malloc(s.size() + 1);
2841
    if (p != NULL) {
2842
      std::copy(s.begin(), s.end(), p);
2843
      p[s.size()] = 0;
2844
    }
2845
    outExtension[0] = p;
2846
  }
2847
  if (outExtensionBytesCount != NULL) {
2848
    outExtensionBytesCount[0] = name.size() + 1;
2849
  }
2850
}
2851

2852
REDGPU_F_DECLSPEC void redFDirectoryGetFileName(RedFHandleDirectory handle, uint64_t index, char ** outFileName, uint64_t * outFileNameBytesCount) {
2853
  ofDirectory * dir = (ofDirectory *)handle;
2854
  std::string name = dir->getFile(index).getFileName();
2855
  {
2856
    std::string s = name;
2857
    char * p = (char *)malloc(s.size() + 1);
2858
    if (p != NULL) {
2859
      std::copy(s.begin(), s.end(), p);
2860
      p[s.size()] = 0;
2861
    }
2862
    outFileName[0] = p;
2863
  }
2864
  if (outFileNameBytesCount != NULL) {
2865
    outFileNameBytesCount[0] = name.size() + 1;
2866
  }
2867
}
2868

2869
REDGPU_F_DECLSPEC void redFDirectoryGetFileBaseName(RedFHandleDirectory handle, uint64_t index, char ** outBaseName, uint64_t * outBaseNameBytesCount) {
2870
  ofDirectory * dir = (ofDirectory *)handle;
2871
  std::string name = dir->getFile(index).getBaseName();
2872
  {
2873
    std::string s = name;
2874
    char * p = (char *)malloc(s.size() + 1);
2875
    if (p != NULL) {
2876
      std::copy(s.begin(), s.end(), p);
2877
      p[s.size()] = 0;
2878
    }
2879
    outBaseName[0] = p;
2880
  }
2881
  if (outBaseNameBytesCount != NULL) {
2882
    outBaseNameBytesCount[0] = name.size() + 1;
2883
  }
2884
}
2885

2886
REDGPU_F_DECLSPEC void redFDirectoryGetFileEnclosingDirectory(RedFHandleDirectory handle, uint64_t index, char ** outEnclosingDirectory, uint64_t * outEnclosingDirectoryBytesCount) {
2887
  ofDirectory * dir = (ofDirectory *)handle;
2888
  std::string name = dir->getFile(index).getEnclosingDirectory();
2889
  {
2890
    std::string s = name;
2891
    char * p = (char *)malloc(s.size() + 1);
2892
    if (p != NULL) {
2893
      std::copy(s.begin(), s.end(), p);
2894
      p[s.size()] = 0;
2895
    }
2896
    outEnclosingDirectory[0] = p;
2897
  }
2898
  if (outEnclosingDirectoryBytesCount != NULL) {
2899
    outEnclosingDirectoryBytesCount[0] = name.size() + 1;
2900
  }
2901
}
2902

2903
REDGPU_F_DECLSPEC void redFDirectoryGetFileAbsolutePath(RedFHandleDirectory handle, uint64_t index, char ** outAbsolutePath, uint64_t * outAbsolutePathBytesCount) {
2904
  ofDirectory * dir = (ofDirectory *)handle;
2905
  std::string name = dir->getFile(index).getAbsolutePath();
2906
  {
2907
    std::string s = name;
2908
    char * p = (char *)malloc(s.size() + 1);
2909
    if (p != NULL) {
2910
      std::copy(s.begin(), s.end(), p);
2911
      p[s.size()] = 0;
2912
    }
2913
    outAbsolutePath[0] = p;
2914
  }
2915
  if (outAbsolutePathBytesCount != NULL) {
2916
    outAbsolutePathBytesCount[0] = name.size() + 1;
2917
  }
2918
}
2919

2920
REDGPU_F_DECLSPEC RedFBool32 redFDirectoryGetFileCanRead(RedFHandleDirectory handle, uint64_t index) {
2921
  ofDirectory * dir = (ofDirectory *)handle;
2922
  return (RedFBool32)dir->getFile(index).canRead();
2923
}
2924

2925
REDGPU_F_DECLSPEC RedFBool32 redFDirectoryGetFileCanWrite(RedFHandleDirectory handle, uint64_t index) {
2926
  ofDirectory * dir = (ofDirectory *)handle;
2927
  return (RedFBool32)dir->getFile(index).canWrite();
2928
}
2929

2930
REDGPU_F_DECLSPEC RedFBool32 redFDirectoryGetFileCanExecute(RedFHandleDirectory handle, uint64_t index) {
2931
  ofDirectory * dir = (ofDirectory *)handle;
2932
  return (RedFBool32)dir->getFile(index).canExecute();
2933
}
2934

2935
REDGPU_F_DECLSPEC RedFBool32 redFDirectoryGetFileIsFile(RedFHandleDirectory handle, uint64_t index) {
2936
  ofDirectory * dir = (ofDirectory *)handle;
2937
  return (RedFBool32)dir->getFile(index).isFile();
2938
}
2939

2940
REDGPU_F_DECLSPEC RedFBool32 redFDirectoryGetFileIsLink(RedFHandleDirectory handle, uint64_t index) {
2941
  ofDirectory * dir = (ofDirectory *)handle;
2942
  return (RedFBool32)dir->getFile(index).isLink();
2943
}
2944

2945
REDGPU_F_DECLSPEC RedFBool32 redFDirectoryGetFileIsDirectory(RedFHandleDirectory handle, uint64_t index) {
2946
  ofDirectory * dir = (ofDirectory *)handle;
2947
  return (RedFBool32)dir->getFile(index).isDirectory();
2948
}
2949

2950
REDGPU_F_DECLSPEC RedFBool32 redFDirectoryGetFileIsDevice(RedFHandleDirectory handle, uint64_t index) {
2951
  ofDirectory * dir = (ofDirectory *)handle;
2952
  return (RedFBool32)dir->getFile(index).isDevice();
2953
}
2954

2955
REDGPU_F_DECLSPEC RedFBool32 redFDirectoryGetFileIsHidden(RedFHandleDirectory handle, uint64_t index) {
2956
  ofDirectory * dir = (ofDirectory *)handle;
2957
  return (RedFBool32)dir->getFile(index).isHidden();
2958
}
2959

2960
REDGPU_F_DECLSPEC uint64_t redFDirectoryGetFileGetSize(RedFHandleDirectory handle, uint64_t index) {
2961
  ofDirectory * dir = (ofDirectory *)handle;
2962
  return dir->getFile(index).getSize();
2963
}
2964

2965
REDGPU_F_DECLSPEC RedFBool32 redFCreateDirectoryPath(const char * dirPath, RedFBool32 bRelativeToDataDefaultIs1, RedFBool32 recursiveDefaultIs0) {
2966
  std::string name = dirPath;
2967
#ifdef __linux__
2968
#warning
2969
  std::string p = name;
2970
#else
2971
  std::filesystem::path p = name;
2972
#endif
2973
  return (RedFBool32)ofDirectory::createDirectory(p, bRelativeToDataDefaultIs1, recursiveDefaultIs0);
2974
}
2975

2976
REDGPU_F_DECLSPEC RedFBool32 redFIsDirectoryEmpty(const char * dirPath, RedFBool32 bRelativeToDataDefaultIs1) {
2977
  std::string name = dirPath;
2978
#ifdef __linux__
2979
#warning
2980
  std::string p = name;
2981
#else
2982
  std::filesystem::path p = name;
2983
#endif
2984
  return (RedFBool32)ofDirectory::isDirectoryEmpty(p, bRelativeToDataDefaultIs1);
2985
}
2986

2987
REDGPU_F_DECLSPEC RedFBool32 redFDoesDirectoryExist(const char * dirPath, RedFBool32 bRelativeToDataDefaultIs1) {
2988
  std::string name = dirPath;
2989
#ifdef __linux__
2990
#warning
2991
  std::string p = name;
2992
#else
2993
  std::filesystem::path p = name;
2994
#endif
2995
  return (RedFBool32)ofDirectory::doesDirectoryExist(p, bRelativeToDataDefaultIs1);
2996
}
2997

2998
REDGPU_F_DECLSPEC RedFBool32 redFRemoveDirectory(const char * dirPath, RedFBool32 deleteIfNotEmpty, RedFBool32 bRelativeToDataDefaultIs1) {
2999
  std::string name = dirPath;
3000
#ifdef __linux__
3001
#warning
3002
  std::string p = name;
3003
#else
3004
  std::filesystem::path p = name;
3005
#endif
3006
  return (RedFBool32)ofDirectory::removeDirectory(p, deleteIfNotEmpty, bRelativeToDataDefaultIs1);
3007
}
3008

3009
REDGPU_F_DECLSPEC RedFBool32 redFCopyFileFromTo(const char * pathSrc, const char * pathDst, RedFBool32 bRelativeToDataDefaultIs1, RedFBool32 overwriteDefaultIs0) {
3010
  std::string nameSrc = pathSrc;
3011
  std::string nameDst = pathDst;
3012
#ifdef __linux__
3013
#warning
3014
  std::string src = nameSrc;
3015
  std::string dst = nameDst;
3016
#else
3017
  std::filesystem::path src = nameSrc;
3018
  std::filesystem::path dst = nameDst;
3019
#endif
3020
  return (RedFBool32)ofFile::copyFromTo(src, dst, bRelativeToDataDefaultIs1, overwriteDefaultIs0);
3021
}
3022

3023
REDGPU_F_DECLSPEC RedFBool32 redFMoveFileFromTo(const char * pathSrc, const char * pathDst, RedFBool32 bRelativeToDataDefaultIs1, RedFBool32 overwriteDefaultIs0) {
3024
  std::string nameSrc = pathSrc;
3025
  std::string nameDst = pathDst;
3026
#ifdef __linux__
3027
#warning
3028
  std::string src = nameSrc;
3029
  std::string dst = nameDst;
3030
#else
3031
  std::filesystem::path src = nameSrc;
3032
  std::filesystem::path dst = nameDst;
3033
#endif
3034
  return (RedFBool32)ofFile::moveFromTo(src, dst, bRelativeToDataDefaultIs1, overwriteDefaultIs0);
3035
}
3036

3037
REDGPU_F_DECLSPEC RedFBool32 redFDoesFileExist(const char * path, RedFBool32 bRelativeToDataDefaultIs1) {
3038
  std::string name = path;
3039
#ifdef __linux__
3040
#warning
3041
  std::string p = name;
3042
#else
3043
  std::filesystem::path p = name;
3044
#endif
3045
  return (RedFBool32)ofFile::doesFileExist(p, bRelativeToDataDefaultIs1);
3046
}
3047

3048
REDGPU_F_DECLSPEC RedFBool32 redFRemoveFile(const char * path, RedFBool32 bRelativeToDataDefaultIs1) {
3049
  std::string name = path;
3050
#ifdef __linux__
3051
#warning
3052
  std::string p = name;
3053
#else
3054
  std::filesystem::path p = name;
3055
#endif
3056
  return (RedFBool32)ofFile::removeFile(p, bRelativeToDataDefaultIs1);
3057
}
3058

3059
REDGPU_F_DECLSPEC void redFGetCurrentWorkingDirectory(char ** outPath, uint64_t * outPathBytesCount) {
3060
  std::string name = ofFilePath::getCurrentWorkingDirectory();
3061
  {
3062
    std::string s = name;
3063
    char * p = (char *)malloc(s.size() + 1);
3064
    if (p != NULL) {
3065
      std::copy(s.begin(), s.end(), p);
3066
      p[s.size()] = 0;
3067
    }
3068
    outPath[0] = p;
3069
  }
3070
  if (outPathBytesCount != NULL) {
3071
    outPathBytesCount[0] = name.size() + 1;
3072
  }
3073
}
3074

3075
REDGPU_F_DECLSPEC void redFGetCurrentExeDir(char ** outPath, uint64_t * outPathBytesCount) {
3076
  std::string name = ofFilePath::getCurrentExeDir();
3077
  {
3078
    std::string s = name;
3079
    char * p = (char *)malloc(s.size() + 1);
3080
    if (p != NULL) {
3081
      std::copy(s.begin(), s.end(), p);
3082
      p[s.size()] = 0;
3083
    }
3084
    outPath[0] = p;
3085
  }
3086
  if (outPathBytesCount != NULL) {
3087
    outPathBytesCount[0] = name.size() + 1;
3088
  }
3089
}
3090

3091
REDGPU_F_DECLSPEC void redFGetCurrentExePath(char ** outPath, uint64_t * outPathBytesCount) {
3092
  std::string name = ofFilePath::getCurrentExePath();
3093
  {
3094
    std::string s = name;
3095
    char * p = (char *)malloc(s.size() + 1);
3096
    if (p != NULL) {
3097
      std::copy(s.begin(), s.end(), p);
3098
      p[s.size()] = 0;
3099
    }
3100
    outPath[0] = p;
3101
  }
3102
  if (outPathBytesCount != NULL) {
3103
    outPathBytesCount[0] = name.size() + 1;
3104
  }
3105
}
3106

3107
REDGPU_F_DECLSPEC void redFGetUserHomeDir(char ** outPath, uint64_t * outPathBytesCount) {
3108
  std::string name = ofFilePath::getUserHomeDir();
3109
  {
3110
    std::string s = name;
3111
    char * p = (char *)malloc(s.size() + 1);
3112
    if (p != NULL) {
3113
      std::copy(s.begin(), s.end(), p);
3114
      p[s.size()] = 0;
3115
    }
3116
    outPath[0] = p;
3117
  }
3118
  if (outPathBytesCount != NULL) {
3119
    outPathBytesCount[0] = name.size() + 1;
3120
  }
3121
}
3122

3123
REDGPU_F_DECLSPEC void redFThreadSetProcedure(RedFHandleThread handle, void (*procedure)(void)) {
3124
  RedFThread * thread = (RedFThread *)handle;
3125
  thread->procedure = procedure;
3126
}
3127

3128
REDGPU_F_DECLSPEC RedFBool32 redFThreadIsRunning(RedFHandleThread handle) {
3129
  RedFThread * thread = (RedFThread *)handle;
3130
  return (RedFBool32)thread->isThreadRunning();
3131
}
3132

3133
REDGPU_F_DECLSPEC void redFThreadGetName(RedFHandleThread handle, char ** outName, uint64_t * outNameBytesCount) {
3134
  RedFThread * thread = (RedFThread *)handle;
3135
  std::string name = thread->getThreadName();
3136
  {
3137
    std::string s = name;
3138
    char * p = (char *)malloc(s.size() + 1);
3139
    if (p != NULL) {
3140
      std::copy(s.begin(), s.end(), p);
3141
      p[s.size()] = 0;
3142
    }
3143
    outName[0] = p;
3144
  }
3145
  if (outNameBytesCount != NULL) {
3146
    outNameBytesCount[0] = name.size() + 1;
3147
  }
3148
}
3149

3150
REDGPU_F_DECLSPEC void redFThreadSetName(RedFHandleThread handle, const char * name) {
3151
  RedFThread * thread = (RedFThread *)handle;
3152
  std::string n = name;
3153
  thread->setThreadName(n);
3154
}
3155

3156
REDGPU_F_DECLSPEC void redFThreadStart(RedFHandleThread handle) {
3157
  RedFThread * thread = (RedFThread *)handle;
3158
  thread->startThread();
3159
}
3160

3161
REDGPU_F_DECLSPEC RedFBool32 redFThreadLock(RedFHandleThread handle) {
3162
  RedFThread * thread = (RedFThread *)handle;
3163
  return (RedFBool32)thread->lock();
3164
}
3165

3166
REDGPU_F_DECLSPEC RedFBool32 redFThreadTryLock(RedFHandleThread handle) {
3167
  RedFThread * thread = (RedFThread *)handle;
3168
  return (RedFBool32)thread->tryLock();
3169
}
3170

3171
REDGPU_F_DECLSPEC void redFThreadUnlock(RedFHandleThread handle) {
3172
  RedFThread * thread = (RedFThread *)handle;
3173
  thread->unlock();
3174
}
3175

3176
REDGPU_F_DECLSPEC void redFThreadStop(RedFHandleThread handle) {
3177
  RedFThread * thread = (RedFThread *)handle;
3178
  thread->stopThread();
3179
}
3180

3181
REDGPU_F_DECLSPEC void redFThreadWaitFor(RedFHandleThread handle, RedFBool32 callStopThreadDefaultIs1, long millisecondsDefaultIsMinus1ForInfiniteJoinTimeout) {
3182
  RedFThread * thread = (RedFThread *)handle;
3183
  thread->waitForThread(callStopThreadDefaultIs1, millisecondsDefaultIsMinus1ForInfiniteJoinTimeout);
3184
}
3185

3186
REDGPU_F_DECLSPEC void redFThreadSleep(RedFHandleThread handle, long milliseconds) {
3187
  RedFThread * thread = (RedFThread *)handle;
3188
  thread->sleep(milliseconds);
3189
}
3190

3191
REDGPU_F_DECLSPEC void redFThreadYield(RedFHandleThread handle) {
3192
  RedFThread * thread = (RedFThread *)handle;
3193
  thread->yield();
3194
}
3195

3196
REDGPU_F_DECLSPEC RedFBool32 redFThreadIsCurrent(RedFHandleThread handle) {
3197
  RedFThread * thread = (RedFThread *)handle;
3198
  return (RedFBool32)thread->isCurrentThread();
3199
}
3200

3201
REDGPU_F_DECLSPEC RedFBool32 redFThreadChannelSend(RedFHandleThreadChannel handle, void * value) {
3202
  ofThreadChannel<void *> * channel = (ofThreadChannel<void *> *)handle;
3203
  void * sends = value;
3204
  return (RedFBool32)channel->send(sends);
3205
}
3206

3207
REDGPU_F_DECLSPEC RedFBool32 redFThreadChannelReceive(RedFHandleThreadChannel handle, void ** outSentValue) {
3208
  ofThreadChannel<void *> * channel = (ofThreadChannel<void *> *)handle;
3209
  void * received = NULL;
3210
  RedFBool32 b = (RedFBool32)channel->receive(received);
3211
  outSentValue[0] = received;
3212
  return b;
3213
}
3214

3215
REDGPU_F_DECLSPEC RedFBool32 redFThreadChannelTryReceive(RedFHandleThreadChannel handle, void ** outSentValue) {
3216
  ofThreadChannel<void *> * channel = (ofThreadChannel<void *> *)handle;
3217
  void * received = NULL;
3218
  RedFBool32 b = (RedFBool32)channel->tryReceive(received);
3219
  outSentValue[0] = received;
3220
  return b;
3221
}
3222

3223
REDGPU_F_DECLSPEC RedFBool32 redFThreadChannelTryReceiveWithTimeout(RedFHandleThreadChannel handle, void ** outSentValue, int64_t timeoutMs) {
3224
  ofThreadChannel<void *> * channel = (ofThreadChannel<void *> *)handle;
3225
  void * received = NULL;
3226
  RedFBool32 b = (RedFBool32)channel->tryReceive(received, timeoutMs);
3227
  outSentValue[0] = received;
3228
  return b;
3229
}
3230

3231
REDGPU_F_DECLSPEC RedFBool32 redFThreadChannelEmpty(RedFHandleThreadChannel handle) {
3232
  ofThreadChannel<void *> * channel = (ofThreadChannel<void *> *)handle;
3233
  return (RedFBool32)channel->empty();
3234
}
3235

3236
REDGPU_F_DECLSPEC void redFThreadChannelClose(RedFHandleThreadChannel handle) {
3237
  ofThreadChannel<void *> * channel = (ofThreadChannel<void *> *)handle;
3238
  channel->close();
3239
}
3240

3241
REDGPU_F_DECLSPEC RedFBool32 redFEventParametersKeyHasModifier(RedFHandleEventParametersKey parameters, int modifier) {
3242
  return (RedFBool32)((ofKeyEventArgs *)parameters)->hasModifier(modifier);
3243
}
3244

3245
REDGPU_F_DECLSPEC unsigned redFEventParametersKeyGetCodepoint(RedFHandleEventParametersKey parameters) {
3246
  return ((ofKeyEventArgs *)parameters)->codepoint;
3247
}
3248

3249
REDGPU_F_DECLSPEC RedFBool32 redFEventParametersKeyIsRepeat(RedFHandleEventParametersKey parameters) {
3250
  return (RedFBool32)((ofKeyEventArgs *)parameters)->isRepeat;
3251
}
3252

3253
REDGPU_F_DECLSPEC int redFEventParametersKeyGetKey(RedFHandleEventParametersKey parameters) {
3254
  return ((ofKeyEventArgs *)parameters)->key;
3255
}
3256

3257
REDGPU_F_DECLSPEC int redFEventParametersKeyGetKeycode(RedFHandleEventParametersKey parameters) {
3258
  return ((ofKeyEventArgs *)parameters)->keycode;
3259
}
3260

3261
REDGPU_F_DECLSPEC int redFEventParametersKeyGetModifiers(RedFHandleEventParametersKey parameters) {
3262
  return ((ofKeyEventArgs *)parameters)->modifiers;
3263
}
3264

3265
REDGPU_F_DECLSPEC int redFEventParametersKeyGetScancode(RedFHandleEventParametersKey parameters) {
3266
  return ((ofKeyEventArgs *)parameters)->scancode;
3267
}
3268

3269
REDGPU_F_DECLSPEC RedFKeyEventType redFEventParametersKeyGetEventType(RedFHandleEventParametersKey parameters) {
3270
  return (RedFKeyEventType)((ofKeyEventArgs *)parameters)->type;
3271
}
3272

3273
REDGPU_F_DECLSPEC RedFBool32 redFEventParametersMouseHasModifier(RedFHandleEventParametersMouse parameters, int modifier) {
3274
  return (RedFBool32)((ofMouseEventArgs *)parameters)->hasModifier(modifier);
3275
}
3276

3277
REDGPU_F_DECLSPEC float redFEventParametersMouseGetX(RedFHandleEventParametersMouse parameters) {
3278
  return ((ofMouseEventArgs *)parameters)->x;
3279
}
3280

3281
REDGPU_F_DECLSPEC float redFEventParametersMouseGetY(RedFHandleEventParametersMouse parameters) {
3282
  return ((ofMouseEventArgs *)parameters)->y;
3283
}
3284

3285
REDGPU_F_DECLSPEC int redFEventParametersMouseGetButton(RedFHandleEventParametersMouse parameters) {
3286
  return ((ofMouseEventArgs *)parameters)->button;
3287
}
3288

3289
REDGPU_F_DECLSPEC int redFEventParametersMouseGetModifiers(RedFHandleEventParametersMouse parameters) {
3290
  return ((ofMouseEventArgs *)parameters)->modifiers;
3291
}
3292

3293
REDGPU_F_DECLSPEC float redFEventParametersMouseGetScrollX(RedFHandleEventParametersMouse parameters) {
3294
  return ((ofMouseEventArgs *)parameters)->scrollX;
3295
}
3296

3297
REDGPU_F_DECLSPEC float redFEventParametersMouseGetScrollY(RedFHandleEventParametersMouse parameters) {
3298
  return ((ofMouseEventArgs *)parameters)->scrollY;
3299
}
3300

3301
REDGPU_F_DECLSPEC RedFMouseEventType redFEventParametersMouseGetEventType(RedFHandleEventParametersMouse parameters) {
3302
  return (RedFMouseEventType)((ofMouseEventArgs *)parameters)->type;
3303
}
3304

3305
REDGPU_F_DECLSPEC int redFEventParametersResizeGetWidth(RedFHandleEventParametersResize parameters) {
3306
  return ((ofResizeEventArgs *)parameters)->width;
3307
}
3308

3309
REDGPU_F_DECLSPEC int redFEventParametersResizeGetHeight(RedFHandleEventParametersResize parameters) {
3310
  return ((ofResizeEventArgs *)parameters)->height;
3311
}
3312

3313
REDGPU_F_DECLSPEC uint64_t redFEventParametersDragGetFilesCount(RedFHandleEventParametersDrag parameters) {
3314
  uint64_t out = ((ofDragInfo *)parameters)->files.size();
3315
  return out;
3316
}
3317

3318
REDGPU_F_DECLSPEC const char * redFEventParametersDragGetFile(RedFHandleEventParametersDrag parameters, uint64_t fileIndex) {
3319
  const char * out = ((ofDragInfo *)parameters)->files[fileIndex].c_str();
3320
  return out;
3321
}
3322

3323
REDGPU_F_DECLSPEC void redFEventParametersDragGetFileW(RedFHandleEventParametersDrag parameters, uint64_t fileIndex, wchar_t ** outPath, uint64_t * outPathBytesCount) {
3324
  std::string name = ((ofDragInfo *)parameters)->files[fileIndex];
3325
  std::wstring ws;
3326
  {
3327
    if (!name.empty()) {
3328
#ifdef _WIN32
3329
      ws = CA2W(name.c_str(), CP_UTF8);
3330
#else
3331
      ws = s2ws(name);
3332
#endif
3333
    }
3334
    wchar_t * p = (wchar_t *)malloc((ws.size() + 1) * sizeof(wchar_t));
3335
    if (p != NULL) {
3336
      for (size_t i = 0, count = ws.size(); i < count; i += 1) {
3337
        p[i] = ws[i];
3338
      }
3339
      p[ws.size()] = 0;
3340
    }
3341
    outPath[0] = p;
3342
  }
3343
  if (outPathBytesCount != NULL) {
3344
    outPathBytesCount[0] = (ws.size() + 1) * sizeof(wchar_t);
3345
  }
3346
}
3347

3348
REDGPU_F_DECLSPEC float redFEventParametersDragGetPositionX(RedFHandleEventParametersDrag parameters) {
3349
  return ((ofDragInfo *)parameters)->position.x;
3350
}
3351

3352
REDGPU_F_DECLSPEC float redFEventParametersDragGetPositionY(RedFHandleEventParametersDrag parameters) {
3353
  return ((ofDragInfo *)parameters)->position.y;
3354
}
3355

3356
REDGPU_F_DECLSPEC RedFBool32 redFGetMousePressed(int button) {
3357
  return (RedFBool32)ofGetMousePressed(button);
3358
}
3359

3360
REDGPU_F_DECLSPEC int redFGetMouseX(void) {
3361
  return ofGetMouseX();
3362
}
3363

3364
REDGPU_F_DECLSPEC int redFGetMouseY(void) {
3365
  return ofGetMouseY();
3366
}
3367

3368
REDGPU_F_DECLSPEC int redFGetPreviousMouseX(void) {
3369
  return ofGetPreviousMouseX();
3370
}
3371

3372
REDGPU_F_DECLSPEC int redFGetPreviousMouseY(void) {
3373
  return ofGetPreviousMouseY();
3374
}
3375

3376
REDGPU_F_DECLSPEC void redFPushMatrix(void) {
3377
  ofPushMatrix();
3378
}
3379

3380
REDGPU_F_DECLSPEC void redFMultMatrix(void * mat4) {
3381
  glm::mat4 m = glm::make_mat4((float *)mat4);
3382
  ofMultMatrix(m);
3383
}
3384

3385
REDGPU_F_DECLSPEC void redFMultViewMatrix(void * mat4) {
3386
  glm::mat4 m = glm::make_mat4((float *)mat4);
3387
  ofMultViewMatrix(m);
3388
}
3389

3390
REDGPU_F_DECLSPEC void redFScale(float x, float y, float z) {
3391
  ofScale(x, y, z);
3392
}
3393

3394
REDGPU_F_DECLSPEC void redFRotateDeg(float degrees, float axisX, float axisY, float axisZ) {
3395
  if (axisX == 0 && axisY == 0 && axisZ == 0) {
3396
    return;
3397
  }
3398
  ofRotateDeg(degrees, axisX, axisY, axisZ);
3399
}
3400

3401
REDGPU_F_DECLSPEC void redFTranslate(float x, float y, float z) {
3402
  ofTranslate(x, y, z);
3403
}
3404

3405
REDGPU_F_DECLSPEC void redFPopMatrix(void) {
3406
  ofPopMatrix();
3407
}
3408

3409
REDGPU_F_DECLSPEC void redFSetMatrixMode(RedFMatrixMode matrixMode) {
3410
  ofSetMatrixMode((ofMatrixMode)matrixMode);
3411
}
3412

3413
REDGPU_F_DECLSPEC void redFLoadMatrix(void * mat4) {
3414
  ofLoadMatrix((const float *)mat4);
3415
}
3416

3417
REDGPU_F_DECLSPEC void redFLoadViewMatrix(void * mat4) {
3418
  glm::mat4 m = glm::make_mat4((float *)mat4);
3419
  ofLoadViewMatrix(m);
3420
}
3421

3422
REDGPU_F_DECLSPEC void redFPushView(void) {
3423
  ofPushView();
3424
}
3425

3426
REDGPU_F_DECLSPEC void redFPopView(void) {
3427
  ofPopView();
3428
}
3429

3430
REDGPU_F_DECLSPEC void redFPushStyle(void) {
3431
  ofPushStyle();
3432
}
3433

3434
REDGPU_F_DECLSPEC void redFBackground(int r, int g, int b, int a) {
3435
  ofBackground(r, g, b, a);
3436
}
3437

3438
REDGPU_F_DECLSPEC void redFFill(void) {
3439
  ofFill();
3440
}
3441

3442
REDGPU_F_DECLSPEC void redFNoFill(void) {
3443
  ofNoFill();
3444
}
3445

3446
REDGPU_F_DECLSPEC void redFSetColor(int r, int g, int b, int a) {
3447
  ofSetColor(r, g, b, a);
3448
}
3449

3450
REDGPU_F_DECLSPEC void redFSetLineWidth(float width) {
3451
  ofSetLineWidth(width);
3452
}
3453

3454
REDGPU_F_DECLSPEC void redFPopStyle(void) {
3455
  ofPopStyle();
3456
}
3457

3458
REDGPU_F_DECLSPEC void redFDrawTriangle(float x0, float y0, float z0, float x1, float y1, float z1, float x2, float y2, float z2) {
3459
  glm::vec3 p0;
3460
  p0.x = x0;
3461
  p0.y = y0;
3462
  p0.z = z0;
3463
  glm::vec3 p1;
3464
  p1.x = x1;
3465
  p1.y = y1;
3466
  p1.z = z1;
3467
  glm::vec3 p2;
3468
  p2.x = x2;
3469
  p2.y = y2;
3470
  p2.z = z2;
3471
  ofDrawTriangle(p0, p1, p2);
3472
}
3473

3474
REDGPU_F_DECLSPEC void redFDrawSphere(float x, float y, float z, float radius) {
3475
  ofDrawSphere(x, y, z, radius);
3476
}
3477

3478
REDGPU_F_DECLSPEC void redFDrawBox(float x, float y, float z, float width, float height, float depth) {
3479
  ofDrawBox(x, y, z, width, height, depth);
3480
}
3481

3482
REDGPU_F_DECLSPEC void redFDrawPlane(float x, float y, float z, float width, float height) {
3483
  ofDrawPlane(x, y, z, width, height);
3484
}
3485

3486
REDGPU_F_DECLSPEC void redFDrawBoxPrimitive(float x, float y, float z, float qx, float qy, float qz, float qw, float width, float height, float depth, int resWidth, int resHeight, int resDepth, RedFBool32 wireframe, int r, int g, int b, int a) {
3487
  ofBoxPrimitive box;
3488
  box.set(width, height, depth);
3489
  box.setResolution(resWidth, resHeight, resDepth);
3490
  ofColor color;
3491
  color.r = r;
3492
  color.g = g;
3493
  color.b = b;
3494
  color.a = a;
3495
  box.setSideColor(ofBoxPrimitive::SIDE_FRONT, color);
3496
  box.setSideColor(ofBoxPrimitive::SIDE_RIGHT, color);
3497
  box.setSideColor(ofBoxPrimitive::SIDE_LEFT, color);
3498
  box.setSideColor(ofBoxPrimitive::SIDE_BACK, color);
3499
  box.setSideColor(ofBoxPrimitive::SIDE_TOP, color);
3500
  box.setSideColor(ofBoxPrimitive::SIDE_BOTTOM, color);
3501
  glm::quat orientation;
3502
  orientation.x = qx;
3503
  orientation.y = qy;
3504
  orientation.z = qz;
3505
  orientation.w = qw;
3506
  box.setOrientation(orientation);
3507
  box.setPosition(x, y, z);
3508
  if (wireframe == 1) {
3509
    box.drawWireframe();
3510
  } else {
3511
    box.draw();
3512
  }
3513
}
3514

3515
REDGPU_F_DECLSPEC void redFDrawPlanePrimitive(float x, float y, float z, float qx, float qy, float qz, float qw, float width, float height, int resWidth, int resHeight, RedFBool32 wireframe) {
3516
  ofPlanePrimitive plane;
3517
  plane.set(width, height);
3518
  plane.setResolution(resWidth, resHeight);
3519
  glm::quat orientation;
3520
  orientation.x = qx;
3521
  orientation.y = qy;
3522
  orientation.z = qz;
3523
  orientation.w = qw;
3524
  plane.setOrientation(orientation);
3525
  plane.setPosition(x, y, z);
3526
  if (wireframe == 1) {
3527
    plane.drawWireframe();
3528
  } else {
3529
    plane.draw();
3530
  }
3531
}
3532

3533
REDGPU_F_DECLSPEC void redFGetBoxPrimitiveMesh(float width, float height, float depth, int resWidth, int resHeight, int resDepth, RedFHandleMesh replaceMesh) {
3534
  ofBoxPrimitive box;
3535
  box.set(width, height, depth);
3536
  box.setResolution(resWidth, resHeight, resDepth);
3537
  ofMesh mesh = box.getMesh();
3538
  ofMesh * out = (ofMesh *)replaceMesh;
3539
  out[0] = mesh;
3540
}
3541

3542
REDGPU_F_DECLSPEC void redFGetPlanePrimitiveMesh(float width, float height, int resWidth, int resHeight, RedFHandleMesh replaceMesh) {
3543
  ofPlanePrimitive plane;
3544
  plane.set(width, height);
3545
  plane.setResolution(resWidth, resHeight);
3546
  ofMesh mesh = plane.getMesh();
3547
  ofMesh * out = (ofMesh *)replaceMesh;
3548
  out[0] = mesh;
3549
}
3550

3551
REDGPU_F_DECLSPEC void redFDrawLine(float x0, float y0, float z0, float x1, float y1, float z1) {
3552
  ofDrawLine(x0, y0, z0, x1, y1, z1);
3553
}
3554

3555
REDGPU_F_DECLSPEC void redFDrawCircle(float x, float y, float z, float radius) {
3556
  ofDrawCircle(x, y, z, radius);
3557
}
3558

3559
REDGPU_F_DECLSPEC void redFDrawRectangle(float x, float y, float z, float w, float h) {
3560
  ofDrawRectangle(x, y, z, w, h);
3561
}
3562

3563
REDGPU_F_DECLSPEC void redFDrawRectRounded(float x, float y, float z, float w, float h, float topLeftRadius, float topRightRadius, float bottomRightRadius, float bottomLeftRadius) {
3564
  ofDrawRectRounded(x, y, z, w, h, topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius);
3565
}
3566

3567
REDGPU_F_DECLSPEC void redFDrawCurve(float x0, float y0, float z0, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3) {
3568
  ofDrawCurve(x0, y0, z0, x1, y1, z1, x2, y2, z2, x3, y3, z3);
3569
}
3570

3571
REDGPU_F_DECLSPEC void redFDrawBezier(float x0, float y0, float z0, float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3) {
3572
  ofDrawBezier(x0, y0, z0, x1, y1, z1, x2, y2, z2, x3, y3, z3);
3573
}
3574

3575
REDGPU_F_DECLSPEC void redFDrawBitmapString(const char * string, float x, float y, float z) {
3576
  std::string s = string;
3577
  ofDrawBitmapString(s, x, y, z);
3578
}
3579

3580
REDGPU_F_DECLSPEC void redFDrawBitmapStringHighlight(const char * string, float x, float y, float z, int bgR, int bgG, int bgB, int bgA, int fgR, int fgG, int fgB, int fgA) {
3581
  std::string s = string;
3582
  glm::vec3 p;
3583
  p.x = x;
3584
  p.y = y;
3585
  p.z = z;
3586
  ofColor bg;
3587
  bg.r = bgR;
3588
  bg.g = bgG;
3589
  bg.b = bgB;
3590
  bg.a = bgA;
3591
  ofColor fg;
3592
  fg.r = fgR;
3593
  fg.g = fgG;
3594
  fg.b = fgB;
3595
  fg.a = fgA;
3596
  ofDrawBitmapStringHighlight(s, p, bg, fg);
3597
}
3598

3599
REDGPU_F_DECLSPEC void redFEnableAlphaBlending(void) {
3600
  ofEnableAlphaBlending();
3601
}
3602

3603
REDGPU_F_DECLSPEC void redFDisableAlphaBlending(void) {
3604
  ofDisableAlphaBlending();
3605
}
3606

3607
REDGPU_F_DECLSPEC void redFEnableAntiAliasing(void) {
3608
  ofEnableAntiAliasing();
3609
}
3610

3611
REDGPU_F_DECLSPEC void redFDisableAntiAliasing(void) {
3612
  ofDisableAntiAliasing();
3613
}
3614

3615
REDGPU_F_DECLSPEC void redFEnableBlendMode(RedFBlendMode blendMode) {
3616
  ofEnableBlendMode((ofBlendMode)blendMode);
3617
}
3618

3619
REDGPU_F_DECLSPEC void redFDisableBlendMode(void) {
3620
  ofDisableBlendMode();
3621
}
3622

3623
REDGPU_F_DECLSPEC void redFEnableDepthTest(void) {
3624
  ofEnableDepthTest();
3625
}
3626

3627
REDGPU_F_DECLSPEC void redFDisableDepthTest(void) {
3628
  ofDisableDepthTest();
3629
}
3630

3631
REDGPU_F_DECLSPEC void redFGetClipboardStringChars(char ** outString, uint64_t * outStringBytesCount) {
3632
  std::string clipboard = ofGetClipboardString();
3633
  {
3634
    std::string s = clipboard;
3635
    char * p = (char *)malloc(s.size() + 1);
3636
    if (p != NULL) {
3637
      std::copy(s.begin(), s.end(), p);
3638
      p[s.size()] = 0;
3639
    }
3640
    outString[0] = p;
3641
  }
3642
  if (outStringBytesCount != NULL) {
3643
    outStringBytesCount[0] = clipboard.size() + 1;
3644
  }
3645
}
3646

3647
REDGPU_F_DECLSPEC void redFSetClipboardString(const char * string) {
3648
  std::string clipboard = string;
3649
  ofSetClipboardString(clipboard);
3650
}
3651

3652
REDGPU_F_DECLSPEC void redFShowCursor(void) {
3653
  ofShowCursor();
3654
}
3655

3656
REDGPU_F_DECLSPEC void redFHideCursor(void) {
3657
  ofHideCursor();
3658
}
3659

3660
#ifdef _WIN32
3661
REDGPU_F_DECLSPEC unsigned long redFGetX11Window(void) {
3662
  return 0;
3663
}
3664

3665
REDGPU_F_DECLSPEC void * redFGetX11Display(void) {
3666
  return NULL;
3667
}
3668
#endif
3669
#ifdef __linux__
3670
REDGPU_F_DECLSPEC unsigned long redFGetX11Window(void) {
3671
  return (unsigned long)ofGetX11Window();
3672
}
3673

3674
REDGPU_F_DECLSPEC void * redFGetX11Display(void) {
3675
  return (void *)ofGetX11Display();
3676
}
3677
#endif
3678

3679
REDGPU_F_DECLSPEC void redFSetFrameRate(int targetRate) {
3680
  ofSetFrameRate(targetRate);
3681
}
3682

3683
REDGPU_F_DECLSPEC void redFSetVerticalSync(RedFBool32 sync) {
3684
  ofSetVerticalSync(sync);
3685
}
3686

3687
REDGPU_F_DECLSPEC void redFSetFullscreen(RedFBool32 fullscreen) {
3688
  ofSetFullscreen(fullscreen);
3689
}
3690

3691
REDGPU_F_DECLSPEC int redFGetWidth(void) {
3692
  return ofGetWidth();
3693
}
3694

3695
REDGPU_F_DECLSPEC int redFGetHeight(void) {
3696
  return ofGetHeight();
3697
}
3698

3699
REDGPU_F_DECLSPEC RedFBool32 redFIsVFlipped(void) {
3700
  return (RedFBool32)ofIsVFlipped();
3701
}
3702

3703
REDGPU_F_DECLSPEC float redFGetNativeViewportX(void) {
3704
  return ofGetNativeViewport().x;
3705
}
3706

3707
REDGPU_F_DECLSPEC float redFGetNativeViewportY(void) {
3708
  return ofGetNativeViewport().y;
3709
}
3710

3711
REDGPU_F_DECLSPEC float redFGetNativeViewportWidth(void) {
3712
  return ofGetNativeViewport().width;
3713
}
3714

3715
REDGPU_F_DECLSPEC float redFGetNativeViewportHeight(void) {
3716
  return ofGetNativeViewport().height;
3717
}
3718

3719
REDGPU_F_DECLSPEC void redFViewport(float x, float y, float width, float height, RedFBool32 vFlip) {
3720
  ofViewport(x, y, width, height, vFlip);
3721
}
3722

3723
REDGPU_F_DECLSPEC void redFSetClearDepthValue(float depth) {
3724
  glClearDepth(depth);
3725
}
3726

3727
REDGPU_F_DECLSPEC void redFSetDepthFunc(unsigned func) {
3728
  glDepthFunc(func);
3729
}
3730

3731
REDGPU_F_DECLSPEC void redFColorMask(RedFBool32 r, RedFBool32 g, RedFBool32 b, RedFBool32 a) {
3732
  glColorMask(r, g, b, a);
3733
}
3734

3735
REDGPU_F_DECLSPEC void redFClear(float r, float g, float b, float a) {
3736
  ofClear(r, g, b, a);
3737
}
3738

3739
REDGPU_F_DECLSPEC void redFClearAlpha(void) {
3740
  ofClearAlpha();
3741
}
3742

3743
REDGPU_F_DECLSPEC void redFEnableLighting(void) {
3744
  ofEnableLighting();
3745
}
3746

3747
REDGPU_F_DECLSPEC void redFDisableLighting(void) {
3748
  ofDisableLighting();
3749
}
3750

3751
REDGPU_F_DECLSPEC RedFBool32 redFGetLightingEnabled(void) {
3752
  return (RedFBool32)ofGetLightingEnabled();
3753
}
3754

3755
REDGPU_F_DECLSPEC void redFEnableSeparateSpecularLight(void) {
3756
  ofEnableSeparateSpecularLight();
3757
}
3758

3759
REDGPU_F_DECLSPEC void redFDisableSeparateSpecularLight(void) {
3760
  ofDisableSeparateSpecularLight();
3761
}
3762

3763
REDGPU_F_DECLSPEC void redFSetGlobalAmbientColor(float r, float g, float b, float a) {
3764
  ofSetGlobalAmbientColor(ofFloatColor(r, g, b, a));
3765
}
3766

3767
REDGPU_F_DECLSPEC void redFGetGlobalAmbientColor(void * outVec4) {
3768
  ofFloatColor out = ofGetGlobalAmbientColor();
3769
  float * outFloats = (float *)outVec4;
3770
  outFloats[0] = out.r;
3771
  outFloats[1] = out.g;
3772
  outFloats[2] = out.b;
3773
  outFloats[3] = out.a;
3774
}
3775

3776
REDGPU_F_DECLSPEC void redFSetSmoothLighting(RedFBool32 enable) {
3777
  ofSetSmoothLighting(enable);
3778
}
3779

3780
REDGPU_F_DECLSPEC void redFEnableCulling(unsigned mode) {
3781
  glEnable(GL_CULL_FACE);
3782
  glCullFace(mode);
3783
}
3784

3785
REDGPU_F_DECLSPEC void redFDisableCulling(void) {
3786
  glDisable(GL_CULL_FACE);
3787
}
3788

3789
REDGPU_F_DECLSPEC void redFSaveScreenToPng(const char * fileName) {
3790
  std::string path = fileName;
3791
  ofSaveScreen(path);
3792
}
3793

3794
REDGPU_F_DECLSPEC void redFSaveScreenRawToMemory(int x, int y, int width, int height, void * out8BitRGBAPixels) {
3795
  // NOTE(Constantine): Won't work for OpenGL ES.
3796
  glPixelStorei(0x0D05, 1); // GL_PACK_ALIGNMENT
3797
  glReadPixels(x, y, width, height, 0x1908, 0x1401, out8BitRGBAPixels);
3798
}
3799

3800
REDGPU_F_DECLSPEC float redFGetElapsedTimef(void) {
3801
  return ofGetElapsedTimef();
3802
}
3803

3804
REDGPU_F_DECLSPEC uint64_t redFGetElapsedTimeMillis(void) {
3805
  return ofGetElapsedTimeMillis();
3806
}
3807

3808
REDGPU_F_DECLSPEC uint64_t redFGetElapsedTimeMicros(void) {
3809
  return ofGetElapsedTimeMicros();
3810
}
3811

3812
REDGPU_F_DECLSPEC void redFResetElapsedTimeCounter(void) {
3813
  ofResetElapsedTimeCounter();
3814
}
3815

3816
REDGPU_F_DECLSPEC double redFGetLastFrameTime(void) {
3817
  return ofGetLastFrameTime();
3818
}
3819

3820
REDGPU_F_DECLSPEC uint64_t redFGetSystemTimeMillis(void) {
3821
  return ofGetSystemTimeMillis();
3822
}
3823

3824
REDGPU_F_DECLSPEC uint64_t redFGetSystemTimeMicros(void) {
3825
  return ofGetSystemTimeMicros();
3826
}
3827

3828
REDGPU_F_DECLSPEC unsigned redFGetUnixTime(void) {
3829
  return ofGetUnixTime();
3830
}
3831

3832
REDGPU_F_DECLSPEC void redFDisableArbTex(void) {
3833
  ofDisableArbTex();
3834
}
3835

3836
REDGPU_F_DECLSPEC void redFEnableArbTex(void) {
3837
  ofEnableArbTex();
3838
}
3839

3840
REDGPU_F_DECLSPEC void redFClipControl(unsigned origin, unsigned depth) {
3841
  glClipControl(origin, depth);
3842
}
3843

3844
REDGPU_F_DECLSPEC void redFEnable(unsigned glenum) {
3845
  glEnable(glenum);
3846
}
3847

3848
REDGPU_F_DECLSPEC void redFDisable(unsigned glenum) {
3849
  glDisable(glenum);
3850
}
3851

3852
REDGPU_F_DECLSPEC void redFGetIntegerv(unsigned glenum, void * outValue) {
3853
  glGetIntegerv(glenum, (int *)outValue);
3854
}
3855

3856
REDGPU_F_DECLSPEC void redFGetEnv(const char * variable, char ** outValue, uint64_t * outValueBytesCount) {
3857
  std::string name = variable;
3858
  std::string value = ofGetEnv(name);
3859
  {
3860
    std::string s = value;
3861
    char * p = (char *)malloc(s.size() + 1);
3862
    if (p != NULL) {
3863
      std::copy(s.begin(), s.end(), p);
3864
      p[s.size()] = 0;
3865
    }
3866
    outValue[0] = p;
3867
  }
3868
  if (outValueBytesCount != NULL) {
3869
    outValueBytesCount[0] = value.size() + 1;
3870
  }
3871
}
3872

3873
REDGPU_F_DECLSPEC void redFSystem(const char * command, char ** outOutput, uint64_t * outOutputBytesCount) {
3874
  std::string cmd = command;
3875
  std::string output = ofSystem(cmd);
3876
  if (outOutput != NULL) {
3877
    std::string s = output;
3878
    char * p = (char *)malloc(s.size() + 1);
3879
    if (p != NULL) {
3880
      std::copy(s.begin(), s.end(), p);
3881
      p[s.size()] = 0;
3882
    }
3883
    outOutput[0] = p;
3884
  }
3885
  if (outOutputBytesCount != NULL) {
3886
    outOutputBytesCount[0] = output.size() + 1;
3887
  }
3888
}
3889

3890
REDGPU_F_DECLSPEC void redFSystemAlertDialog(const char * errorMessage) {
3891
  std::string name = errorMessage;
3892
  ofSystemAlertDialog(name);
3893
}
3894

3895
REDGPU_F_DECLSPEC RedFBool32 redFSystemLoadDialog(const char * windowTitle, RedFBool32 bFolderSelection, const char * defaultPath, char ** outFilePath, uint64_t * outFilePathBytesCount, char ** outFileName, uint64_t * outFileNameBytesCount) {
3896
  std::string title = windowTitle;
3897
  std::string path  = defaultPath;
3898
  ofFileDialogResult result = ofSystemLoadDialog(title, bFolderSelection, path);
3899
  if (outFilePath != NULL) {
3900
    std::string s = result.filePath;
3901
    char * p = (char *)malloc(s.size() + 1);
3902
    if (p != NULL) {
3903
      std::copy(s.begin(), s.end(), p);
3904
      p[s.size()] = 0;
3905
    }
3906
    outFilePath[0] = p;
3907
  }
3908
  if (outFilePathBytesCount != NULL) {
3909
    outFilePathBytesCount[0] = result.filePath.size() + 1;
3910
  }
3911
  if (outFileName != NULL) {
3912
    std::string s = result.fileName;
3913
    char * p = (char *)malloc(s.size() + 1);
3914
    if (p != NULL) {
3915
      std::copy(s.begin(), s.end(), p);
3916
      p[s.size()] = 0;
3917
    }
3918
    outFileName[0] = p;
3919
  }
3920
  if (outFileNameBytesCount != NULL) {
3921
    outFileNameBytesCount[0] = result.fileName.size() + 1;
3922
  }
3923
  return (RedFBool32)result.bSuccess;
3924
}
3925

3926
REDGPU_F_DECLSPEC RedFBool32 redFSystemSaveDialog(const char * defaultName, const char * messageName, char ** outFilePath, uint64_t * outFilePathBytesCount, char ** outFileName, uint64_t * outFileNameBytesCount) {
3927
  std::string name    = defaultName;
3928
  std::string message = messageName;
3929
  ofFileDialogResult result = ofSystemSaveDialog(name, message);
3930
  if (outFilePath != NULL) {
3931
    std::string s = result.filePath;
3932
    char * p = (char *)malloc(s.size() + 1);
3933
    if (p != NULL) {
3934
      std::copy(s.begin(), s.end(), p);
3935
      p[s.size()] = 0;
3936
    }
3937
    outFilePath[0] = p;
3938
  }
3939
  if (outFilePathBytesCount != NULL) {
3940
    outFilePathBytesCount[0] = result.filePath.size() + 1;
3941
  }
3942
  if (outFileName != NULL) {
3943
    std::string s = result.fileName;
3944
    char * p = (char *)malloc(s.size() + 1);
3945
    if (p != NULL) {
3946
      std::copy(s.begin(), s.end(), p);
3947
      p[s.size()] = 0;
3948
    }
3949
    outFileName[0] = p;
3950
  }
3951
  if (outFileNameBytesCount != NULL) {
3952
    outFileNameBytesCount[0] = result.fileName.size() + 1;
3953
  }
3954
  return (RedFBool32)result.bSuccess;
3955
}
3956

3957
REDGPU_F_DECLSPEC void redFSystemTextBoxDialog(const char * question, const char * text, char ** outAnswer, uint64_t * outAnswerBytesCount) {
3958
  std::string que  = question;
3959
  std::string show = text;
3960
  std::string answer = ofSystemTextBoxDialog(que, show);
3961
  {
3962
    std::string s = answer;
3963
    char * p = (char *)malloc(s.size() + 1);
3964
    if (p != NULL) {
3965
      std::copy(s.begin(), s.end(), p);
3966
      p[s.size()] = 0;
3967
    }
3968
    outAnswer[0] = p;
3969
  }
3970
  if (outAnswerBytesCount != NULL) {
3971
    outAnswerBytesCount[0] = answer.size() + 1;
3972
  }
3973
}
3974

3975
REDGPU_F_DECLSPEC void redFEnableFramebufferSRGBGammaCorrection(void) {
3976
  glEnable(GL_FRAMEBUFFER_SRGB);
3977
}
3978

3979
REDGPU_F_DECLSPEC void * redFGetGLFWwindowPointer(void) {
3980
 return (void *)(static_cast<ofAppGLFWWindow *>(ofGetWindowPtr())->getGLFWWindow());
3981
}
3982

3983
REDGPU_F_DECLSPEC void redFFree(void * pointer) {
3984
  free(pointer);
3985
}
3986

3987
REDGPU_F_DECLSPEC void redFDrawPoint(float x, float y, float z, float radius, RedFHandleCamera camera) {
3988
  float cpx = redFNodeGetGlobalPositionX(redFCameraCastToNode(camera));
3989
  float cpy = redFNodeGetGlobalPositionY(redFCameraCastToNode(camera));
3990
  float cpz = redFNodeGetGlobalPositionZ(redFCameraCastToNode(camera));
3991
  redFDrawSphere(x, y, z, glm::distance(glm::vec3(cpx, cpy, cpz), glm::vec3(x, y, z)) * radius);
3992
}
3993

3994
REDGPU_F_DECLSPEC void redFDrawBitmapStringHighlightFromCamera(const char * string, float x, float y, float z, int bgR, int bgG, int bgB, int bgA, int fgR, int fgG, int fgB, int fgA, RedFHandleCamera camera) {
3995
  float cpx = redFNodeGetGlobalPositionX(redFCameraCastToNode(camera));
3996
  float cpy = redFNodeGetGlobalPositionY(redFCameraCastToNode(camera));
3997
  float cpz = redFNodeGetGlobalPositionZ(redFCameraCastToNode(camera));
3998
  float cdx = redFNodeGetLookAtDirX(redFCameraCastToNode(camera));
3999
  float cdy = redFNodeGetLookAtDirY(redFCameraCastToNode(camera));
4000
  float cdz = redFNodeGetLookAtDirZ(redFCameraCastToNode(camera));
4001
  float p[3] = {};
4002
  redFCameraWorldToScreen(camera, x, y, z, p);
4003
  float dot = (x-cpx) * cdx + (y-cpy) * cdy + (z-cpz) * cdz;
4004
  if (dot > 0) {
4005
    redFDrawBitmapStringHighlight(string, p[0], p[1], p[2], bgR, bgG, bgB, bgA, fgR, fgG, fgB, fgA);
4006
  }
4007
}
4008

4009
REDGPU_F_DECLSPEC RedFBool32 redFFbxLoad(RedFHandleFbx handle, const char * filepath) {
4010
  ofxFBX * fbx = (ofxFBX *)handle;
4011
  ofxFBXSource::Scene::Settings settings = ofxFBXSource::Scene::Settings();
4012
  settings.importBones              = true;
4013
  settings.importMaterials          = false;
4014
  settings.importTextures           = false;
4015
  settings.importShapes             = false;
4016
  settings.importGobos              = false;
4017
  settings.importAnimations         = true;
4018
  settings.importNurbsCurves        = false;
4019
  settings.useKeyFrames             = true;
4020
  settings.printInfo                = false;
4021
  settings.filePath                 = filepath;
4022
  settings.unloadIfUnused           = false;
4023
  settings.cacheMeshKeyframes       = false;
4024
  settings.blendCachedMeshKeyframes = false;
4025
  bool loaded = fbx->load(settings);
4026
  if (loaded) {
4027
    if (fbx->getCurrentAnimation().isPlaying()) {
4028
      fbx->getCurrentAnimation().stop();
4029
    }
4030
  }
4031
  return (RedFBool32)loaded;
4032
}
4033

4034
REDGPU_F_DECLSPEC void redFFbxCopyToFbx(RedFHandleFbx handle, RedFHandleFbx to) {
4035
  ofxFBX * x = (ofxFBX *)to;
4036
  ofxFBX * y = (ofxFBX *)handle;
4037
  x[0] = y[0];
4038
}
4039

4040
REDGPU_F_DECLSPEC void redFFbxClear(RedFHandleFbx handle) {
4041
  ofxFBX * fbx = (ofxFBX *)handle;
4042
  fbx->clear();
4043
}
4044

4045
REDGPU_F_DECLSPEC void redFFbxEarlyUpdate(RedFHandleFbx handle) {
4046
  ofxFBX * fbx = (ofxFBX *)handle;
4047
  fbx->earlyUpdate();
4048
}
4049

4050
REDGPU_F_DECLSPEC void redFFbxLateUpdate(RedFHandleFbx handle) {
4051
  ofxFBX * fbx = (ofxFBX *)handle;
4052
  fbx->lateUpdate();
4053
}
4054

4055
REDGPU_F_DECLSPEC int redFFbxGetMeshesCount(RedFHandleFbx handle) {
4056
  ofxFBX * fbx = (ofxFBX *)handle;
4057
  return fbx->getNumMeshes();
4058
}
4059

4060
REDGPU_F_DECLSPEC RedFHandleMesh redFFbxGetMesh(RedFHandleFbx handle, int meshIndex) {
4061
  ofxFBX * fbx = (ofxFBX *)handle;
4062
  std::vector< std::shared_ptr<ofxFBXMesh> > & meshes = fbx->getMeshes();
4063
  ofMesh & mesh = meshes[meshIndex]->getMesh();
4064
  ofMesh * meshPointer = &mesh;
4065
  return (RedFHandleMesh)(void *)meshPointer;
4066
}
4067

4068
REDGPU_F_DECLSPEC void redFFbxGetMeshName(RedFHandleFbx handle, int meshIndex, uint64_t * outCharsCountIncludingNullTerminator, char * outChars) {
4069
  ofxFBX * fbx = (ofxFBX *)handle;
4070
  std::string name = fbx->getMeshName(meshIndex);
4071
  if (outCharsCountIncludingNullTerminator != NULL) {
4072
    outCharsCountIncludingNullTerminator[0] = name.size() + 1;
4073
  }
4074
  if (outChars != NULL) {
4075
    std::copy(name.begin(), name.end(), outChars);
4076
    outChars[name.size()] = 0;
4077
  }
4078
}
4079

4080
REDGPU_F_DECLSPEC int redFFbxGetRootBonesCount(RedFHandleFbx handle) {
4081
  ofxFBX * fbx = (ofxFBX *)handle;
4082
  return fbx->getNumSkeletons();
4083
}
4084

4085
REDGPU_F_DECLSPEC RedFHandleFbxBone redFFbxGetRootBone(RedFHandleFbx handle, int rootBoneIndex) {
4086
  ofxFBX * fbx = (ofxFBX *)handle;
4087
  std::vector< std::shared_ptr<ofxFBXSkeleton> > & skeletons = fbx->getSkeletons();
4088
  ofxFBXSkeleton * skeleton = skeletons[rootBoneIndex].get();
4089
  ofxFBXBone * root = skeleton->root.get();
4090
  return (RedFHandleFbxBone)(void *)root;
4091
}
4092

4093
REDGPU_F_DECLSPEC RedFHandleNode redFFbxBoneCastToNode(RedFHandleFbxBone handle) {
4094
  return (RedFHandleNode)(void *)handle;
4095
}
4096

4097
REDGPU_F_DECLSPEC void redFFbxBoneGetName(RedFHandleFbxBone handle, uint64_t * outCharsCountIncludingNullTerminator, char * outChars) {
4098
  ofxFBXBone * bone = (ofxFBXBone *)handle;
4099
  std::string name = bone->getName();
4100
  if (outCharsCountIncludingNullTerminator != NULL) {
4101
    outCharsCountIncludingNullTerminator[0] = name.size() + 1;
4102
  }
4103
  if (outChars != NULL) {
4104
    std::copy(name.begin(), name.end(), outChars);
4105
    outChars[name.size()] = 0;
4106
  }
4107
}
4108

4109
REDGPU_F_DECLSPEC int redFFbxBoneGetChildBonesCount(RedFHandleFbxBone handle) {
4110
  ofxFBXBone * bone = (ofxFBXBone *)handle;
4111
  return bone->childBones.size();
4112
}
4113

4114
REDGPU_F_DECLSPEC RedFHandleFbxBone redFFbxBoneGetChildBone(RedFHandleFbxBone handle, int childBoneIndex) {
4115
  ofxFBXBone * bone = (ofxFBXBone *)handle;
4116
  auto b = bone->childBones.begin();
4117
  for (uint64_t i = 0; i < childBoneIndex; i += 1) {
4118
    ++b;
4119
  }
4120
  ofxFBXBone * child = b->second.get();
4121
  return (RedFHandleFbxBone)(void *)child;
4122
}
4123

4124
REDGPU_F_DECLSPEC RedFHandleFbxBone redFFbxBoneGetChildBoneByNameRecursively(RedFHandleFbxBone handle, const char * boneName) {
4125
  ofxFBXBone * bone = (ofxFBXBone *)handle;
4126
  std::string name = boneName;
4127
  ofxFBXBone * b = bone->getBone(name).get();
4128
  return (RedFHandleFbxBone)(void *)b;
4129
}
4130

4131
// New in REDGPU Framework 2
4132

4133
REDGPU_F_DECLSPEC int redF2Main(const RedFEvents * events, int windowWidth, int windowHeight, RedFWindowMode windowMode, RedFBool32 useCustomOpenGLVersion, int customOpenGLVersionMajor, int customOpenGLVersionMinor, RedFBool32 windowIsDecorated, RedFBool32 windowIsResizable, int msaaSamples, uint64_t optionalSettingsCount, const void * optionalSettings) {
4134
  __REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events = {};
4135
  if (events != NULL) {
4136
    __REDGPU_F_GLOBAL_87602fd8921e493298df8495aa4fe136e9c9a7c2_events = events[0];
4137
  }
4138
  return ofAppMain2(windowWidth, windowHeight, windowMode, useCustomOpenGLVersion, customOpenGLVersionMajor, customOpenGLVersionMinor, windowIsDecorated, windowIsResizable, msaaSamples, optionalSettingsCount, optionalSettings);
4139
}
4140

4141
REDGPU_F_DECLSPEC void redF2SetLogLevel(RedF2LogLevel logLevel) {
4142
  ofSetLogLevel((ofLogLevel)logLevel);
4143
}
4144

4145
REDGPU_F_DECLSPEC RedF2LogLevel redF2GetLogLevel(void) {
4146
  return (RedF2LogLevel)ofGetLogLevel();
4147
}
4148

4149
REDGPU_F_DECLSPEC void redF2FrontFace(unsigned mode) {
4150
  glFrontFace(mode);
4151
}
4152

4153
REDGPU_F_DECLSPEC void redF2DepthMask(unsigned char flag) {
4154
  glDepthMask(flag);
4155
}
4156

4157
REDGPU_F_DECLSPEC void redF2Finish(void) {
4158
  glFinish();
4159
}
4160

4161
REDGPU_F_DECLSPEC RedFBool32 redF2IsProgrammableRenderer(void) {
4162
  return ofIsGLProgrammableRenderer() == true ? 1 : 0;
4163
}
4164

4165
REDGPU_F_DECLSPEC RedFBool32 redF2ShadowsAreSupported(void) {
4166
  return 1;
4167
}
4168

4169
REDGPU_F_DECLSPEC void redF2MeshLoadPly(const char * fileName, RedFHandleMesh replaceMesh) {
4170
  ofMesh * mesh = (ofMesh *)replaceMesh;
4171
  std::string name = fileName;
4172
#ifdef __linux__
4173
#warning
4174
  std::string path = name;
4175
#else
4176
  std::filesystem::path path = name;
4177
#endif
4178
  mesh->load(path);
4179
}
4180

4181
REDGPU_F_DECLSPEC void redF2MeshInvertNormals(RedFHandleMesh handle) {
4182
  ofMesh * mesh = (ofMesh *)handle;
4183
  for (size_t i = 0; i < mesh->getNumNormals(); i += 1) {
4184
    mesh->getNormals()[i] *= -1.f;
4185
  }
4186
}
4187

4188
REDGPU_F_DECLSPEC void redF2LightDraw(RedFHandleLight handle) {
4189
  ofLight * light = (ofLight *)handle;
4190
  light->draw();
4191
}
4192

4193
REDGPU_F_DECLSPEC RedFHandleShadow redF2LightGetShadow(RedFHandleLight handle) {
4194
  ofLight * light = (ofLight *)handle;
4195
  ofShadow & shadow = light->getShadow();
4196
  ofShadow * shadowPointer = &shadow;
4197
  return (RedFHandleShadow)(void *)shadowPointer;
4198
}
4199

4200
REDGPU_F_DECLSPEC RedFBool32 redF2LightShouldRenderShadowDepthPass(RedFHandleLight handle) {
4201
  ofLight * light = (ofLight *)handle;
4202
  return light->shouldRenderShadowDepthPass() == true ? 1 : 0;
4203
}
4204

4205
REDGPU_F_DECLSPEC int redF2LightGetNumShadowDepthPasses(RedFHandleLight handle) {
4206
  ofLight * light = (ofLight *)handle;
4207
  return light->getNumShadowDepthPasses();
4208
}
4209

4210
REDGPU_F_DECLSPEC void redF2LightBeginShadowDepthPass(RedFHandleLight handle, int aPassIndex) {
4211
  ofLight * light = (ofLight *)handle;
4212
  light->beginShadowDepthPass(aPassIndex);
4213
}
4214

4215
REDGPU_F_DECLSPEC void redF2LightEndShadowDepthPass(RedFHandleLight handle, int aPassIndex) {
4216
  ofLight * light = (ofLight *)handle;
4217
  light->endShadowDepthPass(aPassIndex);
4218
}
4219

4220
REDGPU_F_DECLSPEC void redF2ShadowsEnableAllShadows(void) {
4221
  ofShadow::enableAllShadows();
4222
}
4223

4224
REDGPU_F_DECLSPEC void redF2ShadowsDisableAllShadows(void) {
4225
  ofShadow::disableAllShadows();
4226
}
4227

4228
REDGPU_F_DECLSPEC void redF2ShadowsSetAllShadowBias(float bias) {
4229
  ofShadow::setAllShadowBias(bias);
4230
}
4231

4232
REDGPU_F_DECLSPEC void redF2ShadowsSetAllShadowNormalBias(float normalBias) {
4233
  ofShadow::setAllShadowNormalBias(normalBias);
4234
}
4235

4236
REDGPU_F_DECLSPEC void redF2ShadowsSetAllShadowDepthResolutions(int width, int height) {
4237
  ofShadow::setAllShadowDepthResolutions(width, height);
4238
}
4239

4240
REDGPU_F_DECLSPEC void redF2ShadowsSetAllShadowTypes(RedF2ShadowType type) {
4241
  ofShadow::setAllShadowTypes((ofShadowType)type);
4242
}
4243

4244
REDGPU_F_DECLSPEC void redF2ShadowsSetAllShadowSampleRadius(float sampleRadius) {
4245
  ofShadow::setAllShadowSampleRadius(sampleRadius);
4246
}
4247

4248
REDGPU_F_DECLSPEC void redF2ShadowSetBias(RedFHandleShadow handle, float bias) {
4249
  ofShadow * shadow = (ofShadow *)handle;
4250
  shadow->setBias(bias);
4251
}
4252

4253
REDGPU_F_DECLSPEC void redF2ShadowSetNormalBias(RedFHandleShadow handle, float normalBias) {
4254
  ofShadow * shadow = (ofShadow *)handle;
4255
  shadow->setNormalBias(normalBias);
4256
}
4257
REDGPU_F_DECLSPEC void redF2ShadowSetAllShadowDepthResolutions(RedFHandleShadow handle, int width, int height) {
4258
  ofShadow * shadow = (ofShadow *)handle;
4259
  shadow->setAllShadowDepthResolutions(width, height);
4260
}
4261

4262
REDGPU_F_DECLSPEC void redF2ShadowSetShadowType(RedFHandleShadow handle, RedF2ShadowType type) {
4263
  ofShadow * shadow = (ofShadow *)handle;
4264
  shadow->setShadowType((ofShadowType)type);
4265
}
4266

4267
REDGPU_F_DECLSPEC void redF2ShadowSetSampleRadius(RedFHandleShadow handle, float sampleRadius) {
4268
  ofShadow * shadow = (ofShadow *)handle;
4269
  shadow->setSampleRadius(sampleRadius);
4270
}
4271

4272
REDGPU_F_DECLSPEC void redF2ShadowSetEnabled(RedFHandleShadow handle, RedFBool32 enable) {
4273
  ofShadow * shadow = (ofShadow *)handle;
4274
  shadow->setEnabled(enable);
4275
}
4276

4277
REDGPU_F_DECLSPEC RedFBool32 redF2ShadowIsEnabled(RedFHandleShadow handle) {
4278
  ofShadow * shadow = (ofShadow *)handle;
4279
  return shadow->getIsEnabled() == true ? 1 : 0;
4280
}
4281

4282
REDGPU_F_DECLSPEC void redF2ShadowSetNearClip(RedFHandleShadow handle, float anear) {
4283
  ofShadow * shadow = (ofShadow *)handle;
4284
  shadow->setNearClip(anear);
4285
}
4286

4287
REDGPU_F_DECLSPEC void redF2ShadowSetFarClip(RedFHandleShadow handle, float afar) {
4288
  ofShadow * shadow = (ofShadow *)handle;
4289
  shadow->setFarClip(afar);
4290
}
4291

4292
REDGPU_F_DECLSPEC void redF2ShadowSetStrength(RedFHandleShadow handle, float astrength) {
4293
  ofShadow * shadow = (ofShadow *)handle;
4294
  shadow->setStrength(astrength);
4295
}
4296

4297
REDGPU_F_DECLSPEC void redF2ShadowSetCullingEnabled(RedFHandleShadow handle, RedFBool32 enable) {
4298
  ofShadow * shadow = (ofShadow *)handle;
4299
  shadow->setGlCullingEnabled(enable);
4300
}
4301

4302
REDGPU_F_DECLSPEC void redF2ShadowSetFrontFaceWindingOrder(RedFHandleShadow handle, unsigned mode) {
4303
  ofShadow * shadow = (ofShadow *)handle;
4304
  shadow->setFrontFaceWindingOrder(mode);
4305
}
4306

4307
REDGPU_F_DECLSPEC void redF2ShadowDrawFrustum(RedFHandleShadow handle) {
4308
  ofShadow * shadow = (ofShadow *)handle;
4309
  shadow->drawFrustum();
4310
}
4311

4312
REDGPU_F_DECLSPEC void redF2GetSpherePrimitiveMesh(float radius, int resolution, RedFHandleMesh replaceMesh) {
4313
  ofSpherePrimitive sphere;
4314
  sphere.set(radius, resolution, OF_PRIMITIVE_TRIANGLES);
4315
  ofMesh mesh = sphere.getMesh();
4316
  ofMesh * out = (ofMesh *)replaceMesh;
4317
  out[0] = mesh;
4318
}
4319

4320
REDGPU_F_DECLSPEC void redF2GetCylinderPrimitiveMesh(float radius, float height, int radiusSegments, int heightSegments, int capSegments, RedFBool32 isCapped, RedFHandleMesh replaceMesh) {
4321
  ofMesh::cylinder(0.4, 1.0, 48, 12, 4, true, OF_PRIMITIVE_TRIANGLES );
4322
  ofCylinderPrimitive cylinder;
4323
  cylinder.set(radius, height, radiusSegments, heightSegments, capSegments, isCapped, OF_PRIMITIVE_TRIANGLES);
4324
  ofMesh mesh = cylinder.getMesh();
4325
  ofMesh * out = (ofMesh *)replaceMesh;
4326
  out[0] = mesh;
4327
}
4328

4329
REDGPU_F_DECLSPEC void redF2ManipulatorGetCurrentState(RedFHandleManipulator handle, RedF2ManipulatorStateScale * outCurrScale, RedF2ManipulatorStateScale * outCurrScalePredict, RedF2ManipulatorStateRotation * outCurrRotation, RedF2ManipulatorStateRotation * outCurrRotationPredict, RedF2ManipulatorStateTranslation * outCurrTranslation, RedF2ManipulatorStateTranslation * outCurrTranslationPredict) {
4330
  ofxManipulator * manipulator = (ofxManipulator *)handle;
4331
  manipulator->getManipulatorState(
4332
    (int *)outCurrScale,
4333
    (int *)outCurrScalePredict,
4334
    (int *)outCurrRotation,
4335
    (int *)outCurrRotationPredict,
4336
    (int *)outCurrTranslation,
4337
    (int *)outCurrTranslationPredict
4338
  );
4339
}
4340

4341
REDGPU_F_DECLSPEC RedFBool32 redF2ManipulatorIsFreezed(RedFHandleManipulator handle) {
4342
  ofxManipulator * manipulator = (ofxManipulator *)handle;
4343
  return (RedFBool32)manipulator->isFreezed();
4344
}
4345

4346
REDGPU_F_DECLSPEC void redF2ManipulatorFreeze(RedFHandleManipulator handle) {
4347
  ofxManipulator * manipulator = (ofxManipulator *)handle;
4348
  manipulator->freeze();
4349
}
4350

4351
REDGPU_F_DECLSPEC void redF2ManipulatorUnfreeze(RedFHandleManipulator handle) {
4352
  ofxManipulator * manipulator = (ofxManipulator *)handle;
4353
  manipulator->unfreeze();
4354
}
4355

4356
REDGPU_F_DECLSPEC void redF2PostProcessingInit(RedFHandlePostProcessing handle, int width, int height) {
4357
  ofxPostProcessing * postproc = (ofxPostProcessing *)handle;
4358
  postproc->init(width, height, false);
4359
}
4360

4361
REDGPU_F_DECLSPEC void redF2PostProcessingSetFlip(RedFHandlePostProcessing handle, RedFBool32 flip) {
4362
  ofxPostProcessing * postproc = (ofxPostProcessing *)handle;
4363
  postproc->setFlip(flip == 1 ? true : false);
4364
}
4365

4366
REDGPU_F_DECLSPEC RedFHandlePostProcessingPass redF2PostProcessingCreatePassSSAO(RedFHandlePostProcessing handle) {
4367
  ofxPostProcessing * postproc = (ofxPostProcessing *)handle;
4368
  itg::SSAOPass::Ptr pass = postproc->createPass<itg::SSAOPass>(NULL, NULL);
4369
  itg::SSAOPass * passPtr = pass.get();
4370
  return (RedFHandlePostProcessingPass)(void *)passPtr;
4371
}
4372

4373
REDGPU_F_DECLSPEC RedFHandlePostProcessingPass redF2PostProcessingCreatePassSSAOWithCustomSSAOShader(RedFHandlePostProcessing handle, const char * customSSAOShader) {
4374
  ofxPostProcessing * postproc = (ofxPostProcessing *)handle;
4375
  itg::SSAOPass::Ptr pass = postproc->createPass<itg::SSAOPass>(NULL, customSSAOShader);
4376
  itg::SSAOPass * passPtr = pass.get();
4377
  return (RedFHandlePostProcessingPass)(void *)passPtr;
4378
}
4379

4380
REDGPU_F_DECLSPEC RedFHandlePostProcessingPass redF2PostProcessingCreatePassGeneric(RedFHandlePostProcessing handle, const char * vertexShader, const char * fragmentShader) {
4381
  ofxPostProcessing * postproc = (ofxPostProcessing *)handle;
4382
  itg::GenericPass::Ptr pass = postproc->createPass<itg::GenericPass>(vertexShader, fragmentShader);
4383
  itg::GenericPass * passPtr = pass.get();
4384
  return (RedFHandlePostProcessingPass)(void *)passPtr;
4385
}
4386

4387
REDGPU_F_DECLSPEC void redF2PostProcessingPassSSAOSetParameters(RedFHandlePostProcessingPass handle, float cameraNearDefaultIs1, float cameraFarDefaultIs1000, float fogNearDefaultIs1, float fogFarDefaultIs1000, RedFBool32 fogEnabledDefaultIs0, RedFBool32 onlyAODefaultIs0, float aoClampDefaultIs0dot5, float lumInfluenceDefaultIs0dot9) {
4388
  itg::SSAOPass * pass = (itg::SSAOPass *)handle;
4389
  pass->setCameraNear(cameraNearDefaultIs1);
4390
  pass->setCameraFar(cameraFarDefaultIs1000);
4391
  pass->setFogNear(fogNearDefaultIs1);
4392
  pass->setFogFar(fogFarDefaultIs1000);
4393
  pass->setFogEnabled(fogEnabledDefaultIs0 == 1 ? true : false);
4394
  pass->setOnlyAO(onlyAODefaultIs0 == 1 ? true : false);
4395
  pass->setAoClamp(aoClampDefaultIs0dot5);
4396
  pass->setLumInfluence(lumInfluenceDefaultIs0dot9);
4397
}
4398

4399
REDGPU_F_DECLSPEC void redF2PostProcessingPassGenericSetParameters(RedFHandlePostProcessingPass handle, float parameter0, float parameter1, float parameter2, float parameter3, float parameter4, float parameter5, float parameter6, float parameter7, float parameter8, float parameter9, float parameter10, float parameter11, float parameter12, float parameter13, float parameter14, float parameter15) {
4400
  itg::GenericPass * pass = (itg::GenericPass *)handle;
4401
  pass->setParameter0(parameter0);
4402
  pass->setParameter1(parameter1);
4403
  pass->setParameter2(parameter2);
4404
  pass->setParameter3(parameter3);
4405
  pass->setParameter4(parameter4);
4406
  pass->setParameter5(parameter5);
4407
  pass->setParameter6(parameter6);
4408
  pass->setParameter7(parameter7);
4409
  pass->setParameter8(parameter8);
4410
  pass->setParameter9(parameter9);
4411
  pass->setParameter10(parameter10);
4412
  pass->setParameter11(parameter11);
4413
  pass->setParameter12(parameter12);
4414
  pass->setParameter13(parameter13);
4415
  pass->setParameter14(parameter14);
4416
  pass->setParameter15(parameter15);
4417
}
4418

4419
REDGPU_F_DECLSPEC void redF2PostProcessingBegin(RedFHandlePostProcessing handle, RedFHandleCamera camera) {
4420
  ofxPostProcessing * postproc = (ofxPostProcessing *)handle;
4421
  ofCamera *          cam      = (ofCamera *)camera;
4422
  postproc->begin(cam[0]);
4423
}
4424

4425
REDGPU_F_DECLSPEC void redF2PostProcessingEnd(RedFHandlePostProcessing handle, RedFHandleCamera camera) {
4426
  ofxPostProcessing * postproc = (ofxPostProcessing *)handle;
4427
  ofCamera *          cam      = (ofCamera *)camera;
4428
  postproc->end(cam[0]);
4429
}
4430

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.