Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

flare.h

Go to the documentation of this file.
00001 /* Copyright (C) Yossarian King, 2000. 
00002  * All rights reserved worldwide.
00003  *
00004  * This software is provided "as is" without express or implied
00005  * warranties. You may freely copy and compile this source into
00006  * applications you distribute provided that the copyright text
00007  * below is included in the resulting source code, for example:
00008  * "Portions Copyright (C) Yossarian King, 2000"
00009  */
00010 /************************************************************
00011 
00012     Game Programming Gems
00013     Lens Flare Demo header file.
00014 
00015     Y. King / May 2000
00016     Electronic Arts Canada, Inc.
00017 
00018  ************************************************************/
00019 
00020 // Modified by Alan Baylis 20/10/2002
00021 
00022 #ifndef __FLARE_H
00023 #define __FLARE_H
00024 
00025 /* --- Defines --- */
00026 
00027 #define FLARE_MAXELEMENTSPERFLARE         15
00028 #define FLARE_RANGE(A,B)    ( (rand()%((B)-(A)+1)) + (A) )
00029 #define FLARE_FRANGE(A,B)   ( ((float)(rand()&0xffffff)/(float)0xfffffe)*((B)-(A)) + (A) )
00030 #define MAKEID(a,b,c,d)     (((a)<<24) | ((b)<<16) | ((c)<<8) | ((d)<<0))
00031 
00032 /* --- Types --- */
00033 
00034 typedef struct FLARE_ELEMENT_DEF
00035 {
00036     struct TEXTURE_DEF  *texture;
00037 
00038     float           fDistance;        // Distance along ray from source (0.0-1.0)
00039     float           fSize;            // Size relative to flare envelope (0.0-1.0)
00040     unsigned int    argb;            // ARGB for intensity mapping
00041 }
00042     FLARE_ELEMENT_DEF;
00043 
00044 typedef struct FLARE_DEF
00045 {
00046     float           fScale;     // Scale factor for adjusting overall size of flare elements.
00047     float           fMaxSize;   // Max size of largest element, as proportion of screen width (0.0-1.0)
00048     int             nPieces;    // Number of elements in use
00049 
00050 
00051     FLARE_ELEMENT_DEF    element[FLARE_MAXELEMENTSPERFLARE];
00052 }
00053     FLARE_DEF;
00054 
00055 /* --- Prototypes --- */
00056 void    FLARE_randomize(FLARE_DEF *flare,
00057                         int nTextures,
00058                         int nPieces,
00059                         float fMaxSize,
00060                         unsigned int minColour,
00061                         unsigned int maxColour);
00062 
00063 void    FLARE_render(FLARE_DEF *flare, int lx, int ly, int cx, int cy);
00064 void    drawQuad( int x, int y, int width, int height, TEXTURE_DEF *tex, unsigned int colour );
00065 TEXTURE_DEF *TM_getNthTexture( int n );
00066 TEXTURE_DEF *TM_getNamedTexture( char *name );
00067 void    TM_loadTextures( void );
00068 void    loadFlareFile( FLARE_DEF *flare, char *filename );
00069 void    newFlare( int bFromFile );
00070 void  DrawLensFlare();
00071 void InitializeLensFlare();
00072 void ResetLensFlare();
00073 void CleanupLensFlare();
00074 
00075 #endif __FLARE_H_

Generated on Fri Dec 23 05:21:20 2005 for Skybox by doxygen1.2.15