1 /*! @header Quesa.h 2 Declares the fundamental Quesa types and functions. 3 */ 4 /* NAME: 5 Quesa.h 6 7 DESCRIPTION: 8 Quesa public header. 9 10 COPYRIGHT: 11 Copyright (c) 1999-2004, Quesa Developers. All rights reserved. 12 13 For the current release of Quesa, please see: 14 15 <http://www.quesa.org/> 16 17 Redistribution and use in source and binary forms, with or without 18 modification, are permitted provided that the following conditions 19 are met: 20 21 o Redistributions of source code must retain the above copyright 22 notice, this list of conditions and the following disclaimer. 23 24 o Redistributions in binary form must reproduce the above 25 copyright notice, this list of conditions and the following 26 disclaimer in the documentation and/or other materials provided 27 with the distribution. 28 29 o Neither the name of Quesa nor the names of its contributors 30 may be used to endorse or promote products derived from this 31 software without specific prior written permission. 32 33 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 34 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 35 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 36 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 37 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 38 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 39 TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 40 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 41 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 42 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 43 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 44 */ 45 #ifndef QUESA_HDR 46 #define QUESA_HDR 47 //============================================================================= 48 // Auto-discovery 49 //----------------------------------------------------------------------------- 50 // Note : Since we normally use a fairly well defined set of compilers, 51 // we can attempt to determine the correct platform by magic. 52 //----------------------------------------------------------------------------- 53 #if !defined(QUESA_OS_MACINTOSH) && \ 54 !defined(QUESA_OS_WIN32) && \ 55 !defined(QUESA_OS_UNIX) && \ 56 !defined(QUESA_OS_BE) && \ 57 !defined(QUESA_OS_COCOA) 58 59 // Mac OS 60 #if ((defined(__MWERKS__) && __dest_os == __mac_os) || defined(MPW_CPLUS) || defined(MPW_C)) 61 #ifndef QUESA_OS_MACINTOSH 62 #define QUESA_OS_MACINTOSH 1 63 #endif 64 #endif 65 66 67 // Windows 68 #if (defined(_MSC_VER) || (defined(__MWERKS__) && __INTEL__)) 69 #ifndef QUESA_OS_WIN32 70 #define QUESA_OS_WIN32 1 71 #endif 72 #endif 73 74 75 // Be 76 #if ((defined(__be_os) && (__dest_os == __be_os))) 77 #ifndef QUESA_OS_BE 78 #define QUESA_OS_BE 1 79 #endif 80 #endif 81 82 #endif 83 84 85 86 87 88 //============================================================================= 89 // Platform selection 90 //----------------------------------------------------------------------------- 91 // Note : Build systems are responsible for defining one QUESA_OS_xxxx 92 // constant, depending on the current platform. 93 // 94 // The other platform values are then set to 0 here. 95 //----------------------------------------------------------------------------- 96 #ifdef QUESA_OS_COCOA 97 #undef QUESA_OS_COCOA 98 #define QUESA_OS_COCOA 1 99 #define QUESA_OS_MACINTOSH 1 100 #else 101 #define QUESA_OS_COCOA 0 102 #endif 103 104 #ifdef QUESA_OS_MACINTOSH 105 #undef QUESA_OS_MACINTOSH 106 #define QUESA_OS_MACINTOSH 1 107 #else 108 #define QUESA_OS_MACINTOSH 0 109 #endif 110 111 #ifdef QUESA_OS_WIN32 112 #undef QUESA_OS_WIN32 113 #define QUESA_OS_WIN32 1 114 #else 115 #define QUESA_OS_WIN32 0 116 #endif 117 118 #ifdef QUESA_OS_UNIX 119 #undef QUESA_OS_UNIX 120 #define QUESA_OS_UNIX 1 121 #else 122 #define QUESA_OS_UNIX 0 123 #endif 124 125 #ifdef QUESA_OS_BE 126 #undef QUESA_OS_BE 127 #define QUESA_OS_BE 1 128 #else 129 #define QUESA_OS_BE 0 130 #endif 131 132 #if (!QUESA_OS_MACINTOSH && \ 133 !QUESA_OS_WIN32 && \ 134 !QUESA_OS_UNIX && \ 135 !QUESA_OS_BE) 136 #error Target OS not selected! 137 #endif 138 139 #if ( (QUESA_OS_MACINTOSH && (QUESA_OS_WIN32 || QUESA_OS_UNIX || QUESA_OS_BE )) || \ 140 (QUESA_OS_WIN32 && (QUESA_OS_MACINTOSH || QUESA_OS_UNIX || QUESA_OS_BE )) || \ 141 (QUESA_OS_UNIX && (QUESA_OS_MACINTOSH || QUESA_OS_WIN32 || QUESA_OS_BE )) || \ 142 (QUESA_OS_BE && (QUESA_OS_MACINTOSH || QUESA_OS_WIN32 || QUESA_OS_UNIX )) ) 143 #error More than one target OS has been selected! 144 #endif 145 146 147 148 149 150 //============================================================================= 151 // Platform specific pre-amble 152 //----------------------------------------------------------------------------- 153 // Mac specific 154 #if (QUESA_OS_MACINTOSH) 155 // Build constants 156 #ifdef __LITTLE_ENDIAN__ 157 #define QUESA_HOST_IS_BIG_ENDIAN 0 158 #else 159 #define QUESA_HOST_IS_BIG_ENDIAN 1 160 #endif 161 162 #define QUESA_SUPPORT_QUICKTIME 1 163 164 #if defined(__GNUC__) && (defined(__APPLE_CPP__) || defined(__APPLE_CC__) || defined(__NEXT_CPP__)) 165 #define QUESA_UH_IN_FRAMEWORKS 1 166 #elif defined(__MACH__) && __MACH__ 167 #define QUESA_UH_IN_FRAMEWORKS 1 168 #else 169 #define QUESA_UH_IN_FRAMEWORKS 0 170 #endif 171 172 173 // Includes 174 #if QUESA_UH_IN_FRAMEWORKS 175 #include <Carbon/Carbon.h> 176 #else 177 #include <Dialogs.h> 178 #include <MacTypes.h> 179 #endif 180 181 182 // Ensure compiler settings match QD3D, to be binary compatible 183 #pragma options align=power 184 185 186 // Export symbols when building a shared library 187 #ifdef Q3_EXPORT_SYMBOLS 188 #if __MWERKS__ 189 #define Q3_EXTERN_API_C(_type) __declspec(dllexport) _type 190 #elif __GNUC__ >= 4 191 #define Q3_EXTERN_API_C(_type) __attribute__((visibility("default"))) _type 192 #endif 193 #endif 194 #endif // QUESA_OS_MACINTOSH 195 196 197 // Windows specific 198 #if QUESA_OS_WIN32 199 // Build constants 200 #define QUESA_HOST_IS_BIG_ENDIAN 0 201 202 203 // Includes for VC++ (Win CW builds should use the Win32Headers prefix) 204 #if _MSC_VER 205 #include <Windows.h> 206 207 // Disable unknown #pragma warning for VC++ 208 #pragma warning(disable:4068) 209 #endif 210 211 212 // Export symbols when building a shared library 213 #ifdef Q3_EXPORT_SYMBOLS 214 #define Q3_EXTERN_API_C(_type) __declspec(dllexport) _type __cdecl 215 #endif 216 #endif // QUESA_OS_WIN32 217 218 219 220 221 222 //============================================================================= 223 // Platform independent pre-amble 224 //----------------------------------------------------------------------------- 225 // Default to big endian 226 #ifndef QUESA_HOST_IS_BIG_ENDIAN 227 #define QUESA_HOST_IS_BIG_ENDIAN 1 228 #endif 229 230 231 // Default to not supporting QuickTime 232 #ifndef QUESA_SUPPORT_QUICKTIME 233 #define QUESA_SUPPORT_QUICKTIME 0 234 #endif 235 236 237 // Default to allowing extensions to the QD3D API 238 #ifndef QUESA_ALLOW_QD3D_EXTENSIONS 239 #define QUESA_ALLOW_QD3D_EXTENSIONS 1 240 #endif 241 242 243 // Default to not using inline APIs 244 #ifndef QUESA_ALLOW_INLINE_APIS 245 #define QUESA_ALLOW_INLINE_APIS 0 246 #endif 247 248 249 // Sanity-check that extensions are only used for legacy targets 250 #if !QUESA_ALLOW_QD3D_EXTENSIONS 251 #if !((QUESA_OS_MACINTOSH && !TARGET_API_MAC_CARBON) || QUESA_OS_WIN32) 252 #error "Extensions should only be turned off on Mac Classic or Win32 platforms" 253 #endif 254 #endif 255 256 257 258 259 260 //============================================================================= 261 // Include files 262 //----------------------------------------------------------------------------- 263 #if QUESA_SUPPORT_QUICKTIME 264 #if ((QUESA_OS_MACINTOSH && QUESA_UH_IN_FRAMEWORKS) || (QUESA_OS_COCOA)) 265 #include <QuickTime/Movies.h> 266 #else 267 #include <Movies.h> 268 #endif 269 #endif 270 271 // Disable QD3D header 272 #if defined(__QD3D__) 273 #error 274 #endif 275 276 #define __QD3D__ 277 278 #include <stdio.h> 279 280 #if _MSC_VER 281 typedef unsigned __int8 uint8_t; 282 typedef unsigned __int16 uint16_t; 283 typedef unsigned __int32 uint32_t; 284 285 typedef signed __int8 int8_t; 286 typedef signed __int16 int16_t; 287 typedef signed __int32 int32_t; 288 289 #else 290 #include <inttypes.h> 291 #endif 292 //============================================================================= 293 // C++ preamble 294 //----------------------------------------------------------------------------- 295 #ifdef __cplusplus 296 extern "C" { 297 #endif 298 299 300 301 302 303 //============================================================================= 304 // Bootstrap types/macros 305 //----------------------------------------------------------------------------- 306 // Types 307 308 309 /*! 310 @typedef TQ3Uns32 311 @abstract Unsigned 32-bit integer. 312 */ 313 typedef uint32_t TQ3Uns32; 314 /*! 315 @typedef TQ3Int32 316 @abstract Signed 32-bit integer. 317 */ 318 typedef int32_t TQ3Int32; 319 /*! 320 @typedef TQ3ObjectType 321 @abstract Numeric type code for a class of Quesa objects. 322 */ 323 typedef TQ3Int32 TQ3ObjectType; 324 325 326 // Macros 327 #ifndef Q3_CALLBACK_API_C 328 #define Q3_CALLBACK_API_C(_type, _name) _type (*_name) 329 #endif 330 331 #ifndef Q3_EXTERN_API_C 332 #define Q3_EXTERN_API_C(_type) extern _type 333 #endif 334 335 #define Q3_FOUR_CHARACTER_CONSTANT(_a, _b, _c, _d) \ 336 ((TQ3Uns32) \ 337 ((TQ3Uns32) (_a) << 24) | \ 338 ((TQ3Uns32) (_b) << 16) | \ 339 ((TQ3Uns32) (_c) << 8) | \ 340 ((TQ3Uns32) (_d))) 341 342 #define Q3_OBJECT_TYPE(_a, _b, _c, _d) \ 343 ((TQ3ObjectType) \ 344 Q3_FOUR_CHARACTER_CONSTANT((_a), (_b), (_c), (_d))) 345 346 #define Q3_METHOD_TYPE(_a, _b, _c, _d) \ 347 ((TQ3ObjectType) \ 348 Q3_FOUR_CHARACTER_CONSTANT((_a), (_b), (_c), (_d))) 349 350 351 352 353 354 //============================================================================= 355 // Constants 356 //----------------------------------------------------------------------------- 357 /*! 358 * @enum 359 * Miscellaneous constants 360 * 361 * @constant kQ3StringMaximumLength Maximum length of TQ3ObjectClassNameString. 362 * @constant kQ3ArrayIndexNULL NULL array index. 363 */ 364 enum { 365 kQ3StringMaximumLength = 1024, 366 kQ3ArrayIndexNULL = 0xFFFFFFFFUL 367 }; 368 369 370 /*! 371 * @enum 372 * TQ3Language 373 * @discussion 374 * Languages. 375 * 376 * @constant kQ3LanguageDefault Default language for current OS. 377 * @constant kQ3LanguageEnglishUS US English. 378 */ 379 typedef enum { 380 kQ3LanguageDefault = 0, 381 kQ3LanguageEnglishUS = 1, 382 kQ3LanguageSize32 = 0xFFFFFFFF 383 } TQ3Language; 384 385 386 /*! 387 * @enum 388 * TQ3Boolean 389 * @discussion 390 * Fundamental boolean type. 391 * 392 * @constant kQ3False False. 393 * @constant kQ3True True. 394 */ 395 typedef enum { 396 kQ3False = 0, 397 kQ3True = 1, 398 kQ3BooleanSize32 = 0xFFFFFFFF 399 } TQ3Boolean; 400 401 402 /*! 403 * @enum 404 * TQ3Switch 405 * @discussion 406 * Fundamental switch type. 407 * 408 * @constant kQ3Off Off. 409 * @constant kQ3On On. 410 */ 411 typedef enum { 412 kQ3Off = 0, 413 kQ3On = 1, 414 kQ3SwitchSize32 = 0xFFFFFFFF 415 } TQ3Switch; 416 417 418 /*! 419 * @enum 420 * TQ3Status 421 * @discussion 422 * Fundamental status type. 423 * 424 * @constant kQ3Failure Indicates failure. 425 * @constant kQ3Success Indicates success 426 */ 427 typedef enum { 428 kQ3Failure = 0, 429 kQ3Success = 1, 430 kQ3StatusSize32 = 0xFFFFFFFF 431 } TQ3Status; 432 433 434 /*! 435 * @enum 436 * TQ3Axis 437 * @discussion 438 * Fundamental axis type. 439 * 440 * @constant kQ3AxisX Indicates X axis. 441 * @constant kQ3AxisY Indicates Y axis. 442 * @constant kQ3AxisZ Indicates Z axis. 443 */ 444 typedef enum { 445 kQ3AxisX = 0, 446 kQ3AxisY = 1, 447 kQ3AxisZ = 2, 448 kQ3AxisSize32 = 0xFFFFFFFF 449 } TQ3Axis; 450 451 452 /*! 453 * @enum 454 * TQ3PixelType 455 * @discussion 456 * Fundamental pixel formats. 457 * 458 * @constant kQ3PixelTypeRGB32 8 bits for red, green, and blue. Alpha ignored. 459 * @constant kQ3PixelTypeARGB32 8 bits for alpha, red, green, and blue. 460 * @constant kQ3PixelTypeRGB16 5 bits for red, green, and blue. Alpha ignored. 461 * @constant kQ3PixelTypeARGB16 1 bit for alpha. 5 bits for red, green, and blue. 462 * @constant kQ3PixelTypeRGB16_565 5 bits for red, 6 bits for green, 5 bits for blue. 463 * @constant kQ3PixelTypeRGB24 8 bits for red, green, and blue. No alpha byte. 464 * @constant kQ3PixelTypeUnknown Unknown pixel type. 465 */ 466 typedef enum { 467 kQ3PixelTypeRGB32 = 0, 468 kQ3PixelTypeARGB32 = 1, 469 kQ3PixelTypeRGB16 = 2, 470 kQ3PixelTypeARGB16 = 3, 471 kQ3PixelTypeRGB16_565 = 4, 472 kQ3PixelTypeRGB24 = 5, 473 kQ3PixelTypeUnknown = 200, 474 kQ3PixelTypeSize32 = 0xFFFFFFFF 475 } TQ3PixelType; 476 477 478 /*! 479 * @enum 480 * TQ3Endian 481 * @discussion 482 * Fundamental endian type. 483 * 484 * @constant kQ3EndianBig Big endian. 485 * @constant kQ3EndianLittle Little endian. 486 */ 487 typedef enum { 488 kQ3EndianBig = 0, 489 kQ3EndianLittle = 1, 490 kQ3EndianSize32 = 0xFFFFFFFF 491 } TQ3Endian; 492 493 494 /*! 495 * @enum 496 * TQ3EndCapMasks 497 * @discussion 498 * Fundamental end caps type. 499 * 500 * @constant kQ3EndCapNone No end caps. 501 * @constant kQ3EndCapMaskTop Top end cap. 502 * @constant kQ3EndCapMaskBottom Bottom end cap. 503 * @constant kQ3EndCapMaskInterior Interior end cap. 504 */ 505 typedef enum { 506 kQ3EndCapNone = 0, 507 kQ3EndCapMaskTop = (1 << 0), 508 kQ3EndCapMaskBottom = (1 << 1), 509 kQ3EndCapMaskInterior = (1 << 2), 510 kQ3EndCapSize32 = 0xFFFFFFFF 511 } TQ3EndCapMasks; 512 513 514 /*! 515 * @enum 516 * TQ3ElementTypes 517 * @discussion 518 * Fundamental element types. 519 * 520 * @constant kQ3ElementTypeNone Indicates no element. 521 * @constant kQ3ElementTypeUnknown Indicates unknown element type. 522 * @constant kQ3ElementTypeSet Indicates set element. 523 */ 524 typedef enum { 525 kQ3ElementTypeNone = 0, 526 kQ3ElementTypeUnknown = 32, 527 kQ3ElementTypeSet = 33, 528 kQ3ElementTypeSize32 = 0xFFFFFFFF 529 } TQ3ElementTypes; 530 531 532 /*! 533 * @enum 534 * TQ3ComputeBounds 535 * @discussion 536 * Bounds accuracy types. 537 * 538 * @constant kQ3ComputeBoundsExact Compute exact bounds by transforming vertices 539 * to world coordinates then calculating bounds. 540 * Slower, but more accurate. 541 * @constant kQ3ComputeBoundsApproximate Compute approximate bounds by transforming 542 * local bounding box to world coordinates. 543 * Faster, but less accurate. 544 */ 545 typedef enum { 546 kQ3ComputeBoundsExact = 0, 547 kQ3ComputeBoundsApproximate = 1, 548 kQ3ComputeBoundsSize32 = 0xFFFFFFFF 549 } TQ3ComputeBounds; 550 551 552 // Method types 553 enum { 554 kQ3XMethodTypeObjectUnregister = Q3_METHOD_TYPE('u', 'n', 'r', 'g'), 555 kQ3XMethodTypeObjectIsDrawable = Q3_METHOD_TYPE('i', 's', 'd', 'r') 556 }; 557 558 559 // Object types 560 /*! 561 @enum Object_Types 562 @abstract Type codes of Quesa object classes. 563 @discussion These values should be considered to be of type TQ3ObjectType. 564 */ 565 enum { 566 kQ3ObjectTypeInvalid = ((TQ3ObjectType) 0), 567 kQ3ObjectTypeView = Q3_OBJECT_TYPE('v', 'i', 'e', 'w'), 568 kQ3ObjectTypeViewer = Q3_OBJECT_TYPE('v', 'w', 'e', 'r'), 569 kQ3ObjectTypeSlab = Q3_OBJECT_TYPE('s', 'l', 'a', 'b'), 570 kQ3ObjectTypeElement = Q3_OBJECT_TYPE('e', 'l', 'm', 'n'), 571 kQ3ElementTypeAttribute = Q3_OBJECT_TYPE('e', 'a', 't', 't'), 572 kQ3ObjectTypePick = Q3_OBJECT_TYPE('p', 'i', 'c', 'k'), 573 kQ3PickTypeWindowPoint = Q3_OBJECT_TYPE('p', 'k', 'w', 'p'), 574 kQ3PickTypeWindowRect = Q3_OBJECT_TYPE('p', 'k', 'w', 'r'), 575 kQ3PickTypeWorldRay = Q3_OBJECT_TYPE('p', 'k', 'r', 'y'), 576 kQ3ObjectTypeShared = Q3_OBJECT_TYPE('s', 'h', 'r', 'd'), 577 kQ3SharedTypeRenderer = Q3_OBJECT_TYPE('r', 'd', 'd', 'r'), 578 kQ3RendererTypeWireFrame = Q3_OBJECT_TYPE('w', 'r', 'f', 'r'), 579 kQ3RendererTypeGeneric = Q3_OBJECT_TYPE('g', 'n', 'r', 'r'), 580 kQ3RendererTypeInteractive = Q3_OBJECT_TYPE('c', 't', 'w', 'n'), 581 kQ3SharedTypeShape = Q3_OBJECT_TYPE('s', 'h', 'a', 'p'), 582 kQ3ShapeTypeGeometry = Q3_OBJECT_TYPE('g', 'm', 't', 'r'), 583 kQ3GeometryTypeBox = Q3_OBJECT_TYPE('b', 'o', 'x', ' '), 584 kQ3GeometryTypeGeneralPolygon = Q3_OBJECT_TYPE('g', 'p', 'g', 'n'), 585 kQ3GeometryTypeLine = Q3_OBJECT_TYPE('l', 'i', 'n', 'e'), 586 kQ3GeometryTypeMarker = Q3_OBJECT_TYPE('m', 'r', 'k', 'r'), 587 kQ3GeometryTypePixmapMarker = Q3_OBJECT_TYPE('m', 'r', 'k', 'p'), 588 kQ3GeometryTypeMesh = Q3_OBJECT_TYPE('m', 'e', 's', 'h'), 589 kQ3GeometryTypeNURBCurve = Q3_OBJECT_TYPE('n', 'r', 'b', 'c'), 590 kQ3GeometryTypeNURBPatch = Q3_OBJECT_TYPE('n', 'r', 'b', 'p'), 591 kQ3GeometryTypePoint = Q3_OBJECT_TYPE('p', 'n', 't', ' '), 592 kQ3GeometryTypePolygon = Q3_OBJECT_TYPE('p', 'l', 'y', 'g'), 593 kQ3GeometryTypePolyLine = Q3_OBJECT_TYPE('p', 'l', 'y', 'l'), 594 kQ3GeometryTypeTriangle = Q3_OBJECT_TYPE('t', 'r', 'n', 'g'), 595 kQ3GeometryTypeTriGrid = Q3_OBJECT_TYPE('t', 'r', 'i', 'g'), 596 kQ3GeometryTypeCone = Q3_OBJECT_TYPE('c', 'o', 'n', 'e'), 597 kQ3GeometryTypeCylinder = Q3_OBJECT_TYPE('c', 'y', 'l', 'n'), 598 kQ3GeometryTypeDisk = Q3_OBJECT_TYPE('d', 'i', 's', 'k'), 599 kQ3GeometryTypeEllipse = Q3_OBJECT_TYPE('e', 'l', 'p', 's'), 600 kQ3GeometryTypeEllipsoid = Q3_OBJECT_TYPE('e', 'l', 'p', 'd'), 601 kQ3GeometryTypePolyhedron = Q3_OBJECT_TYPE('p', 'l', 'h', 'd'), 602 kQ3GeometryTypeTorus = Q3_OBJECT_TYPE('t', 'o', 'r', 's'), 603 kQ3GeometryTypeTriMesh = Q3_OBJECT_TYPE('t', 'm', 's', 'h'), 604 kQ3ShapeTypeShader = Q3_OBJECT_TYPE('s', 'h', 'd', 'r'), 605 kQ3ShaderTypeSurface = Q3_OBJECT_TYPE('s', 'u', 's', 'h'), 606 kQ3SurfaceShaderTypeTexture = Q3_OBJECT_TYPE('t', 'x', 's', 'u'), 607 kQ3ShaderTypeIllumination = Q3_OBJECT_TYPE('i', 'l', 's', 'h'), 608 kQ3IlluminationTypePhong = Q3_OBJECT_TYPE('p', 'h', 'i', 'l'), 609 kQ3IlluminationTypeLambert = Q3_OBJECT_TYPE('l', 'm', 'i', 'l'), 610 kQ3IlluminationTypeNULL = Q3_OBJECT_TYPE('n', 'u', 'i', 'l'), 611 kQ3ShapeTypeStyle = Q3_OBJECT_TYPE('s', 't', 'y', 'l'), 612 kQ3StyleTypeBackfacing = Q3_OBJECT_TYPE('b', 'c', 'k', 'f'), 613 kQ3StyleTypeInterpolation = Q3_OBJECT_TYPE('i', 'n', 't', 'p'), 614 kQ3StyleTypeFill = Q3_OBJECT_TYPE('f', 'i', 's', 't'), 615 kQ3StyleTypePickID = Q3_OBJECT_TYPE('p', 'k', 'i', 'd'), 616 #if QUESA_ALLOW_QD3D_EXTENSIONS 617 kQ3StyleTypeCastShadows = Q3_OBJECT_TYPE('c', 'a', 's', 'h'), 618 #endif // QUESA_ALLOW_QD3D_EXTENSIONS 619 kQ3StyleTypeReceiveShadows = Q3_OBJECT_TYPE('r', 'c', 's', 'h'), 620 kQ3StyleTypeHighlight = Q3_OBJECT_TYPE('h', 'i', 'g', 'h'), 621 kQ3StyleTypeSubdivision = Q3_OBJECT_TYPE('s', 'b', 'd', 'v'), 622 kQ3StyleTypeOrientation = Q3_OBJECT_TYPE('o', 'f', 'd', 'r'), 623 kQ3StyleTypePickParts = Q3_OBJECT_TYPE('p', 'k', 'p', 't'), 624 kQ3StyleTypeAntiAlias = Q3_OBJECT_TYPE('a', 'n', 't', 'i'), 625 kQ3StyleTypeFog = Q3_OBJECT_TYPE('f', 'o', 'g', 'g'), 626 kQ3ShapeTypeTransform = Q3_OBJECT_TYPE('x', 'f', 'r', 'm'), 627 kQ3TransformTypeMatrix = Q3_OBJECT_TYPE('m', 't', 'r', 'x'), 628 kQ3TransformTypeScale = Q3_OBJECT_TYPE('s', 'c', 'a', 'l'), 629 kQ3TransformTypeTranslate = Q3_OBJECT_TYPE('t', 'r', 'n', 's'), 630 kQ3TransformTypeRotate = Q3_OBJECT_TYPE('r', 'o', 't', 't'), 631 kQ3TransformTypeRotateAboutPoint= Q3_OBJECT_TYPE('r', 't', 'a', 'p'), 632 kQ3TransformTypeRotateAboutAxis = Q3_OBJECT_TYPE('r', 't', 'a', 'a'), 633 kQ3TransformTypeQuaternion = Q3_OBJECT_TYPE('q', 't', 'r', 'n'), 634 kQ3TransformTypeReset = Q3_OBJECT_TYPE('r', 's', 'e', 't'), 635 #if QUESA_ALLOW_QD3D_EXTENSIONS 636 kQ3TransformTypeCamera = Q3_OBJECT_TYPE('c', 'a', 'm', 't'), 637 kQ3TransformTypeCameraRasterize = Q3_OBJECT_TYPE('r', 'a', 's', 't'), 638 #endif // QUESA_ALLOW_QD3D_EXTENSIONS 639 kQ3ShapeTypeLight = Q3_OBJECT_TYPE('l', 'g', 'h', 't'), 640 kQ3LightTypeAmbient = Q3_OBJECT_TYPE('a', 'm', 'b', 'n'), 641 kQ3LightTypeDirectional = Q3_OBJECT_TYPE('d', 'r', 'c', 't'), 642 kQ3LightTypePoint = Q3_OBJECT_TYPE('p', 'n', 't', 'l'), 643 kQ3LightTypeSpot = Q3_OBJECT_TYPE('s', 'p', 'o', 't'), 644 kQ3ShapeTypeCamera = Q3_OBJECT_TYPE('c', 'm', 'r', 'a'), 645 kQ3CameraTypeOrthographic = Q3_OBJECT_TYPE('o', 'r', 't', 'h'), 646 kQ3CameraTypeViewPlane = Q3_OBJECT_TYPE('v', 'w', 'p', 'l'), 647 kQ3CameraTypeViewAngleAspect = Q3_OBJECT_TYPE('v', 'a', 'n', 'a'), 648 kQ3ShapeTypeStateOperator = Q3_OBJECT_TYPE('s', 't', 'o', 'p'), 649 kQ3StateOperatorTypePush = Q3_OBJECT_TYPE('p', 'u', 's', 'h'), 650 kQ3StateOperatorTypePop = Q3_OBJECT_TYPE('p', 'o', 'p', ' '), 651 kQ3ShapeTypeGroup = Q3_OBJECT_TYPE('g', 'r', 'u', 'p'), 652 kQ3GroupTypeDisplay = Q3_OBJECT_TYPE('d', 's', 'p', 'g'), 653 kQ3DisplayGroupTypeOrdered = Q3_OBJECT_TYPE('o', 'r', 'd', 'g'), 654 kQ3DisplayGroupTypeIOProxy = Q3_OBJECT_TYPE('i', 'o', 'p', 'x'), 655 kQ3GroupTypeLight = Q3_OBJECT_TYPE('l', 'g', 'h', 'g'), 656 kQ3GroupTypeInfo = Q3_OBJECT_TYPE('i', 'n', 'f', 'o'), 657 kQ3ShapeTypeUnknown = Q3_OBJECT_TYPE('u', 'n', 'k', 'n'), 658 kQ3UnknownTypeText = Q3_OBJECT_TYPE('u', 'k', 't', 'x'), 659 kQ3UnknownTypeBinary = Q3_OBJECT_TYPE('u', 'k', 'b', 'n'), 660 kQ3ShapeTypeReference = Q3_OBJECT_TYPE('r', 'f', 'r', 'n'), 661 kQ3ReferenceTypeExternal = Q3_OBJECT_TYPE('r', 'f', 'e', 'x'), 662 kQ3SharedTypeSet = Q3_OBJECT_TYPE('s', 'e', 't', ' '), 663 kQ3SetTypeAttribute = Q3_OBJECT_TYPE('a', 't', 't', 'r'), 664 kQ3SharedTypeDrawContext = Q3_OBJECT_TYPE('d', 'c', 't', 'x'), 665 kQ3DrawContextTypePixmap = Q3_OBJECT_TYPE('d', 'p', 'x', 'p'), 666 kQ3DrawContextTypeMacintosh = Q3_OBJECT_TYPE('d', 'm', 'a', 'c'), 667 kQ3DrawContextTypeCocoa = Q3_OBJECT_TYPE('d', 'c', 'c', 'o'), 668 kQ3DrawContextTypeWin32DC = Q3_OBJECT_TYPE('d', 'w', '3', '2'), 669 kQ3DrawContextTypeDDSurface = Q3_OBJECT_TYPE('d', 'd', 'd', 's'), 670 kQ3DrawContextTypeX11 = Q3_OBJECT_TYPE('d', 'x', '1', '1'), 671 kQ3DrawContextTypeBe = Q3_OBJECT_TYPE('d', 'c', 'b', 'e'), 672 kQ3SharedTypeTexture = Q3_OBJECT_TYPE('t', 'x', 't', 'r'), 673 kQ3TextureTypePixmap = Q3_OBJECT_TYPE('t', 'x', 'p', 'm'), 674 kQ3TextureTypeMipmap = Q3_OBJECT_TYPE('t', 'x', 'm', 'm'), 675 kQ3TextureTypeCompressedPixmap = Q3_OBJECT_TYPE('t', 'x', 'c', 'p'), 676 kQ3SharedTypeFile = Q3_OBJECT_TYPE('f', 'i', 'l', 'e'), 677 kQ3SharedTypeStorage = Q3_OBJECT_TYPE('s', 't', 'r', 'g'), 678 kQ3StorageTypeMemory = Q3_OBJECT_TYPE('m', 'e', 'm', 's'), 679 kQ3MemoryStorageTypeHandle = Q3_OBJECT_TYPE('h', 'n', 'd', 'l'), 680 kQ3StorageTypePath = Q3_OBJECT_TYPE('Q', 's', 't', 'p'), 681 kQ3StorageTypeUnix = Q3_OBJECT_TYPE('u', 'x', 's', 't'), 682 kQ3UnixStorageTypePath = Q3_OBJECT_TYPE('u', 'n', 'i', 'x'), 683 kQ3StorageTypeMacintosh = Q3_OBJECT_TYPE('m', 'a', 'c', 'n'), 684 kQ3MacintoshStorageTypeFSSpec = Q3_OBJECT_TYPE('m', 'a', 'c', 'p'), 685 kQ3StorageTypeWin32 = Q3_OBJECT_TYPE('w', 'i', 's', 't'), 686 kQ3StorageTypeBe = Q3_OBJECT_TYPE('b', 'e', 's', 't'), 687 kQ3SharedTypeString = Q3_OBJECT_TYPE('s', 't', 'r', 'n'), 688 kQ3StringTypeCString = Q3_OBJECT_TYPE('s', 't', 'r', 'c'), 689 kQ3SharedTypeShapePart = Q3_OBJECT_TYPE('s', 'p', 'r', 't'), 690 kQ3ShapePartTypeMeshPart = Q3_OBJECT_TYPE('s', 'p', 'm', 'h'), 691 kQ3MeshPartTypeMeshFacePart = Q3_OBJECT_TYPE('m', 'f', 'a', 'c'), 692 kQ3MeshPartTypeMeshEdgePart = Q3_OBJECT_TYPE('m', 'e', 'd', 'g'), 693 kQ3MeshPartTypeMeshVertexPart = Q3_OBJECT_TYPE('m', 'v', 't', 'x'), 694 kQ3SharedTypeControllerState = Q3_OBJECT_TYPE('c', 't', 's', 't'), 695 kQ3SharedTypeTracker = Q3_OBJECT_TYPE('t', 'r', 'k', 'r'), 696 kQ3SharedTypeViewHints = Q3_OBJECT_TYPE('v', 'w', 'h', 'n'), 697 kQ3SharedTypeEndGroup = Q3_OBJECT_TYPE('e', 'n', 'd', 'g') 698 }; 699 700 701 702 703 704 //============================================================================= 705 // Types 706 //----------------------------------------------------------------------------- 707 // Basic types 708 /*! 709 @typedef TQ3Uns8 710 @abstract Unsigned 8-bit integer. 711 */ 712 typedef uint8_t TQ3Uns8; 713 /*! 714 @typedef TQ3Int8 715 @abstract Signed 8-bit integer. 716 */ 717 typedef int8_t TQ3Int8; 718 /*! 719 @typedef TQ3Uns16 720 @abstract Unsigned 16-bit integer. 721 */ 722 typedef uint16_t TQ3Uns16; 723 /*! 724 @typedef TQ3Int16 725 @abstract Signed 16-bit integer. 726 */ 727 typedef int16_t TQ3Int16; 728 /*! 729 @typedef TQ3Float32 730 @abstract 32-bit floating-point number. 731 */ 732 typedef float TQ3Float32; 733 /*! 734 @typedef TQ3Float64 735 @abstract 64-bit floating-point number. 736 */ 737 typedef double TQ3Float64; 738 /*! 739 @typedef TQ3Size 740 @abstract Size type. 741 */ 742 typedef TQ3Uns32 TQ3Size; 743 744 #if QUESA_HOST_IS_BIG_ENDIAN 745 /*! 746 @typedef TQ3Uns64 747 @abstract Unsigned 64-bit integer. 748 */ 749 typedef struct TQ3Uns64 { 750 TQ3Uns32 hi; 751 TQ3Uns32 lo; 752 } TQ3Uns64; 753 754 /*! 755 @typedef TQ3Int64 756 @abstract Signed 64-bit integer. 757 */ 758 typedef struct TQ3Int64 { 759 TQ3Int32 hi; 760 TQ3Uns32 lo; 761 } TQ3Int64; 762 763 #else 764 typedef struct TQ3Uns64 { 765 TQ3Uns32 lo; 766 TQ3Uns32 hi; 767 } TQ3Uns64; 768 769 typedef struct TQ3Int64 { 770 TQ3Uns32 lo; 771 TQ3Int32 hi; 772 } TQ3Int64; 773 #endif 774 775 776 // Misc types 777 /*! 778 @typedef TQ3ElementType 779 @abstract Type identifier for an element. 780 */ 781 typedef TQ3Int32 TQ3ElementType; 782 /*! 783 @typedef TQ3XMethodType 784 @abstract Type identifier for an element. 785 */ 786 typedef TQ3Uns32 TQ3XMethodType; 787 /*! 788 @typedef TQ3EndCap 789 @abstract End cap flag word, see TQ3EndCapMasks for specific values. 790 */ 791 typedef TQ3Uns32 TQ3EndCap; 792 /*! 793 @typedef TQ3XObjectClass 794 @abstract Object class opaque pointer. 795 */ 796 typedef struct OpaqueTQ3XObjectClass *TQ3XObjectClass; 797 /*! 798 @typedef TQ3GroupPosition 799 @abstract Group position opaque pointer. 800 */ 801 typedef struct OpaqueTQ3GroupPosition *TQ3GroupPosition; 802 /*! 803 @typedef TQ3ObjectClassNameString 804 @abstract Class name C string. 805 */ 806 typedef char TQ3ObjectClassNameString[kQ3StringMaximumLength]; 807 typedef void *TQ3ControllerRef; 808 809 810 // Function types 811 typedef Q3_CALLBACK_API_C(void, TQ3XFunctionPointer)( 812 void); 813 814 typedef Q3_CALLBACK_API_C(TQ3XFunctionPointer, TQ3XMetaHandler)( 815 TQ3XMethodType methodType); 816 817 818 // Object types 819 /*! 820 @typedef TQ3Object 821 @abstract Quesa object opaque pointer. 822 */ 823 typedef struct OpaqueTQ3Object *TQ3Object; 824 825 typedef TQ3Object TQ3ElementObject; 826 typedef TQ3Object TQ3SharedObject; 827 typedef TQ3SharedObject TQ3RendererObject; 828 typedef TQ3SharedObject TQ3DrawContextObject; 829 typedef TQ3SharedObject TQ3SetObject; 830 typedef TQ3SetObject TQ3AttributeSet; 831 typedef TQ3SharedObject TQ3FileObject; 832 typedef TQ3SharedObject TQ3ShapeObject; 833 typedef TQ3ShapeObject TQ3GroupObject; 834 typedef TQ3GroupObject TQ3DisplayGroupObject; 835 typedef TQ3ShapeObject TQ3GeometryObject; 836 typedef TQ3ShapeObject TQ3ShaderObject; 837 typedef TQ3ShaderObject TQ3SurfaceShaderObject; 838 typedef TQ3ShaderObject TQ3IlluminationShaderObject; 839 typedef TQ3ShapeObject TQ3StyleObject; 840 typedef TQ3ShapeObject TQ3TransformObject; 841 typedef TQ3ShapeObject TQ3LightObject; 842 typedef TQ3ShapeObject TQ3CameraObject; 843 typedef TQ3ShapeObject TQ3UnknownObject; 844 typedef TQ3ShapeObject TQ3ReferenceObject; 845 typedef TQ3ShapeObject TQ3StateOperatorObject; 846 typedef TQ3SharedObject TQ3ShapePartObject; 847 typedef TQ3ShapePartObject TQ3MeshPartObject; 848 typedef TQ3MeshPartObject TQ3MeshFacePartObject; 849 typedef TQ3MeshPartObject TQ3MeshEdgePartObject; 850 typedef TQ3MeshPartObject TQ3MeshVertexPartObject; 851 typedef TQ3SharedObject TQ3ControllerStateObject; 852 typedef TQ3SharedObject TQ3TrackerObject; 853 typedef TQ3SharedObject TQ3StringObject; 854 typedef TQ3SharedObject TQ3StorageObject; 855 typedef TQ3SharedObject TQ3TextureObject; 856 typedef TQ3SharedObject TQ3ViewHintsObject; 857 typedef TQ3Object TQ3ViewObject; 858 typedef TQ3Object TQ3ViewerObject; 859 typedef TQ3Object TQ3SlabObject; 860 typedef TQ3Object TQ3PickObject; 861 862 863 // Geometric types 864 /*! 865 * @struct 866 * TQ3Vector2D 867 * @discussion 868 * Fundamental 2D vector type. 869 * 870 * @field x x coordinate. 871 * @field y y coordinate. 872 */ 873 typedef struct TQ3Vector2D { 874 float x; 875 float y; 876 } TQ3Vector2D; 877 878 879 /*! 880 * @struct 881 * TQ3Vector3D 882 * @discussion 883 * Fundamental 3D vector type. 884 * 885 * @field x x coordinate. 886 * @field y y coordinate. 887 * @field z z coordinate. 888 */ 889 typedef struct TQ3Vector3D { 890 float x; 891 float y; 892 float z; 893 } TQ3Vector3D; 894 895 896 /*! 897 * @struct 898 * TQ3Point2D 899 * @discussion 900 * Fundamental 2D point type. 901 * 902 * @field x x coordinate. 903 * @field y y coordinate. 904 */ 905 typedef struct TQ3Point2D { 906 float x; 907 float y; 908 } TQ3Point2D; 909 910 911 /*! 912 * @struct 913 * TQ3Point3D 914 * @discussion 915 * Fundamental 3D point type. 916 * 917 * @field x x coordinate. 918 * @field y y coordinate. 919 * @field z z coordinate. 920 */ 921 typedef struct TQ3Point3D { 922 float x; 923 float y; 924 float z; 925 } TQ3Point3D; 926 927 928 /*! 929 * @struct 930 * TQ3RationalPoint3D 931 * @discussion 932 * Fundamental 3D rational point type. 933 * 934 * @field x x coordinate. 935 * @field y y coordinate. 936 * @field w Point weight. 937 */ 938 typedef struct TQ3RationalPoint3D { 939 float x; 940 float y; 941 float w; 942 } TQ3RationalPoint3D; 943 944 945 /*! 946 * @struct 947 * TQ3RationalPoint4D 948 * @discussion 949 * Fundamental 4D rational point type. 950 * 951 * @field x x coordinate. 952 * @field y y coordinate. 953 * @field z z coordinate. 954 * @field w Point weight. 955 */ 956 typedef struct TQ3RationalPoint4D { 957 float x; 958 float y; 959 float z; 960 float w; 961 } TQ3RationalPoint4D; 962 963 964 /*! 965 * @struct 966 * TQ3Quaternion 967 * @discussion 968 * Fundamental Quaternion type. 969 * 970 * @field w w component. 971 * @field x x component. 972 * @field y y component. 973 * @field z z component. 974 */ 975 typedef struct TQ3Quaternion { 976 float w; 977 float x; 978 float y; 979 float z; 980 } TQ3Quaternion; 981 982 983 /*! 984 * @struct 985 * TQ3Ray3D 986 * @discussion 987 * Fundamental ray type. 988 * 989 * @field origin Origin of ray. 990 * @field direction Direction of ray. 991 */ 992 typedef struct TQ3Ray3D { 993 TQ3Point3D origin; 994 TQ3Vector3D direction; 995 } TQ3Ray3D; 996 997 998 /*! 999 * @struct 1000 * TQ3Sphere 1001 * @discussion 1002 * Fundamental sphere type. 1003 * 1004 * @field origin Origin of sphere. 1005 * @field radius Radius of sphere. 1006 */ 1007 typedef struct TQ3Sphere { 1008 TQ3Point3D origin; 1009 float radius; 1010 } TQ3Sphere; 1011 1012 1013 /*! 1014 * @struct 1015 * TQ3Param2D 1016 * @discussion 1017 * Fundamental 2D parametric point type. 1018 * 1019 * @field u u component. 1020 * @field v v component. 1021 */ 1022 typedef struct TQ3Param2D { 1023 float u; 1024 float v; 1025 } TQ3Param2D; 1026 1027 1028 /*! 1029 * @struct 1030 * TQ3Param3D 1031 * @discussion 1032 * Fundamental 3D parametric point type. 1033 * 1034 * @field u u component. 1035 * @field v v component. 1036 * @field w w component. 1037 */ 1038 typedef struct TQ3Param3D { 1039 float u; 1040 float v; 1041 float w; 1042 } TQ3Param3D; 1043 1044 1045 /*! 1046 * @struct 1047 * TQ3Tangent2D 1048 * @discussion 1049 * Fundamental 2D parametric surface tangent type. 1050 * 1051 * @field uTangent Tangent in the u direction. 1052 * @field vTangent Tangent in the v direction. 1053 */ 1054 typedef struct TQ3Tangent2D { 1055 TQ3Vector3D uTangent; 1056 TQ3Vector3D vTangent; 1057 } TQ3Tangent2D; 1058 1059 1060 /*! 1061 * @struct 1062 * TQ3Tangent3D 1063 * @discussion 1064 * Fundamental 3D parametric surface tangent type. 1065 * 1066 * @field uTangent Tangent in the u direction. 1067 * @field vTangent Tangent in the v direction. 1068 * @field wTangent Tangent in the w direction. 1069 */ 1070 typedef struct TQ3Tangent3D { 1071 TQ3Vector3D uTangent; 1072 TQ3Vector3D vTangent; 1073 TQ3Vector3D wTangent; 1074 } TQ3Tangent3D; 1075 1076 1077 /*! 1078 * @struct 1079 * TQ3PolarPoint 1080 * @discussion 1081 * Fundamental polar point type. 1082 * 1083 * @field r Distance along the radius vector from polar origin. 1084 * @field theta Angle in radians between polar axis and the radius vector. 1085 */ 1086 typedef struct TQ3PolarPoint { 1087 float r; 1088 float theta; 1089 } TQ3PolarPoint; 1090 1091 1092 /*! 1093 * @struct 1094 * TQ3SphericalPoint 1095 * @discussion 1096 * Fundamental spherical point type. 1097 * 1098 * @field rho Distance along the radius vector from polar origin. 1099 * @field theta Angle in radians between x axis and the projection of the 1100 * radius vector onto the xy plane. 1101 * @field phi Angle in radians between z axis and the radius vector. 1102 */ 1103 typedef struct TQ3SphericalPoint { 1104 float rho; 1105 float theta; 1106 float phi; 1107 } TQ3SphericalPoint; 1108 1109 1110 // Color types 1111 /*! 1112 * @struct 1113 * TQ3ColorRGB 1114 * @discussion 1115 * Fundamental RGB colour type. 1116 * 1117 * @field r Red component, between 0.0 and 1.0. 1118 * @field g Green component, between 0.0 and 1.0. 1119 * @field b Blue component, between 0.0 and 1.0. 1120 */ 1121 typedef struct TQ3ColorRGB { 1122 float r; 1123 float g; 1124 float b; 1125 } TQ3ColorRGB; 1126 1127 1128 /*! 1129 * @struct 1130 * TQ3ColorARGB 1131 * @discussion 1132 * Fundamental ARGB point type. 1133 * 1134 * @field a Alpha component, between 0.0 (transparent) and 1.0 (opaque). 1135 * @field r Red component, between 0.0 and 1.0. 1136 * @field g Green component, between 0.0 and 1.0. 1137 * @field b Blue component, between 0.0 and 1.0. 1138 */ 1139 typedef struct TQ3ColorARGB { 1140 float a; 1141 float r; 1142 float g; 1143 float b; 1144 } TQ3ColorARGB; 1145 1146 1147 /*! 1148 * @struct 1149 * TQ3ColorRGBA 1150 * @discussion 1151 * Fundamental RGBA point type. 1152 * 1153 * @field r Red component, between 0.0 and 1.0. 1154 * @field g Green component, between 0.0 and 1.0. 1155 * @field b Blue component, between 0.0 and 1.0. 1156 * @field a Alpha component, between 0.0 (transparent) and 1.0 (opaque). 1157 */ 1158 typedef struct TQ3ColorRGBA { 1159 float r; 1160 float g; 1161 float b; 1162 float a; 1163 } TQ3ColorRGBA; 1164 1165 1166 // Vertex type 1167 /*! 1168 * @struct 1169 * TQ3Vertex3D 1170 * @discussion 1171 * Fundamental vertex type. 1172 * 1173 * @field point Location of the vertex. 1174 * @field attributeSet Attribute set for the vertex. 1175 */ 1176 typedef struct TQ3Vertex3D { 1177 TQ3Point3D point; 1178 TQ3AttributeSet attributeSet; 1179 } TQ3Vertex3D; 1180 1181 1182 // Matrix types 1183 /*! 1184 * @struct 1185 * TQ3Matrix3x3 1186 * @discussion 1187 * Fundamental 3x3 matrix type. 1188 * 1189 * @field value 3x3 array of values that define the matrix. 1190 */ 1191 typedef struct TQ3Matrix3x3 { 1192 float value[3][3]; 1193 } TQ3Matrix3x3; 1194 1195 1196 /*! 1197 * @struct 1198 * TQ3Matrix4x4 1199 * @discussion 1200 * Fundamental 4x4 matrix type. 1201 * 1202 * @field value 4x4 array of values that define the matrix. 1203 */ 1204 typedef struct TQ3Matrix4x4 { 1205 float value[4][4]; 1206 } TQ3Matrix4x4; 1207 1208 1209 // Bitmap/Pixmap types 1210 /*! 1211 * @struct 1212 * TQ3Pixmap 1213 * @discussion 1214 * Fundamental Pixmap type. 1215 * 1216 * @field image Pointer to (height*rowBytes) sized block of memory containing the image data. 1217 * @field width Width of the image. 1218 * @field height Height of the image. 1219 * @field rowBytes Distance in bytes from begining of one row of image data to the next. 1220 * @field pixelSize Size in bits of each pixel. 1221 * @field pixelType The pixel format of the image data. The format must be appropriate for pixelSize. 1222 * @field bitOrder The order in which bits in a byte are addressed within the image data. 1223 * @field byteOrder The order in which bytes in a word are addressed within the image data. 1224 */ 1225 typedef struct TQ3Pixmap { 1226 void *image; 1227 TQ3Uns32 width; 1228 TQ3Uns32 height; 1229 TQ3Uns32 rowBytes; 1230 TQ3Uns32 pixelSize; 1231 TQ3PixelType pixelType; 1232 TQ3Endian bitOrder; 1233 TQ3Endian byteOrder; 1234 } TQ3Pixmap; 1235 1236 1237 /*! 1238 * @struct 1239 * TQ3StoragePixmap 1240 * @discussion 1241 * Fundamental storage Pixmap type. 1242 * 1243 * @field image A storage object that contains the image data. 1244 * @field width Width of the image. 1245 * @field height Height of the image. 1246 * @field rowBytes Distance in bytes from begining of one row of image data to the next. 1247 * @field pixelSize Size in bits of each pixel. 1248 * @field pixelType The pixel format of the image data. The format must be appropriate for pixelSize. 1249 * @field bitOrder The order in which bits in a byte are addressed within the image data. 1250 * @field byteOrder The order in which bytes in a word are addressed within the image data. 1251 */ 1252 typedef struct TQ3StoragePixmap { 1253 TQ3StorageObject image; 1254 TQ3Uns32 width; 1255 TQ3Uns32 height; 1256 TQ3Uns32 rowBytes; 1257 TQ3Uns32 pixelSize; 1258 TQ3PixelType pixelType; 1259 TQ3Endian bitOrder; 1260 TQ3Endian byteOrder; 1261 } TQ3StoragePixmap; 1262 1263 1264 /*! 1265 * @struct 1266 * TQ3Bitmap 1267 * @discussion 1268 * Fundamental Bitmap type. 1269 * 1270 * @field image Pointer to (height*rowBytes) sized block of memory containing the image data. 1271 * Each row of image data starts on a new byte. 1272 * @field width Width of the image. 1273 * @field height Height of the image. 1274 * @field rowBytes Distance in bytes from begining of one row of image data to the next. 1275 * @field bitOrder The order in which bits in a byte are addressed within the image data. 1276 */ 1277 typedef struct TQ3Bitmap { 1278 TQ3Uns8 *image; 1279 TQ3Uns32 width; 1280 TQ3Uns32 height; 1281 TQ3Uns32 rowBytes; 1282 TQ3Endian bitOrder; 1283 } TQ3Bitmap; 1284 1285 1286 /*! 1287 * @struct 1288 * TQ3MipmapImage 1289 * @discussion 1290 * Fundamental Mipmap image type. 1291 * 1292 * @field width Width of the mipmap, which must be a power of 2. 1293 * @field height Height of the mipmap, which must be a power of 2. 1294 * @field rowBytes Distance in bytes from begining of one row of image data to the next. 1295 * @field offset Offset in bytes from the begining of the image base to this mipmap. 1296 */ 1297 typedef struct TQ3MipmapImage { 1298 TQ3Uns32 width; 1299 TQ3Uns32 height; 1300 TQ3Uns32 rowBytes; 1301 TQ3Uns32 offset; 1302 } TQ3MipmapImage; 1303 1304 1305 /*! 1306 * @struct 1307 * TQ3Mipmap 1308 * @discussion 1309 * This is the data structure for a mipmap texture. If the useMipmapping field is kQ3False, 1310 * then only the first record of the mipmaps array needs to be filled in. If useMipmapping 1311 * is kQ3True, then the number of mipmaps should be the base 2 logarithm of the larger 1312 * dimension of the first mipmap, plus 1. For example, if the first mipmap is of size 4 × 16, then 1313 * you must also include mipmaps of sizes 2 × 8, 1 × 4, 1 × 2, and 1 × 1, 1314 * making 5 mipmaps in all. 1315 * 1316 * @field image A storage object that contains the image data. 1317 * @field useMipmapping Flag indicating if mipmapping should be used and all mipmaps have been supplied. 1318 * @field pixelType The pixel format of the image data. 1319 * @field bitOrder The order in which bits in a byte are addressed within the image data. 1320 * @field byteOrder The order in which bytes in a word are addressed within the image data. 1321 * @field reserved Reserved - must be set to 0. 1322 * @field mipmaps Up to 32 mip-map image specifications. 1323 */ 1324 typedef struct TQ3Mipmap { 1325 TQ3StorageObject image; 1326 TQ3Boolean useMipmapping; 1327 TQ3PixelType pixelType; 1328 TQ3Endian bitOrder; 1329 TQ3Endian byteOrder; 1330 TQ3Uns32 reserved; 1331 TQ3MipmapImage mipmaps[32]; 1332 } TQ3Mipmap; 1333 1334 1335 /*! 1336 * @struct 1337 * TQ3CompressedPixmap 1338 * @discussion 1339 * QuickTime compressed Pixmap image type. Only available on platforms with QuickTime. 1340 * 1341 * @field compressedImage A storage object that contains the QuickTime compressed image data. 1342 * @field imageDescByteOrder Endianness of data in the imageDesc field. 1343 * @field imageDesc QuickTime image description. 1344 * @field makeMipmaps Indicates if mipmapping is required. 1345 * @field width Width of the image. 1346 * @field height Height of the image. 1347 * @field pixelSize Size in bits of each pixel (must be 16 or 32). 1348 * @field pixelType The pixel format of the image data. The format must be appropriate for pixelSize. 1349 */ 1350 typedef struct TQ3CompressedPixmap { 1351 TQ3StorageObject compressedImage; 1352 TQ3Endian imageDescByteOrder; 1353 TQ3StorageObject imageDesc; 1354 TQ3Boolean makeMipmaps; 1355 TQ3Uns32 width; 1356 TQ3Uns32 height; 1357 TQ3Uns32 pixelSize; 1358 TQ3PixelType pixelType; 1359 } TQ3CompressedPixmap; 1360 1361 1362 // Mathematical types 1363 /*! 1364 * @struct 1365 * TQ3Area 1366 * @discussion 1367 * Fundamental area type. 1368 * 1369 * @field min Minimum corner of area. 1370 * @field max Maximum corner of area. 1371 */ 1372 typedef struct TQ3Area { 1373 TQ3Point2D min; 1374 TQ3Point2D max; 1375 } TQ3Area; 1376 1377 1378 /*! 1379 * @struct 1380 * TQ3PlaneEquation 1381 * @discussion 1382 * Fundamental plane equation type. 1383 * 1384 * @field normal The normal vector to the plane. 1385 * @field constant The plane constant (the value d in the plane equation ax+by+cz+d=0). 1386 */ 1387 typedef struct TQ3PlaneEquation { 1388 TQ3Vector3D normal; 1389 float constant; 1390 } TQ3PlaneEquation; 1391 1392 1393 /*! 1394 * @struct 1395 * TQ3BoundingBox 1396 * @discussion 1397 * Fundamental bounding box type. 1398 * 1399 * @field min Minimum corner of bounding box. 1400 * @field max Maximum corner of bounding box. 1401 * @field isEmpty Is the bounding box empty. The box is only valid if isEmpty is kQ3False. 1402 */ 1403 typedef struct TQ3BoundingBox { 1404 TQ3Point3D min; 1405 TQ3Point3D max; 1406 TQ3Boolean isEmpty; 1407 } TQ3BoundingBox; 1408 1409 1410 /*! 1411 * @struct 1412 * TQ3BoundingSphere 1413 * @discussion 1414 * Fundamental bounding sphere type. 1415 * 1416 * @field origin Origin of bounding sphere. 1417 * @field radius Radius of bounding sphere. 1418 * @field isEmpty Is the bounding sphere empty? The sphere is only valid if isEmpty is kQ3False. 1419 */ 1420 typedef struct TQ3BoundingSphere { 1421 TQ3Point3D origin; 1422 float radius; 1423 TQ3Boolean isEmpty; 1424 } TQ3BoundingSphere; 1425 1426 1427 // Subclass type 1428 /*! 1429 * @struct 1430 * TQ3SubClassData 1431 * @discussion 1432 * Object sub-class type. 1433 * 1434 * @field numClasses The number of types contained in classTypes. 1435 * @field classTypes The types of the sub-classes. 1436 */ 1437 typedef struct TQ3SubClassData { 1438 TQ3Uns32 numClasses; 1439 TQ3ObjectType *classTypes; 1440 } TQ3SubClassData; 1441 1442 1443 1444 1445 1446 //============================================================================= 1447 // Function prototypes 1448 //----------------------------------------------------------------------------- 1449 /*! 1450 * @function 1451 * Q3Initialize 1452 * @discussion 1453 * Initialises Quesa. 1454 * 1455 * Only Q3IsInitialized, Q3GetVersion, and Q3GetReleaseVersion may be 1456 * called before the Quesa library is initialised. 1457 * 1458 * @result Success or failure of the operation. 1459 */ 1460 Q3_EXTERN_API_C ( TQ3Status ) 1461 Q3Initialize ( 1462 void 1463 ); 1464 1465 1466 1467 /*! 1468 * @function 1469 * Q3Exit 1470 * @discussion 1471 * Shuts down Quesa, and releases any resources allocated by the library. 1472 * 1473 * @result Success or failure of the operation. 1474 */ 1475 Q3_EXTERN_API_C ( TQ3Status ) 1476 Q3Exit ( 1477 void 1478 ); 1479 1480 1481 1482 /*! 1483 * @function 1484 * Q3IsInitialized 1485 * @discussion 1486 * Tests to see if Quesa has been initialised or not. 1487 * 1488 * @result True or false as Quesa has been initialised or not. 1489 */ 1490 Q3_EXTERN_API_C ( TQ3Boolean ) 1491 Q3IsInitialized ( 1492 void 1493 ); 1494 1495 1496 1497 /*! 1498 * @function 1499 * Q3GetVersion 1500 * @discussion 1501 * Returns the major and minor revision levels of the installed 1502 * Quesa software. 1503 * 1504 * For example, if the revision is 1.6a23 (= 1.6.0a23), returns 1 1505 * as the major revision level and 6 as the minor revision level: 1506 * The final 0 in the minor revision level is omitted. 1507 * If the revision is 1.61a23 (= 1.6.1a23), returns 1 as the major 1508 * revision level and 61 as the minor revision level. 1509 * 1510 * Note that unlike QD3D, Quesa allows Q3GetVersion to be called 1511 * outside of a <code>Q3Initialize</code>/<code>Q3Exit</code> block. 1512 * 1513 * @param majorRevision Receives the major revision level of Quesa. 1514 * @param minorRevision Receives the minor revision level of Quesa. 1515 * @result Success or failure of the operation. 1516 */ 1517 Q3_EXTERN_API_C ( TQ3Status ) 1518 Q3GetVersion ( 1519 TQ3Uns32 *majorRevision, 1520 TQ3Uns32 *minorRevision 1521 ); 1522 1523 1524 1525 /*! 1526 * @function 1527 * Q3GetReleaseVersion 1528 * @discussion 1529 * Returns the revision of the installed Quesa software in the format of the 1530 * first four bytes of a Macintosh <code>'vers'</code> resource. 1531 * 1532 * The four bytes contain 1) the major revision level, 2) the minor revision, 1533 * 3) the development stage, and 4) the prerelease revision level, respectively. 1534 * The three revision levels are each represented in binary coded decimal. 1535 * The development stage can be development (0x20), alpha (0x40), beta (0x60) 1536 * or release (0x80). 1537 * 1538 * For example, if the revision is 1.61a23 (= 1.6.1a23), returns 0x01614023. 1539 * For more information, see the description of the <code>'vers'</code> resource 1540 * in the book <i>Inside Macintosh: Macintosh Toolbox Essentials.</i> 1541 * 1542 * Note that unlike QD3D, Quesa allows Q3GetReleaseVersion to be called 1543 * outside of a <code>Q3Initialize</code>/<code>Q3Exit</code> block. 1544 * 1545 * @param releaseRevision Receives the revision of Quesa. 1546 * @result Success or failure of the operation. 1547 */ 1548 Q3_EXTERN_API_C ( TQ3Status ) 1549 Q3GetReleaseVersion ( 1550 TQ3Uns32 *releaseRevision 1551 ); 1552 1553 1554 1555 /*! 1556 @functiongroup Object Hierarchy Functions 1557 */ 1558 1559 1560 1561 /*! 1562 * @function 1563 * Q3ObjectHierarchy_GetTypeFromString 1564 * @discussion 1565 * Returns the class type for a class identified by a class name string. 1566 * 1567 * @param objectClassString The class name of the class to locate. 1568 * @param objectClassType Receives the class type of the class. 1569 * @result Success or failure of the operation. 1570 */ 1571 Q3_EXTERN_API_C ( TQ3Status ) 1572 Q3ObjectHierarchy_GetTypeFromString ( 1573 const TQ3ObjectClassNameString objectClassString, 1574 TQ3ObjectType *objectClassType 1575 ); 1576 1577 1578 1579 /*! 1580 * @function 1581 * Q3ObjectHierarchy_GetStringFromType 1582 * @discussion 1583 * Returns the class name string for a class identified by a class type. 1584 * 1585 * @param objectClassType The class type of the class to locate. 1586 * @param objectClassString Receives the class name string of the class. 1587 * @result Success or failure of the operation. 1588 */ 1589 Q3_EXTERN_API_C ( TQ3Status ) 1590 Q3ObjectHierarchy_GetStringFromType ( 1591 TQ3ObjectType objectClassType, 1592 TQ3ObjectClassNameString objectClassString 1593 ); 1594 1595 1596 1597 /*! 1598 * @function 1599 * Q3ObjectHierarchy_IsTypeRegistered 1600 * @discussion 1601 * Check to see if a class is registered with Quesa. 1602 * 1603 * @param objectClassType The class type of the class to check. 1604 * @result True or false as the class is registered or not. 1605 */ 1606 Q3_EXTERN_API_C ( TQ3Boolean ) 1607 Q3ObjectHierarchy_IsTypeRegistered ( 1608 TQ3ObjectType objectClassType 1609 ); 1610 1611 1612 1613 /*! 1614 * @function 1615 * Q3ObjectHierarchy_IsNameRegistered 1616 * @discussion 1617 * Check to see if a class is registered with Quesa. 1618 * 1619 * @param majorRevision The class name of the class to check. 1620 * @result True or false as the class is registered or not. 1621 */ 1622 Q3_EXTERN_API_C ( TQ3Boolean ) 1623 Q3ObjectHierarchy_IsNameRegistered ( 1624 const char *objectClassName 1625 ); 1626 1627 1628 1629 /*! 1630 * @function 1631 * Q3ObjectHierarchy_GetSubClassData 1632 * @discussion 1633 * Return the immediate sub-classes of a class. 1634 * 1635 * The data returned must be released with a subsequent call to 1636 * Q3ObjectHierarchy_EmptySubClassData. 1637 * 1638 * @param objectClassType The class type of the class to query. 1639 * @param subClassData Receives the immediate sub-classes of the class. 1640 * @result Success or failure of the operation. 1641 */ 1642 Q3_EXTERN_API_C ( TQ3Status ) 1643 Q3ObjectHierarchy_GetSubClassData ( 1644 TQ3ObjectType objectClassType, 1645 TQ3SubClassData *subClassData 1646 ); 1647 1648 1649 1650 /*! 1651 * @function 1652 * Q3ObjectHierarchy_EmptySubClassData 1653 * @discussion 1654 * Release the memory allocated by a previous call to 1655 * Q3ObjectHierarchy_GetSubClassData. 1656 * 1657 * @param subClassData The sub-class data to release. 1658 * @result Success or failure of the operation. 1659 */ 1660 Q3_EXTERN_API_C ( TQ3Status ) 1661 Q3ObjectHierarchy_EmptySubClassData ( 1662 TQ3SubClassData *subClassData 1663 ); 1664 1665 1666 1667 /*! 1668 @functiongroup Object Functions 1669 */ 1670 1671 1672 1673 /*! 1674 * @function 1675 * Q3Object_Dispose 1676 * @discussion 1677 * Disposes of a Quesa object. 1678 * 1679 * Most types of TQ3Object are reference-counted. This function 1680 * decrements the reference count of the object. When the reference count 1681 * falls to 0, the object is deleted. 1682 * 1683 * When used on a non-reference-counted object such as a view or pick, 1684 * the object is deleted immediately. 1685 * 1686 * @param object The object to dispose. 1687 * @result Success or failure of the operation. 1688 */ 1689 Q3_EXTERN_API_C ( TQ3Status ) 1690 Q3Object_Dispose ( 1691 TQ3Object object 1692 ); 1693 1694 1695 1696 /*! 1697 * @function 1698 * Q3Object_CleanDispose 1699 * @discussion 1700 * Cleanly disposes of a Quesa object. 1701 * 1702 * If theObject is not NULL, invokes Q3Object_Dispose to decrement the object 1703 * reference count then clears the supplied pointer to prevent stale references. 1704 * 1705 * Equivalent to: 1706 * 1707 * if (theObject != NULL) 1708 * { 1709 * Q3Object_Dispose(theObject); 1710 * theObject = NULL; 1711 * } 1712 * 1713 * <em>This function is not available in QD3D.</em> 1714 * 1715 * @param theObject The object to dispose (may be NULL). 1716 * @result Success or failure of the operation. 1717 */ 1718 #if QUESA_ALLOW_QD3D_EXTENSIONS 1719 1720 Q3_EXTERN_API_C ( TQ3Status ) 1721 Q3Object_CleanDispose ( 1722 TQ3Object *theObject 1723 ); 1724 1725 #endif // QUESA_ALLOW_QD3D_EXTENSIONS 1726 1727 1728 1729 /*! 1730 * @function 1731 * Q3Object_Duplicate 1732 * @discussion 1733 * Duplicates a Quesa object. 1734 * 1735 * Returns a new copy of the object, with a reference count of 1. 1736 * 1737 * @param object The object to duplicate. 1738 * @result A new copy of the object. 1739 */ 1740 Q3_EXTERN_API_C ( TQ3Object ) 1741 Q3Object_Duplicate ( 1742 TQ3Object object 1743 ); 1744 1745 1746 1747 /*! 1748 * @function 1749 * Q3Object_Submit 1750 * @discussion 1751 * Submit an object to a view. 1752 * 1753 * The object is submitted to the view's current processing loop, 1754 * e.g., for rendering, picking, or writing to a file. 1755 * 1756 * @param object The object to submit. 1757 * @param view The view to submit the object to. 1758 * @result Success or failure of the operation. 1759 */ 1760 Q3_EXTERN_API_C ( TQ3Status ) 1761 Q3Object_Submit ( 1762 TQ3Object object, 1763 TQ3ViewObject view 1764 ); 1765 1766 1767 1768 /*! 1769 * @function 1770 * Q3Object_IsDrawable 1771 * @discussion 1772 * Tests to see if an object is drawable. 1773 * 1774 * Only drawable objects may be submitted to a view's rendering loop. 1775 * 1776 * @param object The object to test. 1777 * @result True or false as the object is drawable or not. 1778 */ 1779 Q3_EXTERN_API_C ( TQ3Boolean ) 1780 Q3Object_IsDrawable ( 1781 TQ3Object object 1782 ); 1783 1784 1785 1786 /*! 1787 * @function 1788 * Q3Object_IsWritable 1789 * @discussion 1790 * Tests to see if an object is writable. 1791 * 1792 * Only drawable objects may be submitted to a view's writing loop. 1793 * 1794 * @param object The object to test. 1795 * @result True or false as the object is writable or not. 1796 */ 1797 Q3_EXTERN_API_C ( TQ3Boolean ) 1798 Q3Object_IsWritable ( 1799 TQ3Object object, 1800 TQ3FileObject theFile 1801 ); 1802 1803 1804 1805 /*! 1806 * @function 1807 * Q3Object_GetType 1808 * @discussion 1809 * Returns the top level type of an object. 1810 * 1811 * Returns kQ3ObjectTypeElement, kQ3ObjectTypePick, kQ3ObjectTypeShared, 1812 * or kQ3ObjectTypeView. Returns kQ3ObjectTypeInvalid if the object type 1813 * is unknown. 1814 * 1815 * @param object The object to test. 1816 * @result The top level type of the object. 1817 */ 1818 Q3_EXTERN_API_C ( TQ3ObjectType ) 1819 Q3Object_GetType ( 1820 TQ3Object object 1821 ); 1822 1823 1824 1825 /*! 1826 * @function 1827 * Q3Object_GetLeafType 1828 * @discussion 1829 * Returns the leaf type of an object. 1830 * 1831 * Returns the most specific type that can be identified from the object 1832 * (e.g., a camera object may have a leaf type of kQ3CameraTypeViewAngleAspect). 1833 * Returns kQ3ObjectTypeInvalid if the object type is unknown. 1834 * 1835 * @param object The object to test. 1836 * @result The leaf type of the object. 1837 */ 1838 Q3_EXTERN_API_C ( TQ3ObjectType ) 1839 Q3Object_GetLeafType ( 1840 TQ3Object object 1841 ); 1842 1843 1844 1845 /*! 1846 * @function 1847 * Q3Object_IsType 1848 * @discussion 1849 * Tests to see if an object belongs to a given type. 1850 * 1851 * Examines both the object supplied and its parents. E.g., a camera object 1852 * would return true for a type of kQ3CameraTypeViewAngleAspect, 1853 * kQ3ShapeTypeCamera, kQ3SharedTypeShape, and kQ3ObjectTypeShared but would 1854 * return false for kQ3ObjectTypePick. 1855 * 1856 * @param object The object to test. 1857 * @param theType The type to test the object against. 1858 * @result True or false as the object belongs to the type or not. 1859 */ 1860 Q3_EXTERN_API_C ( TQ3Boolean ) 1861 Q3Object_IsType ( 1862 TQ3Object object, 1863 TQ3ObjectType theType 1864 ); 1865 1866 1867 /*! 1868 * @function 1869 * Q3Object_AddElement 1870 * @discussion 1871 * Add an element to an object. 1872 * Same as <code>Q3Shape_AddElement</code>, except that the object is not 1873 * required to be a shape or set. 1874 * 1875 * If the object is Shared, this operation will increment the object's edit index. 1876 * 1877 * <em>This function is not available in QD3D.</em> 1878 * 1879 * @param object The object to update. 1880 * @param theType The type of the element data. 1881 * @param data The element data. 1882 * @result Success or failure of the operation. 1883 */ 1884 #if QUESA_ALLOW_QD3D_EXTENSIONS 1885 1886 Q3_EXTERN_API_C ( TQ3Status ) 1887 Q3Object_AddElement ( 1888 TQ3Object object, 1889 TQ3ElementType theType, 1890 const void *data 1891 ); 1892 1893 #endif 1894 1895 1896 1897 /*! 1898 * @function 1899 * Q3Object_GetElement 1900 * @discussion 1901 * Get an element from an object. 1902 * Same as <code>Q3Shape_GetElement</code>, except that the object is not 1903 * required to be a shape or set. 1904 * 1905 * <em>This function is not available in QD3D.</em> 1906 * 1907 * @param object The object to query. 1908 * @param theType The type of the element data. 1909 * @param data Receives the element data. 1910 * @result Success or failure of the operation. 1911 */ 1912 #if QUESA_ALLOW_QD3D_EXTENSIONS 1913 1914 Q3_EXTERN_API_C ( TQ3Status ) 1915 Q3Object_GetElement ( 1916 TQ3Object object, 1917 TQ3ElementType theType, 1918 void *data 1919 ); 1920 1921 #endif 1922 1923 1924 1925 /*! 1926 * @function 1927 * Q3Object_ContainsElement 1928 * @discussion 1929 * Check to see if an object contains an element of a given type. 1930 * Same as <code>Q3Shape_ContainsElement</code>, except that the object is not 1931 * required to be a shape or set. 1932 * 1933 * <em>This function is not available in QD3D.</em> 1934 * 1935 * @param object The object to query. 1936 * @param theType The type of the element data to look for. 1937 * @result Success or failure of the operation. 1938 */ 1939 #if QUESA_ALLOW_QD3D_EXTENSIONS 1940 1941 Q3_EXTERN_API_C ( TQ3Boolean ) 1942 Q3Object_ContainsElement ( 1943 TQ3Object object, 1944 TQ3ElementType theType 1945 ); 1946 1947 #endif 1948 1949 1950 1951 /*! 1952 * @function 1953 * Q3Object_GetNextElementType 1954 * @discussion 1955 * Iterate through the element types in an object. 1956 * Same as <code>Q3Shape_GetNextElementType</code>, except that the object is not 1957 * required to be a shape or set. 1958 * 1959 * Pass in kQ3ElementTypeNone to start iterating through the element 1960 * types in the object, and pass back the returned value to obtain 1961 * the next type. The type is set to kQ3ElementTypeNone if there are no more 1962 * elements in the shape. 1963 * 1964 * <em>This function is not available in QD3D.</em> 1965 * 1966 * @param object The object to query. 1967 * @param theType Receives the next element type. 1968 * @result Success or failure of the operation. 1969 */ 1970 #if QUESA_ALLOW_QD3D_EXTENSIONS 1971 1972 Q3_EXTERN_API_C ( TQ3Status ) 1973 Q3Object_GetNextElementType ( 1974 TQ3Object object, 1975 TQ3ElementType *theType 1976 ); 1977 1978 #endif 1979 1980 1981 1982 /*! 1983 * @function 1984 * Q3Object_EmptyElements 1985 * @discussion 1986 * Empty an object of any elements it contains. 1987 * Same as <code>Q3Shape_EmptyElements</code>, except that the object is not 1988 * required to be a shape or set. 1989 * 1990 * If the object is Shared, this operation will increment the object's edit index. 1991 * 1992 * <em>This function is not available in QD3D.</em> 1993 * 1994 * @param object The object to update. 1995 * @result Success or failure of the operation. 1996 */ 1997 #if QUESA_ALLOW_QD3D_EXTENSIONS 1998 1999 Q3_EXTERN_API_C ( TQ3Status ) 2000 Q3Object_EmptyElements ( 2001 TQ3Object object 2002 ); 2003 2004 #endif 2005 2006 2007 2008 /*! 2009 * @function 2010 * Q3Object_ClearElement 2011 * @discussion 2012 * Empty an object of a particular type of element. 2013 * Same as <code>Q3Shape_ClearElement</code>, except that the object is not 2014 * required to be a shape or set. 2015 * 2016 * If the object is Shared, this operation will increment the object's edit index. 2017 * 2018 * <em>This function is not available in QD3D.</em> 2019 * 2020 * @param object The object to update. 2021 * @param theType The element type to remove. 2022 * @result Success or failure of the operation. 2023 */ 2024 #if QUESA_ALLOW_QD3D_EXTENSIONS 2025 2026 Q3_EXTERN_API_C ( TQ3Status ) 2027 Q3Object_ClearElement ( 2028 TQ3Object object, 2029 TQ3ElementType theType 2030 ); 2031 2032 #endif 2033 2034 2035 2036 /*! 2037 * @function 2038 * Q3Object_GetSet 2039 * @discussion 2040 * Get the element set of an object. This is not the same as the set 2041 * returned by <code>Q3Shape_GetSet</code>. 2042 * 2043 * This function is primarily for the use of file format plug-ins. 2044 * Most applications will not need it. 2045 * 2046 * <em>This function is not available in QD3D.</em> 2047 * 2048 * @param object The object. 2049 * @param set Receives a set object, or NULL. 2050 * @result Success or failure of the operation. 2051 */ 2052 #if QUESA_ALLOW_QD3D_EXTENSIONS 2053 2054 Q3_EXTERN_API_C ( TQ3Status ) 2055 Q3Object_GetSet ( 2056 TQ3Object object, 2057 TQ3SetObject* set 2058 ); 2059 2060 #endif 2061 2062 2063 2064 /*! 2065 * @function 2066 * Q3Object_GetProperty 2067 * @discussion 2068 * Get property data from an object. 2069 * 2070 * The operation fails if the property does not exist or if you provide a 2071 * buffer that is not large enough to hold the data. 2072 * 2073 * If you do not know the size of the property, you may call Q3Object_GetProperty 2074 * passing NULL for the buffer to find the size of the data, then allocate your 2075 * buffer and call Q3Object_GetProperty again. 2076 * 2077 * <em>This function is not available in QD3D.</em> 2078 * 2079 * @param object The object. 2080 * @param propType Property type tag. 2081 * @param bufferSize Size of provided buffer in bytes. 2082 * @param actualSize Returns size of returned data in bytes. 2083 * You may pass NULL if you do not need this information. 2084 * @param buffer Buffer to receive the property data. May be NULL. 2085 * @result Success or failure of the operation. 2086 */ 2087 #if QUESA_ALLOW_QD3D_EXTENSIONS 2088 2089 Q3_EXTERN_API_C ( TQ3Status ) 2090 Q3Object_GetProperty( 2091 TQ3Object object, 2092 TQ3ObjectType propType, 2093 TQ3Uns32 bufferSize, 2094 TQ3Uns32* actualSize, 2095 void* buffer ); 2096 2097 #endif 2098 2099 2100 2101 /*! 2102 * @function 2103 * Q3Object_RemoveProperty 2104 * @discussion 2105 * Remove a property from an object. 2106 * 2107 * <em>This function is not available in QD3D.</em> 2108 * 2109 * @param object The object. 2110 * @param propType Property type tag. 2111 * @result Success or failure of the operation. 2112 */ 2113 #if QUESA_ALLOW_QD3D_EXTENSIONS 2114 2115 Q3_EXTERN_API_C ( TQ3Status ) 2116 Q3Object_RemoveProperty( 2117 TQ3Object object, 2118 TQ3ObjectType propType ); 2119 2120 #endif 2121 2122 2123 2124 /*! 2125 * @function 2126 * Q3Object_SetProperty 2127 * @discussion 2128 * Set a property of an object. If there was already a property of the 2129 * same type, it is replaced. 2130 * 2131 * Property type tags consisting of all lowercase ASCII letters are reserved 2132 * for Quesa internal use. 2133 * 2134 * <em>This function is not available in QD3D.</em> 2135 * 2136 * @param object The object. 2137 * @param propType Property type tag. 2138 * @param dataSize Size in bytes of the data. 2139 * @param data Data to copy into the property. 2140 * @result Success or failure of the operation. 2141 */ 2142 #if QUESA_ALLOW_QD3D_EXTENSIONS 2143 2144 Q3_EXTERN_API_C ( TQ3Status ) 2145 Q3Object_SetProperty( 2146 TQ3Object object, 2147 TQ3ObjectType propType, 2148 TQ3Uns32 dataSize, 2149 const void* data ); 2150 2151 #endif 2152 2153 2154 2155 /*! 2156 * @function 2157 * Q3Object_SetSet 2158 * @discussion 2159 * Assign to the element set of an object, disposing any previous set. 2160 * This is not the same as the set element that is 2161 * changed by <code>Q3Shape_SetSet</code>. 2162 * 2163 * This function is primarily for the use of file format plug-ins. 2164 * Most applications will not need it. 2165 * 2166 * <em>This function is not available in QD3D.</em> 2167 * 2168 * @param object The object. 2169 * @param set A set object. 2170 * @result A set object, or NULL. 2171 */ 2172 #if QUESA_ALLOW_QD3D_EXTENSIONS 2173 2174 Q3_EXTERN_API_C ( TQ3Status ) 2175 Q3Object_SetSet ( 2176 TQ3Object object, 2177 TQ3SetObject set 2178 ); 2179 2180 #endif 2181 2182 2183 2184 /*! 2185 @functiongroup Shared Object Functions 2186 */ 2187 2188 2189 2190 /*! 2191 * @function 2192 * Q3Shared_GetType 2193 * @discussion 2194 * Get the type of a shared object. 2195 * 2196 * Returns kQ3ObjectTypeInvalid if the object is not a shared object or 2197 * the type can not be determined. Returns a kQ3SharedTypeXXXX value 2198 * for shared objects. 2199 * 2200 * @param sharedObject The object to test. 2201 * @result The type of the shared object. 2202 */ 2203 Q3_EXTERN_API_C ( TQ3ObjectType ) 2204 Q3Shared_GetType ( 2205 TQ3SharedObject sharedObject 2206 ); 2207 2208 2209 2210 /*! 2211 * @function 2212 * Q3Shared_GetReference 2213 * @discussion 2214 * Increment the reference count of a shared object. 2215 * 2216 * @param sharedObject The object whose reference count should be incremented. 2217 * @result The object whose reference count has been incremented. 2218 */ 2219 Q3_EXTERN_API_C ( TQ3SharedObject ) 2220 Q3Shared_GetReference ( 2221 TQ3SharedObject sharedObject 2222 ); 2223 2224 2225 2226 /*! 2227 * @function 2228 * Q3Shared_IsReferenced 2229 * @discussion 2230 * Determine if a shared object has more than one reference to it. 2231 * 2232 * Returns kQ3True if the object has more than one reference to it. Will 2233 * return kQ3False if the object a reference count of one. 2234 * 2235 * @param sharedObject The object to test. 2236 * @result True or false as the object has more than one reference. 2237 */ 2238 Q3_EXTERN_API_C ( TQ3Boolean ) 2239 Q3Shared_IsReferenced ( 2240 TQ3SharedObject sharedObject 2241 ); 2242 2243 2244 2245 /*! 2246 * @function 2247 * Q3Shared_GetReferenceCount 2248 * @discussion 2249 * Return the reference count of a shared object. 2250 * 2251 * This function should be used only for debugging. If you are 2252 * tempted to use it for something else, then you probably don't 2253 * understand the correct way to work with reference-counted objects. 2254 * 2255 * <em>This function is not available in QD3D.</em> 2256 * 2257 * @param sharedObject The object to test. 2258 * @result Reference count. 2259 */ 2260 #if QUESA_ALLOW_QD3D_EXTENSIONS 2261 2262 Q3_EXTERN_API_C ( TQ3Uns32 ) 2263 Q3Shared_GetReferenceCount ( 2264 TQ3SharedObject sharedObject 2265 ); 2266 2267 #endif // QUESA_ALLOW_QD3D_EXTENSIONS 2268 2269 2270 2271 /*! 2272 * @function 2273 * Q3Shared_GetEditIndex 2274 * @discussion 2275 * Get the edit index of a shared object. 2276 * 2277 * An edit index is a unique number associated with a shared object, which 2278 * changes each time the object is edited. By testing this number, you 2279 * can determine when an object has been edited. 2280 * 2281 * @param sharedObject The object to query. 2282 * @result The current edit index of the object. 2283 */ 2284 Q3_EXTERN_API_C ( TQ3Uns32 ) 2285 Q3Shared_GetEditIndex ( 2286 TQ3SharedObject sharedObject 2287 ); 2288 2289 2290 2291 /*! 2292 * @function 2293 * Q3Shared_Edited 2294 * @discussion 2295 * Change the edit index of a shared object. 2296 * 2297 * Editing a shared object will change its edit index automatically: this 2298 * function is typically used for shared plug-in objects who need to indicate 2299 * to Quesa that their private data has changed. 2300 * 2301 * @param sharedObject The object to update. 2302 * @result Success or failure of the operation. 2303 */ 2304 Q3_EXTERN_API_C ( TQ3Status ) 2305 Q3Shared_Edited ( 2306 TQ3SharedObject sharedObject 2307 ); 2308 2309 2310 2311 /*! 2312 @functiongroup Shape Functions 2313 */ 2314 2315 2316 2317 /*! 2318 * @function 2319 * Q3Shape_GetType 2320 * @discussion 2321 * Get the type of a shape object. 2322 * 2323 * Returns kQ3ObjectTypeInvalid if the object is not a shape object or 2324 * the type can not be determined. Returns a kQ3ShapeTypeXXXX value 2325 * for shape objects. 2326 * 2327 * @param shape The object to test. 2328 * @result The type of the shape object. 2329 */ 2330 Q3_EXTERN_API_C ( TQ3ObjectType ) 2331 Q3Shape_GetType ( 2332 TQ3ShapeObject shape 2333 ); 2334 2335 2336 2337 /*! 2338 * @function 2339 * Q3Shape_GetSet 2340 * @discussion 2341 * Get the set element currently associated with a shape. 2342 * The function call <code>Q3Shape_GetSet( o, &s )</code> is equivalent to 2343 * <code>Q3Shape_GetElement( o, kQ3ElementTypeSet, &s )</code>. 2344 * 2345 * Note that this is not the same as the attribute set of a geometry object, 2346 * nor is in the internal set which holds elements on an object. That is, 2347 * after adding elements or attributes to an object, this function may still 2348 * return the NULL set. 2349 * 2350 * @param shape The object to query. 2351 * @param theSet Receives the set of the object, or NULL. 2352 * @result Success or failure of the operation. 2353 */ 2354 Q3_EXTERN_API_C ( TQ3Status ) 2355 Q3Shape_GetSet ( 2356 TQ3ShapeObject shape, 2357 TQ3SetObject *theSet 2358 ); 2359 2360 2361 2362 /*! 2363 * @function 2364 * Q3Shape_SetSet 2365 * @discussion 2366 * Set the set element currently associated with a shape. 2367 * The function call <code>Q3Shape_SetSet( o, s )</code> is equivalent to 2368 * <code>Q3Shape_SetElement( o, kQ3ElementTypeSet, &s )</code>. 2369 * 2370 * Note that this is not the same as the attribute set of a geometry object. 2371 * 2372 * @param shape The object to update. 2373 * @param theSet The new set for the object. 2374 * @result Success or failure of the operation. 2375 */ 2376 Q3_EXTERN_API_C ( TQ3Status ) 2377 Q3Shape_SetSet ( 2378 TQ3ShapeObject shape, 2379 TQ3SetObject theSet 2380 ); 2381 2382 2383 2384 /*! 2385 * @function 2386 * Q3Shape_AddElement 2387 * @discussion 2388 * Add an element to a shape. 2389 * 2390 * @param shape The object to update. 2391 * @param theType The type of the element data. 2392 * @param data The element data. 2393 * @result Success or failure of the operation. 2394 */ 2395 Q3_EXTERN_API_C ( TQ3Status ) 2396 Q3Shape_AddElement ( 2397 TQ3ShapeObject shape, 2398 TQ3ElementType theType, 2399 const void *data 2400 ); 2401 2402 2403 2404 /*! 2405 * @function 2406 * Q3Shape_GetElement 2407 * @discussion 2408 * Get an element from a shape. 2409 * 2410 * @param shape The object to query. 2411 * @param theType The type of the element data. 2412 * @param data Receives the element data. 2413 * @result Success or failure of the operation. 2414 */ 2415 Q3_EXTERN_API_C ( TQ3Status ) 2416 Q3Shape_GetElement ( 2417 TQ3ShapeObject shape, 2418 TQ3ElementType theType, 2419 void *data 2420 ); 2421 2422 2423 2424 /*! 2425 * @function 2426 * Q3Shape_ContainsElement 2427 * @discussion 2428 * Check to see if a shape contains an element of a given type. 2429 * 2430 * @param shape The object to query. 2431 * @param theType The type of the element data to look for. 2432 * @result Success or failure of the operation. 2433 */ 2434 Q3_EXTERN_API_C ( TQ3Boolean ) 2435 Q3Shape_ContainsElement ( 2436 TQ3ShapeObject shape, 2437 TQ3ElementType theType 2438 ); 2439 2440 2441 2442 /*! 2443 * @function 2444 * Q3Shape_GetNextElementType 2445 * @discussion 2446 * Iterate through the element types in a shape. 2447 * 2448 * Pass in kQ3ElementTypeNone to start iterating through the element 2449 * types in the shape, and pass back the returned value to obtain 2450 * the next type. Is set to kQ3ElementTypeNone if there are no more 2451 * elements in the shape. 2452 * 2453 * @param shape The object to query. 2454 * @param theType Receives the next element type. 2455 * @result Success or failure of the operation. 2456 */ 2457 Q3_EXTERN_API_C ( TQ3Status ) 2458 Q3Shape_GetNextElementType ( 2459 TQ3ShapeObject shape, 2460 TQ3ElementType *theType 2461 ); 2462 2463 2464 2465 /*! 2466 * @function 2467 * Q3Shape_EmptyElements 2468 * @discussion 2469 * Empty a shape of any elements it contains. 2470 * 2471 * @param shape The object to update. 2472 * @result Success or failure of the operation. 2473 */ 2474 Q3_EXTERN_API_C ( TQ3Status ) 2475 Q3Shape_EmptyElements ( 2476 TQ3ShapeObject shape 2477 ); 2478 2479 2480 2481 /*! 2482 * @function 2483 * Q3Shape_ClearElement 2484 * @discussion 2485 * Empty a shape of a particular type of element. 2486 * 2487 * @param shape The object to update. 2488 * @param theType The element type to remove. 2489 * @result Success or failure of the operation. 2490 */ 2491 Q3_EXTERN_API_C ( TQ3Status ) 2492 Q3Shape_ClearElement ( 2493 TQ3ShapeObject shape, 2494 TQ3ElementType theType 2495 ); 2496 2497 2498 2499 /*! 2500 @functiongroup Bitmap Functions 2501 */ 2502 2503 2504 2505 /*! 2506 * @function 2507 * Q3Bitmap_Empty 2508 * @discussion 2509 * Release the memory used by a TQ3Bitmap. 2510 * 2511 * Should be used to release the data used by TQ3Bitmaps returned by 2512 * Quesa. You should not call Q3Bitmap_Empty on TQ3Bitmaps whose 2513 * image data was allocated by you. 2514 * 2515 * @param bitmap The TQ3Bitmap whose image data should be released. 2516 * @result Success or failure of the operation. 2517 */ 2518 Q3_EXTERN_API_C ( TQ3Status ) 2519 Q3Bitmap_Empty ( 2520 TQ3Bitmap *bitmap 2521 ); 2522 2523 2524 2525 /*! 2526 * @function 2527 * Q3Bitmap_GetImageSize 2528 * @discussion 2529 * Determine how much image data would be required for a TQ3Bitmap. 2530 * 2531 * Returns the smallest block of memory that could hold a bitmap 2532 * with the specified dimensions. 2533 * 2534 * @param width The proposed width of the bitmap. 2535 * @param height The proposed height of the bitmap. 2536 * @result The number of bytes needed for the bitmap. 2537 */ 2538 Q3_EXTERN_API_C ( TQ3Uns32 ) 2539 Q3Bitmap_GetImageSize ( 2540 TQ3Uns32 width, 2541 TQ3Uns32 height 2542 ); 2543 2544 2545 2546 /*! 2547 * @function 2548 * Q3Bitmap_GetBit 2549 * @discussion 2550 * Get the status of a bit within a bitmap. 2551 * 2552 * <em>This function is not available in QD3D.</em> 2553 * 2554 * @param theBitMap The bitmap to query. 2555 * @param x The x coordinate of the pixel to query. 2556 * @param y The y coordinate of the pixel to query. 2557 * @result The status of the bit. 2558 */ 2559 #if QUESA_ALLOW_QD3D_EXTENSIONS 2560 2561 Q3_EXTERN_API_C ( TQ3Boolean ) 2562 Q3Bitmap_GetBit ( 2563 const TQ3Bitmap *theBitmap, 2564 TQ3Uns32 x, 2565 TQ3Uns32 y 2566 ); 2567 2568 #endif // QUESA_ALLOW_QD3D_EXTENSIONS 2569 2570 2571 2572 /*! 2573 * @function 2574 * Q3Bitmap_SetBit 2575 * @discussion 2576 * Set the status of a bit within a bitmap. 2577 * 2578 * <em>This function is not available in QD3D.</em> 2579 * 2580 * @param theBitMap The bitmap to update. 2581 * @param x The x coordinate of the pixel to update. 2582 * @param y The y coordinate of the pixel to update. 2583 * @param theState The new state for the pixel. 2584 * @result Success or failure of the operation. 2585 */ 2586 #if QUESA_ALLOW_QD3D_EXTENSIONS 2587 2588 Q3_EXTERN_API_C ( TQ3Status ) 2589 Q3Bitmap_SetBit ( 2590 TQ3Bitmap *theBitmap, 2591 TQ3Uns32 x, 2592 TQ3Uns32 y, 2593 TQ3Boolean theState 2594 ); 2595 2596 #endif // QUESA_ALLOW_QD3D_EXTENSIONS 2597 2598 2599 // Work around a HeaderDoc bug 2600 /*! 2601 @functiongroup 2602 */ 2603 2604 2605 2606 //============================================================================= 2607 // C++ postamble 2608 //----------------------------------------------------------------------------- 2609 #ifdef __cplusplus 2610 } 2611 #endif 2612 2613 2614 #endif 2615 2616 2617