Test Code/TinselTest.h

/******************************************************************************
 **                                                                          **
 **     Module:     TinselTest.h                                             **
 **                                                                          **
 **     Purpose:    Include file for Tinsel Town test app                    **
 **                                                                          **
 **     Author:     Mike W. Kelley                                           **
 **                                                                          **
 **                 2/3/95  Revised for 0.9 SDK release                      **
 **                                                                          **
 **     Copyright (C) 1994-95 Apple Computer, Inc.  All rights reserved.     **
 **                                                                          **
 *****************************************************************************/
 
#define kTinselWindows              2
#define kDeviceWindowBorder         20
#define kTinselMaxWindowSize        350
#define kWindowClipBoundary         20
#define kClipRoundRect              20
#define kTextureSizeNBits           8
#define kTextureSize                (1<<kTextureSizeNBits)
 
/* kStyle... are constants that switch between the available styles */
#define kStyleSingleBuffered        0
#define kStyleDoubleBuffered        1
#define kStyleSingleBufferedClip    2
#define kStyleDoubleBufferedClip    3
 
#define kMaxStyle                   kStyleDoubleBufferedClip
 
/* kTest... are constants that switch between the available tests */
#define kTestPoints                 0
#define kTestLines                  1
#define kTestTriGouraud             2
#define kTestTriTexture             3
 
#define kMaxTest                    kTestTriTexture
 
/* kN... set the number of primitives drawn in the kTinsel... tests */
/* kNFlush sets how many times flush is called per frame */
#define kNPoints                    10000
#define kNLines                     1000
#define kNTris                      100
#define kNFlushes                   5
 
/*
 * Global variables.
 */
 
extern  long            gWindowWidth, gWindowHeight;
extern  TQAEngine       *gEngine [kTinselWindows];
extern  TQADrawContext  *gDrawContext [kTinselWindows];
extern  TQATexture      *gTexture [kTinselWindows];
 
/*
 * Handy datatypes.
 */
 
typedef struct TexturePixel
{
    unsigned char       a;      /* D31:24 */
    unsigned char       r;      /* D23:16 */
    unsigned char       g;      /* D15:8 */
    unsigned char       b;      /* D7:0 */
} TexturePixel;
 
/*
 * Function prototypes.
 */
 
void InitToolbox (void);
 
Boolean CreateTestWindows (
    long            maxWidth,
    long            maxHeight);
 
Boolean CreateWindowClip (
    void);
 
void ClearWindows (
    void);
 
TQATexture *CreateMipMapTexture (
    TQAEngine       *engine,
    TexturePixel    *pixmap,
    long            rowBytes,
    long            widthNBits,
    long            heightNBits);
 
void TinselError (
    const char      *message);
 
/*
 * Test functions. These all operate on all the open test windows.
 */
 
void TestRandomVGouraud (
    TQAVGouraud         *v);
 
void TestRandomVTexture (
    TQAVTexture     *v);
 
Boolean TestDrawContextNew (
    unsigned long   flags,
    Boolean         do2DClipping);
 
void TestDrawContextDelete (
    void);
 
Boolean TestTextureNew (
    void);
 
void TestRenderStart (
    void);
 
void TestRenderEnd (
    void);
 
void TestSetStateTexture (
    void);
 
void TestFlush (
    void);
 
void TestDrawPoint (
    const TQAVGouraud   *v);
 
void TestDrawLine (
    const TQAVGouraud   *v0,
    const TQAVGouraud   *v1);
 
void TestDrawTriGouraud (
    const TQAVGouraud   *v0,
    const TQAVGouraud   *v1,
    const TQAVGouraud   *v2,
    unsigned long       flags);
 
void TestDrawTriTexture (
    const TQAVTexture   *v0,
    const TQAVTexture   *v1,
    const TQAVTexture   *v2,
    unsigned long       flags);