Mac OS 9
RAVE.h
Go to the documentation of this file.
1 
19 #ifndef __RAVE__
20 #define __RAVE__
21 
22 #ifndef __CONDITIONALMACROS__
23 #include <ConditionalMacros.h>
24 #endif
25 
26 #if TARGET_OS_MAC
27 #ifndef __MACTYPES__
28 #include <MacTypes.h>
29 #endif
30 
31 #ifndef __QUICKDRAW__
32 #include <Quickdraw.h>
33 #endif
34 
35 #ifndef __QDOFFSCREEN__
36 #include <QDOffscreen.h>
37 #endif
38 
39 #endif /* TARGET_OS_MAC */
40 
41 #if TARGET_OS_WIN32
42 #include <windows.h>
43 #ifndef RAVE_NO_DIRECTDRAW
44 #include <ddraw.h>
45 #endif /* !defined(RAVE_NO_DIRECTDRAW) */
46 
47 #endif /* TARGET_OS_WIN32 */
48 
49 #if PRAGMA_ONCE
50 #pragma once
51 #endif
52 
53 #ifdef __cplusplus
54 extern "C"
55 {
56 #endif
57 
58 #if PRAGMA_IMPORT
59 #pragma import on
60 #endif
61 
62 #if PRAGMA_STRUCT_ALIGN
63 #pragma options align = power
64 #elif PRAGMA_STRUCT_PACKPUSH
65 #pragma pack(push, 2)
66 #elif PRAGMA_STRUCT_PACK
67 #pragma pack(2)
68 #endif
69 
70 #if PRAGMA_ENUM_ALWAYSINT
71 #if defined(__fourbyteints__) && !__fourbyteints__
72 #define __RAVE__RESTORE_TWOBYTEINTS
73 #pragma fourbyteints on
74 #endif
75 #pragma enumsalwaysint on
76 #elif PRAGMA_ENUM_OPTIONS
77 #pragma option enum =int
78 #elif PRAGMA_ENUM_PACK
79 #if __option(pack_enums)
80 #define __RAVE__RESTORE_PACKED_ENUMS
81 #pragma options(!pack_enums)
82 #endif
83 #endif
84 
85 #define RAVE_OBSOLETE 0
86 
87  /******************************************************************************
88  *
89  * Platform macros.
90  * This sets kQAPlatform to one of kQAMacOS, kQAWin32, or kQAGeneric.
91  * kQAPlatform controls platform-specific compilation switches and types.
92  *
93  *****************************************************************************/
94 
95 #if !defined(kQAMacOS)
96 #define kQAMacOS 1 /* Target is MacOS */
97 #endif
98 
99 #if !defined(kQAGeneric)
100 #define kQAGeneric 2 /* Target is generic platform */
101 #endif
102 
103 #if !defined(kQAWin32)
104 #define kQAWin32 3 /* Target is Win32 */
105 #endif
106 
107 #if defined(_WIN32) || defined(_WINDOWS)
108 #define kQAPlatform kQAWin32
109 #elif !defined(kQAPlatform)
110 #define kQAPlatform kQAMacOS
111 #endif
112 
113 /******************************************************************************
114  *
115  * Export Control
116  *
117  *****************************************************************************/
118 #if defined(_MSC_VER)
119 /* Microsoft Visual C */
120 #if defined(WIN32_RAVEEXPORTING)
121 /* define when building DLL */
122 #define RAVE_EXPORT __declspec(dllexport)
123 #define RAVE_CALL
124 #define RAVE_CALLBACK
125 #else
126 #define RAVE_EXPORT __declspec(dllimport)
127 #define RAVE_CALL __cdecl
128 #define RAVE_CALLBACK __cdecl
129 #endif
130 /* WIN32_RAVEEXPORTING */
131 #else
132 #define RAVE_EXPORT
133 #define RAVE_CALL
134 #define RAVE_CALLBACK
135 #endif
136  /* _MSC_VER */
137 
138  /******************************************************************************
139  *
140  * Platform dependent datatypes: TQAImagePixelType, TQADevice, TQAClip, and
141  *TQARect.
142  *
143  *****************************************************************************/
144  enum TQAImagePixelType
145  {
146  kQAPixel_Alpha1 = 0, /* 1 bit/pixel alpha */
147  kQAPixel_RGB16 = 1, /* 16 bits/pixel, R=14:10, G=9:5, B=4:0 */
148  kQAPixel_ARGB16 = 2, /* 16 bits/pixel, A=15, R=14:10, G=9:5, B=4:0 */
149  kQAPixel_RGB32 = 3, /* 32 bits/pixel, R=23:16, G=15:8, B=7:0 */
150  kQAPixel_ARGB32 = 4, /* 32 bits/pixel, A=31:24, R=23:16, G=15:8, B=7:0 */
151  kQAPixel_CL4 = 5, /* 4 bit color look up table, always big endian, ie high 4
152  bits effect left pixel */
153  kQAPixel_CL8 = 6, /* 8 bit color look up table */
154  kQAPixel_RGB16_565 =
155  7, /* Win32 ONLY 16 bits/pixel, no alpha, R:5, G:6, B:5 */
156  kQAPixel_RGB24 = 8, /* Win32 ONLY 24 bits/pixel, no alpha, R:8, G:8, B:8 */
157  kQAPixel_RGB8_332 = 9, /* 8 bits/pixel, R=7:5, G = 4:2, B = 1:0 */
158  kQAPixel_ARGB16_4444 = 10, /* 16 bits/pixel, A=15:12, R=11:8, G=7:4, B=3:0 */
159  kQAPixel_ACL16_88 =
160  11, /* 16 bits/pixel, A=15:8, CL=7:0, 8 bit alpha + 8 bit color lookup */
161  kQAPixel_I8 = 12, /* 8 bits/pixel, I=7:0, intensity map (grayscale) */
162  kQAPixel_AI16_88 =
163  13, /* 16 bits/pixel, A=15:8, I=7:0, intensity map (grayscale) */
164  kQAPixel_YUVS = 14, /* 16 bits/pixel, QD's kYUVSPixelFormat (4:2:2, YUYV
165  ordering, unsigned UV) */
166  kQAPixel_YUVU = 15, /* 16 bits/pixel, QD's kYUVUPixelFormat (4:2:2, YUYV
167  ordering, signed UV) */
168  kQAPixel_YVYU422 = 16, /* 16 bits/pixel, QD's kYVYU422PixelFormat (4:2:2, YVYU
169  ordering, unsigned UV) */
170  kQAPixel_UYVY422 = 17 /* 16 bits/pixel, QD's kUYVY422PixelFormat (4:2:2, UYVY
171  ordering, unsigned UV) */
172  };
173  typedef enum TQAImagePixelType TQAImagePixelType;
174 
175  enum TQAColorTableType
176  {
177  kQAColorTable_CL8_RGB32 =
178  0, /* 256 entry, 32 bit/pixel, R=23:16, G=15:8, B=7:0 */
179  kQAColorTable_CL4_RGB32 =
180  1 /* 16 entry, 32 bit/pixel, R=23:16, G=15:8, B=7:0 */
181  };
182  typedef enum TQAColorTableType TQAColorTableType;
183 
184  /* Selects target device type */
185  enum TQADeviceType
186  {
187  kQADeviceMemory = 0, /* Memory draw context */
188  kQADeviceGDevice = 1, /* Macintosh GDevice draw context */
189  kQADeviceWin32DC = 2, /* Win32 DC */
190  kQADeviceDDSurface = 3 /* Win32 DirectDraw Surface */
191  };
192  typedef enum TQADeviceType TQADeviceType;
193 
194  /* Generic memory pixmap device */
196  {
197  long rowBytes; /* Rowbytes */
198  TQAImagePixelType pixelType; /* Depth, color space, etc. */
199  long width; /* Width in pixels */
200  long height; /* Height in pixels */
201  void *baseAddr; /* Base address of pixmap */
202  };
203  typedef struct TQADeviceMemory TQADeviceMemory;
204  /* Offscreen Device */
206  {
207  TQAImagePixelType pixelType; /* Depth, color space, etc. */
208  };
209  typedef struct TQADeviceOffscreen TQADeviceOffscreen;
210  /* Selects target clip type */
211  enum TQAClipType
212  {
213  kQAClipRgn = 0, /* Macintosh clipRgn with serial number */
214  kQAClipWin32Rgn = 1 /* Win32 clip region */
215  };
216  typedef enum TQAClipType TQAClipType;
217 
218  struct TQARect
219  {
220  long left;
221  long right;
222  long top;
223  long bottom;
224  };
225  typedef struct TQARect TQARect;
226 #if TARGET_OS_MAC
227  union TQAPlatformDevice
228  {
229  TQADeviceMemory memoryDevice;
230  GDHandle gDevice;
231  };
232  typedef union TQAPlatformDevice TQAPlatformDevice;
233  union TQAPlatformClip
234  {
235  RgnHandle clipRgn;
236  };
237  typedef union TQAPlatformClip TQAPlatformClip;
238  typedef CALLBACK_API(void, TQADrawNotificationProcPtr)(short left, short top,
239  short right,
240  short bottom,
241  long refCon);
242 
243  typedef long TQADrawNotificationProcRefNum;
244 /* used to unregister your proc */
245 #elif TARGET_OS_WIN32
246 
247 #if !defined(RAVE_NO_DIRECTDRAW)
248 
249 enum TQADirectDrawObjectSelector
250 {
251  kQADirectDrawObject = 1,
252  kQADirectDrawObject2 = 2
253 };
254 typedef enum TQADirectDrawObjectSelector TQADirectDrawObjectSelector;
255 
256 enum TQADirectDrawSurfaceSelector
257 {
258  kQADirectDrawSurface = 1,
259  kQADirectDrawSurface2 = 2
260 };
261 typedef enum TQADirectDrawSurfaceSelector TQADirectDrawSurfaceSelector;
262 
263 #endif /* !RAVE_NO_DIRECTDRAW */
264 
265 union TQAPlatformDevice
266 {
267  TQADeviceMemory memoryDevice;
268  HDC hdc;
269 #if !defined(RAVE_NO_DIRECTDRAW)
270  struct
271  {
272  TQADirectDrawObjectSelector objectSelector;
273  union
274  {
275  LPDIRECTDRAW lpDirectDraw;
276  LPDIRECTDRAW2 lpDirectDraw2;
277  };
278 
279  TQADirectDrawSurfaceSelector surfaceSelector;
280  union
281  {
282  LPDIRECTDRAWSURFACE lpDirectDrawSurface;
283  LPDIRECTDRAWSURFACE2 lpDirectDrawSurface2;
284  };
285  };
286 #endif /* RAVE_NO_DIRECTDRAW */
287 };
289 
290 union TQAPlatformClip
291 {
292  HRGN clipRgn;
293 };
294 typedef union TQAPlatformClip TQAPlatformClip;
295 
296 #else
302 {
303  TQADeviceMemory memoryDevice;
304 };
307 {
308  void *region; /* ??? */
309 };
310 typedef union TQAPlatformClip TQAPlatformClip;
311 #endif /* */
312 
313  struct TQADevice
314  {
315  TQADeviceType deviceType;
316  TQAPlatformDevice device;
317  };
318  typedef struct TQADevice TQADevice;
319  struct TQAClip
320  {
321  TQAClipType clipType;
322  TQAPlatformClip clip;
323  };
324  typedef struct TQAClip TQAClip;
325  /******************************************************************************
326  *
327  * Basic data types.
328  *
329  *****************************************************************************/
330 
331  /* Pointer to a drawing engine */
332  typedef struct TQAEngine TQAEngine;
333  /* Pointer to an allocated texture */
334  typedef struct TQATexture TQATexture;
335  /* Pointer to an allocated bitmap */
336  typedef struct TQABitmap TQABitmap;
337  /* Engine's private draw context pointer */
338  typedef struct TQADrawPrivate TQADrawPrivate;
339  /* An engine specific color table structure */
340  typedef struct TQAColorTable TQAColorTable;
341  /* A single triangle element for QADrawTriMesh */
343  {
344  unsigned long triangleFlags; /* Triangle flags, see kQATriFlags_ */
345  unsigned long vertices[3]; /* Indices into a vertex array */
346  };
347  typedef struct TQAIndexedTriangle TQAIndexedTriangle;
348  /* An image for use as texture or bitmap */
349  struct TQAImage
350  {
351  long width; /* Width of pixmap */
352  long height; /* Height of pixmap */
353  long rowBytes; /* Rowbytes of pixmap */
354  void *pixmap; /* Pixmap */
355  };
356  typedef struct TQAImage TQAImage;
357  /* a pixel buffer */
358 
360  /* a zbuffer */
361  struct TQAZBuffer
362  {
363  long width; /* Width of pixmap */
364  long height; /* Height of pixmap */
365  long rowBytes; /* Rowbytes of pixmap */
366  void *zbuffer; /* pointer to the zbuffer data */
367  long zDepth; /* bit depth of zbuffer (16,24,32...) */
368  long isBigEndian; /* true if zbuffer values are in big-endian format, false if
369  little-endian */
370  };
371  typedef struct TQAZBuffer TQAZBuffer;
372  /* Standard error type */
373  enum TQAError
374  {
375  kQANoErr = 0, /* No error */
376  kQAError = 1, /* Generic error flag */
377  kQAOutOfMemory = 2, /* Insufficient memory */
378  kQANotSupported = 3, /* Requested feature is not supported */
379  kQAOutOfDate = 4, /* A newer drawing engine was registered */
380  kQAParamErr = 5, /* Error in passed parameters */
381  kQAGestaltUnknown = 6, /* Requested gestalt type isn't available */
382  kQADisplayModeUnsupported =
383  7, /* Engine cannot render to the display in its current , */
384  /* mode, but could if it were in some other mode */
385  kQAOutOfVideoMemory =
386  8 /* There is not enough VRAM to support the desired context dimensions */
387  };
388  typedef enum TQAError TQAError;
389 
390  /* TQABoolean */
391 
392  typedef unsigned char TQABoolean;
393  /************************************************************************************************
394  *
395  * Vertex data types.
396  *
397  ***********************************************************************************************/
425  struct TQAVGouraud
426  {
427  float x; /* X pixel coordinate, 0.0 <= x < width */
428  float y; /* Y pixel coordinate, 0.0 <= y < height */
429  float z; /* Z coordinate, 0.0 <= z <= 1.0 */
430  float invW; /* 1 / w; required only when kQAPerspectiveZ_On is set */
431 
432  float r; /* Red, 0.0 <= r <= 1.0 */
433  float g; /* Green, 0.0 <= g <= 1.0 */
434  float b; /* Blue, 0.0 <= b <= 1.0 */
435  float a; /* Alpha, 0.0 <= a <= 1.0, 1.0 is opaque */
436  };
437  typedef struct TQAVGouraud TQAVGouraud;
472  struct TQAVTexture
473  {
474  float x; /* X pixel coordinate, 0.0 <= x < width */
475  float y; /* Y pixel coordinate, 0.0 <= y < height */
476  float z; /* Z coordinate, 0.0 <= z <= 1.0 */
477  float invW; /* 1 / w (always required) */
478 
479  /* rgb are used only when kQATextureOp_Decal is set. a is always required */
480 
481  float r; /* Red, 0.0 <= r <= 1.0 */
482  float g; /* Green, 0.0 <= g <= 1.0 */
483  float b; /* Blue, 0.0 <= b <= 1.0 */
484  float a; /* Alpha, 0.0 <= a <= 1.0, 1.0 is opaque */
485 
486  /* uOverW and vOverW are required by all modes */
487 
488  float uOverW; /* u / w */
489  float vOverW; /* v / w */
490 
491  /* kd_r/g/b are used only when kQATextureOp_Modulate is set */
492 
493  float kd_r; /* Scale factor for texture red, 0.0 <= kd_r */
494  float kd_g; /* Scale factor for texture green, 0.0 <= kd_g */
495  float kd_b; /* Scale factor for texture blue, 0.0 <= kd_b */
496 
497  /* ks_r/g/b are used only when kQATextureOp_Highlight is set */
498 
499  float ks_r; /* Red specular highlight, 0.0 <= ks_r <= 1.0 */
500  float ks_g; /* Green specular highlight, 0.0 <= ks_g <= 1.0 */
501  float ks_b; /* Blue specular highlight, 0.0 <= ks_b <= 1.0 */
502  };
503  typedef struct TQAVTexture TQAVTexture;
510  {
511  float invW;
512  float uOverW;
513  float vOverW;
514  };
515  typedef struct TQAVMultiTexture TQAVMultiTexture;
516 
517  /************************************************************************************************
518  *
519  * Constants used for the state variables.
520  *
521  ***********************************************************************************************/
638  {
639  kQATag_ZFunction = 0,
640  kQATag_Antialias = 8,
641  kQATag_Blend = 9,
642  kQATag_PerspectiveZ = 10,
643  kQATag_TextureFilter = 11,
644  kQATag_TextureOp = 12,
645  kQATag_CSGTag = 14,
646  kQATag_CSGEquation = 15,
647  kQATag_BufferComposite = 16,
648  kQATag_FogMode = 17,
649  kQATag_ChannelMask = 27,
650  kQATag_ZBufferMask = 28,
651  kQATag_ZSortedHint = 29,
652  kQATag_ChromakeyEnable = 30,
653  kQATag_AlphaTestFunc = 31,
654  kQATag_DontSwap = 32,
655  kQATag_MultiTextureEnable = 33,
656  kQATag_MultiTextureCurrent = 34,
657  kQATag_MultiTextureOp = 35,
658  kQATag_MultiTextureFilter = 36,
659  kQATag_MultiTextureWrapU = 37,
660  kQATag_MultiTextureWrapV = 38,
661  kQATag_MultiTextureMagFilter = 39,
662  kQATag_MultiTextureMinFilter = 40,
663  kQATag_BitmapFilter =
664  54, /* filter to use while scaling bitmaps, one of kQAFilter_xxx */
665  kQATag_DrawContextFilter =
666  55, /* filter to use while scaling draw contexts, one of kQAFilter_xxx */
667  kQATagGL_DrawBuffer = 100,
668  kQATagGL_TextureWrapU = 101,
669  kQATagGL_TextureWrapV = 102,
670  kQATagGL_TextureMagFilter = 103,
671  kQATagGL_TextureMinFilter = 104,
672  kQATagGL_ScissorXMin = 105,
673  kQATagGL_ScissorYMin = 106,
674  kQATagGL_ScissorXMax = 107,
675  kQATagGL_ScissorYMax = 108,
676  kQATagGL_BlendSrc = 109,
677  kQATagGL_BlendDst = 110,
678  kQATagGL_LinePattern = 111,
679  kQATagGL_AreaPattern0 = 117, /* ...kQATagGL_AreaPattern1-30 */
680  kQATagGL_AreaPattern31 = 148,
681  kQATagGL_LinePatternFactor = 149, /* equivalent to GL_LINE_STIPPLE_REPEAT */
682  kQATag_EngineSpecific_Minimum = 1000
683  };
684  typedef enum TQATagInt TQATagInt;
685 
686  enum TQATagPtr
687  {
688  kQATag_Texture = 13,
689  kQATag_MultiTexture = 26
690  };
691  typedef enum TQATagPtr TQATagPtr;
692 
693  enum TQATagFloat
694  {
695  kQATag_ColorBG_a = 1,
696  kQATag_ColorBG_r = 2,
697  kQATag_ColorBG_g = 3,
698  kQATag_ColorBG_b = 4,
699  kQATag_Width = 5,
700  kQATag_ZMinOffset = 6,
701  kQATag_ZMinScale = 7,
702  kQATag_FogColor_a = 18,
703  kQATag_FogColor_r = 19,
704  kQATag_FogColor_g = 20,
705  kQATag_FogColor_b = 21,
706  kQATag_FogStart = 22,
707  kQATag_FogEnd = 23,
708  kQATag_FogDensity = 24,
709  kQATag_FogMaxDepth = 25,
710  kQATag_MipmapBias = 41,
711  kQATag_MultiTextureMipmapBias = 42,
712  kQATag_Chromakey_r = 43,
713  kQATag_Chromakey_g = 44,
714  kQATag_Chromakey_b = 45,
715  kQATag_AlphaTestRef = 46,
716  kQATag_MultiTextureBorder_a = 47,
717  kQATag_MultiTextureBorder_r = 48,
718  kQATag_MultiTextureBorder_g = 49,
719  kQATag_MultiTextureBorder_b = 50,
720  kQATag_MultiTextureFactor = 51,
721  kQATag_BitmapScale_x =
722  52, /* horizontal bitmap scale factor, default value is 1.0 */
723  kQATag_BitmapScale_y =
724  53, /* vertical bitmap scale factor, default value is 1.0 */
725  kQATag_MultiTextureEnvColor_a = 56,
726  kQATag_MultiTextureEnvColor_r = 57,
727  kQATag_MultiTextureEnvColor_g = 58,
728  kQATag_MultiTextureEnvColor_b = 59,
729  kQATagGL_DepthBG = 112,
730  kQATagGL_TextureBorder_a = 113,
731  kQATagGL_TextureBorder_r = 114,
732  kQATagGL_TextureBorder_g = 115,
733  kQATagGL_TextureBorder_b = 116,
734  kQATagGL_TextureEnvColor_a = 150,
735  kQATagGL_TextureEnvColor_r = 151,
736  kQATagGL_TextureEnvColor_g = 152,
737  kQATagGL_TextureEnvColor_b = 153
738  };
739  typedef enum TQATagFloat TQATagFloat;
740 
741  /* kQATag_ZFunction */
742  enum
743  {
744  kQAZFunction_None =
745  0, /* Z is neither tested nor written (same as no Z buffer) */
746  kQAZFunction_LT = 1, /* Znew < Zbuffer is visible */
747  kQAZFunction_EQ = 2, /* Znew == Zbuffer is visible */
748  kQAZFunction_LE = 3, /* Znew <= Zbuffer is visible */
749  kQAZFunction_GT = 4, /* Znew > Zbuffer is visible */
750  kQAZFunction_NE = 5, /* Znew != Zbuffer is visible */
751  kQAZFunction_GE = 6, /* Znew >= Zbuffer is visible */
752  kQAZFunction_True = 7, /* Znew is always visible */
753  kQAZFunction_False = 8 /* Znew is never visible */
754  };
755 
756 /* kQATag_Width */
757 #define kQAMaxWidth 128.0
758  /* kQATag_Antialias */
759  enum
760  {
761  kQAAntiAlias_Off = 0,
762  kQAAntiAlias_Fast = 1,
763  kQAAntiAlias_Mid = 2,
764  kQAAntiAlias_Best = 3
765  };
766 
767  /* kQATag_Blend */
768  enum
769  {
770  kQABlend_PreMultiply = 0,
771  kQABlend_Interpolate = 1,
772  kQABlend_OpenGL = 2
773  };
774 
775  /* kQATag_BufferComposite */
776  enum
777  {
778  kQABufferComposite_None =
779  0, /* Default: New pixels overwrite initial buffer contents */
780  kQABufferComposite_PreMultiply = 1, /* New pixels are blended with initial
781  buffer contents via PreMultiply */
782  kQABufferComposite_Interpolate = 2 /* New pixels are blended with initial
783  buffer contents via Interpolate */
784  };
785 
786  /* kQATag_PerspectiveZ */
787  enum
788  {
789  kQAPerspectiveZ_Off = 0, /* Use Z for hidden surface removal */
790  kQAPerspectiveZ_On = 1 /* Use InvW for hidden surface removal */
791  };
792 
793  /* kQATag_TextureFilter */
794  enum
795  {
796  /* suggested meanings of these values */
797  kQATextureFilter_Fast = 0, /* No filtering, pick nearest */
798  kQATextureFilter_Mid = 1, /* Fastest method that does some filtering */
799  kQATextureFilter_Best = 2 /* Highest quality renderer can do */
800  };
801 
802  /* filter tag values */
803  enum
804  {
805  /* suggested meanings of these values */
806  kQAFilter_Fast = 0, /* No filtering, pick nearest */
807  kQAFilter_Mid = 1, /* Fastest method that does some filtering */
808  kQAFilter_Best = 2 /* Highest quality renderer can do */
809  };
810 
811  /* kQATag_TextureOp (mask of one or more) */
812  enum
813  {
814  kQATextureOp_None = 0, /* Default texture mapping mode */
815  kQATextureOp_Modulate = (1 << 0), /* Modulate texture color with kd_r/g/b */
816  kQATextureOp_Highlight = (1 << 1), /* Add highlight value ks_r/g/b */
817  kQATextureOp_Decal = (1 << 2), /* When texture alpha == 0, use rgb instead */
818  kQATextureOp_Shrink =
819  (1 << 3), /* This is a non-wrapping texture, so the ??? */
820  kQATextureOp_Blend = (1 << 4) /* Same as GL_TEXTURE_ENV_MODE GL_BLEND */
821  };
822 
823  /* kQATag_MultiTextureOp */
824  enum
825  {
826  kQAMultiTexture_Add = 0, /* texels are added to form final pixel */
827  kQAMultiTexture_Modulate = 1, /* texels are multiplied to form final pixel */
828  kQAMultiTexture_BlendAlpha =
829  2, /* texels are blended according to 2nd texel's alpha */
830  kQAMultiTexture_Fixed =
831  3 /* texels are blended by a fixed factor via kQATag_MultiTextureFactor */
832  };
833 
834 /* kQATag_CSGTag */
835 #define kQACSGTag_None 0xffffffffUL
836  enum
837  {
838  kQACSGTag_0 = 0, /* Submitted tris have CSG ID 0 */
839  kQACSGTag_1 = 1, /* Submitted tris have CSG ID 1 */
840  kQACSGTag_2 = 2, /* Submitted tris have CSG ID 2 */
841  kQACSGTag_3 = 3, /* Submitted tris have CSG ID 3 */
842  kQACSGTag_4 = 4 /* Submitted tris have CSG ID 4 */
843  };
844 
845  /* kQATagGL_TextureWrapU/V */
846  enum
847  {
848  kQAGL_Repeat = 0,
849  kQAGL_Clamp = 1
850  };
851 
852  /* kQATagGL_BlendSrc */
853  enum
854  {
855  kQAGL_SourceBlend_XXX = 0
856  };
857 
858  /* kQATagGL_BlendDst */
859  enum
860  {
861  kQAGL_DestBlend_XXX = 0
862  };
863 
864  /* kQATagGL_DrawBuffer (mask of one or more) */
865  enum
866  {
867  kQAGL_DrawBuffer_None = 0,
868  kQAGL_DrawBuffer_FrontLeft = (1 << 0),
869  kQAGL_DrawBuffer_FrontRight = (1 << 1),
870  kQAGL_DrawBuffer_BackLeft = (1 << 2),
871  kQAGL_DrawBuffer_BackRight = (1 << 3),
872  kQAGL_DrawBuffer_Front =
873  (kQAGL_DrawBuffer_FrontLeft | kQAGL_DrawBuffer_FrontRight),
874  kQAGL_DrawBuffer_Back =
875  (kQAGL_DrawBuffer_BackLeft | kQAGL_DrawBuffer_BackRight)
876  };
877 
878  /* kQATag_FogMode */
879  enum
880  {
881  kQAFogMode_None = 0, /* no fog */
882  kQAFogMode_Alpha = 1, /* fog value is alpha */
883  kQAFogMode_Linear = 2, /* fog = (end - z) / (end - start) */
884  kQAFogMode_Exponential = 3, /* fog = exp(-density * z) */
885  kQAFogMode_ExponentialSquared = 4 /* fog = exp(-density * z * density * z) */
886  };
887 
888  /* kQATag_ChannelMask */
889  enum
890  {
891  kQAChannelMask_r = (1 << 0),
892  kQAChannelMask_g = (1 << 1),
893  kQAChannelMask_b = (1 << 2),
894  kQAChannelMask_a = (1 << 3)
895  };
896 
897  /* kQATag_ZBufferMask */
898  enum
899  {
900  kQAZBufferMask_Disable = 0,
901  kQAZBufferMask_Enable = 1
902  };
903 
904  /* kQATag_AlphaTestFunc */
905  enum
906  {
907  kQAAlphaTest_None = 0,
908  kQAAlphaTest_LT = 1,
909  kQAAlphaTest_EQ = 2,
910  kQAAlphaTest_LE = 3,
911  kQAAlphaTest_GT = 4,
912  kQAAlphaTest_NE = 5,
913  kQAAlphaTest_GE = 6,
914  kQAAlphaTest_True = 7
915  };
916 
917  /* flags for QAAccess__xxx */
918  enum
919  {
920  kQANoCopyNeeded = (1 << 0)
921  };
922 
923  /************************************************************************************************
924  *
925  * Constants used as function parameters.
926  *
927  ***********************************************************************************************/
933  {
934  kQAVertexMode_Point = 0, /* Draw nVertices points */
935  kQAVertexMode_Line = 1, /* Draw nVertices/2 line segments */
936  kQAVertexMode_Polyline = 2, /* Draw nVertices-1 connected line segments */
937  kQAVertexMode_Tri = 3, /* Draw nVertices/3 triangles */
938  kQAVertexMode_Strip = 4, /* Draw nVertices-2 triangles as a strip */
939  kQAVertexMode_Fan = 5, /* Draw nVertices-2 triangles as a fan from v0 */
940  kQAVertexMode_NumModes = 6
941  };
942  typedef enum TQAVertexMode TQAVertexMode;
943 
949  {
950  kQAGestalt_OptionalFeatures = 0, /* Mask of one or more kQAOptional_xxx */
951  kQAGestalt_FastFeatures = 1, /* Mask of one or more kQAFast_xxx */
952  kQAGestalt_VendorID = 2, /* Vendor ID */
953  kQAGestalt_EngineID = 3, /* Engine ID */
954  kQAGestalt_Revision = 4, /* Revision number of this engine */
955  kQAGestalt_ASCIINameLength = 5, /* strlen (asciiName) */
956  kQAGestalt_ASCIIName = 6, /* Causes strcpy (response, asciiName) */
957  kQAGestalt_TextureMemory = 7, /* amount of texture RAM currently available */
958  kQAGestalt_FastTextureMemory =
959  8, /* amount of texture RAM currently available */
960  kQAGestalt_DrawContextPixelTypesAllowed =
961  9, /* returns all the draw context pixel types supported by the RAVE
962  engine */
963  kQAGestalt_DrawContextPixelTypesPreferred =
964  10, /* returns all the draw context pixel types that are preferred by the
965  RAVE engine. */
966  kQAGestalt_TexturePixelTypesAllowed =
967  11, /* returns all the texture pixel types that are supported by the RAVE
968  engine */
969  kQAGestalt_TexturePixelTypesPreferred =
970  12, /* returns all the texture pixel types that are preferred by the RAVE
971  engine.*/
972  kQAGestalt_BitmapPixelTypesAllowed =
973  13, /* returns all the bitmap pixel types that are supported by the RAVE
974  engine. */
975  kQAGestalt_BitmapPixelTypesPreferred =
976  14, /* returns all the bitmap pixel types that are preferred by the RAVE
977  engine. */
978  kQAGestalt_OptionalFeatures2 = 15, /* Mask of one or more kQAOptional2_xxx */
979  kQAGestalt_MultiTextureMax =
980  16, /* max number of multi textures supported by this engine */
981  kQAGestalt_NumSelectors = 17,
982  kQAGestalt_EngineSpecific_Minimum =
983  1000 /* all gestalts here and above are for engine specific purposes */
984  };
986 
991 #if RAVE_OBSOLETE
992  enum TQAMethodSelector
993  {
994  kQAMethod_RenderCompletion =
995  0, /* Called when rendering has completed and buffers swapped */
996  kQAMethod_DisplayModeChanged = 1, /* Called when a display mode has changed */
997  kQAMethod_ReloadTextures =
998  2, /* Called when texture memory has been invalidated */
999  kQAMethod_BufferInitialize =
1000  3, /* Called when a buffer needs to be initialized */
1001  kQAMethod_BufferComposite =
1002  4, /* Called when rendering is finished and its safe to composite */
1003  kQAMethod_NumSelectors = 5
1004  };
1005  typedef enum TQAMethodSelector TQAMethodSelector;
1006 
1007 #else
1009 {
1010  kQAMethod_RenderCompletion =
1011  0, /* Called when rendering has completed and buffers swapped */
1012  kQAMethod_DisplayModeChanged = 1, /* Called when a display mode has changed */
1013  kQAMethod_ReloadTextures =
1014  2, /* Called when texture memory has been invalidated */
1015  kQAMethod_ImageBufferInitialize =
1016  3, /* Called when a buffer needs to be initialized */
1017  kQAMethod_ImageBuffer2DComposite =
1018  4, /* Called when rendering is finished and its safe to composite */
1019  kQAMethod_NumSelectors = 5
1020 };
1022 
1023 #endif /* RAVE_OBSOLETE */
1024 
1029  enum
1030  {
1031  kQATriFlags_None = 0, /* No flags (triangle is front-facing or don't care) */
1032  kQATriFlags_Backfacing = (1 << 0) /* Triangle is back-facing */
1033  };
1034 
1039  enum
1040  {
1041  kQATexture_None = 0, /* No flags */
1042  kQATexture_Lock = (1 << 0), /* Don't swap this texture out */
1043  kQATexture_Mipmap = (1 << 1), /* This texture is mipmapped */
1044  kQATexture_NoCompression = (1 << 2), /* Do not compress this texture */
1045  kQATexture_HighCompression =
1046  (1 << 3), /* Compress texture, even if it takes a while */
1047  kQATexture_NonRelocatable =
1048  (1 << 4), /* Image buffer in VRAM should be non-relocatable */
1049  kQATexture_NoCopy = (1 << 5), /* Don't copy image to VRAM when creating it */
1050  kQATexture_FlipOrigin =
1051  (1 << 6), /* The image(s) is(are) in a bottom-up format. (The image(s)
1052  is(are) flipped vertically.) */
1053  kQATexture_PriorityBits =
1054  (1 << 31) | (1 << 30) | (1 << 29) |
1055  (1 << 28) /* Texture priority: 4 upper bits for 16 levels of priority */
1056  };
1057 
1062  enum
1063  {
1064  kQABitmap_None = 0, /* No flags */
1065  kQABitmap_Lock = (1 << 1), /* Don't swap this bitmap out */
1066  kQABitmap_NoCompression = (1 << 2), /* Do not compress this bitmap */
1067  kQABitmap_HighCompression =
1068  (1 << 3), /* Compress bitmap, even if it takes a while */
1069  kQABitmap_NonRelocatable =
1070  (1 << 4), /* Image buffer in VRAM should be non-relocatable */
1071  kQABitmap_NoCopy = (1 << 5), /* Don't copy image to VRAM when creating it */
1072  kQABitmap_FlipOrigin = (1 << 6), /* The image is in a bottom-up format. (The
1073  image is flipped vertically.) */
1074  kQABitmap_PriorityBits =
1075  (1 << 31) | (1 << 30) | (1 << 29) |
1076  (1 << 28) /* Bitmap priority: 4 upper bits for 16 levels of priority */
1077  };
1078 
1083  enum
1084  {
1085  kQAContext_None = 0, /* No flags */
1086  kQAContext_NoZBuffer = (1 << 0), /* No hidden surface removal */
1087  kQAContext_DeepZ = (1 << 1), /* Hidden surface precision >= 24 bits */
1088  kQAContext_DoubleBuffer = (1 << 2), /* Double buffered window */
1089  kQAContext_Cache = (1 << 3), /* This is a cache context */
1090  kQAContext_NoDither = (1 << 4), /* No dithering, straight color banding */
1091  kQAContext_Scale =
1092  (1 << 5), /* The draw context is to be scaled. The front buffer is a
1093  different size than the back buffer. */
1094  kQAContext_NonRelocatable =
1095  (1 << 6), /* The back buffer and the z buffer must not move in memory */
1096  kQAContext_EngineSpecific1 = (1 << 28), /* engine specific flag # 1 */
1097  kQAContext_EngineSpecific2 = (1 << 29), /* engine specific flag # 2 */
1098  kQAContext_EngineSpecific3 = (1 << 30), /* engine specific flag # 3 */
1099  kQAContext_EngineSpecific4 = (1 << 31) /* engine specific flag # 4 */
1100  };
1101 
1106  enum
1107  {
1108  kQAOptional_None = 0, /* No optional features */
1109  kQAOptional_DeepZ = (1 << 0), /* Hidden surface precision >= 24 bits */
1110  kQAOptional_Texture = (1 << 1), /* Texture mapping */
1111  kQAOptional_TextureHQ =
1112  (1 << 2), /* High quality texture (tri-linear mip or better) */
1113  kQAOptional_TextureColor =
1114  (1 << 3), /* Full color modulation and highlight of textures */
1115  kQAOptional_Blend = (1 << 4), /* Transparency blending of RGB */
1116  kQAOptional_BlendAlpha =
1117  (1 << 5), /* Transparency blending includes alpha channel */
1118  kQAOptional_Antialias = (1 << 6), /* Antialiased rendering */
1119  kQAOptional_ZSorted =
1120  (1 << 7), /* Z sorted rendering (for transparency, etc.) */
1121  kQAOptional_PerspectiveZ =
1122  (1 << 8), /* Hidden surface removal using InvW instead of Z */
1123  kQAOptional_OpenGL =
1124  (1 << 9), /* Extended rasterization features for OpenGL� */
1125  kQAOptional_NoClear =
1126  (1 << 10), /* This drawing engine doesn't clear before drawing */
1127  kQAOptional_CSG = (1 << 11), /* kQATag_CSGxxx are implemented */
1128  kQAOptional_BoundToDevice =
1129  (1 << 12), /* This engine is tightly bound to GDevice */
1130  kQAOptional_CL4 = (1 << 13), /* This engine suports kQAPixel_CL4 */
1131  kQAOptional_CL8 = (1 << 14), /* This engine suports kQAPixel_CL8 */
1132  kQAOptional_BufferComposite =
1133  (1 << 15), /* This engine can composite with initial buffer contents */
1134  kQAOptional_NoDither = (1 << 16), /* This engine can draw with no dithering */
1135  kQAOptional_FogAlpha = (1 << 17), /* This engine suports alpha based fog */
1136  kQAOptional_FogDepth = (1 << 18), /* This engine suports depth based fog */
1137  kQAOptional_MultiTextures =
1138  (1 << 19), /* This bit set if engine supports texture compositing */
1139  kQAOptional_MipmapBias = (1 << 20), /* This bit is set if the engine supports
1140  mipmap selection bias */
1141  kQAOptional_ChannelMask = (1 << 21),
1142  kQAOptional_ZBufferMask = (1 << 22),
1143  kQAOptional_AlphaTest = (1 << 23), /* this engine supports alpha testing */
1144  kQAOptional_AccessTexture =
1145  (1 << 24), /* if engine supports access to texture */
1146  kQAOptional_AccessBitmap =
1147  (1 << 25), /* if engine supports access to bitmaps */
1148  kQAOptional_AccessDrawBuffer =
1149  (1 << 26), /* if engine supports access to draw buffer */
1150  kQAOptional_AccessZBuffer =
1151  (1 << 27), /* if engine supports access to zbuffer */
1152  kQAOptional_ClearDrawBuffer =
1153  (1 << 28), /* if engine supports QAClearDrawBuffer() */
1154  kQAOptional_ClearZBuffer =
1155  (1 << 29), /* if engine supports QAClearZBuffer() */
1156  kQAOptional_OffscreenDrawContexts =
1157  (1 << 30) /* if engine supports TQADeviceOffscreen */
1158  };
1159 
1164  enum
1165  {
1166  kQAOptional2_None = 0,
1167  kQAOptional2_TextureDrawContexts =
1168  (1 << 1), /* if engine supports QATextureNewFromDrawContext() */
1169  kQAOptional2_BitmapDrawContexts =
1170  (1 << 2), /* if engine supports QABitmapNewFromDrawContext() */
1171  kQAOptional2_Busy = (1 << 3), /* if engine supports QABusy() */
1172  kQAOptional2_SwapBuffers = (1 << 4), /* if engine supports QASwapBuffers() */
1173  kQAOptional2_Chromakey =
1174  (1 << 5), /* if engine supports chromakeying via kQATag_Chromakey_xxx */
1175  kQAOptional2_NonRelocatable =
1176  (1 << 6), /* if engine supports nonrelocatable texture & bitmap image
1177  buffers in VRAM */
1178  kQAOptional2_NoCopy = (1 << 7), /* if engine supports ability to not copy
1179  texture & bitmap image to VRAM */
1180  kQAOptional2_PriorityBits =
1181  (1 << 8), /* if engine supports texture & bitmap priority levels */
1182  kQAOptional2_FlipOrigin = (1 << 9), /* if engine supports textures & bitmaps
1183  that are vertically flipped */
1184  kQAOptional2_BitmapScale =
1185  (1 << 10), /* if engine supports scaled bitmap drawing */
1186  kQAOptional2_DrawContextScale =
1187  (1 << 11), /* if engine supports scaled draw contexts */
1188  kQAOptional2_DrawContextNonRelocatable =
1189  (1 << 12) /* if engine supports draw contexts with non relocatable buffers
1190  */
1191  };
1192 
1197  enum
1198  {
1199  kQAFast_None = 0, /* No accelerated features */
1200  kQAFast_Line = (1 << 0), /* Line drawing */
1201  kQAFast_Gouraud = (1 << 1), /* Gouraud shaded triangles */
1202  kQAFast_Texture = (1 << 2), /* Texture mapped triangles */
1203  kQAFast_TextureHQ =
1204  (1 << 3), /* High quality texture (tri-linear mip or better) */
1205  kQAFast_Blend = (1 << 4), /* Transparency blending */
1206  kQAFast_Antialiasing = (1 << 5), /* Antialiased rendering */
1207  kQAFast_ZSorted = (1 << 6), /* Z sorted rendering of non-opaque objects */
1208  kQAFast_CL4 = (1 << 7), /* This engine accelerates kQAPixel_CL4 */
1209  kQAFast_CL8 = (1 << 8), /* This engine accelerates kQAPixel_CL8 */
1210  kQAFast_FogAlpha = (1 << 9), /* This engine accelerates alpha based fog */
1211  kQAFast_FogDepth = (1 << 10), /* This engine accelerates depth based fog */
1212  kQAFast_MultiTextures =
1213  (1 << 11), /* This engine accelerates texture compositing */
1214  kQAFast_BitmapScale =
1215  (1 << 12), /* This engine accelerates scaled bitmap drawing */
1216  kQAFast_DrawContextScale =
1217  (1 << 13) /* This engine accelerates scaled draw contexts */
1218  };
1219 
1220  /************************************************************************************************
1221  *
1222  * Macro definition for easily setting the texture priority bits in the flags
1223  *field of QATextureNew(), and QABitMapNew().
1224  *
1225  * The priority value must be a number between 0 and 15. 0 is top priority, and
1226  *15 is lowest priority. Note that this is different than OpenGL which uses
1227  *floats from 0.0 to 1.0 where 1.0 is top priority. In RAVE, this system is more
1228  *like texture ranking, thus 0 is top rank, and 15 is the last ranking.
1229  *
1230  * Texture prioritization is mainly used for systems which support AGP memory.
1231  *This allows the hardware driver to determine which textures to put into faster
1232  *VRAM and which to put into slower AGP RAM. If you dont care about texture
1233  *priority, then you dont need to worry about this macro or the priority bits
1234  *since the default will always be top priority when all 4 bits of this flag
1235  *field are 0's.
1236  *
1237  * To upload a texture with high priority, do the following:
1238  *
1239  * unsigned long flags = kQATexture_Mipmap; // Initialize
1240  *flags
1241  *
1242  * flags |= QACalculatePriorityBits(0); // Setting top
1243  *priority (this actually does
1244  * // nothing since the
1245  *bits are still 0000) QATextureNew(myEngine, flags, pixelType, image,
1246  *&raveTexture);
1247  *
1248  *
1249  * To do a texture with a middle priority of 8, do the following:
1250  *
1251  * unsigned long flags = kQATexture_HighCompression; // Initialize
1252  *flags
1253  *
1254  * flags |= QACalculatePriorityBits(8); // Setting middle
1255  *priority
1256  *
1257  * QATextureNew(myEngine, flags, pixelType, image, &raveTexture);
1258  *
1259  ***********************************************************************************************/
1260 
1261 #define QACalculatePriorityBits(_priority) (((unsigned long)(_priority)) << 28)
1262 
1263  /************************************************************************************************
1264  *
1265  * Macro definitions for the drawing engine methods included in TQADrawContext.
1266  *These macros are the recommended means of accessing the engine's draw methods,
1267  *e.g:
1268  *
1269  * TQADrawContext *drawContext;
1270  * TQAVTexture vertices[3];
1271  *
1272  * drawContext = QADrawContextNew (rect, gdevice, engine,
1273  *kQAContext_ZBuffer);
1274  * ...
1275  * QASetInt (drawContext, kQATag_ZFunction, kQAZFunction_LT);
1276  * QADrawTriGouraud (drawContext, &vertices[0], &vertices[1],
1277  *&vertices[2], kQATriFlags_None);
1278  *
1279  * Note that QARenderStart(), QARenderEnd(), QAFlush() and QASync() have real
1280  *function definitions instead of macros. This is because these functions can
1281  *afford the extra per-call overhead of a function layer (which makes
1282  *application code a little smaller), and to allow a cleaner implementation of
1283  *handling NULL parameters to QARenderStart().
1284  *
1285  ***********************************************************************************************/
1286 
1287 #define QASetFloat(drawContext, tag, newValue) \
1288  (drawContext)->setFloat(drawContext, tag, newValue)
1289 
1290 #define QASetInt(drawContext, tag, newValue) \
1291  (drawContext)->setInt(drawContext, tag, newValue)
1292 
1293 #define QASetPtr(drawContext, tag, newValue) \
1294  (drawContext)->setPtr(drawContext, tag, newValue)
1295 
1296 #define QAGetFloat(drawContext, tag) (drawContext)->getFloat(drawContext, tag)
1297 
1298 #define QAGetInt(drawContext, tag) (drawContext)->getInt(drawContext, tag)
1299 
1300 #define QAGetPtr(drawContext, tag) (drawContext)->getPtr(drawContext, tag)
1301 
1302 #define QADrawPoint(drawContext, v) (drawContext)->drawPoint(drawContext, v)
1303 
1304 #define QADrawLine(drawContext, v0, v1) \
1305  (drawContext)->drawLine(drawContext, v0, v1)
1306 
1307 #define QADrawTriGouraud(drawContext, v0, v1, v2, flags) \
1308  (drawContext)->drawTriGouraud(drawContext, v0, v1, v2, flags)
1309 
1310 #define QADrawTriTexture(drawContext, v0, v1, v2, flags) \
1311  (drawContext)->drawTriTexture(drawContext, v0, v1, v2, flags)
1312 
1313 #define QASubmitVerticesGouraud(drawContext, nVertices, vertices) \
1314  (drawContext)->submitVerticesGouraud(drawContext, nVertices, vertices)
1315 
1316 #define QASubmitVerticesTexture(drawContext, nVertices, vertices) \
1317  (drawContext)->submitVerticesTexture(drawContext, nVertices, vertices)
1318 
1319 #define QASubmitMultiTextureParams(drawContext, nParams, params) \
1320  (drawContext)->submitMultiTextureParams(drawContext, nParams, params)
1321 
1322 #define QADrawTriMeshGouraud(drawContext, nTriangle, triangles) \
1323  (drawContext)->drawTriMeshGouraud(drawContext, nTriangle, triangles)
1324 
1325 #define QADrawTriMeshTexture(drawContext, nTriangle, triangles) \
1326  (drawContext)->drawTriMeshTexture(drawContext, nTriangle, triangles)
1327 
1328 #define QADrawVGouraud(drawContext, nVertices, vertexMode, vertices, flags) \
1329  (drawContext) \
1330  ->drawVGouraud(drawContext, nVertices, vertexMode, vertices, flags)
1331 
1332 #define QADrawVTexture(drawContext, nVertices, vertexMode, vertices, flags) \
1333  (drawContext) \
1334  ->drawVTexture(drawContext, nVertices, vertexMode, vertices, flags)
1335 
1336 #define QADrawBitmap(drawContext, v, bitmap) \
1337  (drawContext)->drawBitmap(drawContext, v, bitmap)
1338 
1339 #define QARenderStart(drawContext, dirtyRect, initialContext) \
1340  (drawContext)->renderStart(drawContext, dirtyRect, initialContext)
1341 
1342 #define QARenderEnd(drawContext, modifiedRect) \
1343  (drawContext)->renderEnd(drawContext, modifiedRect)
1344 
1345 #define QARenderAbort(drawContext) (drawContext)->renderAbort(drawContext)
1346 
1347 #define QAFlush(drawContext) (drawContext)->flush(drawContext)
1348 
1349 #define QASync(drawContext) (drawContext)->sync(drawContext)
1350 
1351 #define QASetNoticeMethod(drawContext, method, completionCallBack, refCon) \
1352  (drawContext) \
1353  ->setNoticeMethod(drawContext, method, completionCallBack, refCon)
1354 
1355 #define QAGetNoticeMethod(drawContext, method, completionCallBack, refCon) \
1356  (drawContext) \
1357  ->getNoticeMethod(drawContext, method, completionCallBack, refCon)
1358 
1359 #define QAAccessDrawBuffer(drawContext, pixelBuffer) \
1360  (drawContext)->accessDrawBuffer(drawContext, pixelBuffer)
1361 
1362 #define QAAccessDrawBufferEnd(drawContext, dirtyRect) \
1363  (drawContext)->accessDrawBufferEnd(drawContext, dirtyRect)
1364 
1365 #define QAAccessZBuffer(drawContext, zBuffer) \
1366  (drawContext)->accessZBuffer(drawContext, zBuffer)
1367 
1368 #define QAAccessZBufferEnd(drawContext, dirtyRect) \
1369  (drawContext)->accessZBufferEnd(drawContext, dirtyRect)
1370 
1371 #define QAClearDrawBuffer(drawContext, rect, initialContext) \
1372  (drawContext)->clearDrawBuffer(drawContext, rect, initialContext)
1373 
1374 #define QAClearZBuffer(drawContext, rect, initialContext) \
1375  (drawContext)->clearZBuffer(drawContext, rect, initialContext)
1376 
1377 #define QATextureNewFromDrawContext(drawContext, flags, newTexture) \
1378  (drawContext)->textureFromContext(drawContext, flags, newTexture)
1379 
1380 #define QABitmapNewFromDrawContext(drawContext, flags, newBitmap) \
1381  (drawContext)->bitmapFromContext(drawContext, flags, newBitmap)
1382 
1383 #define QABusy(drawContext) (drawContext)->busy(drawContext)
1384 
1385 #define QASwapBuffers(drawContext, dirtyRect) \
1386  (drawContext)->swapBuffers(drawContext, dirtyRect)
1387 
1388  /********************************************************************
1389  * TQAVersion sets the TQADrawContext 'version' field. It is set by
1390  * the manager to indicate the version of the TQADrawContext structure.
1391  *******************************************************************/
1392  enum TQAVersion
1393  {
1394  kQAVersion_Prerelease = 0,
1395  kQAVersion_1_0 = 1,
1396  kQAVersion_1_0_5 = 2, /* Added tri mesh functions, color tables */
1397  kQAVersion_1_5 =
1398  3, /* Added call backs, texture compression, and new error return code */
1399  kQAVersion_1_6 = 4 /* Added QAAccess_xxx, fog, _Options2, Clear_xxx, etc. */
1400  };
1401  typedef enum TQAVersion TQAVersion;
1402 
1403  /***********************************************************************
1404  * TQADrawContext structure holds method pointers.
1405  * This is a forward refrence. The structure is defined later.
1406  **********************************************************************/
1407  typedef struct TQADrawContext TQADrawContext;
1408  /************************************************************************************************
1409  *
1410  * Typedefs of draw method functions provided by the drawing engine. One
1411  *function pointer for each of these function types in stored in the
1412  *TQADrawContext public data structure.
1413  *
1414  * These functions should be accessed through the QA<function>(context,...)
1415  *macros, defined above.
1416  *
1417  ***********************************************************************************************/
1418  typedef CALLBACK_API_C(void, TQAStandardNoticeMethod)(
1419  const TQADrawContext *drawContext, void *refCon);
1420  typedef CALLBACK_API_C(void,
1421  TQABufferNoticeMethod)(const TQADrawContext *drawContext,
1422  const TQADevice *buffer,
1423  const TQARect *dirtyRect,
1424  void *refCon);
1426  {
1427  TQAStandardNoticeMethod
1428  standardNoticeMethod; /* Used for non-buffer related methods */
1429  TQABufferNoticeMethod
1430  bufferNoticeMethod; /* Used for buffer handling methods */
1431  };
1432  typedef union TQANoticeMethod TQANoticeMethod;
1433  typedef CALLBACK_API_C(void, TQASetFloat)(TQADrawContext *drawContext,
1434  TQATagFloat tag, float newValue);
1435  typedef CALLBACK_API_C(void, TQASetInt)(TQADrawContext *drawContext,
1436  TQATagInt tag, unsigned long newValue);
1437  typedef CALLBACK_API_C(void, TQASetPtr)(TQADrawContext *drawContext,
1438  TQATagPtr tag, const void *newValue);
1439  typedef CALLBACK_API_C(float, TQAGetFloat)(const TQADrawContext *drawContext,
1440  TQATagFloat tag);
1441  typedef CALLBACK_API_C(unsigned long,
1442  TQAGetInt)(const TQADrawContext *drawContext,
1443  TQATagInt tag);
1444  typedef CALLBACK_API_C(void *, TQAGetPtr)(const TQADrawContext *drawContext,
1445  TQATagPtr tag);
1446  typedef CALLBACK_API_C(void, TQADrawPoint)(const TQADrawContext *drawContext,
1447  const TQAVGouraud *v);
1448  typedef CALLBACK_API_C(void, TQADrawLine)(const TQADrawContext *drawContext,
1449  const TQAVGouraud *v0,
1450  const TQAVGouraud *v1);
1451  typedef CALLBACK_API_C(void, TQADrawTriGouraud)(
1452  const TQADrawContext *drawContext, const TQAVGouraud *v0,
1453  const TQAVGouraud *v1, const TQAVGouraud *v2, unsigned long flags);
1454  typedef CALLBACK_API_C(void, TQADrawTriTexture)(
1455  const TQADrawContext *drawContext, const TQAVTexture *v0,
1456  const TQAVTexture *v1, const TQAVTexture *v2, unsigned long flags);
1457  typedef CALLBACK_API_C(void, TQASubmitVerticesGouraud)(
1458  const TQADrawContext *drawContext, unsigned long nVertices,
1459  const TQAVGouraud *vertices);
1460  typedef CALLBACK_API_C(void, TQASubmitVerticesTexture)(
1461  const TQADrawContext *drawContext, unsigned long nVertices,
1462  const TQAVTexture *vertices);
1463  typedef CALLBACK_API_C(void, TQADrawTriMeshGouraud)(
1464  const TQADrawContext *drawContext, unsigned long nTriangles,
1465  const TQAIndexedTriangle *triangles);
1466  typedef CALLBACK_API_C(void, TQADrawTriMeshTexture)(
1467  const TQADrawContext *drawContext, unsigned long nTriangles,
1468  const TQAIndexedTriangle *triangles);
1469  typedef CALLBACK_API_C(void, TQADrawVGouraud)(const TQADrawContext *drawContext,
1470  unsigned long nVertices,
1471  TQAVertexMode vertexMode,
1472  const TQAVGouraud vertices[],
1473  const unsigned long flags[]);
1474  typedef CALLBACK_API_C(void, TQADrawVTexture)(const TQADrawContext *drawContext,
1475  unsigned long nVertices,
1476  TQAVertexMode vertexMode,
1477  const TQAVTexture vertices[],
1478  const unsigned long flags[]);
1479  typedef CALLBACK_API_C(void, TQADrawBitmap)(const TQADrawContext *drawContext,
1480  const TQAVGouraud *v,
1481  TQABitmap *bitmap);
1482  typedef CALLBACK_API_C(void,
1483  TQARenderStart)(const TQADrawContext *drawContext,
1484  const TQARect *dirtyRect,
1485  const TQADrawContext *initialContext);
1486  typedef CALLBACK_API_C(TQAError,
1487  TQARenderEnd)(const TQADrawContext *drawContext,
1488  const TQARect *modifiedRect);
1489  typedef CALLBACK_API_C(TQAError,
1490  TQARenderAbort)(const TQADrawContext *drawContext);
1491  typedef CALLBACK_API_C(TQAError, TQAFlush)(const TQADrawContext *drawContext);
1492  typedef CALLBACK_API_C(TQAError, TQASync)(const TQADrawContext *drawContext);
1493  typedef CALLBACK_API_C(TQAError,
1494  TQASetNoticeMethod)(const TQADrawContext *drawContext,
1496  TQANoticeMethod completionCallBack,
1497  void *refCon);
1498  typedef CALLBACK_API_C(TQAError,
1499  TQAGetNoticeMethod)(const TQADrawContext *drawContext,
1501  TQANoticeMethod *completionCallBack,
1502  void **refCon);
1503  typedef CALLBACK_API_C(void, TQASubmitMultiTextureParams)(
1504  const TQADrawContext *drawContext, unsigned long nParams,
1505  const TQAVMultiTexture *params);
1506  typedef CALLBACK_API_C(TQAError,
1507  TQAAccessDrawBuffer)(const TQADrawContext *drawContext,
1508  TQAPixelBuffer *buffer);
1509  typedef CALLBACK_API_C(TQAError, TQAAccessDrawBufferEnd)(
1510  const TQADrawContext *drawContext, const TQARect *dirtyRect);
1511  typedef CALLBACK_API_C(TQAError,
1512  TQAAccessZBuffer)(const TQADrawContext *drawContext,
1513  TQAZBuffer *buffer);
1514  typedef CALLBACK_API_C(TQAError,
1515  TQAAccessZBufferEnd)(const TQADrawContext *drawContext,
1516  const TQARect *dirtyRect);
1517  typedef CALLBACK_API_C(TQAError, TQAClearDrawBuffer)(
1518  const TQADrawContext *drawContext, const TQARect *rect,
1519  const TQADrawContext *initialContext);
1520  typedef CALLBACK_API_C(TQAError,
1521  TQAClearZBuffer)(const TQADrawContext *drawContext,
1522  const TQARect *rect,
1523  const TQADrawContext *initialContext);
1524  typedef CALLBACK_API_C(TQAError, TQATextureNewFromDrawContext)(
1525  const TQADrawContext *drawContext, unsigned long flags,
1526  TQATexture **newTexture);
1527  typedef CALLBACK_API_C(TQAError, TQABitmapNewFromDrawContext)(
1528  const TQADrawContext *drawContext, unsigned long flags,
1529  TQABitmap **newBitmap);
1530  typedef CALLBACK_API_C(TQABoolean, TQABusy)(const TQADrawContext *drawContext);
1531  typedef CALLBACK_API_C(TQAError,
1532  TQASwapBuffers)(const TQADrawContext *drawContext,
1533  const TQARect *dirtyRect);
1534  /************************************************************************************************
1535  *
1536  * Public TQADrawContext structure. This contains function pointers for the
1537  *chosen drawing engine.
1538  *
1539  ***********************************************************************************************/
1541  {
1542  TQADrawPrivate *drawPrivate; /* Engine's private data for this context */
1543  TQAVersion version; /* Version number */
1544  TQASetFloat setFloat; /* Method: Set a float state variable */
1545  TQASetInt setInt; /* Method: Set an unsigned long state variable */
1546  TQASetPtr setPtr; /* Method: Set an unsigned long state variable */
1547  TQAGetFloat getFloat; /* Method: Get a float state variable */
1548  TQAGetInt getInt; /* Method: Get an unsigned long state variable */
1549  TQAGetPtr getPtr; /* Method: Get an pointer state variable */
1550  TQADrawPoint drawPoint; /* Method: Draw a point */
1551  TQADrawLine drawLine; /* Method: Draw a line */
1552  TQADrawTriGouraud drawTriGouraud; /* Method: Draw a Gouraud shaded triangle */
1553  TQADrawTriTexture drawTriTexture; /* Method: Draw a texture mapped triangle */
1554  TQADrawVGouraud drawVGouraud; /* Method: Draw Gouraud vertices */
1555  TQADrawVTexture drawVTexture; /* Method: Draw texture vertices */
1556  TQADrawBitmap drawBitmap; /* Method: Draw a bitmap */
1557  TQARenderStart renderStart; /* Method: Initialize for rendering */
1558  TQARenderEnd renderEnd; /* Method: Complete rendering and display */
1559  TQARenderAbort
1560  renderAbort; /* Method: Abort any outstanding rendering (blocking) */
1561  TQAFlush
1562  flush; /* Method: Start render of any queued commands (non-blocking) */
1563  TQASync sync; /* Method: Wait for completion of all rendering (blocking) */
1564  TQASubmitVerticesGouraud
1565  submitVerticesGouraud; /* Method: Submit Gouraud vertices for trimesh */
1566  TQASubmitVerticesTexture
1567  submitVerticesTexture; /* Method: Submit Texture vertices for trimesh */
1568  TQADrawTriMeshGouraud
1569  drawTriMeshGouraud; /* Method: Draw a Gouraud triangle mesh */
1570  TQADrawTriMeshTexture
1571  drawTriMeshTexture; /* Method: Draw a Texture triangle mesh */
1572  TQASetNoticeMethod setNoticeMethod; /* Method: Set a notice method */
1573  TQAGetNoticeMethod getNoticeMethod; /* Method: Get a notice method */
1574  TQASubmitMultiTextureParams
1575  submitMultiTextureParams; /* Method: Submit Secondary texture params */
1576  TQAAccessDrawBuffer accessDrawBuffer;
1577  TQAAccessDrawBufferEnd accessDrawBufferEnd;
1578  TQAAccessZBuffer accessZBuffer;
1579  TQAAccessZBufferEnd accessZBufferEnd;
1580  TQAClearDrawBuffer clearDrawBuffer;
1581  TQAClearZBuffer clearZBuffer;
1582  TQATextureNewFromDrawContext textureFromContext;
1583  TQABitmapNewFromDrawContext bitmapFromContext;
1584  TQABusy busy;
1585  TQASwapBuffers swapBuffers;
1586  };
1587 
1588 /************************************************************************************************
1589  *
1590  * Acceleration manager function prototypes.
1591  *
1592  ***********************************************************************************************/
1593 #if CALL_NOT_IN_CARBON
1602  TQAError
1603  QADrawContextNew(const TQADevice *device, const TQARect *rect,
1604  const TQAClip *clip, const TQAEngine *engine,
1605  unsigned long flags, TQADrawContext **newDrawContext);
1606 
1615  void
1617 
1626  TQAError
1627  QAColorTableNew(const TQAEngine *engine, TQAColorTableType tableType,
1628  void *pixelData, long transparentIndexFlag,
1629  TQAColorTable **newTable);
1630 
1639  void
1640  QAColorTableDelete(const TQAEngine *engine, TQAColorTable *colorTable);
1641 
1650  TQAError
1651  QATextureNew(const TQAEngine *engine, unsigned long flags,
1652  TQAImagePixelType pixelType, const TQAImage images[],
1653  TQATexture **newTexture);
1654 
1663  TQAError
1664  QATextureDetach(const TQAEngine *engine, TQATexture *texture);
1665 
1674  void
1675  QATextureDelete(const TQAEngine *engine, TQATexture *texture);
1676 
1685  TQAError
1686  QATextureBindColorTable(const TQAEngine *engine, TQATexture *texture,
1687  TQAColorTable *colorTable);
1688 
1697  TQAError
1698  QABitmapNew(const TQAEngine *engine, unsigned long flags,
1699  TQAImagePixelType pixelType, const TQAImage *image,
1700  TQABitmap **newBitmap);
1701 
1710  TQAError
1711  QABitmapDetach(const TQAEngine *engine, TQABitmap *bitmap);
1712 
1721  void
1722  QABitmapDelete(const TQAEngine *engine, TQABitmap *bitmap);
1723 
1732  TQAError
1733  QABitmapBindColorTable(const TQAEngine *engine, TQABitmap *bitmap,
1734  TQAColorTable *colorTable);
1735 
1744  TQAEngine *
1746 
1755  TQAEngine *
1756  QADeviceGetNextEngine(const TQADevice *device, const TQAEngine *currentEngine);
1757 
1766  TQAError
1767  QAEngineCheckDevice(const TQAEngine *engine, const TQADevice *device);
1768 
1777  TQAError
1778  QAEngineGestalt(const TQAEngine *engine, TQAGestaltSelector selector,
1779  void *response);
1780 
1789  TQAError
1790  QAEngineEnable(long vendorID, long engineID);
1791 
1800  TQAError
1801  QAEngineDisable(long vendorID, long engineID);
1802 
1811  TQAError
1812  QAAccessTexture(const TQAEngine *engine, TQATexture *texture, long mipmapLevel,
1813  long flags, TQAPixelBuffer *buffer);
1814 
1823  TQAError
1824  QAAccessTextureEnd(const TQAEngine *engine, TQATexture *texture,
1825  const TQARect *dirtyRect);
1826 
1835  TQAError
1836  QAAccessBitmap(const TQAEngine *engine, TQABitmap *bitmap, long flags,
1837  TQAPixelBuffer *buffer);
1838 
1847  TQAError
1848  QAAccessBitmapEnd(const TQAEngine *engine, TQABitmap *bitmap,
1849  const TQARect *dirtyRect);
1850 
1851 #endif /* CALL_NOT_IN_CARBON */
1852 
1853 #if TARGET_OS_MAC
1854 #if CALL_NOT_IN_CARBON
1863  TQAError
1864  QARegisterDrawNotificationProc(Rect *globalRect,
1865  TQADrawNotificationProcPtr proc, long refCon,
1866  TQADrawNotificationProcRefNum *refNum);
1867 
1876  TQAError
1877  QAUnregisterDrawNotificationProc(TQADrawNotificationProcRefNum refNum);
1878 
1879 #endif /* CALL_NOT_IN_CARBON */
1880 
1881 #endif /* TARGET_OS_MAC */
1882 
1883 #if PRAGMA_ENUM_ALWAYSINT
1884 #pragma enumsalwaysint reset
1885 #ifdef __RAVE__RESTORE_TWOBYTEINTS
1886 #pragma fourbyteints off
1887 #endif
1888 #elif PRAGMA_ENUM_OPTIONS
1889 #pragma option enum =reset
1890 #elif defined(__RAVE__RESTORE_PACKED_ENUMS)
1891 #pragma options(pack_enums)
1892 #endif
1893 
1894 #if PRAGMA_STRUCT_ALIGN
1895 #pragma options align = reset
1896 #elif PRAGMA_STRUCT_PACKPUSH
1897 #pragma pack(pop)
1898 #elif PRAGMA_STRUCT_PACK
1899 #pragma pack()
1900 #endif
1901 
1902 #ifdef PRAGMA_IMPORT_OFF
1903 #pragma import off
1904 #elif PRAGMA_IMPORT
1905 #pragma import reset
1906 #endif
1907 
1908 #ifdef __cplusplus
1909 }
1910 #endif
1911 
1912 #endif /* __RAVE__ */
Set up for compiler independent conditionals.
Basic Macintosh data types.
Quickdraw Offscreen GWorld Interfaces.
Interface to Quickdraw Graphics.
void QABitmapDelete(const TQAEngine *engine, TQABitmap *bitmap)
TQAEngine * QADeviceGetNextEngine(const TQADevice *device, const TQAEngine *currentEngine)
TQAError QATextureNew(const TQAEngine *engine, unsigned long flags, TQAImagePixelType pixelType, const TQAImage images[], TQATexture **newTexture)
void QADrawContextDelete(TQADrawContext *drawContext)
TQAError QATextureBindColorTable(const TQAEngine *engine, TQATexture *texture, TQAColorTable *colorTable)
TQAError QAEngineGestalt(const TQAEngine *engine, TQAGestaltSelector selector, void *response)
void QATextureDelete(const TQAEngine *engine, TQATexture *texture)
TQAError QAAccessBitmapEnd(const TQAEngine *engine, TQABitmap *bitmap, const TQARect *dirtyRect)
TQAError QABitmapDetach(const TQAEngine *engine, TQABitmap *bitmap)
TQAEngine * QADeviceGetFirstEngine(const TQADevice *device)
TQAError QAAccessBitmap(const TQAEngine *engine, TQABitmap *bitmap, long flags, TQAPixelBuffer *buffer)
TQAError QADrawContextNew(const TQADevice *device, const TQARect *rect, const TQAClip *clip, const TQAEngine *engine, unsigned long flags, TQADrawContext **newDrawContext)
TQAError QAEngineDisable(long vendorID, long engineID)
TQAError QAColorTableNew(const TQAEngine *engine, TQAColorTableType tableType, void *pixelData, long transparentIndexFlag, TQAColorTable **newTable)
TQAError QAEngineCheckDevice(const TQAEngine *engine, const TQADevice *device)
void QAColorTableDelete(const TQAEngine *engine, TQAColorTable *colorTable)
TQAVertexMode
Definition: RAVE.h:933
TQAMethodSelector
Definition: RAVE.h:1009
TQAError QABitmapBindColorTable(const TQAEngine *engine, TQABitmap *bitmap, TQAColorTable *colorTable)
TQAError QAAccessTexture(const TQAEngine *engine, TQATexture *texture, long mipmapLevel, long flags, TQAPixelBuffer *buffer)
TQAError QAEngineEnable(long vendorID, long engineID)
TQAGestaltSelector
Definition: RAVE.h:949
TQATagInt
Definition: RAVE.h:638
TQAError QAAccessTextureEnd(const TQAEngine *engine, TQATexture *texture, const TQARect *dirtyRect)
TQAError QATextureDetach(const TQAEngine *engine, TQATexture *texture)
TQAError QABitmapNew(const TQAEngine *engine, unsigned long flags, TQAImagePixelType pixelType, const TQAImage *image, TQABitmap **newBitmap)
Definition: Quickdraw.h:2178
Definition: Quickdraw.h:306
Definition: MacTypes.h:527
Definition: RAVE.h:320
Definition: RAVE.h:196
Definition: RAVE.h:206
Definition: RAVE.h:314
Definition: RAVE.h:1541
Definition: RAVE.h:350
Definition: RAVE.h:343
Definition: RAVE.h:219
Definition: RAVE.h:426
Definition: RAVE.h:510
Definition: RAVE.h:473
Definition: RAVE.h:362
Definition: RAVE.h:1426
Definition: RAVE.h:307
Definition: RAVE.h:302