RADIO.H
上传用户:zbjingming
上传日期:2010-01-02
资源大小:2436k
文件大小:4k
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- #include <windows.h>
- #include <GL/gl.h>
- #include <GL/glu.h>
- #include <GL/glaux.h>
- /* Head file for display model */
- #define CHARS signed char /* 1 byte signed char */
- #define CHARU unsigned char /* 1 byte unsigned char */
- #define INT2S signed short /* 2 byte signed int */
- #define INT2U unsigned short /* 2 byte unsigned int */
- #define INT4S signed long /* 4 byte signed int */
- #define INT4U unsigned long /* 4 byte unsigned int */
- #define INT8U unsigned long long /* 8 byte unsigned int */
- #define FLOAT float /* 4 byte */
- /* for material type */
- #define DIFFUSE 1
- #define SPECULAR 2
- #define TRANSPARENT 4
- #define ENERGY 8
- #define SAMEKD 16
- #define SAMEKS 32
- #define SAMEKT 64
- /* for image type */
- #define NOIMAGE 0
- #define COLOR2 1
- #define COLOR16 4
- #define COLOR256 8
- #define HIGHCOLOR 16
- #define TRUECOLOR 24
- #define ALPHACOLOR 32
- /* Patch type */
- #define cTRIANGLE 't'
- #define cQUADRIC 'q'
- /* Texture mapping type */
- #define CLAMP_TEXTURE 0
- #define REPEAT_TEXTURE 1
- /* Data struct */
- typedef struct texture_2d
- {
- char fname[30];
- INT2U type; /* CLAMP_TEXTURE or REPEAT_TEXTEXTURE */
- } TEXTURE_2D;
- typedef struct FILEHEAD
- {
- char bftype[2];
- long bfsize;
- long reserved;
- long address;
- long size;
- long width;
- long height;
- int plane;
- int bitcount;
- long compress;
- long sizeImage;
- long Xpelspermeter;
- long Ypelspermeter;
- long IrUsed;
- long CRrImportant;
- } bmphead;
- typedef struct point /* point in 3D */
- {
- FLOAT x, y, z; /* 3D coordinate */
- FLOAT r, g, b; /* color */
- FLOAT u, v; /* texture coordinate */
- } POINT3D;
- typedef struct surface /* surface */
- {
- INT4U pointn; /* point number */
- INT4U triangle; /* triangle number */
- INT4U quadric; /* quadrangle number */
- POINT3D *pointlist; /* points list */
- INT4U *patchlist; /* patches list(list of point No.)*/
- INT4U texId; /* texture index */
- } SURFACE;
- typedef struct object /* OBJECT */
- {
- INT4U SurfNum; /* surface number and list size*/
- SURFACE *surflist; /* surfaces list in the object*/
- } OBJECT;
- /************************************************************************/
- #define INTS int
- #define REAL float
- #define Error 0
- #define NoError 1
- #define FALSE 0
- #define TRUE 1
- #define MINREAL 1.0e-5
- #define MAXREAL 1.0e10
- #define MAXINTS (0x7f<<24)
- #define zero(x) fabs(x) < MINREAL
- #define upint(x) (INTS)(x+1-MINREAL)
- #define addr(i,j) (long)(j)*cam.width+i
- #define MIN(x,y) ((x)<(y)?(x):(y))
- #define LEFT_EG 0x01
- #define RIGHT_EG 0x02
- #define HORIZ 0x04
- #define DCV 0x08
- #define UCV 0x10
- #define MAX_TEX 20
- /************************************************************************/
- extern unsigned char *OpenTexImage( INT2U TexIndex, INT2U *rslx, INT2U *rsly );
- extern void freelist();
- extern void InitRenderWin();
- extern void Render(void);
- extern void write_rgb(char *filename);
- extern void CALLBACK myReshape(int w, int h);
- extern void Hemi_mode();
- extern void CalcTexKd( int TexIndex, float *Kdr, float *Kdg, float *Kdb );
- extern void InitTex( int TexIndex );
- extern void CloseTex();
- extern void ReadData();
- extern void CALLBACK Shoot(void) ;
- void LoadAllTexture();
- void FreeAllTexture();
- void freelist();
- void InitLookAt();
- unsigned char *ImageDatas[MAX_TEX];
- INT2U rslxs[MAX_TEX], rslys[MAX_TEX];
- int texnum;