1 /* 2 * This program is free software; you can redistribute it and/or 3 * modify it under the terms of the GNU General Public License 4 * as published by the Free Software Foundation; either version 2 5 * of the License, or (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software Foundation, 14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 15 * 16 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 17 * All rights reserved. 18 */ 19 20 /** \file 21 * \ingroup GHOST 22 */ 23 24 #pragma once 25 26 #ifdef WITH_CXX_GUARDEDALLOC 27 # include "MEM_guardedalloc.h" 28 #endif 29 30 #if defined(WITH_CXX_GUARDEDALLOC) && defined(__cplusplus) 31 # define GHOST_DECLARE_HANDLE(name) \ 32 typedef struct name##__ { \ 33 int unused; \ 34 MEM_CXX_CLASS_ALLOC_FUNCS(#name) \ 35 } * name 36 #else 37 # define GHOST_DECLARE_HANDLE(name) \ 38 typedef struct name##__ { \ 39 int unused; \ 40 } * name 41 #endif 42 43 /** 44 * Creates a "handle" for a C++ GHOST object. 45 * A handle is just an opaque pointer to an empty struct. 46 * In the API the pointer is cast to the actual C++ class. 47 * The 'name' argument to the macro is the name of the handle to create. 48 */ 49 50 GHOST_DECLARE_HANDLE(GHOST_SystemHandle); 51 GHOST_DECLARE_HANDLE(GHOST_TimerTaskHandle); 52 GHOST_DECLARE_HANDLE(GHOST_WindowHandle); 53 GHOST_DECLARE_HANDLE(GHOST_EventHandle); 54 GHOST_DECLARE_HANDLE(GHOST_RectangleHandle); 55 GHOST_DECLARE_HANDLE(GHOST_EventConsumerHandle); 56 GHOST_DECLARE_HANDLE(GHOST_ContextHandle); 57 GHOST_DECLARE_HANDLE(GHOST_XrContextHandle); 58 59 typedef char GHOST_TInt8; 60 typedef unsigned char GHOST_TUns8; 61 typedef short GHOST_TInt16; 62 typedef unsigned short GHOST_TUns16; 63 typedef int GHOST_TInt32; 64 typedef unsigned int GHOST_TUns32; 65 66 typedef struct { 67 int flags; 68 } GHOST_GLSettings; 69 70 typedef enum { 71 GHOST_glStereoVisual = (1 << 0), 72 GHOST_glDebugContext = (1 << 1), 73 GHOST_glAlphaBackground = (1 << 2), 74 } GHOST_GLFlags; 75 76 typedef enum GHOST_DialogOptions { 77 GHOST_DialogWarning = (1 << 0), 78 GHOST_DialogError = (1 << 1), 79 } GHOST_DialogOptions; 80 81 #ifdef _MSC_VER 82 typedef __int64 GHOST_TInt64; 83 typedef unsigned __int64 GHOST_TUns64; 84 #else 85 typedef long long GHOST_TInt64; 86 typedef unsigned long long GHOST_TUns64; 87 #endif 88 89 typedef void *GHOST_TUserDataPtr; 90 91 typedef enum { GHOST_kFailure = 0, GHOST_kSuccess } GHOST_TSuccess; 92 93 /* Xtilt and Ytilt represent how much the pen is tilted away from 94 * vertically upright in either the X or Y direction, with X and Y the 95 * axes of the tablet surface. 96 * In other words, Xtilt and Ytilt are components of a vector created by projecting 97 * the pen's angle in 3D space vertically downwards on to the XY plane 98 * --Matt 99 */ 100 typedef enum { 101 GHOST_kTabletModeNone = 0, 102 GHOST_kTabletModeStylus, 103 GHOST_kTabletModeEraser 104 } GHOST_TTabletMode; 105 106 typedef enum { 107 GHOST_kTabletAutomatic = 0, 108 GHOST_kTabletNative, 109 GHOST_kTabletWintab, 110 } GHOST_TTabletAPI; 111 112 typedef struct GHOST_TabletData { 113 GHOST_TTabletMode Active; /* 0=None, 1=Stylus, 2=Eraser */ 114 float Pressure; /* range 0.0 (not touching) to 1.0 (full pressure) */ 115 float Xtilt; /* range 0.0 (upright) to 1.0 (tilted fully against the tablet surface) */ 116 float Ytilt; /* as above */ 117 } GHOST_TabletData; 118 119 static const GHOST_TabletData GHOST_TABLET_DATA_NONE = { 120 GHOST_kTabletModeNone, /* No cursor in range */ 121 1.0f, /* Pressure */ 122 0.0f, /* Xtilt */ 123 0.0f}; /* Ytilt */ 124 125 typedef enum { 126 GHOST_kNotVisible = 0, 127 GHOST_kPartiallyVisible, 128 GHOST_kFullyVisible 129 } GHOST_TVisibility; 130 131 typedef enum { GHOST_kFireTimeNever = 0xFFFFFFFF } GHOST_TFireTimeConstant; 132 133 typedef enum { 134 GHOST_kModifierKeyLeftShift = 0, 135 GHOST_kModifierKeyRightShift, 136 GHOST_kModifierKeyLeftAlt, 137 GHOST_kModifierKeyRightAlt, 138 GHOST_kModifierKeyLeftControl, 139 GHOST_kModifierKeyRightControl, 140 GHOST_kModifierKeyOS, 141 GHOST_kModifierKeyNumMasks 142 } GHOST_TModifierKeyMask; 143 144 typedef enum { 145 GHOST_kWindowStateNormal = 0, 146 GHOST_kWindowStateMaximized, 147 GHOST_kWindowStateMinimized, 148 GHOST_kWindowStateFullScreen, 149 GHOST_kWindowStateEmbedded, 150 // GHOST_kWindowStateModified, 151 // GHOST_kWindowStateUnModified, 152 } GHOST_TWindowState; 153 154 typedef enum { GHOST_kWindowOrderTop = 0, GHOST_kWindowOrderBottom } GHOST_TWindowOrder; 155 156 typedef enum { 157 GHOST_kDrawingContextTypeNone = 0, 158 GHOST_kDrawingContextTypeOpenGL, 159 #ifdef WIN32 160 GHOST_kDrawingContextTypeD3D, 161 #endif 162 } GHOST_TDrawingContextType; 163 164 typedef enum { 165 GHOST_kButtonMaskLeft = 0, 166 GHOST_kButtonMaskMiddle, 167 GHOST_kButtonMaskRight, 168 GHOST_kButtonMaskButton4, 169 GHOST_kButtonMaskButton5, 170 /* Trackballs and programmable buttons */ 171 GHOST_kButtonMaskButton6, 172 GHOST_kButtonMaskButton7, 173 GHOST_kButtonNumMasks 174 } GHOST_TButtonMask; 175 176 typedef enum { 177 GHOST_kEventUnknown = 0, 178 179 GHOST_kEventCursorMove, /// Mouse move event 180 GHOST_kEventButtonDown, /// Mouse button event 181 GHOST_kEventButtonUp, /// Mouse button event 182 GHOST_kEventWheel, /// Mouse wheel event 183 GHOST_kEventTrackpad, /// Trackpad event 184 185 #ifdef WITH_INPUT_NDOF 186 GHOST_kEventNDOFMotion, /// N degree of freedom device motion event 187 GHOST_kEventNDOFButton, /// N degree of freedom device button event 188 #endif 189 190 GHOST_kEventKeyDown, 191 GHOST_kEventKeyUp, 192 // GHOST_kEventKeyAuto, 193 194 GHOST_kEventQuitRequest, 195 196 GHOST_kEventWindowClose, 197 GHOST_kEventWindowActivate, 198 GHOST_kEventWindowDeactivate, 199 GHOST_kEventWindowUpdate, 200 GHOST_kEventWindowSize, 201 GHOST_kEventWindowMove, 202 GHOST_kEventWindowDPIHintChanged, 203 204 GHOST_kEventDraggingEntered, 205 GHOST_kEventDraggingUpdated, 206 GHOST_kEventDraggingExited, 207 GHOST_kEventDraggingDropDone, 208 209 GHOST_kEventOpenMainFile, // Needed for Cocoa to open double-clicked .blend file at startup 210 GHOST_kEventNativeResolutionChange, // Needed for Cocoa when window moves to other display 211 212 GHOST_kEventTimer, 213 214 GHOST_kEventImeCompositionStart, 215 GHOST_kEventImeComposition, 216 GHOST_kEventImeCompositionEnd, 217 218 GHOST_kNumEventTypes 219 } GHOST_TEventType; 220 221 typedef enum { 222 GHOST_kStandardCursorFirstCursor = 0, 223 GHOST_kStandardCursorDefault = 0, 224 GHOST_kStandardCursorRightArrow, 225 GHOST_kStandardCursorLeftArrow, 226 GHOST_kStandardCursorInfo, 227 GHOST_kStandardCursorDestroy, 228 GHOST_kStandardCursorHelp, 229 GHOST_kStandardCursorWait, 230 GHOST_kStandardCursorText, 231 GHOST_kStandardCursorCrosshair, 232 GHOST_kStandardCursorCrosshairA, 233 GHOST_kStandardCursorCrosshairB, 234 GHOST_kStandardCursorCrosshairC, 235 GHOST_kStandardCursorPencil, 236 GHOST_kStandardCursorUpArrow, 237 GHOST_kStandardCursorDownArrow, 238 GHOST_kStandardCursorVerticalSplit, 239 GHOST_kStandardCursorHorizontalSplit, 240 GHOST_kStandardCursorEraser, 241 GHOST_kStandardCursorKnife, 242 GHOST_kStandardCursorEyedropper, 243 GHOST_kStandardCursorZoomIn, 244 GHOST_kStandardCursorZoomOut, 245 GHOST_kStandardCursorMove, 246 GHOST_kStandardCursorNSEWScroll, 247 GHOST_kStandardCursorNSScroll, 248 GHOST_kStandardCursorEWScroll, 249 GHOST_kStandardCursorStop, 250 GHOST_kStandardCursorUpDown, 251 GHOST_kStandardCursorLeftRight, 252 GHOST_kStandardCursorTopSide, 253 GHOST_kStandardCursorBottomSide, 254 GHOST_kStandardCursorLeftSide, 255 GHOST_kStandardCursorRightSide, 256 GHOST_kStandardCursorTopLeftCorner, 257 GHOST_kStandardCursorTopRightCorner, 258 GHOST_kStandardCursorBottomRightCorner, 259 GHOST_kStandardCursorBottomLeftCorner, 260 GHOST_kStandardCursorCopy, 261 GHOST_kStandardCursorCustom, 262 263 GHOST_kStandardCursorNumCursors 264 } GHOST_TStandardCursor; 265 266 typedef enum { 267 GHOST_kKeyUnknown = -1, 268 GHOST_kKeyBackSpace, 269 GHOST_kKeyTab, 270 GHOST_kKeyLinefeed, 271 GHOST_kKeyClear, 272 GHOST_kKeyEnter = 0x0D, 273 274 GHOST_kKeyEsc = 0x1B, 275 GHOST_kKeySpace = ' ', 276 GHOST_kKeyQuote = 0x27, 277 GHOST_kKeyComma = ',', 278 GHOST_kKeyMinus = '-', 279 GHOST_kKeyPlus = '+', 280 GHOST_kKeyPeriod = '.', 281 GHOST_kKeySlash = '/', 282 283 // Number keys 284 GHOST_kKey0 = '0', 285 GHOST_kKey1, 286 GHOST_kKey2, 287 GHOST_kKey3, 288 GHOST_kKey4, 289 GHOST_kKey5, 290 GHOST_kKey6, 291 GHOST_kKey7, 292 GHOST_kKey8, 293 GHOST_kKey9, 294 295 GHOST_kKeySemicolon = ';', 296 GHOST_kKeyEqual = '=', 297 298 // Character keys 299 GHOST_kKeyA = 'A', 300 GHOST_kKeyB, 301 GHOST_kKeyC, 302 GHOST_kKeyD, 303 GHOST_kKeyE, 304 GHOST_kKeyF, 305 GHOST_kKeyG, 306 GHOST_kKeyH, 307 GHOST_kKeyI, 308 GHOST_kKeyJ, 309 GHOST_kKeyK, 310 GHOST_kKeyL, 311 GHOST_kKeyM, 312 GHOST_kKeyN, 313 GHOST_kKeyO, 314 GHOST_kKeyP, 315 GHOST_kKeyQ, 316 GHOST_kKeyR, 317 GHOST_kKeyS, 318 GHOST_kKeyT, 319 GHOST_kKeyU, 320 GHOST_kKeyV, 321 GHOST_kKeyW, 322 GHOST_kKeyX, 323 GHOST_kKeyY, 324 GHOST_kKeyZ, 325 326 GHOST_kKeyLeftBracket = '[', 327 GHOST_kKeyRightBracket = ']', 328 GHOST_kKeyBackslash = 0x5C, 329 GHOST_kKeyAccentGrave = '`', 330 331 GHOST_kKeyLeftShift = 0x100, 332 GHOST_kKeyRightShift, 333 GHOST_kKeyLeftControl, 334 GHOST_kKeyRightControl, 335 GHOST_kKeyLeftAlt, 336 GHOST_kKeyRightAlt, 337 GHOST_kKeyOS, // Command key on Apple, Windows key(s) on Windows 338 GHOST_kKeyGrLess, // German PC only! 339 GHOST_kKeyApp, /* Also known as menu key. */ 340 341 GHOST_kKeyCapsLock, 342 GHOST_kKeyNumLock, 343 GHOST_kKeyScrollLock, 344 345 GHOST_kKeyLeftArrow, 346 GHOST_kKeyRightArrow, 347 GHOST_kKeyUpArrow, 348 GHOST_kKeyDownArrow, 349 350 GHOST_kKeyPrintScreen, 351 GHOST_kKeyPause, 352 353 GHOST_kKeyInsert, 354 GHOST_kKeyDelete, 355 GHOST_kKeyHome, 356 GHOST_kKeyEnd, 357 GHOST_kKeyUpPage, 358 GHOST_kKeyDownPage, 359 360 // Numpad keys 361 GHOST_kKeyNumpad0, 362 GHOST_kKeyNumpad1, 363 GHOST_kKeyNumpad2, 364 GHOST_kKeyNumpad3, 365 GHOST_kKeyNumpad4, 366 GHOST_kKeyNumpad5, 367 GHOST_kKeyNumpad6, 368 GHOST_kKeyNumpad7, 369 GHOST_kKeyNumpad8, 370 GHOST_kKeyNumpad9, 371 GHOST_kKeyNumpadPeriod, 372 GHOST_kKeyNumpadEnter, 373 GHOST_kKeyNumpadPlus, 374 GHOST_kKeyNumpadMinus, 375 GHOST_kKeyNumpadAsterisk, 376 GHOST_kKeyNumpadSlash, 377 378 // Function keys 379 GHOST_kKeyF1, 380 GHOST_kKeyF2, 381 GHOST_kKeyF3, 382 GHOST_kKeyF4, 383 GHOST_kKeyF5, 384 GHOST_kKeyF6, 385 GHOST_kKeyF7, 386 GHOST_kKeyF8, 387 GHOST_kKeyF9, 388 GHOST_kKeyF10, 389 GHOST_kKeyF11, 390 GHOST_kKeyF12, 391 GHOST_kKeyF13, 392 GHOST_kKeyF14, 393 GHOST_kKeyF15, 394 GHOST_kKeyF16, 395 GHOST_kKeyF17, 396 GHOST_kKeyF18, 397 GHOST_kKeyF19, 398 GHOST_kKeyF20, 399 GHOST_kKeyF21, 400 GHOST_kKeyF22, 401 GHOST_kKeyF23, 402 GHOST_kKeyF24, 403 404 // Multimedia keypad buttons 405 GHOST_kKeyMediaPlay, 406 GHOST_kKeyMediaStop, 407 GHOST_kKeyMediaFirst, 408 GHOST_kKeyMediaLast 409 } GHOST_TKey; 410 411 typedef enum { 412 /** Grab not set. */ 413 GHOST_kGrabDisable = 0, 414 /** No cursor adjustments. */ 415 GHOST_kGrabNormal, 416 /** Wrap the mouse location to prevent limiting screen bounds. */ 417 GHOST_kGrabWrap, 418 /** Hide the mouse while grabbing and restore the original location on release (numbuts). */ 419 GHOST_kGrabHide, 420 } GHOST_TGrabCursorMode; 421 422 typedef enum { 423 /** Axis that cursor grab will wrap. */ 424 GHOST_kGrabAxisNone = 0, 425 GHOST_kAxisX = (1 << 0), 426 GHOST_kGrabAxisY = (1 << 1), 427 } GHOST_TAxisFlag; 428 429 typedef void *GHOST_TEventDataPtr; 430 431 typedef struct { 432 /** The x-coordinate of the cursor position. */ 433 GHOST_TInt32 x; 434 /** The y-coordinate of the cursor position. */ 435 GHOST_TInt32 y; 436 /** Associated tablet data. */ 437 GHOST_TabletData tablet; 438 } GHOST_TEventCursorData; 439 440 typedef struct { 441 /** The mask of the mouse button. */ 442 GHOST_TButtonMask button; 443 /** Associated tablet data. */ 444 GHOST_TabletData tablet; 445 } GHOST_TEventButtonData; 446 447 typedef struct { 448 /** Displacement of a mouse wheel. */ 449 GHOST_TInt32 z; 450 } GHOST_TEventWheelData; 451 452 typedef enum { 453 GHOST_kTrackpadEventUnknown = 0, 454 GHOST_kTrackpadEventScroll, 455 GHOST_kTrackpadEventRotate, 456 GHOST_kTrackpadEventSwipe, /* Reserved, not used for now */ 457 GHOST_kTrackpadEventMagnify, 458 GHOST_kTrackpadEventSmartMagnify 459 } GHOST_TTrackpadEventSubTypes; 460 461 typedef struct { 462 /** The event subtype */ 463 GHOST_TTrackpadEventSubTypes subtype; 464 /** The x-location of the trackpad event */ 465 GHOST_TInt32 x; 466 /** The y-location of the trackpad event */ 467 GHOST_TInt32 y; 468 /** The x-delta or value of the trackpad event */ 469 GHOST_TInt32 deltaX; 470 /** The y-delta (currently only for scroll subtype) of the trackpad event */ 471 GHOST_TInt32 deltaY; 472 } GHOST_TEventTrackpadData; 473 474 typedef enum { 475 GHOST_kDragnDropTypeUnknown = 0, 476 GHOST_kDragnDropTypeFilenames, /*Array of strings representing file names (full path) */ 477 GHOST_kDragnDropTypeString, /* Unformatted text UTF-8 string */ 478 GHOST_kDragnDropTypeBitmap /*Bitmap image data */ 479 } GHOST_TDragnDropTypes; 480 481 typedef struct { 482 /** The x-coordinate of the cursor position. */ 483 GHOST_TInt32 x; 484 /** The y-coordinate of the cursor position. */ 485 GHOST_TInt32 y; 486 /** The dropped item type */ 487 GHOST_TDragnDropTypes dataType; 488 /** The "dropped content" */ 489 GHOST_TEventDataPtr data; 490 } GHOST_TEventDragnDropData; 491 492 /** similar to wmImeData */ 493 typedef struct { 494 /** size_t */ 495 GHOST_TUserDataPtr result_len, composite_len; 496 /** char * utf8 encoding */ 497 GHOST_TUserDataPtr result, composite; 498 /** Cursor position in the IME composition. */ 499 int cursor_position; 500 /** Represents the position of the beginning of the selection */ 501 int target_start; 502 /** Represents the position of the end of the selection */ 503 int target_end; 504 /** custom temporal data */ 505 GHOST_TUserDataPtr tmp; 506 } GHOST_TEventImeData; 507 508 typedef struct { 509 int count; 510 GHOST_TUns8 **strings; 511 } GHOST_TStringArray; 512 513 typedef enum { 514 GHOST_kNotStarted, 515 GHOST_kStarting, 516 GHOST_kInProgress, 517 GHOST_kFinishing, 518 GHOST_kFinished 519 } GHOST_TProgress; 520 521 #ifdef WITH_INPUT_NDOF 522 typedef struct { 523 /** N-degree of freedom device data v3 [GSoC 2010] */ 524 // Each component normally ranges from -1 to +1, but can exceed that. 525 // These use blender standard view coordinates, with positive rotations being CCW about the axis. 526 float tx, ty, tz; // translation 527 float rx, ry, rz; // rotation: 528 // axis = (rx,ry,rz).normalized 529 // amount = (rx,ry,rz).magnitude [in revolutions, 1.0 = 360 deg] 530 float dt; // time since previous NDOF Motion event 531 GHOST_TProgress progress; // Starting, InProgress or Finishing (for modal handlers) 532 } GHOST_TEventNDOFMotionData; 533 534 typedef enum { GHOST_kPress, GHOST_kRelease } GHOST_TButtonAction; 535 // good for mouse or other buttons too, hmmm? 536 537 typedef struct { 538 GHOST_TButtonAction action; 539 short button; 540 } GHOST_TEventNDOFButtonData; 541 #endif // WITH_INPUT_NDOF 542 543 typedef struct { 544 /** The key code. */ 545 GHOST_TKey key; 546 547 /* ascii / utf8: both should always be set when possible, 548 * - ascii may be '\0' however if the user presses a non ascii key 549 * - unicode may not be set if the system has no unicode support 550 * 551 * These values are intended to be used as follows. 552 * For text input use unicode when available, fallback to ascii. 553 * For areas where unicode is not needed, number input for example, always 554 * use ascii, unicode is ignored - campbell. 555 */ 556 /** The ascii code for the key event ('\0' if none). */ 557 char ascii; 558 /** The unicode character. if the length is 6, not NULL terminated if all 6 are set */ 559 char utf8_buf[6]; 560 561 /** Generated by auto-repeat. */ 562 char is_repeat; 563 } GHOST_TEventKeyData; 564 565 typedef struct { 566 /** Number of pixels on a line. */ 567 GHOST_TUns32 xPixels; 568 /** Number of lines. */ 569 GHOST_TUns32 yPixels; 570 /** Numberof bits per pixel. */ 571 GHOST_TUns32 bpp; 572 /** Refresh rate (in Hertz). */ 573 GHOST_TUns32 frequency; 574 } GHOST_DisplaySetting; 575 576 #ifdef _WIN32 577 typedef void *GHOST_TEmbedderWindowID; 578 #endif // _WIN32 579 580 #ifndef _WIN32 581 // I can't use "Window" from "<X11/Xlib.h>" because it conflits with Window defined in winlay.h 582 typedef int GHOST_TEmbedderWindowID; 583 #endif // _WIN32 584 585 /** 586 * A timer task callback routine. 587 * \param task The timer task object. 588 * \param time The current time. 589 */ 590 #ifdef __cplusplus 591 class GHOST_ITimerTask; 592 typedef void (*GHOST_TimerProcPtr)(GHOST_ITimerTask *task, GHOST_TUns64 time); 593 #else 594 struct GHOST_TimerTaskHandle__; 595 typedef void (*GHOST_TimerProcPtr)(struct GHOST_TimerTaskHandle__ *task, GHOST_TUns64 time); 596 #endif 597 598 #ifdef WITH_XR_OPENXR 599 600 struct GHOST_XrDrawViewInfo; 601 struct GHOST_XrError; 602 /** 603 * The XR view (i.e. the OpenXR runtime) may require a different graphics library than OpenGL. An 604 * offscreen texture of the viewport will then be drawn into using OpenGL, but the final texture 605 * draw call will happen through another lib (say DirectX). 606 * 607 * This enum defines the possible graphics bindings to attempt to enable. 608 */ 609 typedef enum GHOST_TXrGraphicsBinding { 610 GHOST_kXrGraphicsUnknown = 0, 611 GHOST_kXrGraphicsOpenGL, 612 # ifdef WIN32 613 GHOST_kXrGraphicsD3D11, 614 # endif 615 /* For later */ 616 // GHOST_kXrGraphicsVulkan, 617 } GHOST_TXrGraphicsBinding; 618 619 typedef void (*GHOST_XrErrorHandlerFn)(const struct GHOST_XrError *); 620 621 typedef void (*GHOST_XrSessionExitFn)(void *customdata); 622 623 typedef void *(*GHOST_XrGraphicsContextBindFn)(void); 624 typedef void (*GHOST_XrGraphicsContextUnbindFn)(GHOST_ContextHandle graphics_context); 625 typedef void (*GHOST_XrDrawViewFn)(const struct GHOST_XrDrawViewInfo *draw_view, void *customdata); 626 627 /* An array of GHOST_TXrGraphicsBinding items defining the candidate bindings to use. The first 628 * available candidate will be chosen, so order defines priority. */ 629 typedef const GHOST_TXrGraphicsBinding *GHOST_XrGraphicsBindingCandidates; 630 631 typedef struct { 632 float position[3]; 633 /* Blender convention (w, x, y, z) */ 634 float orientation_quat[4]; 635 } GHOST_XrPose; 636 637 enum { 638 GHOST_kXrContextDebug = (1 << 0), 639 GHOST_kXrContextDebugTime = (1 << 1), 640 }; 641 642 typedef struct { 643 const GHOST_XrGraphicsBindingCandidates gpu_binding_candidates; 644 unsigned int gpu_binding_candidates_count; 645 646 unsigned int context_flag; 647 } GHOST_XrContextCreateInfo; 648 649 typedef struct { 650 GHOST_XrPose base_pose; 651 652 GHOST_XrSessionExitFn exit_fn; 653 void *exit_customdata; 654 } GHOST_XrSessionBeginInfo; 655 656 typedef struct GHOST_XrDrawViewInfo { 657 int ofsx, ofsy; 658 int width, height; 659 660 GHOST_XrPose eye_pose; 661 GHOST_XrPose local_pose; 662 663 struct { 664 float angle_left, angle_right; 665 float angle_up, angle_down; 666 } fov; 667 668 /** Set if the buffer should be submitted with a srgb transfer applied. */ 669 char expects_srgb_buffer; 670 } GHOST_XrDrawViewInfo; 671 672 typedef struct GHOST_XrError { 673 const char *user_message; 674 675 void *customdata; 676 } GHOST_XrError; 677 678 #endif 679