Rave.h

Go to the documentation of this file.
00001 /* KB  03/10/97  \Ken5\Include\3rdParty\RAVE.H
00002  **                                                          **
00003  **   Module:     RAVE.h                                        **
00004  **                                                       **
00005  **   Purpose:    Header file for RAVE API                         **
00006  **                                                       **
00007  **   Author:     Mike W. Kelley                                **
00008  **               Brent H. Pease                                **
00009  **                                                       **
00010  **   Copyright (C) 1994-96 Apple Computer, Inc.  All rights reserved.   **
00011  **      OpenGLª is a trademark of Silicon Graphics, Inc.                **
00012  **                                                       **
00013  *****************************************************************************/
00014 
00015 #ifndef _RAVE_h
00016 #define _RAVE_h
00017 
00018 #ifdef __cplusplus
00019 extern "C" {
00020 #endif
00021 
00022 /******************************************************************************
00023  *
00024  * Platform macros.
00025  * This sets kQAPlatform to one of kQAMacOS, kQAWin32, or kQAGeneric.
00026  * kQAPlatform controls platform-specific compilation switches and types.
00027  *
00028  *****************************************************************************/
00029 
00030 #if !defined(kQAMacOS)
00031 #define  kQAMacOS    1        /* Target is MacOS               */
00032 #endif
00033 
00034 #if !defined(kQAGeneric)
00035 #define kQAGeneric      2        /* Target is generic platform    */
00036 #endif
00037 
00038 #if !defined(kQAWin32)
00039 #define kQAWin32     3        /* Target is Win32               */
00040 #endif
00041 
00042 #if defined(_WIN32) || defined(_WINDOWS)
00043    #define kQAPlatform kQAWin32
00044 #elif !defined(kQAPlatform)
00045    #define kQAPlatform kQAMacOS
00046 #endif
00047 
00048 /******************************************************************************
00049  *
00050  * Export Control
00051  *
00052  *****************************************************************************/
00053 
00054 #if defined(_MSC_VER)   /* Microsoft Visual C */
00055    #if defined(WIN32_RAVEEXPORTING) /* define when building DLL */
00056       #define  RAVE_EXPORT    __declspec( dllexport )
00057       #define RAVE_CALL
00058       #define RAVE_CALLBACK
00059    #else
00060       #define RAVE_EXPORT     __declspec( dllimport )
00061       #define RAVE_CALL    __cdecl
00062       #define RAVE_CALLBACK   __cdecl
00063    #endif /* WIN32_RAVEEXPORTING */
00064 #else
00065    #define RAVE_EXPORT
00066    #define RAVE_CALL
00067    #define RAVE_CALLBACK
00068 #endif /* _MSC_VER */
00069 
00070 /******************************************************************************
00071  *
00072  * Platform dependent datatypes: TQAImagePixelType, TQADevice, TQAClip, and TQARect.
00073  *
00074  *****************************************************************************/
00075 
00076 typedef enum TQAImagePixelType
00077 {
00078    kQAPixel_Alpha1      = 0,     /* 1 bit/pixel alpha */
00079    kQAPixel_RGB16    = 1,     /* 16 bit/pixel, R=14:10, G=9:5, B=4:0 */
00080    kQAPixel_ARGB16      = 2,     /* 16 bit/pixel, A=15, R=14:10, G=9:5, B=4:0 */
00081    kQAPixel_RGB32    = 3,     /* 32 bit/pixel, R=23:16, G=15:8, B=7:0 */
00082    kQAPixel_ARGB32      = 4,     /* 32 bit/pixel, A=31:24, R=23:16, G=15:8, B=7:0 */
00083    kQAPixel_CL4      = 5,     /* 4 bit color look up table, always big endian,
00084                               ie high 4 bits effect left pixel */
00085    kQAPixel_CL8      = 6         /* 8 bit color look up table */
00086 #if (kQAPlatform == kQAWin32)
00087    ,
00088    kQAPixel_RGB16_565   = 7,     /* 16 bits/pixel, no alpha, R:5, G:6, B:5 */
00089    kQAPixel_RGB24    = 8         /* 24 bits/pixel, no alpha, R:8, G:8, B:8 */
00090 #endif /* kQAPlatform == kQAWin32 */
00091 } TQAImagePixelType;
00092 
00093 typedef enum TQAColorTableType
00094 {
00095    kQAColorTable_CL8_RGB32    = 0,     /* 256 entry, 32 bit/pixel, R=23:16, G=15:8, B=7:0 */
00096    kQAColorTable_CL4_RGB32    = 1         /* 16 entry, 32 bit/pixel, R=23:16, G=15:8, B=7:0 */
00097 } TQAColorTableType;
00098 
00099 typedef enum TQADeviceType       /* Selects target device type */
00100 {
00101    kQADeviceMemory      = 0,     /* Memory draw context */
00102    kQADeviceGDevice  = 1,     /* Macintosh GDevice draw context */
00103    kQADeviceWin32DC  = 2         /* Win32 DC */
00104 #if !defined(RAVE_NO_DIRECTDRAW)
00105    ,
00106    kQADeviceDDSurface   = 3         /* Win32 DirectDraw Surface */
00107 #endif /* !defined(RAVE_NO_DIRECTDRAW) */
00108 } TQADeviceType;
00109 
00110 typedef struct TQADeviceMemory      /* Generic memory pixmap device */
00111 {
00112    long           rowBytes;   /* Rowbytes */
00113    TQAImagePixelType pixelType;  /* Depth, color space, etc. */
00114    long           width;      /* Width in pixels */
00115    long           height;     /* Height in pixels */
00116    void           *baseAddr;  /* Base address of pixmap */
00117 } TQADeviceMemory;
00118 
00119 typedef enum TQAClipType         /* Selects target clip type */
00120 {
00121    kQAClipRgn        = 0,     /* Macintosh clipRgn with serial number */
00122    kQAClipWin32Rgn      = 1         /* Win32 clip region */
00123 } TQAClipType;
00124 
00125 typedef struct TQARect
00126 {
00127    long           left;
00128    long           right;
00129    long           top;
00130    long           bottom;
00131 } TQARect;
00132 
00133 #if (kQAPlatform == kQAMacOS)
00134 
00135    /*
00136    ** the following gets around a problem in xlc with unsigned 32 bit enums 
00137    ** that have been defined in system header files
00138    */
00139    #if defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
00140       #pragma options enum=small
00141    #endif
00142    
00143    /*
00144     * MacOS supports memory and GDevice. TQARect == Rect. TQAClip is a clipRgn.
00145     */
00146    #include <Quickdraw.h>
00147    #include <QDOffscreen.h>
00148    
00149    /*
00150    ** reset to default after the system headers
00151    */
00152    
00153    #if defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
00154       #pragma options enum=reset
00155    #endif
00156       
00157    
00158    typedef union TQAPlatformDevice
00159    {
00160       TQADeviceMemory   memoryDevice;
00161       GDHandle    gDevice;
00162    } TQAPlatformDevice;
00163    
00164    typedef union TQAPlatformClip
00165    {
00166       RgnHandle      clipRgn;
00167    } TQAPlatformClip;
00168    
00169 #elif (kQAPlatform == kQAWin32)
00170    #include <windows.h>
00171 #if !defined(RAVE_NO_DIRECTDRAW)
00172    #include <ddraw.h>
00173 
00174    typedef enum
00175    {
00176       kQADirectDrawObject     = 1,
00177       kQADirectDrawObject2 = 2
00178    } TQADirectDrawObjectSelector;
00179 
00180    typedef enum
00181    {
00182       kQADirectDrawSurface = 1,
00183       kQADirectDrawSurface2   = 2
00184    } TQADirectDrawSurfaceSelector;
00185 
00186 #endif /* !RAVE_NO_DIRECTDRAW */
00187 
00188    typedef union TQAPlatformDevice
00189    {
00190       TQADeviceMemory         memoryDevice;
00191       HDC                  hdc;
00192 #if !defined(RAVE_NO_DIRECTDRAW)
00193       struct
00194       {
00195          TQADirectDrawObjectSelector      objectSelector;
00196          union
00197          {
00198             LPDIRECTDRAW            lpDirectDraw;
00199             LPDIRECTDRAW2           lpDirectDraw2;
00200          };
00201 
00202          TQADirectDrawSurfaceSelector  surfaceSelector;
00203          union
00204          {
00205             LPDIRECTDRAWSURFACE        lpDirectDrawSurface;
00206             LPDIRECTDRAWSURFACE2    lpDirectDrawSurface2;
00207          };
00208       };
00209 #endif /* RAVE_NO_DIRECTDRAW */
00210    } TQAPlatformDevice;
00211 
00212    typedef union TQAPlatformClip
00213    {
00214       HRGN        clipRgn;
00215    } TQAPlatformClip;
00216 #elif (kQAPlatform == kQAGeneric)
00217    /*
00218     * Generic platform supports memory device only. TQARect is generic. TQAClip is ???.
00219     */
00220    
00221    typedef union TQAPlatformDevice
00222    {
00223       TQADeviceMemory   memoryDevice;
00224    } TQAPlatformDevice;
00225    
00226    typedef union TQAPlatformClip
00227    {
00228       void        *region;       /* ??? */
00229    } TQAPlatformClip;
00230 #else
00231    /* ??? Unrecognized kQAPlatform */
00232 #endif
00233 
00234 typedef struct TQADevice
00235 {
00236    TQADeviceType     deviceType;
00237    TQAPlatformDevice device;
00238 } TQADevice;
00239 
00240 typedef struct TQAClip
00241 {
00242    TQAClipType       clipType;
00243    TQAPlatformClip      clip;
00244 } TQAClip;
00245 
00246 /******************************************************************************
00247  *
00248  * Basic data types.
00249  *
00250  *****************************************************************************/
00251 
00252 typedef struct TQADrawContext TQADrawContext;   /* Drawing context for an engine */
00253 typedef struct TQAEngine TQAEngine;       /* Pointer to a drawing engine */
00254 typedef struct TQATexture TQATexture;        /* Pointer to an allocated texture map */
00255 typedef struct TQABitmap TQABitmap;       /* Pointer to an allocated bitmap */
00256 typedef struct TQADrawPrivate TQADrawPrivate;   /* Engine's private draw context pointer */
00257 typedef struct TQAImage TQAImage;            /* An image for use as texture or bitmap */
00258 typedef struct TQAColorTable TQAColorTable;
00259 
00260 typedef struct TQAIndexedTriangle            /* A single triangle element for QADrawTriMesh */
00261 {
00262    unsigned long  triangleFlags;          /* Triangle flags, see kQATriFlags_ */
00263    unsigned long  vertices[3];            /* Indices into a vertex array */
00264 } TQAIndexedTriangle;
00265 
00266 struct TQAImage                           /* An image for use as texture or bitmap */
00267 {
00268    long     width;                     /* Width of pixmap */
00269    long     height;                    /* Height of pixmap */
00270    long     rowBytes;                  /* Rowbytes of pixmap */
00271    void     *pixmap;                /* Pixmap */
00272 };
00273 
00274 typedef enum TQAError                     /* Standard error type */
00275 {
00276    kQANoErr          = 0,           /* No error */
00277    kQAError          = 1,           /* Generic error flag */
00278    kQAOutOfMemory       = 2,           /* Insufficient memory */
00279    kQANotSupported         = 3,           /* Requested feature is not supported */
00280    kQAOutOfDate         = 4,           /* A newer drawing engine was registered */
00281    kQAParamErr          = 5,           /* Error in passed parameters */
00282    kQAGestaltUnknown    = 6,           /* Requested gestalt type isn't available */
00283    kQADisplayModeUnsupported  = 7,        /* Engine cannot render to the display in its current ,
00284                                      * mode, but could if it were in some other mode */
00285    kQAOutOfVideoMemory     = 8               /* There is not enough VRAM to support the desired
00286                                      * context dimensions */
00287 } TQAError;
00288 
00289 /************************************************************************************************
00290  *
00291  * Vertex data types.
00292  *
00293  ***********************************************************************************************/
00294 
00295 /*
00296  * TQAVGouraud is used for Gouraud shading. Each vertex specifies position, color and Z.
00297  *
00298  * Alpha is always treated as indicating transparency. Drawing engines which don't
00299  * support Z-sorted rendering use the back-to-front transparency blending functions
00300  * shown below. (ARGBsrc are the source (new) values, ARGBdest are  the destination
00301  * (previous) pixel values.)
00302  *
00303  *    Premultiplied                    Interpolated
00304  *
00305  *    A = 1 - (1 - Asrc) * (1 - Adest)    A = 1 - (1 - Asrc) * (1 - Adest) 
00306  *    R = (1 - Asrc) * Rdest + Rsrc       R = (1 - Asrc) * Rdest + Asrc * Rsrc
00307  *    G = (1 - Asrc) * Gdest + Gsrc       G = (1 - Asrc) * Gdest + Asrc * Gsrc
00308  *    B = (1 - Asrc) * Bdest + Bsrc       B = (1 - Asrc) * Bdest + Asrc * Bsrc
00309  *
00310  * Note that the use of other blending modes to implement antialiasing is performed
00311  * automatically by the drawing engine when the kQATag_Antialias variable !=
00312  * kQAAntiAlias_Fast. The driving software should continue to use the alpha fields
00313  * for transparency even when antialiasing is being used (the drawing engine will
00314  * resolve the multiple blending requirements as best as it can).
00315  *
00316  * Drawing engines which perform front-to-back Z-sorted rendering should replace
00317  * the blending function shown above with the equivalent front-to-back formula.
00318  */
00319 
00320 typedef struct TQAVGouraud
00321 {
00322    float          x;    /* X pixel coordinate, 0.0 <= x < width */
00323    float          y;    /* Y pixel coordinate, 0.0 <= y < height */
00324    float          z;    /* Z coordinate, 0.0 <= z <= 1.0 */
00325    float          invW; /* 1 / w; required only when kQAPerspectiveZ_On is set */
00326    
00327    float          r;    /* Red, 0.0 <= r <= 1.0 */
00328    float          g;    /* Green, 0.0 <= g <= 1.0 */
00329    float          b;    /* Blue, 0.0 <= b <= 1.0 */
00330    float          a;    /* Alpha, 0.0 <= a <= 1.0, 1.0 is opaque */
00331 } TQAVGouraud;
00332 
00333 /*
00334  * TQAVTexture is used for texture mapping. The texture mapping operation
00335  * is controlled by the kQATag_TextureOp variable, which is a mask of
00336  * kQATextureOp_None/Modulate/Highlight/Decal. Below is pseudo-code for the
00337  * texture shading operation:
00338  *
00339  *    texPix = TextureLookup (uq/q, vq/q);
00340  *    if (kQATextureOp_Decal)
00341  *    {
00342  *       texPix.r = texPix.a * texPix.r + (1 - texPix.a) * r;
00343  *       texPix.g = texPix.a * texPix.g + (1 - texPix.a) * g;
00344  *       texPix.b = texPix.a * texPix.b + (1 - texPix.a) * b;
00345  *       texPix.a = a;
00346  *    }
00347  *    else
00348  *    {
00349  *       texPix.a = texPix.a * a;
00350  *    }
00351  *    if (kQATextureOp_Modulate)
00352  *    {
00353  *       texPix.r *= kd_r;    // Clamped to prevent overflow
00354  *       texPix.g *= kd_g;    // Clamped to prevent overflow
00355  *       texPix.b *= kd_b;    // Clamped to prevent overflow
00356  *    }
00357  *    if (kQATextureOp_Highlight)
00358  *    {
00359  *       texPix.r += ks_r;    // Clamped to prevent overflow
00360  *       texPix.g += ks_g;    // Clamped to prevent overflow
00361  *       texPix.b += ks_b;    // Clamped to prevent overflow
00362  *    }
00363  *
00364  * After computation of texPix, transparency blending (as shown
00365  * above for TQAVGouraud) is performed.
00366  */
00367 
00368 typedef struct TQAVTexture
00369 {
00370    float          x;    /* X pixel coordinate, 0.0 <= x < width */
00371    float          y;    /* Y pixel coordinate, 0.0 <= y < height */
00372    float          z;    /* Z coordinate, 0.0 <= z <= 1.0 */
00373    float          invW; /* 1 / w (always required) */
00374    
00375    /* rgb are used only when kQATextureOp_Decal is set. a is always required */
00376    
00377    float          r;    /* Red, 0.0 <= r <= 1.0 */
00378    float          g;    /* Green, 0.0 <= g <= 1.0 */
00379    float          b;    /* Blue, 0.0 <= b <= 1.0 */
00380    float          a;    /* Alpha, 0.0 <= a <= 1.0, 1.0 is opaque */
00381 
00382    /* uOverW and vOverW are required by all modes */
00383    
00384    float          uOverW;  /* u / w */
00385    float          vOverW;  /* v / w */
00386    
00387    /* kd_r/g/b are used only when kQATextureOp_Modulate is set */
00388    
00389    float          kd_r; /* Scale factor for texture red, 0.0 <= kd_r */
00390    float          kd_g; /* Scale factor for texture green, 0.0 <= kd_g */
00391    float          kd_b; /* Scale factor for texture blue, 0.0 <= kd_b */
00392    
00393    /* ks_r/g/b are used only when kQATextureOp_Highlight is set */
00394    
00395    float          ks_r; /* Red specular highlight, 0.0 <= ks_r <= 1.0 */
00396    float          ks_g; /* Green specular highlight, 0.0 <= ks_g <= 1.0 */
00397    float          ks_b; /* Blue specular highlight, 0.0 <= ks_b <= 1.0 */
00398 } TQAVTexture;
00399 
00400 /************************************************************************************************
00401  *
00402  * Constants used for the state variables.
00403  *
00404  ***********************************************************************************************/
00405 
00406 /*
00407  * kQATag_xxx is used to select a state variable when calling QASetFloat(), QASetInt(),
00408  * QAGetFloat() and QAGetInt(). The kQATag values are split into two separate
00409  * enumerated types: TQATagInt and TQATagFloat. TQATagInt is used for the QASet/GetInt()
00410  * functions, and TQATagFloat is used for the QASet/GetFloat() functions. (This is so
00411  * that a compiler that typechecks enums can flag a float/int tag mismatch during compile.)
00412  *
00413  * These variables are required by all drawing engines:
00414  *    kQATag_ZFunction        (Int) One of kQAZFunction_xxx
00415  *    kQATag_ColorBG_a        (Float)  Background color alpha
00416  *    kQATag_ColorBG_r        (Float)  Background color red
00417  *    kQATag_ColorBG_g        (Float)  Background color green
00418  *    kQATag_ColorBG_b        (Float)  Background color blue
00419  *    kQATag_Width            (Float)  Line and point width (pixels)
00420  *    kQATag_ZMinOffset       (Float)  Min offset to Z to guarantee visibility (Read only!)
00421  *    kQATag_ZMinScale        (Float)  Min scale to Z to guarantee visibility (Read only!)
00422  
00423  * These variables are used for optional features:
00424  *    kQATag_Antialias        (Int) One of kQAAntiAlias_xxx
00425  *    kQATag_Blend            (Int) One of kQABlend_xxx
00426  *    kQATag_PerspectiveZ        (Int) One of kQAPerspectiveZ_xxx
00427  *    kQATag_TextureFilter    (Int) One of kQATextureFilter_xxx
00428  *    kQATag_TextureOp        (Int) Mask of kQATextureOp_xxx
00429  *    kQATag_Texture          (Int) Pointer to current TQATexture
00430  *    kQATag_CSGTag           (Int) One of kQACSGTag_xxx
00431  *    kQATag_CSGEquation         (Int) 32 bit CSG truth table
00432  *
00433  * These variables are used for OpenGLª support:
00434  *    kQATagGL_DrawBuffer        (Int) Mask of kQAGL_DrawBuffer_xxx
00435  *    kQATagGL_TextureWrapU      (Int) kQAGL_Clamp or kQAGL_Repeat
00436  *    kQATagGL_TextureWrapV      (Int) kQAGL_Clamp or kQAGL_Repeat
00437  *    kQATagGL_TextureMagFilter  (Int) kQAGL_Nearest or kQAGL_Linear
00438  *    kQATagGL_TextureMinFilter  (Int) kQAGL_Nearest, etc.
00439  *    kQATagGL_ScissorXMin    (Int) Minimum X value for scissor rectangle
00440  *    kQATagGL_ScissorYMin    (Int) Minimum Y value for scissor rectangle
00441  *    kQATagGL_ScissorXMax    (Int) Maximum X value for scissor rectangle
00442  *    kQATagGL_ScissorYMax    (Int) Maximum Y value for scissor rectangle
00443  *    kQATagGL_BlendSrc       (Int) Source blending operation
00444  *    kQATagGL_BlendDst       (Int) Destination blending operation
00445  *    kQATagGL_LinePattern    (Int) Line rasterization pattern
00446  *    kQATagGL_AreaPattern0      (Int) First of 32 area pattern registers
00447  *    kQATagGL_AreaPattern31     (Int) Last of 32 area pattern registers
00448  *    kQATagGL_DepthBG        (Float)  Background Z
00449  *    kQATagGL_TextureBorder_a   (Float)  Texture border color alpha
00450  *    kQATagGL_TextureBorder_r   (Float)  Texture border color red
00451  *    kQATagGL_TextureBorder_g   (Float)  Texture border color green
00452  *    kQATagGL_TextureBorder_b   (Float)  Texture border color blue
00453  *
00454  * Tags >= kQATag_EngineSpecific_Minimum may be assigned by the vendor for use as
00455  * engine-specific variables. NOTE: These should be used only in exceptional circumstances,
00456  * as functions performed by these variables won't be generally accessible. All other tag
00457  * values are reserved.
00458  *
00459  *    kQATag_EngineSpecific_Minimum Minimum tag value for drawing-engine specific variables
00460  */
00461 
00462 typedef enum TQATagInt
00463 {
00464    kQATag_ZFunction           = 0,
00465    kQATag_Antialias           = 8,
00466    kQATag_Blend               = 9,
00467    kQATag_PerspectiveZ           = 10,
00468    kQATag_TextureFilter       = 11,
00469    kQATag_TextureOp           = 12,
00470    kQATag_CSGTag              = 14,
00471    kQATag_CSGEquation            = 15,
00472    kQATag_BufferComposite        = 16,
00473    kQATagGL_DrawBuffer           = 100,
00474    kQATagGL_TextureWrapU         = 101,
00475    kQATagGL_TextureWrapV         = 102,
00476    kQATagGL_TextureMagFilter     = 103,
00477    kQATagGL_TextureMinFilter     = 104,
00478    kQATagGL_ScissorXMin       = 105,
00479    kQATagGL_ScissorYMin       = 106,
00480    kQATagGL_ScissorXMax       = 107,
00481    kQATagGL_ScissorYMax       = 108,
00482    kQATagGL_BlendSrc          = 109,
00483    kQATagGL_BlendDst          = 110,
00484    kQATagGL_LinePattern       = 111,
00485    kQATagGL_AreaPattern0         = 117,
00486       /* ...1-30 */
00487    kQATagGL_AreaPattern31        = 148,
00488    kQATag_EngineSpecific_Minimum = 1000
00489 } TQATagInt;
00490 
00491 typedef enum TQATagPtr
00492 {
00493    kQATag_Texture             = 13
00494 } TQATagPtr;
00495 
00496 typedef enum TQATagFloat
00497 {
00498    kQATag_ColorBG_a           = 1,
00499    kQATag_ColorBG_r           = 2,
00500    kQATag_ColorBG_g           = 3,
00501    kQATag_ColorBG_b           = 4,
00502    kQATag_Width               = 5,
00503    kQATag_ZMinOffset          = 6,
00504    kQATag_ZMinScale           = 7,
00505    kQATagGL_DepthBG           = 112,
00506    kQATagGL_TextureBorder_a      = 113,
00507    kQATagGL_TextureBorder_r      = 114,
00508    kQATagGL_TextureBorder_g      = 115,
00509    kQATagGL_TextureBorder_b      = 116
00510 } TQATagFloat;
00511 
00512 /* kQATag_ZFunction */
00513 #define kQAZFunction_None        0  /* Z is neither tested nor written (same as no Z buffer) */
00514 #define kQAZFunction_LT          1  /* Znew < Zbuffer is visible */
00515 #define kQAZFunction_EQ          2  /* OpenGL Only: Znew == Zbuffer is visible */
00516 #define kQAZFunction_LE          3  /* OpenGL Only: Znew <= Zbuffer is visible */
00517 #define kQAZFunction_GT          4  /* OpenGL Only: Znew > Zbuffer is visible */
00518 #define kQAZFunction_NE          5  /* OpenGL Only: Znew != Zbuffer is visible */
00519 #define kQAZFunction_GE          6  /* OpenGL Only: Znew >= Zbuffer is visible */
00520 #define kQAZFunction_True        7  /* Znew is always visible */
00521 
00522 /* kQATag_Width */
00523 #define kQAMaxWidth              128.0
00524 
00525 /* kQATag_Antialias */
00526 #define kQAAntiAlias_Off         0
00527 #define kQAAntiAlias_Fast        1
00528 #define kQAAntiAlias_Mid         2
00529 #define kQAAntiAlias_Best        3
00530 
00531 /* kQATag_Blend */
00532 #define kQABlend_PreMultiply     0
00533 #define kQABlend_Interpolate     1
00534 #define kQABlend_OpenGL          2
00535 
00536 /* kQATag_BufferComposite */
00537 #define kQABufferComposite_None        0  /* Default: New pixels overwrite initial buffer contents */
00538 #define kQABufferComposite_PreMultiply 1  /* New pixels are blended with initial buffer contents via PreMultiply */
00539 #define kQABufferComposite_Interpolate 2  /* New pixels are blended with initial buffer contents via Interpolate */
00540 
00541 /* kQATag_PerspectiveZ */
00542 #define kQAPerspectiveZ_Off         0  /* Use Z for hidden surface removal */
00543 #define kQAPerspectiveZ_On       1  /* Use InvW for hidden surface removal */
00544 
00545 /* kQATag_TextureFilter */
00546 #define kQATextureFilter_Fast    0
00547 #define kQATextureFilter_Mid     1
00548 #define kQATextureFilter_Best    2
00549 
00550 /* kQATag_TextureOp (mask of one or more) */
00551 #define kQATextureOp_None     0           /* Default texture mapping mode */
00552 #define kQATextureOp_Modulate (1 << 0)    /* Modulate texture color with kd_r/g/b */
00553 #define kQATextureOp_Highlight   (1 << 1)    /* Add highlight value ks_r/g/b */
00554 #define kQATextureOp_Decal    (1 << 2)    /* When texture alpha == 0, use rgb instead */
00555 #define kQATextureOp_Shrink      (1 << 3)    /* This is a non-wrapping texture, so the ??? */
00556 
00557 /* kQATag_CSGTag */
00558 #define kQACSGTag_None        0xffffffffUL   /* Do not perform CSG */
00559 #define kQACSGTag_0           0           /* Submitted tris have CSG ID 0 */
00560 #define kQACSGTag_1           1           /* Submitted tris have CSG ID 1 */
00561 #define kQACSGTag_2           2           /* Submitted tris have CSG ID 2 */
00562 #define kQACSGTag_3           3           /* Submitted tris have CSG ID 3 */
00563 #define kQACSGTag_4           4           /* Submitted tris have CSG ID 4 */
00564 
00565 /* kQATagGL_TextureWrapU/V */
00566 #define kQAGL_Repeat          0
00567 #define kQAGL_Clamp              1
00568 
00569 /* kQATagGL_BlendSrc */
00570 #define kQAGL_SourceBlend_XXX    0
00571 
00572 /* kQATagGL_BlendDst */
00573 #define kQAGL_DestBlend_XXX         0
00574 
00575 /* kQATagGL_DrawBuffer (mask of one or more) */
00576 #define kQAGL_DrawBuffer_None    0
00577 #define kQAGL_DrawBuffer_FrontLeft  (1<<0)
00578 #define kQAGL_DrawBuffer_FrontRight (1<<1)
00579 #define kQAGL_DrawBuffer_BackLeft   (1<<2)
00580 #define kQAGL_DrawBuffer_BackRight  (1<<3)
00581 #define kQAGL_DrawBuffer_Front      (kQAGL_DrawBuffer_FrontLeft | kQAGL_DrawBuffer_FrontRight)
00582 #define kQAGL_DrawBuffer_Back    (kQAGL_DrawBuffer_BackLeft | kQAGL_DrawBuffer_BackRight)
00583 
00584 /************************************************************************************************
00585  *
00586  * Constants used as function parameters.
00587  *
00588  ***********************************************************************************************/
00589 
00590 /*
00591  * TQAVertexMode is a parameter to QADrawVGouraud() and QADrawVTexture() that specifies how
00592  * to interpret and draw the vertex array.
00593  */
00594 
00595 typedef enum TQAVertexMode
00596 {
00597    kQAVertexMode_Point           = 0,     /* Draw nVertices points */
00598    kQAVertexMode_Line            = 1,     /* Draw nVertices/2 line segments */
00599    kQAVertexMode_Polyline        = 2,     /* Draw nVertices-1 connected line segments */
00600    kQAVertexMode_Tri          = 3,     /* Draw nVertices/3 triangles */
00601    kQAVertexMode_Strip           = 4,     /* Draw nVertices-2 triangles as a strip */
00602    kQAVertexMode_Fan          = 5,        /* Draw nVertices-2 triangles as a fan from v0 */
00603    kQAVertexMode_NumModes        = 6
00604 
00605 } TQAVertexMode;
00606 
00607 /*
00608  * TQAGestaltSelector is a parameter to QAEngineGestalt(). It selects which gestalt
00609  * parameter will be copied into 'response'.
00610  */
00611 
00612 typedef enum TQAGestaltSelector
00613 {
00614    kQAGestalt_OptionalFeatures      = 0,     /* Mask of one or more kQAOptional_xxx */
00615    kQAGestalt_FastFeatures       = 1,     /* Mask of one or more kQAFast_xxx */
00616    kQAGestalt_VendorID           = 2,     /* Vendor ID */
00617    kQAGestalt_EngineID           = 3,     /* Engine ID */
00618    kQAGestalt_Revision           = 4,     /* Revision number of this engine */
00619    kQAGestalt_ASCIINameLength    = 5,     /* strlen (asciiName) */
00620    kQAGestalt_ASCIIName       = 6,     /* Causes strcpy (response, asciiName) */
00621    kQAGestalt_TextureMemory      = 7,     /* amount of texture RAM currently available */
00622    kQAGestalt_FastTextureMemory  = 8,     /* amount of texture RAM currently available */
00623    kQAGestalt_NumSelectors       = 9
00624 
00625 } TQAGestaltSelector;
00626 
00627 /*
00628  * TQAMethodSelector is a parameter to QASetNoticeMethod to select the notice method
00629  */
00630 
00631 typedef enum TQAMethodSelector
00632 {
00633    kQAMethod_RenderCompletion    = 0,     /* Called when rendering has completed and buffers swapped */
00634    kQAMethod_DisplayModeChanged  = 1,     /* Called when a display mode has changed */
00635    kQAMethod_ReloadTextures      = 2,     /* Called when texture memory has been invalidated */
00636    kQAMethod_BufferInitialize    = 3,     /* Called when a buffer needs to be initialized */
00637    kQAMethod_BufferComposite     = 4,     /* Called when rendering is finished and its safe to composite */
00638    kQAMethod_NumSelectors        = 5
00639    
00640 } TQAMethodSelector;
00641 
00642 /*
00643  * kQATriFlags_xxx are ORed together to generate the 'flags' parameter
00644  * to QADrawTriGouraud() and QADrawTriTexture().
00645  */
00646 
00647 #define  kQATriFlags_None        0        /* No flags (triangle is front-facing or don't care) */
00648 #define kQATriFlags_Backfacing      (1 << 0) /* Triangle is back-facing */
00649 
00650 /*
00651  * kQATexture_xxx are ORed together to generate the 'flags' parameter to QATextureNew().
00652  */
00653 
00654 #define  kQATexture_None            0        /* No flags */
00655 #define kQATexture_Lock          (1<<0)      /* Don't swap this texture out */
00656 #define kQATexture_Mipmap        (1<<1)      /* This texture is mipmapped */
00657 #define kQATexture_NoCompression (1<<2)      /* Do not compress this texture */
00658 #define kQATexture_HighCompression  (1<<3)      /* Compress texture, even if it takes a while */
00659 
00660 /*
00661  * kQABitmap_xxx are ORed together to generate the 'flags' parameter to QABitmapNew().
00662  */
00663 
00664 #define  kQABitmap_None          0        /* No flags */
00665 #define kQABitmap_Lock           (1<<1)      /* Don't swap this bitmap out */
00666 #define kQABitmap_NoCompression     (1<<2)      /* Do not compress this bitmap */
00667 #define kQABitmap_HighCompression   (1<<3)      /* Compress bitmap, even if it takes a while */
00668 
00669 /*
00670  * kQAContext_xxx are ORed together to generate the 'flags' parameter for QADrawContextNew().
00671  */
00672 
00673 #define kQAContext_None          0        /* No flags */
00674 #define kQAContext_NoZBuffer     (1 << 0) /* No hidden surface removal */
00675 #define kQAContext_DeepZ         (1 << 1) /* Hidden surface precision >= 24 bits */
00676 #define kQAContext_DoubleBuffer     (1 << 2) /* Double buffered window */
00677 #define kQAContext_Cache         (1 << 3) /* This is a cache context */
00678 #define kQAContext_NoDither         (1 << 4) /* No dithering, straight color banding */
00679 
00680 /*
00681  * kQAOptional_xxx are ORed together to generate the kQAGestalt_OptionalFeatures response
00682  * from QAEngineGestalt().
00683  */
00684 
00685 #define kQAOptional_None         0        /* No optional features */
00686 #define kQAOptional_DeepZ        (1 << 0) /* Hidden surface precision >= 24 bits */
00687 #define kQAOptional_Texture         (1 << 1) /* Texture mapping */
00688 #define kQAOptional_TextureHQ    (1 << 2) /* High quality texture (tri-linear mip or better) */
00689 #define kQAOptional_TextureColor (1 << 3) /* Full color modulation and highlight of textures */
00690 #define kQAOptional_Blend        (1 << 4) /* Transparency blending of RGB */
00691 #define kQAOptional_BlendAlpha      (1 << 5) /* Transparency blending includes alpha channel */
00692 #define kQAOptional_Antialias    (1 << 6) /* Antialiased rendering */
00693 #define kQAOptional_ZSorted         (1 << 7) /* Z sorted rendering (for transparency, etc.) */
00694 #define kQAOptional_PerspectiveZ (1 << 8) /* Hidden surface removal using InvW instead of Z */
00695 #define kQAOptional_OpenGL       (1 << 9) /* Extended rasterization features for OpenGLª */
00696 #define kQAOptional_NoClear         (1 << 10)   /* This drawing engine doesn't clear before drawing */
00697 #define kQAOptional_CSG          (1 << 11)   /* kQATag_CSGxxx are implemented */
00698 #define kQAOptional_BoundToDevice   (1 << 12)   /* This engine is tightly bound to GDevice */
00699 #define kQAOptional_CL4          (1 << 13)   /* This engine suports kQAPixel_CL4 */
00700 #define kQAOptional_CL8          (1 << 14)   /* This engine suports kQAPixel_CL8 */
00701 #define kQAOptional_BufferComposite (1 << 15)   /* This engine can composite with initial buffer contents */
00702 #define kQAOptional_NoDither     (1 << 16)   /* This engine can draw with no dithering */
00703 
00704 /*
00705  * kQAFast_xxx are ORed together to generate the kQAGestalt_FastFeatures response
00706  * from QAEngineGestalt().
00707  */
00708 
00709 #define kQAFast_None          0        /* No accelerated features */
00710 #define kQAFast_Line          (1 << 0) /* Line drawing */
00711 #define kQAFast_Gouraud          (1 << 1) /* Gouraud shaded triangles */
00712 #define kQAFast_Texture          (1 << 2) /* Texture mapped triangles */
00713 #define kQAFast_TextureHQ        (1 << 3) /* High quality texture (tri-linear mip or better) */
00714 #define kQAFast_Blend            (1 << 4) /* Transparency blending */
00715 #define kQAFast_Antialiasing     (1 << 5) /* Antialiased rendering */
00716 #define kQAFast_ZSorted          (1 << 6) /* Z sorted rendering of non-opaque objects */
00717 #define kQAFast_CL4              (1 << 7) /* This engine accelerates kQAPixel_CL4 */
00718 #define kQAFast_CL8              (1 << 8) /* This engine accelerates kQAPixel_CL8 */
00719 
00720 /************************************************************************************************
00721  *
00722  * Macro definitions for the drawing engine methods included in TQADrawContext. These
00723  * macros are the recommended means of accessing the engine's draw methods, e.g:
00724  *
00725  *    TQADrawContext *drawContext;
00726  *    TQAVTexture    vertices[3];
00727  *
00728  *    drawContext = QADrawContextNew (rect, gdevice, engine, kQAContext_ZBuffer);
00729  *    ...
00730  *    QASetInt (drawContext, kQATag_ZFunction, kQAZFunction_LT);
00731  *    QADrawTriGouraud (drawContext, &vertices[0], &vertices[1], &vertices[2], kQATriFlags_None);
00732  *
00733  * Note that QARenderStart(), QARenderEnd(), QAFlush() and QASync() have real function
00734  * definitions instead of macros. This is because these functions can afford the extra
00735  * per-call overhead of a function layer (which makes application code a little smaller),
00736  * and to allow a cleaner implementation of handling NULL parameters to QARenderStart().
00737  *
00738  ***********************************************************************************************/
00739 
00740 #define QASetFloat(drawContext,tag,newValue) \
00741       (drawContext)->setFloat (drawContext,tag,newValue)
00742 
00743 #define QASetInt(drawContext,tag,newValue) \
00744       (drawContext)->setInt (drawContext,tag,newValue)
00745 
00746 #define QASetPtr(drawContext,tag,newValue) \
00747       (drawContext)->setPtr (drawContext,tag,newValue)
00748 
00749 #define QAGetFloat(drawContext,tag) \
00750       (drawContext)->getFloat (drawContext,tag)
00751 
00752 #define QAGetInt(drawContext,tag) \
00753       (drawContext)->getInt (drawContext,tag)
00754 
00755 #define QAGetPtr(drawContext,tag) \
00756       (drawContext)->getPtr (drawContext,tag)
00757 
00758 #define QADrawPoint(drawContext,v) \
00759       (drawContext)->drawPoint (drawContext,v)
00760 
00761 #define QADrawLine(drawContext,v0,v1) \
00762       (drawContext)->drawLine (drawContext,v0,v1)
00763 
00764 #define QADrawTriGouraud(drawContext,v0,v1,v2,flags) \
00765       (drawContext)->drawTriGouraud (drawContext,v0,v1,v2,flags)
00766 
00767 #define QADrawTriTexture(drawContext,v0,v1,v2,flags) \
00768       (drawContext)->drawTriTexture (drawContext,v0,v1,v2,flags)
00769 
00770 #define QASubmitVerticesGouraud(drawContext,nVertices,vertices) \
00771       (drawContext)->submitVerticesGouraud(drawContext,nVertices,vertices)
00772       
00773 #define QASubmitVerticesTexture(drawContext,nVertices,vertices) \
00774       (drawContext)->submitVerticesTexture(drawContext,nVertices,vertices)
00775       
00776 #define QADrawTriMeshGouraud(drawContext,nTriangle,triangles) \
00777       (drawContext)->drawTriMeshGouraud (drawContext,nTriangle,triangles)
00778 
00779 #define QADrawTriMeshTexture(drawContext,nTriangle,triangles) \
00780       (drawContext)->drawTriMeshTexture (drawContext,nTriangle,triangles)
00781 
00782 #define QADrawVGouraud(drawContext,nVertices,vertexMode,vertices,flags) \
00783       (drawContext)->drawVGouraud (drawContext,nVertices,vertexMode,vertices,flags)
00784 
00785 #define QADrawVTexture(drawContext,nVertices,vertexMode,vertices,flags) \
00786       (drawContext)->drawVTexture (drawContext,nVertices,vertexMode,vertices,flags)
00787 
00788 #define QADrawBitmap(drawContext,v,bitmap) \
00789       (drawContext)->drawBitmap (drawContext,v,bitmap)
00790 
00791 #define QARenderStart(drawContext,dirtyRect,initialContext) \
00792       (drawContext)->renderStart (drawContext,dirtyRect,initialContext)
00793 
00794 #define QARenderEnd(drawContext,modifiedRect) \
00795       (drawContext)->renderEnd (drawContext,modifiedRect)
00796 
00797 #define QARenderAbort(drawContext) \
00798       (drawContext)->renderAbort (drawContext)
00799 
00800 #define QAFlush(drawContext) \
00801       (drawContext)->flush (drawContext)
00802 
00803 #define QASync(drawContext) \
00804       (drawContext)->sync (drawContext)
00805 
00806 #define QASetNoticeMethod(drawContext, method, completionCallBack, refCon) \
00807       (drawContext)->setNoticeMethod (drawContext, method, completionCallBack, refCon)
00808 
00809 #define QAGetNoticeMethod(drawContext, method, completionCallBack, refCon) \
00810       (drawContext)->getNoticeMethod (drawContext, method, completionCallBack, refCon)
00811 
00812 /************************************************************************************************
00813  *
00814  * Typedefs of draw method functions provided by the drawing engine. One function pointer
00815  * for each of these function types in stored in the TQADrawContext public data structure.
00816  *
00817  * These functions should be accessed through the QA<function>(context,...) macros,
00818  * defined above.
00819  *
00820  ***********************************************************************************************/
00821 
00822 typedef void (RAVE_CALLBACK *TQAStandardNoticeMethod)(
00823    const TQADrawContext *drawContext,     /* Draw context */
00824    void              *refCon);         /* user define parameter */
00825 
00826 typedef void (RAVE_CALLBACK *TQABufferNoticeMethod)(
00827    const TQADrawContext *drawContext,     /* Draw context */
00828    const TQADevice         *buffer,       /* TQADevice describing back buffer */
00829    const TQARect        *dirtyRect,       /* Minimum area to process; NULL means whole buffer */
00830    void              *refCon);         /* user define parameter */
00831 
00832 typedef union TQANoticeMethod
00833 {
00834    TQAStandardNoticeMethod standardNoticeMethod;   /* Used for non-buffer related methods */
00835    TQABufferNoticeMethod   bufferNoticeMethod;     /* Used for buffer handling methods */
00836    
00837 } TQANoticeMethod;
00838 
00839 typedef void (RAVE_CALLBACK *TQASetFloat) (
00840    TQADrawContext       *drawContext,     /* Draw context */
00841    TQATagFloat          tag,           /* Tag of variable to set */
00842    float             newValue);        /* New value for variable */
00843 
00844 typedef void (RAVE_CALLBACK *TQASetInt) (
00845    TQADrawContext       *drawContext,     /* Draw context */
00846    TQATagInt            tag,           /* Tag of variable to set */
00847    unsigned long        newValue);        /* New value for variable */
00848 
00849 typedef void (RAVE_CALLBACK *TQASetPtr) (
00850    TQADrawContext       *drawContext,     /* Draw context */
00851    TQATagPtr            tag,           /* Tag of variable to set */
00852    const void           *newValue);       /* New value for variable */
00853 
00854 typedef float (RAVE_CALLBACK *TQAGetFloat) (
00855    const TQADrawContext *drawContext,     /* Draw context */
00856    TQATagFloat          tag);          /* Tag of variable to get */
00857 
00858 typedef unsigned long (RAVE_CALLBACK *TQAGetInt) (
00859    const TQADrawContext *drawContext,     /* Draw context */
00860    TQATagInt            tag);          /* Tag of variable to get */
00861 
00862 typedef void *(RAVE_CALLBACK *TQAGetPtr) (
00863    const TQADrawContext *drawContext,     /* Draw context */
00864    TQATagPtr            tag);          /* Tag of variable to get */
00865 
00866 typedef void (RAVE_CALLBACK *TQADrawPoint) (
00867    const TQADrawContext *drawContext,     /* Draw context */
00868    const TQAVGouraud    *v);           /* Vertex */
00869 
00870 typedef void (RAVE_CALLBACK *TQADrawLine) (
00871    const TQADrawContext *drawContext,     /* Draw context */
00872    const TQAVGouraud       *v0,           /* Vertex 0 */
00873    const TQAVGouraud       *v1);          /* Vertex 1 */
00874 
00875 typedef void (RAVE_CALLBACK *TQADrawTriGouraud) (
00876    const TQADrawContext *drawContext,     /* Draw context */
00877    const TQAVGouraud       *v0,           /* Vertex 0 */
00878    const TQAVGouraud       *v1,           /* Vertex 1 */
00879    const TQAVGouraud       *v2,           /* Vertex 2 */
00880    unsigned long        flags);           /* Mask of kQATriFlags_xxx flags */
00881 
00882 typedef void (RAVE_CALLBACK *TQADrawTriTexture) (
00883    const TQADrawContext *drawContext,     /* Draw context */
00884    const TQAVTexture       *v0,           /* Vertex 0 */
00885    const TQAVTexture       *v1,           /* Vertex 1 */
00886    const TQAVTexture       *v2,           /* Vertex 2 */
00887    unsigned long        flags);           /* Mask of kQATriFlags_xxx flags */
00888 
00889 typedef void (RAVE_CALLBACK *TQASubmitVerticesGouraud) (
00890    const TQADrawContext    *drawContext,  /* Draw context */
00891    unsigned long           nVertices,     /* Number of vertices */
00892    const TQAVGouraud       *vertices);    /* Array of vertices */
00893    
00894 typedef void (RAVE_CALLBACK *TQASubmitVerticesTexture) (
00895    const TQADrawContext    *drawContext,  /* Draw context */
00896    unsigned long           nVertices,     /* Number of vertices */
00897    const TQAVTexture       *vertices);    /* Array of vertices */
00898    
00899 typedef void (RAVE_CALLBACK *TQADrawTriMeshGouraud) (
00900    const TQADrawContext    *drawContext,  /* Draw context */
00901    unsigned long           nTriangles,    /* Number of triangles */
00902    const TQAIndexedTriangle   *triangles);   /* Array of triangles */
00903    
00904 typedef void (RAVE_CALLBACK *TQADrawTriMeshTexture) (
00905    const TQADrawContext    *drawContext,  /* Draw context */
00906    unsigned long           nTriangles,    /* Number of triangles */
00907    const TQAIndexedTriangle   *triangles);   /* Array of triangles */
00908 
00909 typedef void (RAVE_CALLBACK *TQADrawVGouraud) (
00910    const TQADrawContext *drawContext,     /* Draw context */
00911    unsigned long        nVertices,        /* Number of vertices */
00912    TQAVertexMode        vertexMode,       /* One of kQAVertexMode_xxx enumerated values */
00913    const TQAVGouraud       vertices[],       /* Array of vertices */
00914    const unsigned long     flags[]);         /* Array of per-triangle flags (or NULL) */
00915 
00916 typedef void (RAVE_CALLBACK *TQADrawVTexture) (
00917    const TQADrawContext *drawContext,     /* Draw context */
00918    unsigned long        nVertices,        /* Number of vertices */
00919    TQAVertexMode        vertexMode,       /* One of kQAVertexMode_xxx enumerated values */
00920    const TQAVTexture       vertices[],       /* Array of vertices */
00921    const unsigned long     flags[]);         /* Array of per-triangle flags (or NULL) */
00922 
00923 typedef void (RAVE_CALLBACK *TQADrawBitmap) (
00924    const TQADrawContext *drawContext,     /* Draw context */
00925    const TQAVGouraud       *v,               /* xyz, and (if a 1 bit/pixel bitmap) argb */
00926    TQABitmap            *bitmap);         /* Previously allocated by QABitmapNew() */
00927 
00928 typedef void (RAVE_CALLBACK *TQARenderStart) (
00929    const TQADrawContext *drawContext,     /* Draw context */
00930    const TQARect        *dirtyRect,       /* Minimum area to clear; NULL means whole buffer */
00931    const TQADrawContext *initialContext); /* Initial background image (or NULL) */
00932 
00933 typedef TQAError (RAVE_CALLBACK *TQARenderEnd) (
00934    const TQADrawContext *drawContext,     /* Draw context */
00935    const TQARect        *modifiedRect);      /* Minimum area to swap; NULL means whole buffer */
00936 
00937 typedef TQAError (RAVE_CALLBACK *TQARenderAbort) (
00938    const TQADrawContext *drawContext);    /* Draw context */
00939 
00940 typedef TQAError (RAVE_CALLBACK *TQAFlush) (
00941    const TQADrawContext *drawContext);    /* Draw context */
00942 
00943 typedef TQAError (RAVE_CALLBACK *TQASync) (
00944    const TQADrawContext *drawContext);    /* Draw context */
00945 
00946 typedef TQAError (RAVE_CALLBACK *TQASetNoticeMethod)(
00947    const TQADrawContext *drawContext,     /* Draw context */
00948    TQAMethodSelector    method,
00949    TQANoticeMethod         completionCallBack,
00950    void              *refCon);
00951 
00952 typedef TQAError (RAVE_CALLBACK * TQAGetNoticeMethod)(
00953    const TQADrawContext *drawContext,     /* Draw context */
00954    TQAMethodSelector    method,
00955    TQANoticeMethod         *completionCallBack,
00956    void              **refCon);
00957 
00958 /************************************************************************************************
00959  *
00960  * Public TQADrawContext structure. This contains function pointers for the chosen
00961  * drawing engine.
00962  *
00963  ***********************************************************************************************/
00964 
00965 /*
00966  * TQAVersion sets the TQADrawContext 'version' field. It is set by
00967  * the manager to indicate the version of the TQADrawContext structure.
00968  */
00969 
00970 typedef enum TQAVersion
00971 {
00972    kQAVersion_Prerelease      = 0,
00973    kQAVersion_1_0          = 1,
00974    kQAVersion_1_0_5        = 2,        /* Added tri mesh functions, color tables */
00975    kQAVersion_1_5          = 3            /* Added call backs, texture compression, and new error return code */
00976 
00977 } TQAVersion;
00978 
00979 struct TQADrawContext
00980 {
00981    TQADrawPrivate       *drawPrivate;     /* Engine's private data for this context */
00982    const TQAVersion     version;       /* Version number */
00983    TQASetFloat          setFloat;         /* Method: Set a float state variable */
00984    TQASetInt            setInt;           /* Method: Set an unsigned long state variable */
00985    TQASetPtr            setPtr;           /* Method: Set an unsigned long state variable */
00986    TQAGetFloat          getFloat;         /* Method: Get a float state variable */
00987    TQAGetInt            getInt;           /* Method: Get an unsigned long state variable */
00988    TQAGetPtr            getPtr;           /* Method: Get an pointer state variable */
00989    TQADrawPoint         drawPoint;        /* Method: Draw a point */
00990    TQADrawLine          drawLine;         /* Method: Draw a line */
00991    TQADrawTriGouraud    drawTriGouraud;      /* Method: Draw a Gouraud shaded triangle */
00992    TQADrawTriTexture    drawTriTexture;      /* Method: Draw a texture mapped triangle */
00993    TQADrawVGouraud         drawVGouraud;     /* Method: Draw Gouraud vertices */
00994    TQADrawVTexture         drawVTexture;     /* Method: Draw texture vertices */
00995    TQADrawBitmap        drawBitmap;       /* Method: Draw a bitmap */
00996    TQARenderStart       renderStart;      /* Method: Initialize for rendering */
00997    TQARenderEnd         renderEnd;        /* Method: Complete rendering and display */
00998    TQARenderAbort       renderAbort;      /* Method: Abort any outstanding rendering (blocking) */
00999    TQAFlush          flush;            /* Method: Start render of any queued commands (non-blocking) */
01000    TQASync              sync;          /* Method: Wait for completion of all rendering (blocking) */
01001    TQASubmitVerticesGouraud   submitVerticesGouraud;  /* Method: Submit Gouraud vertices for trimesh */
01002    TQASubmitVerticesTexture   submitVerticesTexture;  /* Method: Submit Texture vertices for trimesh */
01003    TQADrawTriMeshGouraud      drawTriMeshGouraud;     /* Method: Draw a Gouraud triangle mesh */
01004    TQADrawTriMeshTexture      drawTriMeshTexture;     /* Method: Draw a Texture triangle mesh */
01005    TQASetNoticeMethod         setNoticeMethod;     /* Method: Set a notice method */
01006    TQAGetNoticeMethod         getNoticeMethod;     /* Method: Get a notice method */
01007 };
01008 
01009 /************************************************************************************************
01010  *
01011  * Acceleration manager function prototypes.
01012  *
01013  ***********************************************************************************************/
01014 
01015 RAVE_EXPORT TQAError RAVE_CALL QADrawContextNew (
01016    const TQADevice   *device,          /* Target device */
01017    const TQARect  *rect,               /* Target rectangle (device coordinates) */
01018    const TQAClip  *clip,               /* 2D clip region */
01019    const TQAEngine   *engine,          /* Drawing engine to use */
01020    unsigned long  flags,               /* Mask of kQAContext_xxx */
01021    TQADrawContext **newDrawContext);      /* (Out) Newly created TQADrawContext */
01022 
01023 RAVE_EXPORT void RAVE_CALL QADrawContextDelete (
01024    TQADrawContext *drawContext);       /* Context to delete */
01025 
01026 RAVE_EXPORT TQAError RAVE_CALL QAColorTableNew(
01027    const TQAEngine      *engine,       /* Drawing engine to use */
01028    TQAColorTableType tableType,        /* Depth, color space, etc. */
01029    void           *pixelData,       /* lookup table entries in pixelType format */
01030    long           transparentIndexFlag,   /* boolean, false means no transparency, true means index 0 is transparent */
01031    TQAColorTable     **newTable);      /* (Out) Newly created TQAColorTable */
01032 
01033 RAVE_EXPORT void RAVE_CALL QAColorTableDelete(
01034    const TQAEngine      *engine,       /* Drawing engine to use */
01035    TQAColorTable     *colorTable);     /* Previously allocated by QAColorTableNew() */
01036 
01037 RAVE_EXPORT TQAError RAVE_CALL QATextureNew (
01038    const TQAEngine      *engine,       /* Drawing engine to use */
01039    unsigned long     flags,            /* Mask of kQATexture_xxx flags */
01040    TQAImagePixelType pixelType,        /* Depth, color space, etc. */
01041    const TQAImage    images[],         /* Image(s) for texture */
01042    TQATexture        **newTexture);    /* (Out) Newly created TQATexture, or NULL on error */ 
01043 
01044 RAVE_EXPORT TQAError RAVE_CALL QATextureDetach (
01045    const TQAEngine      *engine,       /* Drawing engine to use */
01046    TQATexture        *texture);        /* Previously allocated by QATextureNew() */
01047 
01048 RAVE_EXPORT void RAVE_CALL QATextureDelete (
01049    const TQAEngine      *engine,       /* Drawing engine to use */
01050    TQATexture        *texture);        /* Previously allocated by QATextureNew() */
01051 
01052 RAVE_EXPORT TQAError RAVE_CALL QATextureBindColorTable(
01053    const TQAEngine      *engine,       /* Drawing engine to use */
01054    TQATexture        *texture,         /* Previously allocated by QATextureNew() */
01055    TQAColorTable     *colorTable);     /* Previously allocated by QAColorTableNew() */
01056    
01057 RAVE_EXPORT TQAError RAVE_CALL QABitmapNew (
01058    const TQAEngine      *engine,       /* Drawing engine to use */
01059    unsigned long     flags,            /* Mask of kQABitmap_xxx flags */
01060    TQAImagePixelType pixelType,        /* Depth, color space, etc. */
01061    const TQAImage    *image,           /* Image */
01062    TQABitmap         **newBitmap);     /* (Out) Newly created TQABitmap, or NULL on error */ 
01063 
01064 RAVE_EXPORT TQAError RAVE_CALL QABitmapDetach (
01065    const TQAEngine      *engine,       /* Drawing engine to use */
01066    TQABitmap         *bitmap);         /* Previously allocated by QABitmapNew() */
01067 
01068 RAVE_EXPORT void RAVE_CALL QABitmapDelete (
01069    const TQAEngine      *engine,       /* Drawing engine to use */
01070    TQABitmap         *bitmap);         /* Previously allocated by QABitmapNew() */
01071 
01072 RAVE_EXPORT TQAError RAVE_CALL QABitmapBindColorTable(
01073    const TQAEngine      *engine,       /* Drawing engine to use */
01074    TQABitmap         *bitmap,       /* Previously allocated by QABitmapNew() */
01075    TQAColorTable     *colorTable);     /* Previously allocated by QAColorTableNew() */
01076    
01077 RAVE_EXPORT TQAEngine *RAVE_CALL QADeviceGetFirstEngine (
01078    const TQADevice   *device);            /* Target device */
01079 
01080 RAVE_EXPORT TQAEngine *RAVE_CALL QADeviceGetNextEngine (
01081    const TQADevice   *device,          /* Target device */
01082    const TQAEngine   *currentEngine);     /* Engine after 'currentEngine' is returned */
01083 
01084 RAVE_EXPORT TQAError RAVE_CALL QAEngineCheckDevice (
01085    const TQAEngine   *engine,          /* Engine to check on 'device' */
01086    const TQADevice   *device);            /* Target device */
01087 
01088 RAVE_EXPORT TQAError RAVE_CALL QAEngineGestalt (
01089    const TQAEngine      *engine,       /* Engine being queried */
01090    TQAGestaltSelector   selector,         /* Gestalt parameter being requested */
01091    void           *response);       /* Buffer that receives response */
01092 
01093 RAVE_EXPORT TQAError RAVE_CALL QAEngineEnable (
01094    long        vendorID,            /* Vendor ID of engine to enable */
01095    long        engineID);           /* Engine ID of engine to enable */
01096 
01097 RAVE_EXPORT TQAError RAVE_CALL QAEngineDisable (
01098    long        vendorID,            /* Vendor ID of engine to disable */
01099    long        engineID);           /* Engine ID of engine to disable */
01100 
01101 #ifdef __cplusplus
01102 }
01103 #endif
01104 
01105 #endif /* _RAVE_h */

This A:M SDK v12.0 documentation is maintained by Hash Inc. Please address any comments concerning this documentation to AMReports. If you have any information, knowledge, or documentation to share with the A:M developer community, please post them on the Hash SDK forum.

Generated on Thu Oct 27 11:46:45 2005 with doxygen 1.4.5 written by Dimitri van Heesch, © 1997-2001