Blender V5.0
GHOST_Test.cpp
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
12
13#include <iostream>
14#include <math.h>
15#include <string>
16
17#if defined(WIN32) || defined(__APPLE__)
18# ifdef WIN32
19# include <atlbase.h>
20# include <windows.h>
21
22# include <GL/gl.h>
23# else // WIN32 \
24 // __APPLE__ is defined
25# include <AGL/gl.h>
26# endif // WIN32
27#else // defined(WIN32) || defined(__APPLE__)
28# include <GL/gl.h>
29#endif // defined(WIN32) || defined(__APPLE__)
30
31#include "GHOST_Rect.hh"
32
33#include "GHOST_IEvent.hh"
35#include "GHOST_ISystem.hh"
36
37#define LEFT_EYE 0
38#define RIGHT_EYE 1
39
40static bool nVidiaWindows; // very dirty but hey, it's for testing only
41
42static void gearsTimerProc(GHOST_ITimerTask *task, uint64_t time);
43
44static class Application *fApp;
45static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
46static GLfloat fAngle = 0.0;
48
49void StereoProjection(float left,
50 float right,
51 float bottom,
52 float top,
53 float nearplane,
54 float farplane,
55 float zero_plane,
56 float dist,
57 float eye);
58
59static void testTimerProc(GHOST_ITimerTask * /*task*/, uint64_t time)
60{
61 std::cout << "timer1, time=" << int(time) << "\n";
62}
63
64static void gearGL(
65 GLfloat inner_radius, GLfloat outer_radius, GLfloat width, GLint teeth, GLfloat tooth_depth)
66{
67 GLint i;
68 GLfloat r0, r1, r2;
69 GLfloat angle, da;
70 GLfloat u, v, len;
71
72 r0 = inner_radius;
73 r1 = outer_radius - tooth_depth / 2.0;
74 r2 = outer_radius + tooth_depth / 2.0;
75
76 const double pi = 3.14159264;
77 da = 2.0 * pi / teeth / 4.0;
78
79 glShadeModel(GL_FLAT);
80 glNormal3f(0.0, 0.0, 1.0);
81
82 /* draw front face */
83 glBegin(GL_QUAD_STRIP);
84 for (i = 0; i <= teeth; i++) {
85 angle = i * 2.0 * pi / teeth;
86 glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
87 glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
88 glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
89 glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
90 }
91 glEnd();
92
93 /* draw front sides of teeth */
94 glBegin(GL_QUADS);
95 da = 2.0 * pi / teeth / 4.0;
96 for (i = 0; i < teeth; i++) {
97 angle = i * 2.0 * pi / teeth;
98 glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
99 glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
100 glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5);
101 glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
102 }
103 glEnd();
104
105 glNormal3f(0.0, 0.0, -1.0);
106
107 /* draw back face */
108 glBegin(GL_QUAD_STRIP);
109 for (i = 0; i <= teeth; i++) {
110 angle = i * 2.0 * pi / teeth;
111 glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
112 glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
113 glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
114 glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
115 }
116 glEnd();
117
118 /* draw back sides of teeth */
119 glBegin(GL_QUADS);
120 da = 2.0 * pi / teeth / 4.0;
121 for (i = 0; i < teeth; i++) {
122 angle = i * 2.0 * pi / teeth;
123 glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
124 glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5);
125 glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
126 glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
127 }
128 glEnd();
129
130 /* draw outward faces of teeth */
131 glBegin(GL_QUAD_STRIP);
132 for (i = 0; i < teeth; i++) {
133 angle = i * 2.0 * pi / teeth;
134 glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
135 glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
136 u = r2 * cos(angle + da) - r1 * cos(angle);
137 v = r2 * sin(angle + da) - r1 * sin(angle);
138 len = sqrt(u * u + v * v);
139 u /= len;
140 v /= len;
141 glNormal3f(v, -u, 0.0);
142 glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
143 glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
144 glNormal3f(cos(angle), sin(angle), 0.0);
145 glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5);
146 glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5);
147 u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da);
148 v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da);
149 glNormal3f(v, -u, 0.0);
150 glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
151 glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
152 glNormal3f(cos(angle), sin(angle), 0.0);
153 }
154 glVertex3f(r1 * cos(0.0), r1 * sin(0.0), width * 0.5);
155 glVertex3f(r1 * cos(0.0), r1 * sin(0.0), -width * 0.5);
156 glEnd();
157
158 glShadeModel(GL_SMOOTH);
159
160 /* draw inside radius cylinder */
161 glBegin(GL_QUAD_STRIP);
162 for (i = 0; i <= teeth; i++) {
163 angle = i * 2.0 * pi / teeth;
164 glNormal3f(-cos(angle), -sin(angle), 0.0);
165 glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
166 glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
167 }
168 glEnd();
169}
170
171static void drawGearGL(int id)
172{
173 static GLfloat pos[4] = {5.0f, 5.0f, 10.0f, 1.0f};
174 static GLfloat ared[4] = {0.8f, 0.1f, 0.0f, 1.0f};
175 static GLfloat agreen[4] = {0.0f, 0.8f, 0.2f, 1.0f};
176 static GLfloat ablue[4] = {0.2f, 0.2f, 1.0f, 1.0f};
177
178 glLightfv(GL_LIGHT0, GL_POSITION, pos);
179 glEnable(GL_CULL_FACE);
180 glEnable(GL_LIGHTING);
181 glEnable(GL_LIGHT0);
182 glEnable(GL_DEPTH_TEST);
183
184 switch (id) {
185 case 1:
186 glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, ared);
187 gearGL(1.0f, 4.0f, 1.0f, 20, 0.7f);
188 break;
189 case 2:
190 glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, agreen);
191 gearGL(0.5f, 2.0f, 2.0f, 10, 0.7f);
192 break;
193 case 3:
194 glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, ablue);
195 gearGL(1.3f, 2.0f, 0.5f, 10, 0.7f);
196 break;
197 default:
198 break;
199 }
200 glEnable(GL_NORMALIZE);
201}
202
204{
205 glRotatef(view_rotx, 1.0, 0.0, 0.0);
206 glRotatef(view_roty, 0.0, 1.0, 0.0);
207 glRotatef(view_rotz, 0.0, 0.0, 1.0);
208}
209
211{
212 glPushMatrix();
213 glTranslatef(-3.0, -2.0, 0.0);
214 glRotatef(fAngle, 0.0, 0.0, 1.0);
215 drawGearGL(1);
216 glPopMatrix();
217
218 glPushMatrix();
219 glTranslatef(3.1f, -2.0f, 0.0f);
220 glRotatef(-2.0 * fAngle - 9.0, 0.0, 0.0, 1.0);
221 drawGearGL(2);
222 glPopMatrix();
223
224 glPushMatrix();
225 glTranslatef(-3.1f, 2.2f, -1.8f);
226 glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
227 glRotatef(2.0 * fAngle - 2.0, 0.0, 0.0, 1.0);
228 drawGearGL(3);
229 glPopMatrix();
230}
231
232static void View(GHOST_IWindow *window, bool stereo, int eye = 0)
233{
234 window->activateDrawingContext();
235 GHOST_Rect bnds;
236 int noOfScanlines = 0, lowerScanline = 0;
237 /* hard coded for testing purposes, display device dependent */
238 int verticalBlankingInterval = 32;
239 float left, right, bottom, top;
240 float nearplane, farplane, zeroPlane, distance;
241 float eyeSeparation = 0.62f;
242 window->getClientBounds(bnds);
243
244 // viewport
245 if (stereo) {
246 if (nVidiaWindows) {
247 // handled by nVidia driver so act as normal (explicitly put here since
248 // it -is- stereo)
249 glViewport(0, 0, bnds.getWidth(), bnds.getHeight());
250 }
251 else { // generic cross platform above-below stereo
252 noOfScanlines = (bnds.getHeight() - verticalBlankingInterval) / 2;
253 switch (eye) {
254 case LEFT_EYE:
255 // upper half of window
256 lowerScanline = bnds.getHeight() - noOfScanlines;
257 break;
258 case RIGHT_EYE:
259 // lower half of window
260 lowerScanline = 0;
261 break;
262 }
263 }
264 }
265 else {
266 noOfScanlines = bnds.getHeight();
267 lowerScanline = 0;
268 }
269
270 glViewport(0, lowerScanline, bnds.getWidth(), noOfScanlines);
271
272 // projection
273 left = -6.0;
274 right = 6.0;
275 bottom = -4.8f;
276 top = 4.8f;
277 nearplane = 5.0;
278 farplane = 60.0;
279
280 if (stereo) {
281 zeroPlane = 0.0;
282 distance = 14.5;
283 switch (eye) {
284 case LEFT_EYE:
286 right,
287 bottom,
288 top,
289 nearplane,
290 farplane,
291 zeroPlane,
292 distance,
293 -eyeSeparation / 2.0);
294 break;
295 case RIGHT_EYE:
297 right,
298 bottom,
299 top,
300 nearplane,
301 farplane,
302 zeroPlane,
303 distance,
304 eyeSeparation / 2.0);
305 break;
306 }
307 }
308 else {
309 // left = -w;
310 // right = w;
311 // bottom = -h;
312 // top = h;
313 glMatrixMode(GL_PROJECTION);
314 glLoadIdentity();
315 glFrustum(left, right, bottom, top, 5.0, 60.0);
316 glMatrixMode(GL_MODELVIEW);
317 glLoadIdentity();
318 glTranslatef(0.0, 0.0, -40.0);
319 }
320
321 glClearColor(.2f, 0.0f, 0.0f, 0.0f);
322}
323
325 float right,
326 float bottom,
327 float top,
328 float nearplane,
329 float farplane,
330 float zero_plane,
331 float dist,
332 float eye)
333/* Perform the perspective projection for one eye's sub-field.
334 * The projection is in the direction of the negative z axis.
335 *
336 * -6.0, 6.0, -4.8, 4.8,
337 * left, right, bottom, top = the coordinate range, in the plane of zero
338 * parallax setting, which will be displayed on the screen. The
339 * ratio between (right-left) and (top-bottom) should equal the aspect
340 * ratio of the display.
341 *
342 * 6.0, -6.0,
343 * near, far = the z-coordinate values of the clipping planes.
344 *
345 * 0.0,
346 * zero_plane = the z-coordinate of the plane of zero parallax setting.
347 *
348 * 14.5,
349 * dist = the distance from the center of projection to the plane
350 * of zero parallax.
351 *
352 * -0.31
353 * eye = half the eye separation; positive for the right eye sub-field,
354 * negative for the left eye sub-field.
355 */
356{
357 float xmid, ymid, clip_near, clip_far, topw, bottomw, leftw, rightw, dx, dy, n_over_d;
358
359 dx = right - left;
360 dy = top - bottom;
361
362 xmid = (right + left) / 2.0;
363 ymid = (top + bottom) / 2.0;
364
365 clip_near = dist + zero_plane - nearplane;
366 clip_far = dist + zero_plane - farplane;
367
368 n_over_d = clip_near / dist;
369
370 topw = n_over_d * dy / 2.0;
371 bottomw = -topw;
372 rightw = n_over_d * (dx / 2.0 - eye);
373 leftw = n_over_d * (-dx / 2.0 - eye);
374
375 /* Need to be in projection mode for this. */
376 glLoadIdentity();
377 glFrustum(leftw, rightw, bottomw, topw, clip_near, clip_far);
378
379 glTranslatef(-xmid - eye, -ymid, -zero_plane - dist);
380}
381
397
399 : system_(system),
400 main_window_(0),
402 gears_timer_(0),
403 test_timer_(0),
407{
408 GHOST_GPUSettings gpu_settings = {0};
409 gpu_settings.context_type = GHOST_kDrawingContextTypeOpenGL;
410 fApp = this;
411
412 // Create the main window
413 main_window_ = system->createWindow(
414 "gears - main window", 10, 64, 320, 200, GHOST_kWindowStateNormal, gpu_settings);
415
416 if (!main_window_) {
417 std::cout << "could not create main window\n";
418 exit(-1);
419 }
420
421 // Create a secondary window
423 "gears - secondary window", 340, 64, 320, 200, GHOST_kWindowStateNormal, gpu_settings);
424 if (!secondary_window_) {
425 std::cout << "could not create secondary window\n";
426 exit(-1);
427 }
428
429 // Install a timer to have the gears running
430 gears_timer_ = system->installTimer(0 /*delay*/, 20 /*interval*/, gearsTimerProc, main_window_);
431}
432
434{
435 // Dispose windows
436 if (system_->validWindow(main_window_)) {
437 system_->disposeWindow(main_window_);
438 }
439 if (system_->validWindow(secondary_window_)) {
440 system_->disposeWindow(secondary_window_);
441 }
442}
443
445{
446 GHOST_IWindow *window = event->getWindow();
447 bool handled = true;
448
449 switch (event->getType()) {
450#if 0
452 break;
453 case GHOST_kEventCursorButton:
454 std::cout << "GHOST_kEventCursorButton";
455 break;
457 std::cout << "GHOST_kEventCursorMove";
458 break;
459#endif
460 case GHOST_kEventWheel: {
461 GHOST_TEventWheelData *wheelData = (GHOST_TEventWheelData *)event->getData();
462 if (wheelData->value > 0) {
463 view_rotz += 5.f;
464 }
465 else {
466 view_rotz -= 5.f;
467 }
468 break;
469 }
471 break;
472
473 case GHOST_kEventKeyDown: {
474 GHOST_TEventKeyData *keyData = (GHOST_TEventKeyData *)event->getData();
475 switch (keyData->key) {
476 case GHOST_kKeyC: {
477 int cursor = cursor_;
478 cursor++;
479 if (cursor >= GHOST_kStandardCursorNumCursors) {
481 }
483 window->setCursorShape(cursor_);
484 break;
485 }
486
487 case GHOST_kKeyE: {
488 int x = 200, y = 200;
489 system_->setCursorPosition(x, y);
490 break;
491 }
492
493 case GHOST_kKeyH:
494 window->setCursorVisibility(!window->getCursorVisibility());
495 break;
496
497 case GHOST_kKeyM: {
498 bool down = false;
499 system_->getModifierKeyState(GHOST_kModifierKeyLeftShift, down);
500 if (down) {
501 std::cout << "left shift down\n";
502 }
503 system_->getModifierKeyState(GHOST_kModifierKeyRightShift, down);
504 if (down) {
505 std::cout << "right shift down\n";
506 }
507 system_->getModifierKeyState(GHOST_kModifierKeyLeftAlt, down);
508 if (down) {
509 std::cout << "left Alt down\n";
510 }
511 system_->getModifierKeyState(GHOST_kModifierKeyRightAlt, down);
512 if (down) {
513 std::cout << "right Alt down\n";
514 }
515 system_->getModifierKeyState(GHOST_kModifierKeyLeftControl, down);
516 if (down) {
517 std::cout << "left control down\n";
518 }
519 system_->getModifierKeyState(GHOST_kModifierKeyRightControl, down);
520 if (down) {
521 std::cout << "right control down\n";
522 }
523 break;
524 }
525
526 case GHOST_kKeyQ:
527 exit_requested_ = true;
528 break;
529
530 case GHOST_kKeyS: // toggle mono and stereo
531 if (stereo) {
532 stereo = false;
533 }
534 else {
535 stereo = true;
536 }
537 break;
538
539 case GHOST_kKeyT:
540 if (!test_timer_) {
541 test_timer_ = system_->installTimer(0, 1000, testTimerProc);
542 }
543
544 else {
545 system_->removeTimer(test_timer_);
546 test_timer_ = 0;
547 }
548
549 break;
550
551 case GHOST_kKeyW:
552 if (main_window_) {
553 std::string title = main_window_->getTitle();
554 title += "-";
555 main_window_->setTitle(title);
556 }
557 break;
558
559 default:
560 break;
561 }
562 break;
563 }
564
566 GHOST_IWindow *window2 = event->getWindow();
567 if (window2 == main_window_) {
568 exit_requested_ = true;
569 }
570 else {
571 system_->disposeWindow(window2);
572 }
573 break;
574 }
575
577 handled = false;
578 break;
579
581 handled = false;
582 break;
583
585 GHOST_IWindow *window2 = event->getWindow();
586 if (!system_->validWindow(window2)) {
587 break;
588 }
589
590 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
591
592 if (stereo) {
593 View(window2, stereo, LEFT_EYE);
594 glPushMatrix();
595 RenderCamera();
596 RenderScene();
597 glPopMatrix();
598
599 View(window2, stereo, RIGHT_EYE);
600 glPushMatrix();
601 RenderCamera();
602 RenderScene();
603 glPopMatrix();
604 }
605 else {
606 View(window2, stereo);
607 glPushMatrix();
608 RenderCamera();
609 RenderScene();
610 glPopMatrix();
611 }
612 window2->swapBufferRelease();
613 break;
614 }
615
616 default:
617 handled = false;
618 break;
619 }
620 return handled;
621}
622
623int main(int /*argc*/, char ** /*argv*/)
624{
625 nVidiaWindows = false;
626 // nVidiaWindows = true;
627
628#ifdef WIN32
629 /* Set a couple of settings in the registry for the nVidia detonator driver.
630 * So this is very specific...
631 */
632 if (nVidiaWindows) {
633 LONG lresult;
634 HKEY hkey = 0;
635 DWORD dwd = 0;
636 // unsigned char buffer[128];
637
638 CRegKey regkey;
639 // DWORD keyValue;
640 // lresult = regkey.Open(
641 // HKEY_LOCAL_MACHINE, "SOFTWARE\\NVIDIA Corporation\\Global\\Stereo3D\\StereoEnable");
642 lresult = regkey.Open(HKEY_LOCAL_MACHINE,
643 "SOFTWARE\\NVIDIA Corporation\\Global\\Stereo3D\\StereoEnable",
644 KEY_ALL_ACCESS);
645
646 if (lresult == ERROR_SUCCESS) {
647 printf("Successfully opened key\n");
648 }
649# if 0
650 lresult = regkey.QueryValue(&keyValue, "StereoEnable");
651 if (lresult == ERROR_SUCCESS) {
652 printf("Successfully queried key\n");
653 }
654# endif
655 lresult = regkey.SetValue(
656 HKEY_LOCAL_MACHINE, "SOFTWARE\\NVIDIA Corporation\\Global\\Stereo3D\\StereoEnable", "1");
657 if (lresult == ERROR_SUCCESS) {
658 printf("Successfully set value for key\n");
659 }
660 regkey.Close();
661 if (lresult == ERROR_SUCCESS) {
662 printf("Successfully closed key\n");
663 }
664 // regkey.Write("2");
665 }
666#endif // WIN32
667
668 // Create the system
671
672 if (fSystem) {
673 // Create an application object
674 Application app(fSystem);
675
676 // Add the application as event consumer
677 fSystem->addEventConsumer(&app);
678
679 // Enter main loop
680 while (!app.exit_requested_) {
681 // printf("main: loop\n");
682 fSystem->processEvents(true);
683 fSystem->dispatchEvents();
684 }
685
686 // Remove so ghost doesn't do a double free
687 fSystem->removeEventConsumer(&app);
688 }
689
690 // Dispose the system
692
693 return 0;
694}
695
696static void gearsTimerProc(GHOST_ITimerTask *task, uint64_t /*time*/)
697{
698 fAngle += 2.0;
699 view_roty += 1.0;
700 GHOST_IWindow *window = (GHOST_IWindow *)task->getUserData();
701 if (fSystem->validWindow(window)) {
702 window->invalidate();
703 }
704}
static GLfloat fAngle
static GLfloat view_roty
static GLfloat view_rotz
static GLfloat view_rotx
static void gearsTimerProc(GHOST_ITimerTask *task, uint64_t time)
static GHOST_ISystem * fSystem
void RenderScene()
static GLfloat view_rotz
void StereoProjection(float left, float right, float bottom, float top, float nearplane, float farplane, float zero_plane, float dist, float eye)
static void gearGL(GLfloat inner_radius, GLfloat outer_radius, GLfloat width, GLint teeth, GLfloat tooth_depth)
#define RIGHT_EYE
static void testTimerProc(GHOST_ITimerTask *, uint64_t time)
void RenderCamera()
static bool nVidiaWindows
#define LEFT_EYE
static void drawGearGL(int id)
static void View(GHOST_IWindow *window, bool stereo, int eye=0)
static class Application * fApp
@ GHOST_kWindowStateNormal
GHOST_TStandardCursor
#define GHOST_kStandardCursorNumCursors
@ GHOST_kEventWindowClose
@ GHOST_kEventWheel
@ GHOST_kEventCursorMove
@ GHOST_kEventWindowActivate
@ GHOST_kEventWindowUpdate
@ GHOST_kEventWindowDeactivate
@ GHOST_kEventKeyDown
@ GHOST_kEventUnknown
@ GHOST_kEventKeyUp
#define GHOST_kStandardCursorFirstCursor
@ GHOST_kKeyT
@ GHOST_kKeyW
@ GHOST_kKeyC
@ GHOST_kKeyQ
@ GHOST_kKeyM
@ GHOST_kKeyS
@ GHOST_kKeyH
@ GHOST_kKeyE
@ GHOST_kModifierKeyRightControl
@ GHOST_kModifierKeyLeftControl
@ GHOST_kModifierKeyRightAlt
@ GHOST_kModifierKeyRightShift
@ GHOST_kModifierKeyLeftAlt
@ GHOST_kModifierKeyLeftShift
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
Definition IK_Math.h:117
ATTR_WARN_UNUSED_RESULT const BMVert * v
unsigned long long int uint64_t
GHOST_ITimerTask * gears_timer_
Application(GHOST_ISystem *system)
GHOST_IWindow * secondary_window_
GHOST_ITimerTask * test_timer_
GHOST_ISystem * system_
virtual bool processEvent(GHOST_IEvent *event)
GHOST_IWindow * main_window_
bool exit_requested_
GHOST_TStandardCursor cursor_
virtual GHOST_TEventType getType() const =0
virtual GHOST_TEventDataPtr getData() const =0
static GHOST_ISystem * getSystem()
virtual GHOST_IWindow * createWindow(const char *title, int32_t left, int32_t top, uint32_t width, uint32_t height, GHOST_TWindowState state, GHOST_GPUSettings gpu_settings, const bool exclusive=false, const bool is_dialog=false, const GHOST_IWindow *parent_window=nullptr)=0
virtual GHOST_ITimerTask * installTimer(uint64_t delay, uint64_t interval, GHOST_TimerProcPtr timer_proc, GHOST_TUserDataPtr user_data=nullptr)=0
static GHOST_TSuccess createSystem(bool verbose, bool background)
static GHOST_TSuccess disposeSystem()
virtual GHOST_TUserDataPtr getUserData() const =0
virtual void getClientBounds(GHOST_Rect &bounds) const =0
virtual GHOST_TSuccess activateDrawingContext()=0
virtual GHOST_TSuccess setCursorShape(GHOST_TStandardCursor cursor_shape)=0
virtual GHOST_TSuccess swapBufferRelease()=0
virtual GHOST_TSuccess setCursorVisibility(bool visible)=0
virtual bool getCursorVisibility() const =0
virtual GHOST_TSuccess invalidate()=0
virtual int32_t getHeight() const
virtual int32_t getWidth() const
uint pos
uint top
#define main()
#define printf(...)
#define sin
#define cos
#define sqrt
float distance(VecOp< float, D >, VecOp< float, D >) RET
static int left
GHOST_TDrawingContextType context_type
i
Definition text_draw.cc:230
uint len