mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-22 12:41:21 +00:00
Reformat the refresher
This commit is contained in:
parent
b1ddebf552
commit
6f719f4c7b
20 changed files with 4064 additions and 3798 deletions
|
@ -30,7 +30,9 @@
|
|||
#include <jpeglib.h>
|
||||
#include <jerror.h>
|
||||
|
||||
void jpeg_memory_src(j_decompress_ptr cinfo, unsigned char *inbuffer, unsigned long insize);
|
||||
void jpeg_memory_src(j_decompress_ptr cinfo,
|
||||
unsigned char *inbuffer,
|
||||
unsigned long insize);
|
||||
|
||||
void
|
||||
jpg_null(j_decompress_ptr cinfo)
|
||||
|
@ -54,7 +56,10 @@ jpg_skip_input_data(j_decompress_ptr cinfo, long num_bytes)
|
|||
void
|
||||
jpeg_mem_src(j_decompress_ptr cinfo, unsigned char *mem, unsigned long len)
|
||||
{
|
||||
cinfo->src = (struct jpeg_source_mgr *)(*cinfo->mem->alloc_small)((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof(struct jpeg_source_mgr));
|
||||
cinfo->src =
|
||||
(struct jpeg_source_mgr *)(*cinfo->mem->alloc_small)((j_common_ptr)
|
||||
cinfo,
|
||||
JPOOL_PERMANENT, sizeof(struct jpeg_source_mgr));
|
||||
cinfo->src->init_source = jpg_null;
|
||||
cinfo->src->fill_input_buffer = jpg_fill_input_buffer;
|
||||
cinfo->src->skip_input_data = jpg_skip_input_data;
|
||||
|
@ -97,7 +102,8 @@ LoadJPG(char *origname, byte **pic, int *width, int *height)
|
|||
return;
|
||||
}
|
||||
|
||||
if ((rawsize < 10) || (rawdata[6] != 'J') || (rawdata[7] != 'F') || (rawdata[8] != 'I') || (rawdata[9] != 'F'))
|
||||
if ((rawsize < 10) || (rawdata[6] != 'J') || (rawdata[7] != 'F') ||
|
||||
(rawdata[8] != 'I') || (rawdata[9] != 'F'))
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "Invalid JPEG header: %s\n", filename);
|
||||
ri.FS_FreeFile(rawdata);
|
||||
|
@ -138,7 +144,8 @@ LoadJPG(char *origname, byte **pic, int *width, int *height)
|
|||
|
||||
if (!scanline)
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "Insufficient memory for JPEG scanline buffer\n");
|
||||
ri.Con_Printf(PRINT_ALL,
|
||||
"Insufficient memory for JPEG scanline buffer\n");
|
||||
free(rgbadata);
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
ri.FS_FreeFile(rawdata);
|
||||
|
|
|
@ -27,133 +27,137 @@
|
|||
#include "../header/local.h"
|
||||
|
||||
void
|
||||
LoadMD2 ( model_t *mod, void *buffer )
|
||||
LoadMD2(model_t *mod, void *buffer)
|
||||
{
|
||||
int i, j;
|
||||
dmdl_t *pinmodel, *pheader;
|
||||
dstvert_t *pinst, *poutst;
|
||||
dtriangle_t *pintri, *pouttri;
|
||||
daliasframe_t *pinframe, *poutframe;
|
||||
int *pincmd, *poutcmd;
|
||||
dmdl_t *pinmodel, *pheader;
|
||||
dstvert_t *pinst, *poutst;
|
||||
dtriangle_t *pintri, *pouttri;
|
||||
daliasframe_t *pinframe, *poutframe;
|
||||
int *pincmd, *poutcmd;
|
||||
int version;
|
||||
|
||||
pinmodel = (dmdl_t *) buffer;
|
||||
pinmodel = (dmdl_t *)buffer;
|
||||
|
||||
version = LittleLong( pinmodel->version );
|
||||
version = LittleLong(pinmodel->version);
|
||||
|
||||
if ( version != ALIAS_VERSION )
|
||||
if (version != ALIAS_VERSION)
|
||||
{
|
||||
ri.Sys_Error( ERR_DROP, "%s has wrong version number (%i should be %i)",
|
||||
mod->name, version, ALIAS_VERSION );
|
||||
ri.Sys_Error(ERR_DROP, "%s has wrong version number (%i should be %i)",
|
||||
mod->name, version, ALIAS_VERSION);
|
||||
}
|
||||
|
||||
pheader = Hunk_Alloc( LittleLong( pinmodel->ofs_end ) );
|
||||
pheader = Hunk_Alloc(LittleLong(pinmodel->ofs_end));
|
||||
|
||||
/* byte swap the header fields and sanity check */
|
||||
for ( i = 0; i < sizeof ( dmdl_t ) / 4; i++ )
|
||||
for (i = 0; i < sizeof(dmdl_t) / 4; i++)
|
||||
{
|
||||
( (int *) pheader ) [ i ] = LittleLong( ( (int *) buffer ) [ i ] );
|
||||
((int *)pheader)[i] = LittleLong(((int *)buffer)[i]);
|
||||
}
|
||||
|
||||
if ( pheader->skinheight > MAX_LBM_HEIGHT )
|
||||
if (pheader->skinheight > MAX_LBM_HEIGHT)
|
||||
{
|
||||
ri.Sys_Error( ERR_DROP, "model %s has a skin taller than %d", mod->name,
|
||||
MAX_LBM_HEIGHT );
|
||||
ri.Sys_Error(ERR_DROP, "model %s has a skin taller than %d", mod->name,
|
||||
MAX_LBM_HEIGHT);
|
||||
}
|
||||
|
||||
if ( pheader->num_xyz <= 0 )
|
||||
if (pheader->num_xyz <= 0)
|
||||
{
|
||||
ri.Sys_Error( ERR_DROP, "model %s has no vertices", mod->name );
|
||||
ri.Sys_Error(ERR_DROP, "model %s has no vertices", mod->name);
|
||||
}
|
||||
|
||||
if ( pheader->num_xyz > MAX_VERTS )
|
||||
if (pheader->num_xyz > MAX_VERTS)
|
||||
{
|
||||
ri.Sys_Error( ERR_DROP, "model %s has too many vertices", mod->name );
|
||||
ri.Sys_Error(ERR_DROP, "model %s has too many vertices", mod->name);
|
||||
}
|
||||
|
||||
if ( pheader->num_st <= 0 )
|
||||
if (pheader->num_st <= 0)
|
||||
{
|
||||
ri.Sys_Error( ERR_DROP, "model %s has no st vertices", mod->name );
|
||||
ri.Sys_Error(ERR_DROP, "model %s has no st vertices", mod->name);
|
||||
}
|
||||
|
||||
if ( pheader->num_tris <= 0 )
|
||||
if (pheader->num_tris <= 0)
|
||||
{
|
||||
ri.Sys_Error( ERR_DROP, "model %s has no triangles", mod->name );
|
||||
ri.Sys_Error(ERR_DROP, "model %s has no triangles", mod->name);
|
||||
}
|
||||
|
||||
if ( pheader->num_frames <= 0 )
|
||||
if (pheader->num_frames <= 0)
|
||||
{
|
||||
ri.Sys_Error( ERR_DROP, "model %s has no frames", mod->name );
|
||||
ri.Sys_Error(ERR_DROP, "model %s has no frames", mod->name);
|
||||
}
|
||||
|
||||
/* load base s and t vertices (not used in gl version) */
|
||||
pinst = (dstvert_t *) ( (byte *) pinmodel + pheader->ofs_st );
|
||||
poutst = (dstvert_t *) ( (byte *) pheader + pheader->ofs_st );
|
||||
pinst = (dstvert_t *)((byte *)pinmodel + pheader->ofs_st);
|
||||
poutst = (dstvert_t *)((byte *)pheader + pheader->ofs_st);
|
||||
|
||||
for ( i = 0; i < pheader->num_st; i++ )
|
||||
for (i = 0; i < pheader->num_st; i++)
|
||||
{
|
||||
poutst [ i ].s = LittleShort( pinst [ i ].s );
|
||||
poutst [ i ].t = LittleShort( pinst [ i ].t );
|
||||
poutst[i].s = LittleShort(pinst[i].s);
|
||||
poutst[i].t = LittleShort(pinst[i].t);
|
||||
}
|
||||
|
||||
/* load triangle lists */
|
||||
pintri = (dtriangle_t *) ( (byte *) pinmodel + pheader->ofs_tris );
|
||||
pouttri = (dtriangle_t *) ( (byte *) pheader + pheader->ofs_tris );
|
||||
pintri = (dtriangle_t *)((byte *)pinmodel + pheader->ofs_tris);
|
||||
pouttri = (dtriangle_t *)((byte *)pheader + pheader->ofs_tris);
|
||||
|
||||
for ( i = 0; i < pheader->num_tris; i++ )
|
||||
for (i = 0; i < pheader->num_tris; i++)
|
||||
{
|
||||
for ( j = 0; j < 3; j++ )
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
pouttri [ i ].index_xyz [ j ] = LittleShort( pintri [ i ].index_xyz [ j ] );
|
||||
pouttri [ i ].index_st [ j ] = LittleShort( pintri [ i ].index_st [ j ] );
|
||||
pouttri[i].index_xyz[j] = LittleShort(pintri[i].index_xyz[j]);
|
||||
pouttri[i].index_st[j] = LittleShort(pintri[i].index_st[j]);
|
||||
}
|
||||
}
|
||||
|
||||
/* load the frames */
|
||||
for ( i = 0; i < pheader->num_frames; i++ )
|
||||
for (i = 0; i < pheader->num_frames; i++)
|
||||
{
|
||||
pinframe = (daliasframe_t *) ( (byte *) pinmodel
|
||||
+ pheader->ofs_frames + i * pheader->framesize );
|
||||
poutframe = (daliasframe_t *) ( (byte *) pheader
|
||||
+ pheader->ofs_frames + i * pheader->framesize );
|
||||
pinframe = (daliasframe_t *)((byte *)pinmodel
|
||||
+ pheader->ofs_frames + i * pheader->framesize);
|
||||
poutframe = (daliasframe_t *)((byte *)pheader
|
||||
+ pheader->ofs_frames + i * pheader->framesize);
|
||||
|
||||
memcpy( poutframe->name, pinframe->name, sizeof ( poutframe->name ) );
|
||||
memcpy(poutframe->name, pinframe->name, sizeof(poutframe->name));
|
||||
|
||||
for ( j = 0; j < 3; j++ )
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
poutframe->scale [ j ] = LittleFloat( pinframe->scale [ j ] );
|
||||
poutframe->translate [ j ] = LittleFloat( pinframe->translate [ j ] );
|
||||
poutframe->scale[j] = LittleFloat(pinframe->scale[j]);
|
||||
poutframe->translate[j] = LittleFloat(pinframe->translate[j]);
|
||||
}
|
||||
|
||||
/* verts are all 8 bit, so no swapping needed */
|
||||
memcpy( poutframe->verts, pinframe->verts,
|
||||
pheader->num_xyz * sizeof ( dtrivertx_t ) );
|
||||
memcpy(poutframe->verts, pinframe->verts,
|
||||
pheader->num_xyz * sizeof(dtrivertx_t));
|
||||
}
|
||||
|
||||
mod->type = mod_alias;
|
||||
|
||||
/* load the glcmds */
|
||||
pincmd = (int *) ( (byte *) pinmodel + pheader->ofs_glcmds );
|
||||
poutcmd = (int *) ( (byte *) pheader + pheader->ofs_glcmds );
|
||||
pincmd = (int *)((byte *)pinmodel + pheader->ofs_glcmds);
|
||||
poutcmd = (int *)((byte *)pheader + pheader->ofs_glcmds);
|
||||
|
||||
for ( i = 0; i < pheader->num_glcmds; i++ )
|
||||
for (i = 0; i < pheader->num_glcmds; i++)
|
||||
{
|
||||
poutcmd [ i ] = LittleLong( pincmd [ i ] );
|
||||
poutcmd[i] = LittleLong(pincmd[i]);
|
||||
}
|
||||
|
||||
/* register all skins */
|
||||
memcpy( (char *) pheader + pheader->ofs_skins, (char *) pinmodel + pheader->ofs_skins,
|
||||
pheader->num_skins * MAX_SKINNAME );
|
||||
memcpy((char *)pheader + pheader->ofs_skins,
|
||||
(char *)pinmodel + pheader->ofs_skins,
|
||||
pheader->num_skins * MAX_SKINNAME);
|
||||
|
||||
for ( i = 0; i < pheader->num_skins; i++ )
|
||||
for (i = 0; i < pheader->num_skins; i++)
|
||||
{
|
||||
mod->skins [ i ] = R_FindImage( (char *) pheader + pheader->ofs_skins + i * MAX_SKINNAME, it_skin );
|
||||
mod->skins[i] = R_FindImage(
|
||||
(char *)pheader + pheader->ofs_skins + i * MAX_SKINNAME,
|
||||
it_skin);
|
||||
}
|
||||
|
||||
mod->mins [ 0 ] = -32;
|
||||
mod->mins [ 1 ] = -32;
|
||||
mod->mins [ 2 ] = -32;
|
||||
mod->maxs [ 0 ] = 32;
|
||||
mod->maxs [ 1 ] = 32;
|
||||
mod->maxs [ 2 ] = 32;
|
||||
mod->mins[0] = -32;
|
||||
mod->mins[1] = -32;
|
||||
mod->mins[2] = -32;
|
||||
mod->maxs[0] = 32;
|
||||
mod->maxs[1] = 32;
|
||||
mod->maxs[2] = 32;
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,9 @@ LoadPCX(char *origname, byte **pic, byte **palette, int *width, int *height)
|
|||
|
||||
raw = &pcx->data;
|
||||
|
||||
if ((pcx->manufacturer != 0x0a) || (pcx->version != 5) || (pcx->encoding != 1) || (pcx->bits_per_pixel != 8) || (pcx->xmax >= 640) || (pcx->ymax >= 480))
|
||||
if ((pcx->manufacturer != 0x0a) || (pcx->version != 5) ||
|
||||
(pcx->encoding != 1) || (pcx->bits_per_pixel != 8) ||
|
||||
(pcx->xmax >= 640) || (pcx->ymax >= 480))
|
||||
{
|
||||
ri.Con_Printf(PRINT_ALL, "Bad pcx file %s\n", filename);
|
||||
return;
|
||||
|
@ -160,3 +162,4 @@ GetPCXInfo(char *filename, int *width, int *height)
|
|||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,41 +29,42 @@
|
|||
extern int modfilelen;
|
||||
|
||||
void
|
||||
LoadSP2 ( model_t *mod, void *buffer )
|
||||
LoadSP2(model_t *mod, void *buffer)
|
||||
{
|
||||
dsprite_t *sprin, *sprout;
|
||||
dsprite_t *sprin, *sprout;
|
||||
int i;
|
||||
|
||||
sprin = (dsprite_t *) buffer;
|
||||
sprout = Hunk_Alloc( modfilelen );
|
||||
sprin = (dsprite_t *)buffer;
|
||||
sprout = Hunk_Alloc(modfilelen);
|
||||
|
||||
sprout->ident = LittleLong( sprin->ident );
|
||||
sprout->version = LittleLong( sprin->version );
|
||||
sprout->numframes = LittleLong( sprin->numframes );
|
||||
sprout->ident = LittleLong(sprin->ident);
|
||||
sprout->version = LittleLong(sprin->version);
|
||||
sprout->numframes = LittleLong(sprin->numframes);
|
||||
|
||||
if ( sprout->version != SPRITE_VERSION )
|
||||
if (sprout->version != SPRITE_VERSION)
|
||||
{
|
||||
ri.Sys_Error( ERR_DROP, "%s has wrong version number (%i should be %i)",
|
||||
mod->name, sprout->version, SPRITE_VERSION );
|
||||
ri.Sys_Error(ERR_DROP, "%s has wrong version number (%i should be %i)",
|
||||
mod->name, sprout->version, SPRITE_VERSION);
|
||||
}
|
||||
|
||||
if ( sprout->numframes > MAX_MD2SKINS )
|
||||
if (sprout->numframes > MAX_MD2SKINS)
|
||||
{
|
||||
ri.Sys_Error( ERR_DROP, "%s has too many frames (%i > %i)",
|
||||
mod->name, sprout->numframes, MAX_MD2SKINS );
|
||||
ri.Sys_Error(ERR_DROP, "%s has too many frames (%i > %i)",
|
||||
mod->name, sprout->numframes, MAX_MD2SKINS);
|
||||
}
|
||||
|
||||
/* byte swap everything */
|
||||
for ( i = 0; i < sprout->numframes; i++ )
|
||||
for (i = 0; i < sprout->numframes; i++)
|
||||
{
|
||||
sprout->frames [ i ].width = LittleLong( sprin->frames [ i ].width );
|
||||
sprout->frames [ i ].height = LittleLong( sprin->frames [ i ].height );
|
||||
sprout->frames [ i ].origin_x = LittleLong( sprin->frames [ i ].origin_x );
|
||||
sprout->frames [ i ].origin_y = LittleLong( sprin->frames [ i ].origin_y );
|
||||
memcpy( sprout->frames [ i ].name, sprin->frames [ i ].name, MAX_SKINNAME );
|
||||
mod->skins [ i ] = R_FindImage( sprout->frames [ i ].name,
|
||||
it_sprite );
|
||||
sprout->frames[i].width = LittleLong(sprin->frames[i].width);
|
||||
sprout->frames[i].height = LittleLong(sprin->frames[i].height);
|
||||
sprout->frames[i].origin_x = LittleLong(sprin->frames[i].origin_x);
|
||||
sprout->frames[i].origin_y = LittleLong(sprin->frames[i].origin_y);
|
||||
memcpy(sprout->frames[i].name, sprin->frames[i].name, MAX_SKINNAME);
|
||||
mod->skins[i] = R_FindImage(sprout->frames[i].name,
|
||||
it_sprite);
|
||||
}
|
||||
|
||||
mod->type = mod_sprite;
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ LoadTGA(char *origname, byte **pic, int *width, int *height)
|
|||
(targa_header.image_type != 10) &&
|
||||
(targa_header.image_type != 3))
|
||||
{
|
||||
ri.Sys_Error( ERR_DROP, "LoadTGA (%s): Only type 2 (RGB), 3 (gray), and 10 (RGB) TGA images supported", name);
|
||||
ri.Sys_Error(ERR_DROP, "LoadTGA (%s): Only type 2 (RGB), 3 (gray), and 10 (RGB) TGA images supported", name);
|
||||
}
|
||||
|
||||
if (targa_header.colormap_type != 0)
|
||||
|
|
|
@ -86,3 +86,4 @@ GetWalInfo(char *name, int *width, int *height)
|
|||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,33 +50,33 @@
|
|||
#endif
|
||||
|
||||
#ifndef GL_VERSION_1_3
|
||||
#define GL_TEXTURE1 0x84C1
|
||||
#define GL_TEXTURE1 0x84C1
|
||||
#endif
|
||||
|
||||
#define TEXNUM_LIGHTMAPS 1024
|
||||
#define TEXNUM_SCRAPS 1152
|
||||
#define TEXNUM_IMAGES 1153
|
||||
#define MAX_GLTEXTURES 1024
|
||||
#define MAX_SCRAPS 1
|
||||
#define BLOCK_WIDTH 128
|
||||
#define BLOCK_HEIGHT 128
|
||||
#define REF_VERSION "Yamagi Quake II OpenGL Refresher"
|
||||
#define MAX_LBM_HEIGHT 480
|
||||
#define BACKFACE_EPSILON 0.01
|
||||
#define DYNAMIC_LIGHT_WIDTH 128
|
||||
#define TEXNUM_LIGHTMAPS 1024
|
||||
#define TEXNUM_SCRAPS 1152
|
||||
#define TEXNUM_IMAGES 1153
|
||||
#define MAX_GLTEXTURES 1024
|
||||
#define MAX_SCRAPS 1
|
||||
#define BLOCK_WIDTH 128
|
||||
#define BLOCK_HEIGHT 128
|
||||
#define REF_VERSION "Yamagi Quake II OpenGL Refresher"
|
||||
#define MAX_LBM_HEIGHT 480
|
||||
#define BACKFACE_EPSILON 0.01
|
||||
#define DYNAMIC_LIGHT_WIDTH 128
|
||||
#define DYNAMIC_LIGHT_HEIGHT 128
|
||||
#define LIGHTMAP_BYTES 4
|
||||
#define MAX_LIGHTMAPS 128
|
||||
#define GL_LIGHTMAP_FORMAT GL_RGBA
|
||||
|
||||
/* up / down */
|
||||
#define PITCH 0
|
||||
#define PITCH 0
|
||||
|
||||
/* left / right */
|
||||
#define YAW 1
|
||||
#define YAW 1
|
||||
|
||||
/* fall over */
|
||||
#define ROLL 2
|
||||
#define ROLL 2
|
||||
|
||||
#ifndef __VIDDEF_T
|
||||
#define __VIDDEF_T
|
||||
|
@ -88,7 +88,7 @@ typedef struct
|
|||
|
||||
#endif
|
||||
|
||||
char *strlwr ( char *s );
|
||||
char *strlwr(char *s);
|
||||
|
||||
extern viddef_t vid;
|
||||
|
||||
|
@ -113,12 +113,12 @@ typedef enum
|
|||
|
||||
typedef struct image_s
|
||||
{
|
||||
char name [ MAX_QPATH ]; /* game path, including extension */
|
||||
char name[MAX_QPATH]; /* game path, including extension */
|
||||
imagetype_t type;
|
||||
int width, height; /* source image */
|
||||
int upload_width, upload_height; /* after power of two and picmip */
|
||||
int registration_sequence; /* 0 = free */
|
||||
struct msurface_s *texturechain; /* for sort-by-texture world drawing */
|
||||
struct msurface_s *texturechain; /* for sort-by-texture world drawing */
|
||||
int texnum; /* gl texture binding */
|
||||
float sl, tl, sh, th; /* 0,0 - 1,1 unless part of the scrap */
|
||||
qboolean scrap;
|
||||
|
@ -139,11 +139,11 @@ typedef enum
|
|||
|
||||
#include "model.h"
|
||||
|
||||
void GL_BeginRendering ( int *x, int *y, int *width, int *height );
|
||||
void GL_EndRendering ( void );
|
||||
void GL_BeginRendering(int *x, int *y, int *width, int *height);
|
||||
void GL_EndRendering(void);
|
||||
|
||||
void R_SetDefaultState ( void );
|
||||
void R_UpdateSwapInterval ( void );
|
||||
void R_SetDefaultState(void);
|
||||
void R_UpdateSwapInterval(void);
|
||||
|
||||
extern float gldepthmin, gldepthmax;
|
||||
|
||||
|
@ -154,16 +154,16 @@ typedef struct
|
|||
float r, g, b;
|
||||
} glvert_t;
|
||||
|
||||
extern image_t gltextures [ MAX_GLTEXTURES ];
|
||||
extern image_t gltextures[MAX_GLTEXTURES];
|
||||
extern int numgltextures;
|
||||
|
||||
extern image_t *r_notexture;
|
||||
extern image_t *r_particletexture;
|
||||
extern entity_t *currententity;
|
||||
extern model_t *currentmodel;
|
||||
extern image_t *r_notexture;
|
||||
extern image_t *r_particletexture;
|
||||
extern entity_t *currententity;
|
||||
extern model_t *currentmodel;
|
||||
extern int r_visframecount;
|
||||
extern int r_framecount;
|
||||
extern cplane_t frustum [ 4 ];
|
||||
extern cplane_t frustum[4];
|
||||
extern int c_brush_polys, c_alias_polys;
|
||||
extern int gl_filter_min, gl_filter_max;
|
||||
|
||||
|
@ -177,84 +177,84 @@ extern vec3_t r_origin;
|
|||
extern refdef_t r_newrefdef;
|
||||
extern int r_viewcluster, r_viewcluster2, r_oldviewcluster, r_oldviewcluster2;
|
||||
|
||||
extern cvar_t *gl_norefresh;
|
||||
extern cvar_t *gl_lefthand;
|
||||
extern cvar_t *gl_farsee;
|
||||
extern cvar_t *gl_drawentities;
|
||||
extern cvar_t *gl_drawworld;
|
||||
extern cvar_t *gl_speeds;
|
||||
extern cvar_t *gl_fullbright;
|
||||
extern cvar_t *gl_novis;
|
||||
extern cvar_t *gl_nocull;
|
||||
extern cvar_t *gl_lerpmodels;
|
||||
extern cvar_t *gl_norefresh;
|
||||
extern cvar_t *gl_lefthand;
|
||||
extern cvar_t *gl_farsee;
|
||||
extern cvar_t *gl_drawentities;
|
||||
extern cvar_t *gl_drawworld;
|
||||
extern cvar_t *gl_speeds;
|
||||
extern cvar_t *gl_fullbright;
|
||||
extern cvar_t *gl_novis;
|
||||
extern cvar_t *gl_nocull;
|
||||
extern cvar_t *gl_lerpmodels;
|
||||
|
||||
extern cvar_t *gl_lightlevel;
|
||||
extern cvar_t *gl_overbrightbits;
|
||||
extern cvar_t *gl_lightlevel;
|
||||
extern cvar_t *gl_overbrightbits;
|
||||
|
||||
extern cvar_t *gl_vertex_arrays;
|
||||
extern cvar_t *gl_vertex_arrays;
|
||||
|
||||
extern cvar_t *gl_ext_swapinterval;
|
||||
extern cvar_t *gl_ext_palettedtexture;
|
||||
extern cvar_t *gl_ext_multitexture;
|
||||
extern cvar_t *gl_ext_pointparameters;
|
||||
extern cvar_t *gl_ext_compiled_vertex_array;
|
||||
extern cvar_t *gl_ext_mtexcombine;
|
||||
extern cvar_t *gl_ext_swapinterval;
|
||||
extern cvar_t *gl_ext_palettedtexture;
|
||||
extern cvar_t *gl_ext_multitexture;
|
||||
extern cvar_t *gl_ext_pointparameters;
|
||||
extern cvar_t *gl_ext_compiled_vertex_array;
|
||||
extern cvar_t *gl_ext_mtexcombine;
|
||||
|
||||
extern cvar_t *gl_particle_min_size;
|
||||
extern cvar_t *gl_particle_max_size;
|
||||
extern cvar_t *gl_particle_size;
|
||||
extern cvar_t *gl_particle_att_a;
|
||||
extern cvar_t *gl_particle_att_b;
|
||||
extern cvar_t *gl_particle_att_c;
|
||||
extern cvar_t *gl_particle_min_size;
|
||||
extern cvar_t *gl_particle_max_size;
|
||||
extern cvar_t *gl_particle_size;
|
||||
extern cvar_t *gl_particle_att_a;
|
||||
extern cvar_t *gl_particle_att_b;
|
||||
extern cvar_t *gl_particle_att_c;
|
||||
|
||||
extern cvar_t *gl_nosubimage;
|
||||
extern cvar_t *gl_bitdepth;
|
||||
extern cvar_t *gl_mode;
|
||||
extern cvar_t *gl_nosubimage;
|
||||
extern cvar_t *gl_bitdepth;
|
||||
extern cvar_t *gl_mode;
|
||||
|
||||
extern cvar_t *gl_customwidth;
|
||||
extern cvar_t *gl_customheight;
|
||||
extern cvar_t *gl_customwidth;
|
||||
extern cvar_t *gl_customheight;
|
||||
|
||||
#ifdef RETEXTURE
|
||||
extern cvar_t *gl_retexturing;
|
||||
extern cvar_t *gl_retexturing;
|
||||
#endif
|
||||
|
||||
extern cvar_t *gl_log;
|
||||
extern cvar_t *gl_lightmap;
|
||||
extern cvar_t *gl_shadows;
|
||||
extern cvar_t *gl_stencilshadow;
|
||||
extern cvar_t *gl_dynamic;
|
||||
extern cvar_t *gl_nobind;
|
||||
extern cvar_t *gl_round_down;
|
||||
extern cvar_t *gl_picmip;
|
||||
extern cvar_t *gl_skymip;
|
||||
extern cvar_t *gl_showtris;
|
||||
extern cvar_t *gl_finish;
|
||||
extern cvar_t *gl_ztrick;
|
||||
extern cvar_t *gl_clear;
|
||||
extern cvar_t *gl_cull;
|
||||
extern cvar_t *gl_poly;
|
||||
extern cvar_t *gl_texsort;
|
||||
extern cvar_t *gl_polyblend;
|
||||
extern cvar_t *gl_flashblend;
|
||||
extern cvar_t *gl_lightmaptype;
|
||||
extern cvar_t *gl_modulate;
|
||||
extern cvar_t *gl_playermip;
|
||||
extern cvar_t *gl_drawbuffer;
|
||||
extern cvar_t *gl_3dlabs_broken;
|
||||
extern cvar_t *gl_driver;
|
||||
extern cvar_t *gl_swapinterval;
|
||||
extern cvar_t *gl_anisotropic;
|
||||
extern cvar_t *gl_anisotropic_avail;
|
||||
extern cvar_t *gl_texturemode;
|
||||
extern cvar_t *gl_texturealphamode;
|
||||
extern cvar_t *gl_texturesolidmode;
|
||||
extern cvar_t *gl_saturatelighting;
|
||||
extern cvar_t *gl_lockpvs;
|
||||
extern cvar_t *gl_log;
|
||||
extern cvar_t *gl_lightmap;
|
||||
extern cvar_t *gl_shadows;
|
||||
extern cvar_t *gl_stencilshadow;
|
||||
extern cvar_t *gl_dynamic;
|
||||
extern cvar_t *gl_nobind;
|
||||
extern cvar_t *gl_round_down;
|
||||
extern cvar_t *gl_picmip;
|
||||
extern cvar_t *gl_skymip;
|
||||
extern cvar_t *gl_showtris;
|
||||
extern cvar_t *gl_finish;
|
||||
extern cvar_t *gl_ztrick;
|
||||
extern cvar_t *gl_clear;
|
||||
extern cvar_t *gl_cull;
|
||||
extern cvar_t *gl_poly;
|
||||
extern cvar_t *gl_texsort;
|
||||
extern cvar_t *gl_polyblend;
|
||||
extern cvar_t *gl_flashblend;
|
||||
extern cvar_t *gl_lightmaptype;
|
||||
extern cvar_t *gl_modulate;
|
||||
extern cvar_t *gl_playermip;
|
||||
extern cvar_t *gl_drawbuffer;
|
||||
extern cvar_t *gl_3dlabs_broken;
|
||||
extern cvar_t *gl_driver;
|
||||
extern cvar_t *gl_swapinterval;
|
||||
extern cvar_t *gl_anisotropic;
|
||||
extern cvar_t *gl_anisotropic_avail;
|
||||
extern cvar_t *gl_texturemode;
|
||||
extern cvar_t *gl_texturealphamode;
|
||||
extern cvar_t *gl_texturesolidmode;
|
||||
extern cvar_t *gl_saturatelighting;
|
||||
extern cvar_t *gl_lockpvs;
|
||||
|
||||
extern cvar_t *vid_fullscreen;
|
||||
extern cvar_t *vid_gamma;
|
||||
extern cvar_t *vid_fullscreen;
|
||||
extern cvar_t *vid_gamma;
|
||||
|
||||
extern cvar_t *intensity;
|
||||
extern cvar_t *intensity;
|
||||
|
||||
extern int gl_lightmap_format;
|
||||
extern int gl_solid_format;
|
||||
|
@ -265,99 +265,104 @@ extern int gl_tex_alpha_format;
|
|||
extern int c_visible_lightmaps;
|
||||
extern int c_visible_textures;
|
||||
|
||||
extern float r_world_matrix [ 16 ];
|
||||
extern float r_world_matrix[16];
|
||||
|
||||
void R_TranslatePlayerSkin ( int playernum );
|
||||
void R_Bind ( int texnum );
|
||||
void R_MBind ( GLenum target, int texnum );
|
||||
void R_TexEnv ( GLenum value );
|
||||
void R_EnableMultitexture ( qboolean enable );
|
||||
void R_SelectTexture ( GLenum );
|
||||
void R_TranslatePlayerSkin(int playernum);
|
||||
void R_Bind(int texnum);
|
||||
void R_MBind(GLenum target, int texnum);
|
||||
void R_TexEnv(GLenum value);
|
||||
void R_EnableMultitexture(qboolean enable);
|
||||
void R_SelectTexture(GLenum);
|
||||
|
||||
void R_LightPoint ( vec3_t p, vec3_t color );
|
||||
void R_PushDlights ( void );
|
||||
void R_LightPoint(vec3_t p, vec3_t color);
|
||||
void R_PushDlights(void);
|
||||
|
||||
extern model_t *r_worldmodel;
|
||||
extern unsigned d_8to24table [ 256 ];
|
||||
extern unsigned d_8to24table[256];
|
||||
extern int registration_sequence;
|
||||
|
||||
void V_AddBlend ( float r, float g, float b, float a, float *v_blend );
|
||||
int R_Init ( void *hinstance, void *hWnd );
|
||||
void R_Shutdown ( void );
|
||||
void V_AddBlend(float r, float g, float b, float a, float *v_blend);
|
||||
int R_Init(void *hinstance, void *hWnd);
|
||||
void R_Shutdown(void);
|
||||
|
||||
void R_RenderView ( refdef_t *fd );
|
||||
void R_ScreenShot ( void );
|
||||
void R_DrawAliasModel ( entity_t *e );
|
||||
void R_DrawBrushModel ( entity_t *e );
|
||||
void R_DrawSpriteModel ( entity_t *e );
|
||||
void R_DrawBeam ( entity_t *e );
|
||||
void R_DrawWorld ( void );
|
||||
void R_RenderDlights ( void );
|
||||
void R_DrawAlphaSurfaces ( void );
|
||||
void R_RenderBrushPoly ( msurface_t *fa );
|
||||
void R_InitParticleTexture ( void );
|
||||
void Draw_InitLocal ( void );
|
||||
void R_SubdivideSurface ( msurface_t *fa );
|
||||
qboolean R_CullBox ( vec3_t mins, vec3_t maxs );
|
||||
void R_RotateForEntity ( entity_t *e );
|
||||
void R_MarkLeaves ( void );
|
||||
void R_RenderView(refdef_t *fd);
|
||||
void R_ScreenShot(void);
|
||||
void R_DrawAliasModel(entity_t *e);
|
||||
void R_DrawBrushModel(entity_t *e);
|
||||
void R_DrawSpriteModel(entity_t *e);
|
||||
void R_DrawBeam(entity_t *e);
|
||||
void R_DrawWorld(void);
|
||||
void R_RenderDlights(void);
|
||||
void R_DrawAlphaSurfaces(void);
|
||||
void R_RenderBrushPoly(msurface_t *fa);
|
||||
void R_InitParticleTexture(void);
|
||||
void Draw_InitLocal(void);
|
||||
void R_SubdivideSurface(msurface_t *fa);
|
||||
qboolean R_CullBox(vec3_t mins, vec3_t maxs);
|
||||
void R_RotateForEntity(entity_t *e);
|
||||
void R_MarkLeaves(void);
|
||||
|
||||
glpoly_t *WaterWarpPolyVerts ( glpoly_t *p );
|
||||
void R_EmitWaterPolys ( msurface_t *fa );
|
||||
void R_AddSkySurface ( msurface_t *fa );
|
||||
void R_ClearSkyBox ( void );
|
||||
void R_DrawSkyBox ( void );
|
||||
void R_MarkLights ( dlight_t *light, int bit, mnode_t *node );
|
||||
glpoly_t *WaterWarpPolyVerts(glpoly_t *p);
|
||||
void R_EmitWaterPolys(msurface_t *fa);
|
||||
void R_AddSkySurface(msurface_t *fa);
|
||||
void R_ClearSkyBox(void);
|
||||
void R_DrawSkyBox(void);
|
||||
void R_MarkLights(dlight_t *light, int bit, mnode_t *node);
|
||||
|
||||
void COM_StripExtension ( char *in, char *out );
|
||||
void COM_StripExtension(char *in, char *out);
|
||||
|
||||
void Draw_GetPicSize ( int *w, int *h, char *name );
|
||||
void Draw_Pic ( int x, int y, char *name );
|
||||
void Draw_StretchPic ( int x, int y, int w, int h, char *name );
|
||||
void Draw_Char ( int x, int y, int c );
|
||||
void Draw_TileClear ( int x, int y, int w, int h, char *name );
|
||||
void Draw_Fill ( int x, int y, int w, int h, int c );
|
||||
void Draw_FadeScreen ( void );
|
||||
void Draw_StretchRaw ( int x, int y, int w, int h, int cols, int rows, byte *data );
|
||||
void Draw_GetPicSize(int *w, int *h, char *name);
|
||||
void Draw_Pic(int x, int y, char *name);
|
||||
void Draw_StretchPic(int x, int y, int w, int h, char *name);
|
||||
void Draw_Char(int x, int y, int c);
|
||||
void Draw_TileClear(int x, int y, int w, int h, char *name);
|
||||
void Draw_Fill(int x, int y, int w, int h, int c);
|
||||
void Draw_FadeScreen(void);
|
||||
void Draw_StretchRaw(int x, int y, int w, int h, int cols, int rows, byte *data);
|
||||
|
||||
void R_BeginFrame ( float camera_separation );
|
||||
void R_SwapBuffers ( int );
|
||||
void R_SetPalette ( const unsigned char *palette );
|
||||
void R_BeginFrame(float camera_separation);
|
||||
void R_SwapBuffers(int);
|
||||
void R_SetPalette(const unsigned char *palette);
|
||||
|
||||
int Draw_GetPalette ( void );
|
||||
int Draw_GetPalette(void);
|
||||
|
||||
void R_ResampleTexture ( unsigned *in, int inwidth, int inheight, unsigned *out, int outwidth, int outheight );
|
||||
void R_ResampleTexture(unsigned *in, int inwidth, int inheight,
|
||||
unsigned *out, int outwidth, int outheight);
|
||||
|
||||
struct image_s *R_RegisterSkin ( char *name );
|
||||
struct image_s *R_RegisterSkin(char *name);
|
||||
|
||||
void LoadPCX ( char *filename, byte **pic, byte **palette, int *width, int *height );
|
||||
image_t *LoadWal ( char *name );
|
||||
void LoadJPG ( char *origname, byte **pic, int *width, int *height );
|
||||
void LoadTGA ( char *origname, byte **pic, int *width, int *height );
|
||||
void GetWalInfo ( char *name, int *width, int *height );
|
||||
void GetPCXInfo ( char *filename, int *width, int *height );
|
||||
image_t *R_LoadPic ( char *name, byte *pic, int width, int realwidth, int height, int realheight, imagetype_t type, int bits );
|
||||
image_t *R_FindImage ( char *name, imagetype_t type );
|
||||
void R_TextureMode ( char *string );
|
||||
void R_ImageList_f ( void );
|
||||
void LoadPCX(char *filename, byte **pic, byte **palette,
|
||||
int *width, int *height);
|
||||
image_t *LoadWal(char *name);
|
||||
void LoadJPG(char *origname, byte **pic, int *width, int *height);
|
||||
void LoadTGA(char *origname, byte **pic, int *width, int *height);
|
||||
void GetWalInfo(char *name, int *width, int *height);
|
||||
void GetPCXInfo(char *filename, int *width, int *height);
|
||||
image_t *R_LoadPic(char *name, byte *pic, int width, int realwidth,
|
||||
int height, int realheight, imagetype_t type, int bits);
|
||||
image_t *R_FindImage(char *name, imagetype_t type);
|
||||
void R_TextureMode(char *string);
|
||||
void R_ImageList_f(void);
|
||||
|
||||
void R_SetTexturePalette ( unsigned palette [ 256 ] );
|
||||
void R_SetTexturePalette(unsigned palette[256]);
|
||||
|
||||
void R_InitImages ( void );
|
||||
void R_ShutdownImages ( void );
|
||||
void R_InitImages(void);
|
||||
void R_ShutdownImages(void);
|
||||
|
||||
void R_FreeUnusedImages ( void );
|
||||
void R_FreeUnusedImages(void);
|
||||
|
||||
void R_TextureAlphaMode ( char *string );
|
||||
void R_TextureSolidMode ( char *string );
|
||||
int Scrap_AllocBlock ( int w, int h, int *x, int *y );
|
||||
void R_TextureAlphaMode(char *string);
|
||||
void R_TextureSolidMode(char *string);
|
||||
int Scrap_AllocBlock(int w, int h, int *x, int *y);
|
||||
|
||||
/* GL extension emulation functions */
|
||||
void R_DrawParticles2 ( int n, const particle_t particles[], const unsigned colortable [ 768 ] );
|
||||
void R_DrawParticles2(int n,
|
||||
const particle_t particles[],
|
||||
const unsigned colortable[768]);
|
||||
|
||||
/*
|
||||
** GL config stuff
|
||||
*/
|
||||
* GL config stuff
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -385,7 +390,7 @@ typedef struct
|
|||
|
||||
int lightmap_textures;
|
||||
|
||||
int currenttextures [ 2 ];
|
||||
int currenttextures[2];
|
||||
int currenttmu;
|
||||
|
||||
float camera_separation;
|
||||
|
@ -393,9 +398,9 @@ typedef struct
|
|||
|
||||
qboolean hwgamma;
|
||||
|
||||
unsigned char originalRedGammaTable [ 256 ];
|
||||
unsigned char originalGreenGammaTable [ 256 ];
|
||||
unsigned char originalBlueGammaTable [ 256 ];
|
||||
unsigned char originalRedGammaTable[256];
|
||||
unsigned char originalGreenGammaTable[256];
|
||||
unsigned char originalBlueGammaTable[256];
|
||||
} glstate_t;
|
||||
|
||||
typedef struct
|
||||
|
@ -403,26 +408,26 @@ typedef struct
|
|||
int internal_format;
|
||||
int current_lightmap_texture;
|
||||
|
||||
msurface_t *lightmap_surfaces [ MAX_LIGHTMAPS ];
|
||||
msurface_t *lightmap_surfaces[MAX_LIGHTMAPS];
|
||||
|
||||
int allocated [ BLOCK_WIDTH ];
|
||||
int allocated[BLOCK_WIDTH];
|
||||
|
||||
/* the lightmap texture data needs to be kept in
|
||||
* main memory so texsubimage can update properly */
|
||||
byte lightmap_buffer [ 4 * BLOCK_WIDTH * BLOCK_HEIGHT ];
|
||||
main memory so texsubimage can update properly */
|
||||
byte lightmap_buffer[4 * BLOCK_WIDTH * BLOCK_HEIGHT];
|
||||
} gllightmapstate_t;
|
||||
|
||||
extern glconfig_t gl_config;
|
||||
extern glstate_t gl_state;
|
||||
extern refimport_t ri;
|
||||
|
||||
void GLimp_BeginFrame ( float camera_separation );
|
||||
void GLimp_EndFrame ( void );
|
||||
int GLimp_Init ( void );
|
||||
void GLimp_Shutdown ( void );
|
||||
int GLimp_SetMode ( int *pwidth, int *pheight, int mode, qboolean fullscreen );
|
||||
void GLimp_AppActivate ( qboolean active );
|
||||
void GLimp_EnableLogging ( qboolean enable );
|
||||
void GLimp_LogNewFrame ( void );
|
||||
void GLimp_BeginFrame(float camera_separation);
|
||||
void GLimp_EndFrame(void);
|
||||
int GLimp_Init(void);
|
||||
void GLimp_Shutdown(void);
|
||||
int GLimp_SetMode(int *pwidth, int *pheight, int mode, qboolean fullscreen);
|
||||
void GLimp_AppActivate(qboolean active);
|
||||
void GLimp_EnableLogging(qboolean enable);
|
||||
void GLimp_LogNewFrame(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -27,16 +27,16 @@
|
|||
#ifndef REF_MODEL_H
|
||||
#define REF_MODEL_H
|
||||
|
||||
#define SIDE_FRONT 0
|
||||
#define SIDE_BACK 1
|
||||
#define SIDE_ON 2
|
||||
#define SIDE_FRONT 0
|
||||
#define SIDE_BACK 1
|
||||
#define SIDE_ON 2
|
||||
|
||||
#define SURF_PLANEBACK 2
|
||||
#define SURF_DRAWSKY 4
|
||||
#define SURF_DRAWTURB 0x10
|
||||
#define SURF_PLANEBACK 2
|
||||
#define SURF_DRAWSKY 4
|
||||
#define SURF_DRAWTURB 0x10
|
||||
#define SURF_DRAWBACKGROUND 0x40
|
||||
#define SURF_UNDERWATER 0x80
|
||||
#define VERTEXSIZE 7
|
||||
#define SURF_UNDERWATER 0x80
|
||||
#define VERTEXSIZE 7
|
||||
|
||||
/* in memory representation */
|
||||
typedef struct
|
||||
|
@ -56,26 +56,26 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short v [ 2 ];
|
||||
unsigned short v[2];
|
||||
unsigned int cachededgeoffset;
|
||||
} medge_t;
|
||||
|
||||
typedef struct mtexinfo_s
|
||||
{
|
||||
float vecs [ 2 ] [ 4 ];
|
||||
float vecs[2][4];
|
||||
int flags;
|
||||
int numframes;
|
||||
struct mtexinfo_s *next; /* animation chain */
|
||||
image_t *image;
|
||||
image_t *image;
|
||||
} mtexinfo_t;
|
||||
|
||||
typedef struct glpoly_s
|
||||
{
|
||||
struct glpoly_s *next;
|
||||
struct glpoly_s *chain;
|
||||
struct glpoly_s *next;
|
||||
struct glpoly_s *chain;
|
||||
int numverts;
|
||||
int flags; /* for SURF_UNDERWATER (not needed anymore?) */
|
||||
float verts [ 4 ] [ VERTEXSIZE ]; /* variable sized (xyz s1t1 s2t2) */
|
||||
float verts[4][VERTEXSIZE]; /* variable sized (xyz s1t1 s2t2) */
|
||||
} glpoly_t;
|
||||
|
||||
typedef struct msurface_s
|
||||
|
@ -88,26 +88,26 @@ typedef struct msurface_s
|
|||
int firstedge; /* look up in model->surfedges[], negative numbers */
|
||||
int numedges; /* are backwards edges */
|
||||
|
||||
short texturemins [ 2 ];
|
||||
short extents [ 2 ];
|
||||
short texturemins[2];
|
||||
short extents[2];
|
||||
|
||||
int light_s, light_t; /* gl lightmap coordinates */
|
||||
int dlight_s, dlight_t; /* gl lightmap coordinates for dynamic lightmaps */
|
||||
|
||||
glpoly_t *polys; /* multiple if warped */
|
||||
struct msurface_s *texturechain;
|
||||
struct msurface_s *lightmapchain;
|
||||
glpoly_t *polys; /* multiple if warped */
|
||||
struct msurface_s *texturechain;
|
||||
struct msurface_s *lightmapchain;
|
||||
|
||||
mtexinfo_t *texinfo;
|
||||
mtexinfo_t *texinfo;
|
||||
|
||||
/* lighting info */
|
||||
int dlightframe;
|
||||
int dlightbits;
|
||||
|
||||
int lightmaptexturenum;
|
||||
byte styles [ MAXLIGHTMAPS ];
|
||||
float cached_light [ MAXLIGHTMAPS ]; /* values currently used in lightmap */
|
||||
byte *samples; /* [numstyles*surfsize] */
|
||||
byte styles[MAXLIGHTMAPS];
|
||||
float cached_light[MAXLIGHTMAPS]; /* values currently used in lightmap */
|
||||
byte *samples; /* [numstyles*surfsize] */
|
||||
} msurface_t;
|
||||
|
||||
typedef struct mnode_s
|
||||
|
@ -116,13 +116,13 @@ typedef struct mnode_s
|
|||
int contents; /* -1, to differentiate from leafs */
|
||||
int visframe; /* node needs to be traversed if current */
|
||||
|
||||
float minmaxs [ 6 ]; /* for bounding box culling */
|
||||
float minmaxs[6]; /* for bounding box culling */
|
||||
|
||||
struct mnode_s *parent;
|
||||
struct mnode_s *parent;
|
||||
|
||||
/* node specific */
|
||||
cplane_t *plane;
|
||||
struct mnode_s *children [ 2 ];
|
||||
cplane_t *plane;
|
||||
struct mnode_s *children[2];
|
||||
|
||||
unsigned short firstsurface;
|
||||
unsigned short numsurfaces;
|
||||
|
@ -134,24 +134,24 @@ typedef struct mleaf_s
|
|||
int contents; /* wil be a negative contents number */
|
||||
int visframe; /* node needs to be traversed if current */
|
||||
|
||||
float minmaxs [ 6 ]; /* for bounding box culling */
|
||||
float minmaxs[6]; /* for bounding box culling */
|
||||
|
||||
struct mnode_s *parent;
|
||||
struct mnode_s *parent;
|
||||
|
||||
/* leaf specific */
|
||||
int cluster;
|
||||
int area;
|
||||
|
||||
msurface_t **firstmarksurface;
|
||||
msurface_t **firstmarksurface;
|
||||
int nummarksurfaces;
|
||||
} mleaf_t;
|
||||
|
||||
/* Whole model */
|
||||
typedef enum {mod_bad, mod_brush, mod_sprite, mod_alias } modtype_t;
|
||||
typedef enum {mod_bad, mod_brush, mod_sprite, mod_alias} modtype_t;
|
||||
|
||||
typedef struct model_s
|
||||
{
|
||||
char name [ MAX_QPATH ];
|
||||
char name[MAX_QPATH];
|
||||
|
||||
int registration_sequence;
|
||||
|
||||
|
@ -173,61 +173,61 @@ typedef struct model_s
|
|||
int lightmap; /* only for submodels */
|
||||
|
||||
int numsubmodels;
|
||||
mmodel_t *submodels;
|
||||
mmodel_t *submodels;
|
||||
|
||||
int numplanes;
|
||||
cplane_t *planes;
|
||||
cplane_t *planes;
|
||||
|
||||
int numleafs; /* number of visible leafs, not counting 0 */
|
||||
mleaf_t *leafs;
|
||||
mleaf_t *leafs;
|
||||
|
||||
int numvertexes;
|
||||
mvertex_t *vertexes;
|
||||
mvertex_t *vertexes;
|
||||
|
||||
int numedges;
|
||||
medge_t *edges;
|
||||
medge_t *edges;
|
||||
|
||||
int numnodes;
|
||||
int firstnode;
|
||||
mnode_t *nodes;
|
||||
mnode_t *nodes;
|
||||
|
||||
int numtexinfo;
|
||||
mtexinfo_t *texinfo;
|
||||
mtexinfo_t *texinfo;
|
||||
|
||||
int numsurfaces;
|
||||
msurface_t *surfaces;
|
||||
msurface_t *surfaces;
|
||||
|
||||
int numsurfedges;
|
||||
int *surfedges;
|
||||
int *surfedges;
|
||||
|
||||
int nummarksurfaces;
|
||||
msurface_t **marksurfaces;
|
||||
msurface_t **marksurfaces;
|
||||
|
||||
dvis_t *vis;
|
||||
dvis_t *vis;
|
||||
|
||||
byte *lightdata;
|
||||
byte *lightdata;
|
||||
|
||||
/* for alias models and skins */
|
||||
image_t *skins [ MAX_MD2SKINS ];
|
||||
image_t *skins[MAX_MD2SKINS];
|
||||
|
||||
int extradatasize;
|
||||
void *extradata;
|
||||
void *extradata;
|
||||
} model_t;
|
||||
|
||||
void Mod_Init ( void );
|
||||
void Mod_ClearAll ( void );
|
||||
model_t *Mod_ForName ( char *name, qboolean crash );
|
||||
mleaf_t *Mod_PointInLeaf ( float *p, model_t *model );
|
||||
byte *Mod_ClusterPVS ( int cluster, model_t *model );
|
||||
void Mod_Init(void);
|
||||
void Mod_ClearAll(void);
|
||||
model_t *Mod_ForName(char *name, qboolean crash);
|
||||
mleaf_t *Mod_PointInLeaf(float *p, model_t *model);
|
||||
byte *Mod_ClusterPVS(int cluster, model_t *model);
|
||||
|
||||
void Mod_Modellist_f ( void );
|
||||
void Mod_Modellist_f(void);
|
||||
|
||||
void *Hunk_Begin ( int maxsize );
|
||||
void *Hunk_Alloc ( int size );
|
||||
int Hunk_End ( void );
|
||||
void Hunk_Free ( void *base );
|
||||
void *Hunk_Begin(int maxsize);
|
||||
void *Hunk_Alloc(int size);
|
||||
int Hunk_End(void);
|
||||
void Hunk_Free(void *base);
|
||||
|
||||
void Mod_FreeAll ( void );
|
||||
void Mod_Free ( model_t *mod );
|
||||
void Mod_FreeAll(void);
|
||||
void Mod_Free(model_t *mod);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <GL/gl.h>
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
|||
#define APIENTRY
|
||||
#endif
|
||||
|
||||
#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB
|
||||
#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB
|
||||
|
||||
#define GL_TEXTURE0_SGIS 0x835E
|
||||
#define GL_TEXTURE1_SGIS 0x835F
|
||||
|
@ -46,454 +46,547 @@
|
|||
#define GL_POINT_SIZE_MAX_EXT 0x8127
|
||||
#define GL_DISTANCE_ATTENUATION_EXT 0x8129
|
||||
|
||||
qboolean QGL_Init ( const char *dllname );
|
||||
void QGL_Shutdown ( void );
|
||||
qboolean QGL_Init(const char *dllname);
|
||||
void QGL_Shutdown(void);
|
||||
|
||||
extern void ( APIENTRY *qglAccum )( GLenum op, GLfloat value );
|
||||
extern void ( APIENTRY *qglAlphaFunc )( GLenum func, GLclampf ref );
|
||||
extern GLboolean ( APIENTRY *qglAreTexturesResident )( GLsizei n, const GLuint *textures, GLboolean *residences );
|
||||
extern void ( APIENTRY *qglArrayElement )( GLint i );
|
||||
extern void ( APIENTRY *qglBegin )( GLenum mode );
|
||||
extern void ( APIENTRY *qglBindTexture )( GLenum target, GLuint texture );
|
||||
extern void ( APIENTRY *qglBitmap )( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove,
|
||||
const GLubyte *bitmap );
|
||||
extern void ( APIENTRY *qglBlendFunc )( GLenum sfactor, GLenum dfactor );
|
||||
extern void ( APIENTRY *qglCallList )( GLuint list );
|
||||
extern void ( APIENTRY *qglCallLists )( GLsizei n, GLenum type, const GLvoid *lists );
|
||||
extern void ( APIENTRY *qglClear )( GLbitfield mask );
|
||||
extern void ( APIENTRY *qglClearAccum )( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha );
|
||||
extern void ( APIENTRY *qglClearColor )( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
|
||||
extern void ( APIENTRY *qglClearDepth )( GLclampd depth );
|
||||
extern void ( APIENTRY *qglClearIndex )( GLfloat c );
|
||||
extern void ( APIENTRY *qglClearStencil )( GLint s );
|
||||
extern void ( APIENTRY *qglClipPlane )( GLenum plane, const GLdouble *equation );
|
||||
extern void ( APIENTRY *qglColor3b )( GLbyte red, GLbyte green, GLbyte blue );
|
||||
extern void ( APIENTRY *qglColor3bv )( const GLbyte *v );
|
||||
extern void ( APIENTRY *qglColor3d )( GLdouble red, GLdouble green, GLdouble blue );
|
||||
extern void ( APIENTRY *qglColor3dv )( const GLdouble *v );
|
||||
extern void ( APIENTRY *qglColor3f )( GLfloat red, GLfloat green, GLfloat blue );
|
||||
extern void ( APIENTRY *qglColor3fv )( const GLfloat *v );
|
||||
extern void ( APIENTRY *qglColor3i )( GLint red, GLint green, GLint blue );
|
||||
extern void ( APIENTRY *qglColor3iv )( const GLint *v );
|
||||
extern void ( APIENTRY *qglColor3s )( GLshort red, GLshort green, GLshort blue );
|
||||
extern void ( APIENTRY *qglColor3sv )( const GLshort *v );
|
||||
extern void ( APIENTRY *qglColor3ub )( GLubyte red, GLubyte green, GLubyte blue );
|
||||
extern void ( APIENTRY *qglColor3ubv )( const GLubyte *v );
|
||||
extern void ( APIENTRY *qglColor3ui )( GLuint red, GLuint green, GLuint blue );
|
||||
extern void ( APIENTRY *qglColor3uiv )( const GLuint *v );
|
||||
extern void ( APIENTRY *qglColor3us )( GLushort red, GLushort green, GLushort blue );
|
||||
extern void ( APIENTRY *qglColor3usv )( const GLushort *v );
|
||||
extern void ( APIENTRY *qglColor4b )( GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha );
|
||||
extern void ( APIENTRY *qglColor4bv )( const GLbyte *v );
|
||||
extern void ( APIENTRY *qglColor4d )( GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha );
|
||||
extern void ( APIENTRY *qglColor4dv )( const GLdouble *v );
|
||||
extern void ( APIENTRY *qglColor4f )( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha );
|
||||
extern void ( APIENTRY *qglColor4fv )( const GLfloat *v );
|
||||
extern void ( APIENTRY *qglColor4i )( GLint red, GLint green, GLint blue, GLint alpha );
|
||||
extern void ( APIENTRY *qglColor4iv )( const GLint *v );
|
||||
extern void ( APIENTRY *qglColor4s )( GLshort red, GLshort green, GLshort blue, GLshort alpha );
|
||||
extern void ( APIENTRY *qglColor4sv )( const GLshort *v );
|
||||
extern void ( APIENTRY *qglColor4ub )( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha );
|
||||
extern void ( APIENTRY *qglColor4ubv )( const GLubyte *v );
|
||||
extern void ( APIENTRY *qglColor4ui )( GLuint red, GLuint green, GLuint blue, GLuint alpha );
|
||||
extern void ( APIENTRY *qglColor4uiv )( const GLuint *v );
|
||||
extern void ( APIENTRY *qglColor4us )( GLushort red, GLushort green, GLushort blue, GLushort alpha );
|
||||
extern void ( APIENTRY *qglColor4usv )( const GLushort *v );
|
||||
extern void ( APIENTRY *qglColorMask )( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha );
|
||||
extern void ( APIENTRY *qglColorMaterial )( GLenum face, GLenum mode );
|
||||
extern void ( APIENTRY *qglColorPointer )( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
|
||||
extern void ( APIENTRY *qglCopyPixels )( GLint x, GLint y, GLsizei width, GLsizei height, GLenum type );
|
||||
extern void ( APIENTRY *qglCopyTexImage1D )( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width,
|
||||
GLint border );
|
||||
extern void ( APIENTRY *qglCopyTexImage2D )( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width,
|
||||
GLsizei height, GLint border );
|
||||
extern void ( APIENTRY *qglCopyTexSubImage1D )( GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width );
|
||||
extern void ( APIENTRY *qglCopyTexSubImage2D )( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y,
|
||||
GLsizei width, GLsizei height );
|
||||
extern void ( APIENTRY *qglCullFace )( GLenum mode );
|
||||
extern void ( APIENTRY *qglDeleteLists )( GLuint list, GLsizei range );
|
||||
extern void ( APIENTRY *qglDeleteTextures )( GLsizei n, const GLuint *textures );
|
||||
extern void ( APIENTRY *qglDepthFunc )( GLenum func );
|
||||
extern void ( APIENTRY *qglDepthMask )( GLboolean flag );
|
||||
extern void ( APIENTRY *qglDepthRange )( GLclampd zNear, GLclampd zFar );
|
||||
extern void ( APIENTRY *qglDisable )( GLenum cap );
|
||||
extern void ( APIENTRY *qglDisableClientState )( GLenum array );
|
||||
extern void ( APIENTRY *qglDrawArrays )( GLenum mode, GLint first, GLsizei count );
|
||||
extern void ( APIENTRY *qglDrawBuffer )( GLenum mode );
|
||||
extern void ( APIENTRY *qglDrawElements )( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices );
|
||||
extern void ( APIENTRY *qglDrawPixels )( GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels );
|
||||
extern void ( APIENTRY *qglEdgeFlag )( GLboolean flag );
|
||||
extern void ( APIENTRY *qglEdgeFlagPointer )( GLsizei stride, const GLvoid *pointer );
|
||||
extern void ( APIENTRY *qglEdgeFlagv )( const GLboolean *flag );
|
||||
extern void ( APIENTRY *qglEnable )( GLenum cap );
|
||||
extern void ( APIENTRY *qglEnableClientState )( GLenum array );
|
||||
extern void ( APIENTRY *qglEnd )( void );
|
||||
extern void ( APIENTRY *qglEndList )( void );
|
||||
extern void ( APIENTRY *qglEvalCoord1d )( GLdouble u );
|
||||
extern void ( APIENTRY *qglEvalCoord1dv )( const GLdouble *u );
|
||||
extern void ( APIENTRY *qglEvalCoord1f )( GLfloat u );
|
||||
extern void ( APIENTRY *qglEvalCoord1fv )( const GLfloat *u );
|
||||
extern void ( APIENTRY *qglEvalCoord2d )( GLdouble u, GLdouble v );
|
||||
extern void ( APIENTRY *qglEvalCoord2dv )( const GLdouble *u );
|
||||
extern void ( APIENTRY *qglEvalCoord2f )( GLfloat u, GLfloat v );
|
||||
extern void ( APIENTRY *qglEvalCoord2fv )( const GLfloat *u );
|
||||
extern void ( APIENTRY *qglEvalMesh1 )( GLenum mode, GLint i1, GLint i2 );
|
||||
extern void ( APIENTRY *qglEvalMesh2 )( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 );
|
||||
extern void ( APIENTRY *qglEvalPoint1 )( GLint i );
|
||||
extern void ( APIENTRY *qglEvalPoint2 )( GLint i, GLint j );
|
||||
extern void ( APIENTRY *qglFeedbackBuffer )( GLsizei size, GLenum type, GLfloat *buffer );
|
||||
extern void ( APIENTRY *qglFinish )( void );
|
||||
extern void ( APIENTRY *qglFlush )( void );
|
||||
extern void ( APIENTRY *qglFogf )( GLenum pname, GLfloat param );
|
||||
extern void ( APIENTRY *qglFogfv )( GLenum pname, const GLfloat *params );
|
||||
extern void ( APIENTRY *qglFogi )( GLenum pname, GLint param );
|
||||
extern void ( APIENTRY *qglFogiv )( GLenum pname, const GLint *params );
|
||||
extern void ( APIENTRY *qglFrontFace )( GLenum mode );
|
||||
extern void ( APIENTRY *qglFrustum )( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar );
|
||||
extern GLuint ( APIENTRY *qglGenLists )( GLsizei range );
|
||||
extern void ( APIENTRY *qglGenTextures )( GLsizei n, GLuint *textures );
|
||||
extern void ( APIENTRY *qglGetBooleanv )( GLenum pname, GLboolean *params );
|
||||
extern void ( APIENTRY *qglGetClipPlane )( GLenum plane, GLdouble *equation );
|
||||
extern void ( APIENTRY *qglGetDoublev )( GLenum pname, GLdouble *params );
|
||||
extern GLenum ( APIENTRY *qglGetError )( void );
|
||||
extern void ( APIENTRY *qglGetFloatv )( GLenum pname, GLfloat *params );
|
||||
extern void ( APIENTRY *qglGetIntegerv )( GLenum pname, GLint *params );
|
||||
extern void ( APIENTRY *qglGetLightfv )( GLenum light, GLenum pname, GLfloat *params );
|
||||
extern void ( APIENTRY *qglGetLightiv )( GLenum light, GLenum pname, GLint *params );
|
||||
extern void ( APIENTRY *qglGetMapdv )( GLenum target, GLenum query, GLdouble *v );
|
||||
extern void ( APIENTRY *qglGetMapfv )( GLenum target, GLenum query, GLfloat *v );
|
||||
extern void ( APIENTRY *qglGetMapiv )( GLenum target, GLenum query, GLint *v );
|
||||
extern void ( APIENTRY *qglGetMaterialfv )( GLenum face, GLenum pname, GLfloat *params );
|
||||
extern void ( APIENTRY *qglGetMaterialiv )( GLenum face, GLenum pname, GLint *params );
|
||||
extern void ( APIENTRY *qglGetPixelMapfv )( GLenum map, GLfloat *values );
|
||||
extern void ( APIENTRY *qglGetPixelMapuiv )( GLenum map, GLuint *values );
|
||||
extern void ( APIENTRY *qglGetPixelMapusv )( GLenum map, GLushort *values );
|
||||
extern void ( APIENTRY *qglGetPointerv )( GLenum pname, GLvoid **params );
|
||||
extern void ( APIENTRY *qglGetPolygonStipple )( GLubyte *mask );
|
||||
extern const GLubyte * ( APIENTRY * qglGetString )(GLenum name);
|
||||
extern void ( APIENTRY *qglGetTexEnvfv )( GLenum target, GLenum pname, GLfloat *params );
|
||||
extern void ( APIENTRY *qglGetTexEnviv )( GLenum target, GLenum pname, GLint *params );
|
||||
extern void ( APIENTRY *qglGetTexGendv )( GLenum coord, GLenum pname, GLdouble *params );
|
||||
extern void ( APIENTRY *qglGetTexGenfv )( GLenum coord, GLenum pname, GLfloat *params );
|
||||
extern void ( APIENTRY *qglGetTexGeniv )( GLenum coord, GLenum pname, GLint *params );
|
||||
extern void ( APIENTRY *qglGetTexImage )( GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels );
|
||||
extern void ( APIENTRY *qglGetTexLevelParameterfv )( GLenum target, GLint level, GLenum pname, GLfloat *params );
|
||||
extern void ( APIENTRY *qglGetTexLevelParameteriv )( GLenum target, GLint level, GLenum pname, GLint *params );
|
||||
extern void ( APIENTRY *qglGetTexParameterfv )( GLenum target, GLenum pname, GLfloat *params );
|
||||
extern void ( APIENTRY *qglGetTexParameteriv )( GLenum target, GLenum pname, GLint *params );
|
||||
extern void ( APIENTRY *qglHint )( GLenum target, GLenum mode );
|
||||
extern void ( APIENTRY *qglIndexMask )( GLuint mask );
|
||||
extern void ( APIENTRY *qglIndexPointer )( GLenum type, GLsizei stride, const GLvoid *pointer );
|
||||
extern void ( APIENTRY *qglIndexd )( GLdouble c );
|
||||
extern void ( APIENTRY *qglIndexdv )( const GLdouble *c );
|
||||
extern void ( APIENTRY *qglIndexf )( GLfloat c );
|
||||
extern void ( APIENTRY *qglIndexfv )( const GLfloat *c );
|
||||
extern void ( APIENTRY *qglIndexi )( GLint c );
|
||||
extern void ( APIENTRY *qglIndexiv )( const GLint *c );
|
||||
extern void ( APIENTRY *qglIndexs )( GLshort c );
|
||||
extern void ( APIENTRY *qglIndexsv )( const GLshort *c );
|
||||
extern void ( APIENTRY *qglIndexub )( GLubyte c );
|
||||
extern void ( APIENTRY *qglIndexubv )( const GLubyte *c );
|
||||
extern void ( APIENTRY *qglInitNames )( void );
|
||||
extern void ( APIENTRY *qglInterleavedArrays )( GLenum format, GLsizei stride, const GLvoid *pointer );
|
||||
extern GLboolean ( APIENTRY *qglIsEnabled )( GLenum cap );
|
||||
extern GLboolean ( APIENTRY *qglIsList )( GLuint list );
|
||||
extern GLboolean ( APIENTRY *qglIsTexture )( GLuint texture );
|
||||
extern void ( APIENTRY *qglLightModelf )( GLenum pname, GLfloat param );
|
||||
extern void ( APIENTRY *qglLightModelfv )( GLenum pname, const GLfloat *params );
|
||||
extern void ( APIENTRY *qglLightModeli )( GLenum pname, GLint param );
|
||||
extern void ( APIENTRY *qglLightModeliv )( GLenum pname, const GLint *params );
|
||||
extern void ( APIENTRY *qglLightf )( GLenum light, GLenum pname, GLfloat param );
|
||||
extern void ( APIENTRY *qglLightfv )( GLenum light, GLenum pname, const GLfloat *params );
|
||||
extern void ( APIENTRY *qglLighti )( GLenum light, GLenum pname, GLint param );
|
||||
extern void ( APIENTRY *qglLightiv )( GLenum light, GLenum pname, const GLint *params );
|
||||
extern void ( APIENTRY *qglLineStipple )( GLint factor, GLushort pattern );
|
||||
extern void ( APIENTRY *qglLineWidth )( GLfloat width );
|
||||
extern void ( APIENTRY *qglListBase )( GLuint base );
|
||||
extern void ( APIENTRY *qglLoadIdentity )( void );
|
||||
extern void ( APIENTRY *qglLoadMatrixd )( const GLdouble *m );
|
||||
extern void ( APIENTRY *qglLoadMatrixf )( const GLfloat *m );
|
||||
extern void ( APIENTRY *qglLoadName )( GLuint name );
|
||||
extern void ( APIENTRY *qglLogicOp )( GLenum opcode );
|
||||
extern void ( APIENTRY *qglMap1d )( GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points );
|
||||
extern void ( APIENTRY *qglMap1f )( GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points );
|
||||
extern void ( APIENTRY *qglMap2d )( GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1,
|
||||
GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points );
|
||||
extern void ( APIENTRY *qglMap2f )( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2,
|
||||
GLint vstride, GLint vorder, const GLfloat *points );
|
||||
extern void ( APIENTRY *qglMapGrid1d )( GLint un, GLdouble u1, GLdouble u2 );
|
||||
extern void ( APIENTRY *qglMapGrid1f )( GLint un, GLfloat u1, GLfloat u2 );
|
||||
extern void ( APIENTRY *qglMapGrid2d )( GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2 );
|
||||
extern void ( APIENTRY *qglMapGrid2f )( GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2 );
|
||||
extern void ( APIENTRY *qglMaterialf )( GLenum face, GLenum pname, GLfloat param );
|
||||
extern void ( APIENTRY *qglMaterialfv )( GLenum face, GLenum pname, const GLfloat *params );
|
||||
extern void ( APIENTRY *qglMateriali )( GLenum face, GLenum pname, GLint param );
|
||||
extern void ( APIENTRY *qglMaterialiv )( GLenum face, GLenum pname, const GLint *params );
|
||||
extern void ( APIENTRY *qglMatrixMode )( GLenum mode );
|
||||
extern void ( APIENTRY *qglMultMatrixd )( const GLdouble *m );
|
||||
extern void ( APIENTRY *qglMultMatrixf )( const GLfloat *m );
|
||||
extern void ( APIENTRY *qglNewList )( GLuint list, GLenum mode );
|
||||
extern void ( APIENTRY *qglNormal3b )( GLbyte nx, GLbyte ny, GLbyte nz );
|
||||
extern void ( APIENTRY *qglNormal3bv )( const GLbyte *v );
|
||||
extern void ( APIENTRY *qglNormal3d )( GLdouble nx, GLdouble ny, GLdouble nz );
|
||||
extern void ( APIENTRY *qglNormal3dv )( const GLdouble *v );
|
||||
extern void ( APIENTRY *qglNormal3f )( GLfloat nx, GLfloat ny, GLfloat nz );
|
||||
extern void ( APIENTRY *qglNormal3fv )( const GLfloat *v );
|
||||
extern void ( APIENTRY *qglNormal3i )( GLint nx, GLint ny, GLint nz );
|
||||
extern void ( APIENTRY *qglNormal3iv )( const GLint *v );
|
||||
extern void ( APIENTRY *qglNormal3s )( GLshort nx, GLshort ny, GLshort nz );
|
||||
extern void ( APIENTRY *qglNormal3sv )( const GLshort *v );
|
||||
extern void ( APIENTRY *qglNormalPointer )( GLenum type, GLsizei stride, const GLvoid *pointer );
|
||||
extern void ( APIENTRY *qglOrtho )( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar );
|
||||
extern void ( APIENTRY *qglPassThrough )( GLfloat token );
|
||||
extern void ( APIENTRY *qglPixelMapfv )( GLenum map, GLsizei mapsize, const GLfloat *values );
|
||||
extern void ( APIENTRY *qglPixelMapuiv )( GLenum map, GLsizei mapsize, const GLuint *values );
|
||||
extern void ( APIENTRY *qglPixelMapusv )( GLenum map, GLsizei mapsize, const GLushort *values );
|
||||
extern void ( APIENTRY *qglPixelStoref )( GLenum pname, GLfloat param );
|
||||
extern void ( APIENTRY *qglPixelStorei )( GLenum pname, GLint param );
|
||||
extern void ( APIENTRY *qglPixelTransferf )( GLenum pname, GLfloat param );
|
||||
extern void ( APIENTRY *qglPixelTransferi )( GLenum pname, GLint param );
|
||||
extern void ( APIENTRY *qglPixelZoom )( GLfloat xfactor, GLfloat yfactor );
|
||||
extern void ( APIENTRY *qglPointSize )( GLfloat size );
|
||||
extern void ( APIENTRY *qglPolygonMode )( GLenum face, GLenum mode );
|
||||
extern void ( APIENTRY *qglPolygonOffset )( GLfloat factor, GLfloat units );
|
||||
extern void ( APIENTRY *qglPolygonStipple )( const GLubyte *mask );
|
||||
extern void ( APIENTRY *qglPopAttrib )( void );
|
||||
extern void ( APIENTRY *qglPopClientAttrib )( void );
|
||||
extern void ( APIENTRY *qglPopMatrix )( void );
|
||||
extern void ( APIENTRY *qglPopName )( void );
|
||||
extern void ( APIENTRY *qglPrioritizeTextures )( GLsizei n, const GLuint *textures, const GLclampf *priorities );
|
||||
extern void ( APIENTRY *qglPushAttrib )( GLbitfield mask );
|
||||
extern void ( APIENTRY *qglPushClientAttrib )( GLbitfield mask );
|
||||
extern void ( APIENTRY *qglPushMatrix )( void );
|
||||
extern void ( APIENTRY *qglPushName )( GLuint name );
|
||||
extern void ( APIENTRY *qglRasterPos2d )( GLdouble x, GLdouble y );
|
||||
extern void ( APIENTRY *qglRasterPos2dv )( const GLdouble *v );
|
||||
extern void ( APIENTRY *qglRasterPos2f )( GLfloat x, GLfloat y );
|
||||
extern void ( APIENTRY *qglRasterPos2fv )( const GLfloat *v );
|
||||
extern void ( APIENTRY *qglRasterPos2i )( GLint x, GLint y );
|
||||
extern void ( APIENTRY *qglRasterPos2iv )( const GLint *v );
|
||||
extern void ( APIENTRY *qglRasterPos2s )( GLshort x, GLshort y );
|
||||
extern void ( APIENTRY *qglRasterPos2sv )( const GLshort *v );
|
||||
extern void ( APIENTRY *qglRasterPos3d )( GLdouble x, GLdouble y, GLdouble z );
|
||||
extern void ( APIENTRY *qglRasterPos3dv )( const GLdouble *v );
|
||||
extern void ( APIENTRY *qglRasterPos3f )( GLfloat x, GLfloat y, GLfloat z );
|
||||
extern void ( APIENTRY *qglRasterPos3fv )( const GLfloat *v );
|
||||
extern void ( APIENTRY *qglRasterPos3i )( GLint x, GLint y, GLint z );
|
||||
extern void ( APIENTRY *qglRasterPos3iv )( const GLint *v );
|
||||
extern void ( APIENTRY *qglRasterPos3s )( GLshort x, GLshort y, GLshort z );
|
||||
extern void ( APIENTRY *qglRasterPos3sv )( const GLshort *v );
|
||||
extern void ( APIENTRY *qglRasterPos4d )( GLdouble x, GLdouble y, GLdouble z, GLdouble w );
|
||||
extern void ( APIENTRY *qglRasterPos4dv )( const GLdouble *v );
|
||||
extern void ( APIENTRY *qglRasterPos4f )( GLfloat x, GLfloat y, GLfloat z, GLfloat w );
|
||||
extern void ( APIENTRY *qglRasterPos4fv )( const GLfloat *v );
|
||||
extern void ( APIENTRY *qglRasterPos4i )( GLint x, GLint y, GLint z, GLint w );
|
||||
extern void ( APIENTRY *qglRasterPos4iv )( const GLint *v );
|
||||
extern void ( APIENTRY *qglRasterPos4s )( GLshort x, GLshort y, GLshort z, GLshort w );
|
||||
extern void ( APIENTRY *qglRasterPos4sv )( const GLshort *v );
|
||||
extern void ( APIENTRY *qglReadBuffer )( GLenum mode );
|
||||
extern void ( APIENTRY *qglReadPixels )( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
|
||||
GLvoid *pixels );
|
||||
extern void ( APIENTRY *qglRectd )( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 );
|
||||
extern void ( APIENTRY *qglRectdv )( const GLdouble *v1, const GLdouble *v2 );
|
||||
extern void ( APIENTRY *qglRectf )( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 );
|
||||
extern void ( APIENTRY *qglRectfv )( const GLfloat *v1, const GLfloat *v2 );
|
||||
extern void ( APIENTRY *qglRecti )( GLint x1, GLint y1, GLint x2, GLint y2 );
|
||||
extern void ( APIENTRY *qglRectiv )( const GLint *v1, const GLint *v2 );
|
||||
extern void ( APIENTRY *qglRects )( GLshort x1, GLshort y1, GLshort x2, GLshort y2 );
|
||||
extern void ( APIENTRY *qglRectsv )( const GLshort *v1, const GLshort *v2 );
|
||||
extern GLint ( APIENTRY *qglRenderMode )( GLenum mode );
|
||||
extern void ( APIENTRY *qglRotated )( GLdouble angle, GLdouble x, GLdouble y, GLdouble z );
|
||||
extern void ( APIENTRY *qglRotatef )( GLfloat angle, GLfloat x, GLfloat y, GLfloat z );
|
||||
extern void ( APIENTRY *qglScaled )( GLdouble x, GLdouble y, GLdouble z );
|
||||
extern void ( APIENTRY *qglScalef )( GLfloat x, GLfloat y, GLfloat z );
|
||||
extern void ( APIENTRY *qglScissor )( GLint x, GLint y, GLsizei width, GLsizei height );
|
||||
extern void ( APIENTRY *qglSelectBuffer )( GLsizei size, GLuint *buffer );
|
||||
extern void ( APIENTRY *qglShadeModel )( GLenum mode );
|
||||
extern void ( APIENTRY *qglStencilFunc )( GLenum func, GLint ref, GLuint mask );
|
||||
extern void ( APIENTRY *qglStencilMask )( GLuint mask );
|
||||
extern void ( APIENTRY *qglStencilOp )( GLenum fail, GLenum zfail, GLenum zpass );
|
||||
extern void ( APIENTRY *qglTexCoord1d )( GLdouble s );
|
||||
extern void ( APIENTRY *qglTexCoord1dv )( const GLdouble *v );
|
||||
extern void ( APIENTRY *qglTexCoord1f )( GLfloat s );
|
||||
extern void ( APIENTRY *qglTexCoord1fv )( const GLfloat *v );
|
||||
extern void ( APIENTRY *qglTexCoord1i )( GLint s );
|
||||
extern void ( APIENTRY *qglTexCoord1iv )( const GLint *v );
|
||||
extern void ( APIENTRY *qglTexCoord1s )( GLshort s );
|
||||
extern void ( APIENTRY *qglTexCoord1sv )( const GLshort *v );
|
||||
extern void ( APIENTRY *qglTexCoord2d )( GLdouble s, GLdouble t );
|
||||
extern void ( APIENTRY *qglTexCoord2dv )( const GLdouble *v );
|
||||
extern void ( APIENTRY *qglTexCoord2f )( GLfloat s, GLfloat t );
|
||||
extern void ( APIENTRY *qglTexCoord2fv )( const GLfloat *v );
|
||||
extern void ( APIENTRY *qglTexCoord2i )( GLint s, GLint t );
|
||||
extern void ( APIENTRY *qglTexCoord2iv )( const GLint *v );
|
||||
extern void ( APIENTRY *qglTexCoord2s )( GLshort s, GLshort t );
|
||||
extern void ( APIENTRY *qglTexCoord2sv )( const GLshort *v );
|
||||
extern void ( APIENTRY *qglTexCoord3d )( GLdouble s, GLdouble t, GLdouble r );
|
||||
extern void ( APIENTRY *qglTexCoord3dv )( const GLdouble *v );
|
||||
extern void ( APIENTRY *qglTexCoord3f )( GLfloat s, GLfloat t, GLfloat r );
|
||||
extern void ( APIENTRY *qglTexCoord3fv )( const GLfloat *v );
|
||||
extern void ( APIENTRY *qglTexCoord3i )( GLint s, GLint t, GLint r );
|
||||
extern void ( APIENTRY *qglTexCoord3iv )( const GLint *v );
|
||||
extern void ( APIENTRY *qglTexCoord3s )( GLshort s, GLshort t, GLshort r );
|
||||
extern void ( APIENTRY *qglTexCoord3sv )( const GLshort *v );
|
||||
extern void ( APIENTRY *qglTexCoord4d )( GLdouble s, GLdouble t, GLdouble r, GLdouble q );
|
||||
extern void ( APIENTRY *qglTexCoord4dv )( const GLdouble *v );
|
||||
extern void ( APIENTRY *qglTexCoord4f )( GLfloat s, GLfloat t, GLfloat r, GLfloat q );
|
||||
extern void ( APIENTRY *qglTexCoord4fv )( const GLfloat *v );
|
||||
extern void ( APIENTRY *qglTexCoord4i )( GLint s, GLint t, GLint r, GLint q );
|
||||
extern void ( APIENTRY *qglTexCoord4iv )( const GLint *v );
|
||||
extern void ( APIENTRY *qglTexCoord4s )( GLshort s, GLshort t, GLshort r, GLshort q );
|
||||
extern void ( APIENTRY *qglTexCoord4sv )( const GLshort *v );
|
||||
extern void ( APIENTRY *qglTexCoordPointer )( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
|
||||
extern void ( APIENTRY *qglTexEnvf )( GLenum target, GLenum pname, GLfloat param );
|
||||
extern void ( APIENTRY *qglTexEnvfv )( GLenum target, GLenum pname, const GLfloat *params );
|
||||
extern void ( APIENTRY *qglTexEnvi )( GLenum target, GLenum pname, GLint param );
|
||||
extern void ( APIENTRY *qglTexEnviv )( GLenum target, GLenum pname, const GLint *params );
|
||||
extern void ( APIENTRY *qglTexGend )( GLenum coord, GLenum pname, GLdouble param );
|
||||
extern void ( APIENTRY *qglTexGendv )( GLenum coord, GLenum pname, const GLdouble *params );
|
||||
extern void ( APIENTRY *qglTexGenf )( GLenum coord, GLenum pname, GLfloat param );
|
||||
extern void ( APIENTRY *qglTexGenfv )( GLenum coord, GLenum pname, const GLfloat *params );
|
||||
extern void ( APIENTRY *qglTexGeni )( GLenum coord, GLenum pname, GLint param );
|
||||
extern void ( APIENTRY *qglTexGeniv )( GLenum coord, GLenum pname, const GLint *params );
|
||||
extern void ( APIENTRY *qglTexImage1D )( GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border,
|
||||
GLenum format, GLenum type, const GLvoid *pixels );
|
||||
extern void ( APIENTRY *qglTexImage2D )( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
|
||||
GLint border, GLenum format, GLenum type, const GLvoid *pixels );
|
||||
extern void ( APIENTRY *qglTexParameterf )( GLenum target, GLenum pname, GLfloat param );
|
||||
extern void ( APIENTRY *qglTexParameterfv )( GLenum target, GLenum pname, const GLfloat *params );
|
||||
extern void ( APIENTRY *qglTexParameteri )( GLenum target, GLenum pname, GLint param );
|
||||
extern void ( APIENTRY *qglTexParameteriv )( GLenum target, GLenum pname, const GLint *params );
|
||||
extern void ( APIENTRY *qglTexSubImage1D )( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type,
|
||||
const GLvoid *pixels );
|
||||
extern void ( APIENTRY *qglTexSubImage2D )( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
|
||||
GLsizei height, GLenum format, GLenum type, const GLvoid *pixels );
|
||||
extern void ( APIENTRY *qglTranslated )( GLdouble x, GLdouble y, GLdouble z );
|
||||
extern void ( APIENTRY *qglTranslatef )( GLfloat x, GLfloat y, GLfloat z );
|
||||
extern void ( APIENTRY *qglVertex2d )( GLdouble x, GLdouble y );
|
||||
extern void ( APIENTRY *qglVertex2dv )( const GLdouble *v );
|
||||
extern void ( APIENTRY *qglVertex2f )( GLfloat x, GLfloat y );
|
||||
extern void ( APIENTRY *qglVertex2fv )( const GLfloat *v );
|
||||
extern void ( APIENTRY *qglVertex2i )( GLint x, GLint y );
|
||||
extern void ( APIENTRY *qglVertex2iv )( const GLint *v );
|
||||
extern void ( APIENTRY *qglVertex2s )( GLshort x, GLshort y );
|
||||
extern void ( APIENTRY *qglVertex2sv )( const GLshort *v );
|
||||
extern void ( APIENTRY *qglVertex3d )( GLdouble x, GLdouble y, GLdouble z );
|
||||
extern void ( APIENTRY *qglVertex3dv )( const GLdouble *v );
|
||||
extern void ( APIENTRY *qglVertex3f )( GLfloat x, GLfloat y, GLfloat z );
|
||||
extern void ( APIENTRY *qglVertex3fv )( const GLfloat *v );
|
||||
extern void ( APIENTRY *qglVertex3i )( GLint x, GLint y, GLint z );
|
||||
extern void ( APIENTRY *qglVertex3iv )( const GLint *v );
|
||||
extern void ( APIENTRY *qglVertex3s )( GLshort x, GLshort y, GLshort z );
|
||||
extern void ( APIENTRY *qglVertex3sv )( const GLshort *v );
|
||||
extern void ( APIENTRY *qglVertex4d )( GLdouble x, GLdouble y, GLdouble z, GLdouble w );
|
||||
extern void ( APIENTRY *qglVertex4dv )( const GLdouble *v );
|
||||
extern void ( APIENTRY *qglVertex4f )( GLfloat x, GLfloat y, GLfloat z, GLfloat w );
|
||||
extern void ( APIENTRY *qglVertex4fv )( const GLfloat *v );
|
||||
extern void ( APIENTRY *qglVertex4i )( GLint x, GLint y, GLint z, GLint w );
|
||||
extern void ( APIENTRY *qglVertex4iv )( const GLint *v );
|
||||
extern void ( APIENTRY *qglVertex4s )( GLshort x, GLshort y, GLshort z, GLshort w );
|
||||
extern void ( APIENTRY *qglVertex4sv )( const GLshort *v );
|
||||
extern void ( APIENTRY *qglVertexPointer )( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer );
|
||||
extern void ( APIENTRY *qglViewport )( GLint x, GLint y, GLsizei width, GLsizei height );
|
||||
extern void (APIENTRY *qglAccum)(GLenum op, GLfloat value);
|
||||
extern void (APIENTRY *qglAlphaFunc)(GLenum func, GLclampf ref);
|
||||
extern GLboolean (APIENTRY *qglAreTexturesResident)(GLsizei n,
|
||||
const GLuint *textures, GLboolean *residences);
|
||||
extern void (APIENTRY *qglArrayElement)(GLint i);
|
||||
extern void (APIENTRY *qglBegin)(GLenum mode);
|
||||
extern void (APIENTRY *qglBindTexture)(GLenum target, GLuint texture);
|
||||
extern void (APIENTRY *qglBitmap)(GLsizei width, GLsizei height, GLfloat xorig,
|
||||
GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
|
||||
extern void (APIENTRY *qglBlendFunc)(GLenum sfactor, GLenum dfactor);
|
||||
extern void (APIENTRY *qglCallList)(GLuint list);
|
||||
extern void (APIENTRY *qglCallLists)(GLsizei n, GLenum type,
|
||||
const GLvoid *lists);
|
||||
extern void (APIENTRY *qglClear)(GLbitfield mask);
|
||||
extern void (APIENTRY *qglClearAccum)(GLfloat red, GLfloat green, GLfloat blue,
|
||||
GLfloat alpha);
|
||||
extern void (APIENTRY *qglClearColor)(GLclampf red, GLclampf green,
|
||||
GLclampf blue, GLclampf alpha);
|
||||
extern void (APIENTRY *qglClearDepth)(GLclampd depth);
|
||||
extern void (APIENTRY *qglClearIndex)(GLfloat c);
|
||||
extern void (APIENTRY *qglClearStencil)(GLint s);
|
||||
extern void (APIENTRY *qglClipPlane)(GLenum plane, const GLdouble *equation);
|
||||
extern void (APIENTRY *qglColor3b)(GLbyte red, GLbyte green, GLbyte blue);
|
||||
extern void (APIENTRY *qglColor3bv)(const GLbyte *v);
|
||||
extern void (APIENTRY *qglColor3d)(GLdouble red, GLdouble green, GLdouble blue);
|
||||
extern void (APIENTRY *qglColor3dv)(const GLdouble *v);
|
||||
extern void (APIENTRY *qglColor3f)(GLfloat red, GLfloat green, GLfloat blue);
|
||||
extern void (APIENTRY *qglColor3fv)(const GLfloat *v);
|
||||
extern void (APIENTRY *qglColor3i)(GLint red, GLint green, GLint blue);
|
||||
extern void (APIENTRY *qglColor3iv)(const GLint *v);
|
||||
extern void (APIENTRY *qglColor3s)(GLshort red, GLshort green, GLshort blue);
|
||||
extern void (APIENTRY *qglColor3sv)(const GLshort *v);
|
||||
extern void (APIENTRY *qglColor3ub)(GLubyte red, GLubyte green, GLubyte blue);
|
||||
extern void (APIENTRY *qglColor3ubv)(const GLubyte *v);
|
||||
extern void (APIENTRY *qglColor3ui)(GLuint red, GLuint green, GLuint blue);
|
||||
extern void (APIENTRY *qglColor3uiv)(const GLuint *v);
|
||||
extern void (APIENTRY *qglColor3us)(GLushort red, GLushort green, GLushort blue);
|
||||
extern void (APIENTRY *qglColor3usv)(const GLushort *v);
|
||||
extern void (APIENTRY *qglColor4b)(GLbyte red, GLbyte green, GLbyte blue,
|
||||
GLbyte alpha);
|
||||
extern void (APIENTRY *qglColor4bv)(const GLbyte *v);
|
||||
extern void (APIENTRY *qglColor4d)(GLdouble red, GLdouble green, GLdouble blue,
|
||||
GLdouble alpha);
|
||||
extern void (APIENTRY *qglColor4dv)(const GLdouble *v);
|
||||
extern void (APIENTRY *qglColor4f)(GLfloat red, GLfloat green, GLfloat blue,
|
||||
GLfloat alpha);
|
||||
extern void (APIENTRY *qglColor4fv)(const GLfloat *v);
|
||||
extern void (APIENTRY *qglColor4i)(GLint red, GLint green, GLint blue,
|
||||
GLint alpha);
|
||||
extern void (APIENTRY *qglColor4iv)(const GLint *v);
|
||||
extern void (APIENTRY *qglColor4s)(GLshort red, GLshort green, GLshort blue,
|
||||
GLshort alpha);
|
||||
extern void (APIENTRY *qglColor4sv)(const GLshort *v);
|
||||
extern void (APIENTRY *qglColor4ub)(GLubyte red, GLubyte green, GLubyte blue,
|
||||
GLubyte alpha);
|
||||
extern void (APIENTRY *qglColor4ubv)(const GLubyte *v);
|
||||
extern void (APIENTRY *qglColor4ui)(GLuint red, GLuint green, GLuint blue,
|
||||
GLuint alpha);
|
||||
extern void (APIENTRY *qglColor4uiv)(const GLuint *v);
|
||||
extern void (APIENTRY *qglColor4us)(GLushort red, GLushort green, GLushort blue,
|
||||
GLushort alpha);
|
||||
extern void (APIENTRY *qglColor4usv)(const GLushort *v);
|
||||
extern void (APIENTRY *qglColorMask)(GLboolean red, GLboolean green,
|
||||
GLboolean blue, GLboolean alpha);
|
||||
extern void (APIENTRY *qglColorMaterial)(GLenum face, GLenum mode);
|
||||
extern void (APIENTRY *qglColorPointer)(GLint size, GLenum type, GLsizei stride,
|
||||
const GLvoid *pointer);
|
||||
extern void (APIENTRY *qglCopyPixels)(GLint x, GLint y, GLsizei width,
|
||||
GLsizei height, GLenum type);
|
||||
extern void (APIENTRY *qglCopyTexImage1D)(GLenum target, GLint level,
|
||||
GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);
|
||||
extern void (APIENTRY *qglCopyTexImage2D)(GLenum target, GLint level,
|
||||
GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
GLint border);
|
||||
extern void (APIENTRY *qglCopyTexSubImage1D)(GLenum target, GLint level,
|
||||
GLint xoffset, GLint x, GLint y, GLsizei width);
|
||||
extern void (APIENTRY *qglCopyTexSubImage2D)(GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width,
|
||||
GLsizei height);
|
||||
extern void (APIENTRY *qglCullFace)(GLenum mode);
|
||||
extern void (APIENTRY *qglDeleteLists)(GLuint list, GLsizei range);
|
||||
extern void (APIENTRY *qglDeleteTextures)(GLsizei n, const GLuint *textures);
|
||||
extern void (APIENTRY *qglDepthFunc)(GLenum func);
|
||||
extern void (APIENTRY *qglDepthMask)(GLboolean flag);
|
||||
extern void (APIENTRY *qglDepthRange)(GLclampd zNear, GLclampd zFar);
|
||||
extern void (APIENTRY *qglDisable)(GLenum cap);
|
||||
extern void (APIENTRY *qglDisableClientState)(GLenum array);
|
||||
extern void (APIENTRY *qglDrawArrays)(GLenum mode, GLint first, GLsizei count);
|
||||
extern void (APIENTRY *qglDrawBuffer)(GLenum mode);
|
||||
extern void (APIENTRY *qglDrawElements)(GLenum mode, GLsizei count, GLenum type,
|
||||
const GLvoid *indices);
|
||||
extern void (APIENTRY *qglDrawPixels)(GLsizei width, GLsizei height,
|
||||
GLenum format, GLenum type, const GLvoid *pixels);
|
||||
extern void (APIENTRY *qglEdgeFlag)(GLboolean flag);
|
||||
extern void (APIENTRY *qglEdgeFlagPointer)(GLsizei stride,
|
||||
const GLvoid *pointer);
|
||||
extern void (APIENTRY *qglEdgeFlagv)(const GLboolean *flag);
|
||||
extern void (APIENTRY *qglEnable)(GLenum cap);
|
||||
extern void (APIENTRY *qglEnableClientState)(GLenum array);
|
||||
extern void (APIENTRY *qglEnd)(void);
|
||||
extern void (APIENTRY *qglEndList)(void);
|
||||
extern void (APIENTRY *qglEvalCoord1d)(GLdouble u);
|
||||
extern void (APIENTRY *qglEvalCoord1dv)(const GLdouble *u);
|
||||
extern void (APIENTRY *qglEvalCoord1f)(GLfloat u);
|
||||
extern void (APIENTRY *qglEvalCoord1fv)(const GLfloat *u);
|
||||
extern void (APIENTRY *qglEvalCoord2d)(GLdouble u, GLdouble v);
|
||||
extern void (APIENTRY *qglEvalCoord2dv)(const GLdouble *u);
|
||||
extern void (APIENTRY *qglEvalCoord2f)(GLfloat u, GLfloat v);
|
||||
extern void (APIENTRY *qglEvalCoord2fv)(const GLfloat *u);
|
||||
extern void (APIENTRY *qglEvalMesh1)(GLenum mode, GLint i1, GLint i2);
|
||||
extern void (APIENTRY *qglEvalMesh2)(GLenum mode, GLint i1, GLint i2, GLint j1,
|
||||
GLint j2);
|
||||
extern void (APIENTRY *qglEvalPoint1)(GLint i);
|
||||
extern void (APIENTRY *qglEvalPoint2)(GLint i, GLint j);
|
||||
extern void (APIENTRY *qglFeedbackBuffer)(GLsizei size, GLenum type,
|
||||
GLfloat *buffer);
|
||||
extern void (APIENTRY *qglFinish)(void);
|
||||
extern void (APIENTRY *qglFlush)(void);
|
||||
extern void (APIENTRY *qglFogf)(GLenum pname, GLfloat param);
|
||||
extern void (APIENTRY *qglFogfv)(GLenum pname, const GLfloat *params);
|
||||
extern void (APIENTRY *qglFogi)(GLenum pname, GLint param);
|
||||
extern void (APIENTRY *qglFogiv)(GLenum pname, const GLint *params);
|
||||
extern void (APIENTRY *qglFrontFace)(GLenum mode);
|
||||
extern void (APIENTRY *qglFrustum)(GLdouble left, GLdouble right,
|
||||
GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
|
||||
extern GLuint (APIENTRY *qglGenLists)(GLsizei range);
|
||||
extern void (APIENTRY *qglGenTextures)(GLsizei n, GLuint *textures);
|
||||
extern void (APIENTRY *qglGetBooleanv)(GLenum pname, GLboolean *params);
|
||||
extern void (APIENTRY *qglGetClipPlane)(GLenum plane, GLdouble *equation);
|
||||
extern void (APIENTRY *qglGetDoublev)(GLenum pname, GLdouble *params);
|
||||
extern GLenum (APIENTRY *qglGetError)(void);
|
||||
extern void (APIENTRY *qglGetFloatv)(GLenum pname, GLfloat *params);
|
||||
extern void (APIENTRY *qglGetIntegerv)(GLenum pname, GLint *params);
|
||||
extern void (APIENTRY *qglGetLightfv)(GLenum light, GLenum pname,
|
||||
GLfloat *params);
|
||||
extern void (APIENTRY *qglGetLightiv)(GLenum light, GLenum pname, GLint *params);
|
||||
extern void (APIENTRY *qglGetMapdv)(GLenum target, GLenum query, GLdouble *v);
|
||||
extern void (APIENTRY *qglGetMapfv)(GLenum target, GLenum query, GLfloat *v);
|
||||
extern void (APIENTRY *qglGetMapiv)(GLenum target, GLenum query, GLint *v);
|
||||
extern void (APIENTRY *qglGetMaterialfv)(GLenum face, GLenum pname,
|
||||
GLfloat *params);
|
||||
extern void (APIENTRY *qglGetMaterialiv)(GLenum face, GLenum pname,
|
||||
GLint *params);
|
||||
extern void (APIENTRY *qglGetPixelMapfv)(GLenum map, GLfloat *values);
|
||||
extern void (APIENTRY *qglGetPixelMapuiv)(GLenum map, GLuint *values);
|
||||
extern void (APIENTRY *qglGetPixelMapusv)(GLenum map, GLushort *values);
|
||||
extern void (APIENTRY *qglGetPointerv)(GLenum pname, GLvoid **params);
|
||||
extern void (APIENTRY *qglGetPolygonStipple)(GLubyte *mask);
|
||||
extern const GLubyte * (APIENTRY * qglGetString)(GLenum name);
|
||||
extern void (APIENTRY *qglGetTexEnvfv)(GLenum target, GLenum pname,
|
||||
GLfloat *params);
|
||||
extern void (APIENTRY *qglGetTexEnviv)(GLenum target, GLenum pname,
|
||||
GLint *params);
|
||||
extern void (APIENTRY *qglGetTexGendv)(GLenum coord, GLenum pname,
|
||||
GLdouble *params);
|
||||
extern void (APIENTRY *qglGetTexGenfv)(GLenum coord, GLenum pname,
|
||||
GLfloat *params);
|
||||
extern void (APIENTRY *qglGetTexGeniv)(GLenum coord, GLenum pname,
|
||||
GLint *params);
|
||||
extern void (APIENTRY *qglGetTexImage)(GLenum target, GLint level,
|
||||
GLenum format, GLenum type, GLvoid *pixels);
|
||||
extern void (APIENTRY *qglGetTexLevelParameterfv)(GLenum target, GLint level,
|
||||
GLenum pname, GLfloat *params);
|
||||
extern void (APIENTRY *qglGetTexLevelParameteriv)(GLenum target, GLint level,
|
||||
GLenum pname, GLint *params);
|
||||
extern void (APIENTRY *qglGetTexParameterfv)(GLenum target, GLenum pname,
|
||||
GLfloat *params);
|
||||
extern void (APIENTRY *qglGetTexParameteriv)(GLenum target, GLenum pname,
|
||||
GLint *params);
|
||||
extern void (APIENTRY *qglHint)(GLenum target, GLenum mode);
|
||||
extern void (APIENTRY *qglIndexMask)(GLuint mask);
|
||||
extern void (APIENTRY *qglIndexPointer)(GLenum type, GLsizei stride,
|
||||
const GLvoid *pointer);
|
||||
extern void (APIENTRY *qglIndexd)(GLdouble c);
|
||||
extern void (APIENTRY *qglIndexdv)(const GLdouble *c);
|
||||
extern void (APIENTRY *qglIndexf)(GLfloat c);
|
||||
extern void (APIENTRY *qglIndexfv)(const GLfloat *c);
|
||||
extern void (APIENTRY *qglIndexi)(GLint c);
|
||||
extern void (APIENTRY *qglIndexiv)(const GLint *c);
|
||||
extern void (APIENTRY *qglIndexs)(GLshort c);
|
||||
extern void (APIENTRY *qglIndexsv)(const GLshort *c);
|
||||
extern void (APIENTRY *qglIndexub)(GLubyte c);
|
||||
extern void (APIENTRY *qglIndexubv)(const GLubyte *c);
|
||||
extern void (APIENTRY *qglInitNames)(void);
|
||||
extern void (APIENTRY *qglInterleavedArrays)(GLenum format, GLsizei stride,
|
||||
const GLvoid *pointer);
|
||||
extern GLboolean (APIENTRY *qglIsEnabled)(GLenum cap);
|
||||
extern GLboolean (APIENTRY *qglIsList)(GLuint list);
|
||||
extern GLboolean (APIENTRY *qglIsTexture)(GLuint texture);
|
||||
extern void (APIENTRY *qglLightModelf)(GLenum pname, GLfloat param);
|
||||
extern void (APIENTRY *qglLightModelfv)(GLenum pname, const GLfloat *params);
|
||||
extern void (APIENTRY *qglLightModeli)(GLenum pname, GLint param);
|
||||
extern void (APIENTRY *qglLightModeliv)(GLenum pname, const GLint *params);
|
||||
extern void (APIENTRY *qglLightf)(GLenum light, GLenum pname, GLfloat param);
|
||||
extern void (APIENTRY *qglLightfv)(GLenum light, GLenum pname,
|
||||
const GLfloat *params);
|
||||
extern void (APIENTRY *qglLighti)(GLenum light, GLenum pname, GLint param);
|
||||
extern void (APIENTRY *qglLightiv)(GLenum light, GLenum pname,
|
||||
const GLint *params);
|
||||
extern void (APIENTRY *qglLineStipple)(GLint factor, GLushort pattern);
|
||||
extern void (APIENTRY *qglLineWidth)(GLfloat width);
|
||||
extern void (APIENTRY *qglListBase)(GLuint base);
|
||||
extern void (APIENTRY *qglLoadIdentity)(void);
|
||||
extern void (APIENTRY *qglLoadMatrixd)(const GLdouble *m);
|
||||
extern void (APIENTRY *qglLoadMatrixf)(const GLfloat *m);
|
||||
extern void (APIENTRY *qglLoadName)(GLuint name);
|
||||
extern void (APIENTRY *qglLogicOp)(GLenum opcode);
|
||||
extern void (APIENTRY *qglMap1d)(GLenum target, GLdouble u1, GLdouble u2,
|
||||
GLint stride, GLint order, const GLdouble *points);
|
||||
extern void (APIENTRY *qglMap1f)(GLenum target, GLfloat u1, GLfloat u2,
|
||||
GLint stride, GLint order, const GLfloat *points);
|
||||
extern void (APIENTRY *qglMap2d)(GLenum target, GLdouble u1, GLdouble u2,
|
||||
GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride,
|
||||
GLint vorder, const GLdouble *points);
|
||||
extern void (APIENTRY *qglMap2f)(GLenum target, GLfloat u1, GLfloat u2,
|
||||
GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride,
|
||||
GLint vorder, const GLfloat *points);
|
||||
extern void (APIENTRY *qglMapGrid1d)(GLint un, GLdouble u1, GLdouble u2);
|
||||
extern void (APIENTRY *qglMapGrid1f)(GLint un, GLfloat u1, GLfloat u2);
|
||||
extern void (APIENTRY *qglMapGrid2d)(GLint un, GLdouble u1, GLdouble u2,
|
||||
GLint vn, GLdouble v1, GLdouble v2);
|
||||
extern void (APIENTRY *qglMapGrid2f)(GLint un, GLfloat u1, GLfloat u2, GLint vn,
|
||||
GLfloat v1, GLfloat v2);
|
||||
extern void (APIENTRY *qglMaterialf)(GLenum face, GLenum pname, GLfloat param);
|
||||
extern void (APIENTRY *qglMaterialfv)(GLenum face, GLenum pname,
|
||||
const GLfloat *params);
|
||||
extern void (APIENTRY *qglMateriali)(GLenum face, GLenum pname, GLint param);
|
||||
extern void (APIENTRY *qglMaterialiv)(GLenum face, GLenum pname,
|
||||
const GLint *params);
|
||||
extern void (APIENTRY *qglMatrixMode)(GLenum mode);
|
||||
extern void (APIENTRY *qglMultMatrixd)(const GLdouble *m);
|
||||
extern void (APIENTRY *qglMultMatrixf)(const GLfloat *m);
|
||||
extern void (APIENTRY *qglNewList)(GLuint list, GLenum mode);
|
||||
extern void (APIENTRY *qglNormal3b)(GLbyte nx, GLbyte ny, GLbyte nz);
|
||||
extern void (APIENTRY *qglNormal3bv)(const GLbyte *v);
|
||||
extern void (APIENTRY *qglNormal3d)(GLdouble nx, GLdouble ny, GLdouble nz);
|
||||
extern void (APIENTRY *qglNormal3dv)(const GLdouble *v);
|
||||
extern void (APIENTRY *qglNormal3f)(GLfloat nx, GLfloat ny, GLfloat nz);
|
||||
extern void (APIENTRY *qglNormal3fv)(const GLfloat *v);
|
||||
extern void (APIENTRY *qglNormal3i)(GLint nx, GLint ny, GLint nz);
|
||||
extern void (APIENTRY *qglNormal3iv)(const GLint *v);
|
||||
extern void (APIENTRY *qglNormal3s)(GLshort nx, GLshort ny, GLshort nz);
|
||||
extern void (APIENTRY *qglNormal3sv)(const GLshort *v);
|
||||
extern void (APIENTRY *qglNormalPointer)(GLenum type, GLsizei stride,
|
||||
const GLvoid *pointer);
|
||||
extern void (APIENTRY *qglOrtho)(GLdouble left, GLdouble right, GLdouble bottom,
|
||||
GLdouble top, GLdouble zNear, GLdouble zFar);
|
||||
extern void (APIENTRY *qglPassThrough)(GLfloat token);
|
||||
extern void (APIENTRY *qglPixelMapfv)(GLenum map, GLsizei mapsize,
|
||||
const GLfloat *values);
|
||||
extern void (APIENTRY *qglPixelMapuiv)(GLenum map, GLsizei mapsize,
|
||||
const GLuint *values);
|
||||
extern void (APIENTRY *qglPixelMapusv)(GLenum map, GLsizei mapsize,
|
||||
const GLushort *values);
|
||||
extern void (APIENTRY *qglPixelStoref)(GLenum pname, GLfloat param);
|
||||
extern void (APIENTRY *qglPixelStorei)(GLenum pname, GLint param);
|
||||
extern void (APIENTRY *qglPixelTransferf)(GLenum pname, GLfloat param);
|
||||
extern void (APIENTRY *qglPixelTransferi)(GLenum pname, GLint param);
|
||||
extern void (APIENTRY *qglPixelZoom)(GLfloat xfactor, GLfloat yfactor);
|
||||
extern void (APIENTRY *qglPointSize)(GLfloat size);
|
||||
extern void (APIENTRY *qglPolygonMode)(GLenum face, GLenum mode);
|
||||
extern void (APIENTRY *qglPolygonOffset)(GLfloat factor, GLfloat units);
|
||||
extern void (APIENTRY *qglPolygonStipple)(const GLubyte *mask);
|
||||
extern void (APIENTRY *qglPopAttrib)(void);
|
||||
extern void (APIENTRY *qglPopClientAttrib)(void);
|
||||
extern void (APIENTRY *qglPopMatrix)(void);
|
||||
extern void (APIENTRY *qglPopName)(void);
|
||||
extern void (APIENTRY *qglPrioritizeTextures)(GLsizei n, const GLuint *textures,
|
||||
const GLclampf *priorities);
|
||||
extern void (APIENTRY *qglPushAttrib)(GLbitfield mask);
|
||||
extern void (APIENTRY *qglPushClientAttrib)(GLbitfield mask);
|
||||
extern void (APIENTRY *qglPushMatrix)(void);
|
||||
extern void (APIENTRY *qglPushName)(GLuint name);
|
||||
extern void (APIENTRY *qglRasterPos2d)(GLdouble x, GLdouble y);
|
||||
extern void (APIENTRY *qglRasterPos2dv)(const GLdouble *v);
|
||||
extern void (APIENTRY *qglRasterPos2f)(GLfloat x, GLfloat y);
|
||||
extern void (APIENTRY *qglRasterPos2fv)(const GLfloat *v);
|
||||
extern void (APIENTRY *qglRasterPos2i)(GLint x, GLint y);
|
||||
extern void (APIENTRY *qglRasterPos2iv)(const GLint *v);
|
||||
extern void (APIENTRY *qglRasterPos2s)(GLshort x, GLshort y);
|
||||
extern void (APIENTRY *qglRasterPos2sv)(const GLshort *v);
|
||||
extern void (APIENTRY *qglRasterPos3d)(GLdouble x, GLdouble y, GLdouble z);
|
||||
extern void (APIENTRY *qglRasterPos3dv)(const GLdouble *v);
|
||||
extern void (APIENTRY *qglRasterPos3f)(GLfloat x, GLfloat y, GLfloat z);
|
||||
extern void (APIENTRY *qglRasterPos3fv)(const GLfloat *v);
|
||||
extern void (APIENTRY *qglRasterPos3i)(GLint x, GLint y, GLint z);
|
||||
extern void (APIENTRY *qglRasterPos3iv)(const GLint *v);
|
||||
extern void (APIENTRY *qglRasterPos3s)(GLshort x, GLshort y, GLshort z);
|
||||
extern void (APIENTRY *qglRasterPos3sv)(const GLshort *v);
|
||||
extern void (APIENTRY *qglRasterPos4d)(GLdouble x, GLdouble y, GLdouble z,
|
||||
GLdouble w);
|
||||
extern void (APIENTRY *qglRasterPos4dv)(const GLdouble *v);
|
||||
extern void (APIENTRY *qglRasterPos4f)(GLfloat x, GLfloat y, GLfloat z,
|
||||
GLfloat w);
|
||||
extern void (APIENTRY *qglRasterPos4fv)(const GLfloat *v);
|
||||
extern void (APIENTRY *qglRasterPos4i)(GLint x, GLint y, GLint z, GLint w);
|
||||
extern void (APIENTRY *qglRasterPos4iv)(const GLint *v);
|
||||
extern void (APIENTRY *qglRasterPos4s)(GLshort x, GLshort y, GLshort z,
|
||||
GLshort w);
|
||||
extern void (APIENTRY *qglRasterPos4sv)(const GLshort *v);
|
||||
extern void (APIENTRY *qglReadBuffer)(GLenum mode);
|
||||
extern void (APIENTRY *qglReadPixels)(GLint x, GLint y, GLsizei width,
|
||||
GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
|
||||
extern void (APIENTRY *qglRectd)(GLdouble x1, GLdouble y1, GLdouble x2,
|
||||
GLdouble y2);
|
||||
extern void (APIENTRY *qglRectdv)(const GLdouble *v1, const GLdouble *v2);
|
||||
extern void (APIENTRY *qglRectf)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
|
||||
extern void (APIENTRY *qglRectfv)(const GLfloat *v1, const GLfloat *v2);
|
||||
extern void (APIENTRY *qglRecti)(GLint x1, GLint y1, GLint x2, GLint y2);
|
||||
extern void (APIENTRY *qglRectiv)(const GLint *v1, const GLint *v2);
|
||||
extern void (APIENTRY *qglRects)(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
|
||||
extern void (APIENTRY *qglRectsv)(const GLshort *v1, const GLshort *v2);
|
||||
extern GLint (APIENTRY *qglRenderMode)(GLenum mode);
|
||||
extern void (APIENTRY *qglRotated)(GLdouble angle, GLdouble x, GLdouble y,
|
||||
GLdouble z);
|
||||
extern void (APIENTRY *qglRotatef)(GLfloat angle, GLfloat x, GLfloat y,
|
||||
GLfloat z);
|
||||
extern void (APIENTRY *qglScaled)(GLdouble x, GLdouble y, GLdouble z);
|
||||
extern void (APIENTRY *qglScalef)(GLfloat x, GLfloat y, GLfloat z);
|
||||
extern void (APIENTRY *qglScissor)(GLint x, GLint y, GLsizei width,
|
||||
GLsizei height);
|
||||
extern void (APIENTRY *qglSelectBuffer)(GLsizei size, GLuint *buffer);
|
||||
extern void (APIENTRY *qglShadeModel)(GLenum mode);
|
||||
extern void (APIENTRY *qglStencilFunc)(GLenum func, GLint ref, GLuint mask);
|
||||
extern void (APIENTRY *qglStencilMask)(GLuint mask);
|
||||
extern void (APIENTRY *qglStencilOp)(GLenum fail, GLenum zfail, GLenum zpass);
|
||||
extern void (APIENTRY *qglTexCoord1d)(GLdouble s);
|
||||
extern void (APIENTRY *qglTexCoord1dv)(const GLdouble *v);
|
||||
extern void (APIENTRY *qglTexCoord1f)(GLfloat s);
|
||||
extern void (APIENTRY *qglTexCoord1fv)(const GLfloat *v);
|
||||
extern void (APIENTRY *qglTexCoord1i)(GLint s);
|
||||
extern void (APIENTRY *qglTexCoord1iv)(const GLint *v);
|
||||
extern void (APIENTRY *qglTexCoord1s)(GLshort s);
|
||||
extern void (APIENTRY *qglTexCoord1sv)(const GLshort *v);
|
||||
extern void (APIENTRY *qglTexCoord2d)(GLdouble s, GLdouble t);
|
||||
extern void (APIENTRY *qglTexCoord2dv)(const GLdouble *v);
|
||||
extern void (APIENTRY *qglTexCoord2f)(GLfloat s, GLfloat t);
|
||||
extern void (APIENTRY *qglTexCoord2fv)(const GLfloat *v);
|
||||
extern void (APIENTRY *qglTexCoord2i)(GLint s, GLint t);
|
||||
extern void (APIENTRY *qglTexCoord2iv)(const GLint *v);
|
||||
extern void (APIENTRY *qglTexCoord2s)(GLshort s, GLshort t);
|
||||
extern void (APIENTRY *qglTexCoord2sv)(const GLshort *v);
|
||||
extern void (APIENTRY *qglTexCoord3d)(GLdouble s, GLdouble t, GLdouble r);
|
||||
extern void (APIENTRY *qglTexCoord3dv)(const GLdouble *v);
|
||||
extern void (APIENTRY *qglTexCoord3f)(GLfloat s, GLfloat t, GLfloat r);
|
||||
extern void (APIENTRY *qglTexCoord3fv)(const GLfloat *v);
|
||||
extern void (APIENTRY *qglTexCoord3i)(GLint s, GLint t, GLint r);
|
||||
extern void (APIENTRY *qglTexCoord3iv)(const GLint *v);
|
||||
extern void (APIENTRY *qglTexCoord3s)(GLshort s, GLshort t, GLshort r);
|
||||
extern void (APIENTRY *qglTexCoord3sv)(const GLshort *v);
|
||||
extern void (APIENTRY *qglTexCoord4d)(GLdouble s, GLdouble t, GLdouble r,
|
||||
GLdouble q);
|
||||
extern void (APIENTRY *qglTexCoord4dv)(const GLdouble *v);
|
||||
extern void (APIENTRY *qglTexCoord4f)(GLfloat s, GLfloat t, GLfloat r,
|
||||
GLfloat q);
|
||||
extern void (APIENTRY *qglTexCoord4fv)(const GLfloat *v);
|
||||
extern void (APIENTRY *qglTexCoord4i)(GLint s, GLint t, GLint r, GLint q);
|
||||
extern void (APIENTRY *qglTexCoord4iv)(const GLint *v);
|
||||
extern void (APIENTRY *qglTexCoord4s)(GLshort s, GLshort t, GLshort r,
|
||||
GLshort q);
|
||||
extern void (APIENTRY *qglTexCoord4sv)(const GLshort *v);
|
||||
extern void (APIENTRY *qglTexCoordPointer)(GLint size, GLenum type,
|
||||
GLsizei stride, const GLvoid *pointer);
|
||||
extern void (APIENTRY *qglTexEnvf)(GLenum target, GLenum pname, GLfloat param);
|
||||
extern void (APIENTRY *qglTexEnvfv)(GLenum target, GLenum pname,
|
||||
const GLfloat *params);
|
||||
extern void (APIENTRY *qglTexEnvi)(GLenum target, GLenum pname, GLint param);
|
||||
extern void (APIENTRY *qglTexEnviv)(GLenum target, GLenum pname,
|
||||
const GLint *params);
|
||||
extern void (APIENTRY *qglTexGend)(GLenum coord, GLenum pname, GLdouble param);
|
||||
extern void (APIENTRY *qglTexGendv)(GLenum coord, GLenum pname,
|
||||
const GLdouble *params);
|
||||
extern void (APIENTRY *qglTexGenf)(GLenum coord, GLenum pname, GLfloat param);
|
||||
extern void (APIENTRY *qglTexGenfv)(GLenum coord, GLenum pname,
|
||||
const GLfloat *params);
|
||||
extern void (APIENTRY *qglTexGeni)(GLenum coord, GLenum pname, GLint param);
|
||||
extern void (APIENTRY *qglTexGeniv)(GLenum coord, GLenum pname,
|
||||
const GLint *params);
|
||||
extern void (APIENTRY *qglTexImage1D)(GLenum target, GLint level,
|
||||
GLint internalformat, GLsizei width, GLint border, GLenum format,
|
||||
GLenum type, const GLvoid *pixels);
|
||||
extern void (APIENTRY *qglTexImage2D)(GLenum target, GLint level,
|
||||
GLint internalformat, GLsizei width, GLsizei height, GLint border,
|
||||
GLenum format, GLenum type, const GLvoid *pixels);
|
||||
extern void (APIENTRY *qglTexParameterf)(GLenum target, GLenum pname,
|
||||
GLfloat param);
|
||||
extern void (APIENTRY *qglTexParameterfv)(GLenum target, GLenum pname,
|
||||
const GLfloat *params);
|
||||
extern void (APIENTRY *qglTexParameteri)(GLenum target, GLenum pname,
|
||||
GLint param);
|
||||
extern void (APIENTRY *qglTexParameteriv)(GLenum target, GLenum pname,
|
||||
const GLint *params);
|
||||
extern void (APIENTRY *qglTexSubImage1D)(GLenum target, GLint level,
|
||||
GLint xoffset, GLsizei width, GLenum format, GLenum type,
|
||||
const GLvoid *pixels);
|
||||
extern void (APIENTRY *qglTexSubImage2D)(GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
|
||||
GLenum format, GLenum type, const GLvoid *pixels);
|
||||
extern void (APIENTRY *qglTranslated)(GLdouble x, GLdouble y, GLdouble z);
|
||||
extern void (APIENTRY *qglTranslatef)(GLfloat x, GLfloat y, GLfloat z);
|
||||
extern void (APIENTRY *qglVertex2d)(GLdouble x, GLdouble y);
|
||||
extern void (APIENTRY *qglVertex2dv)(const GLdouble *v);
|
||||
extern void (APIENTRY *qglVertex2f)(GLfloat x, GLfloat y);
|
||||
extern void (APIENTRY *qglVertex2fv)(const GLfloat *v);
|
||||
extern void (APIENTRY *qglVertex2i)(GLint x, GLint y);
|
||||
extern void (APIENTRY *qglVertex2iv)(const GLint *v);
|
||||
extern void (APIENTRY *qglVertex2s)(GLshort x, GLshort y);
|
||||
extern void (APIENTRY *qglVertex2sv)(const GLshort *v);
|
||||
extern void (APIENTRY *qglVertex3d)(GLdouble x, GLdouble y, GLdouble z);
|
||||
extern void (APIENTRY *qglVertex3dv)(const GLdouble *v);
|
||||
extern void (APIENTRY *qglVertex3f)(GLfloat x, GLfloat y, GLfloat z);
|
||||
extern void (APIENTRY *qglVertex3fv)(const GLfloat *v);
|
||||
extern void (APIENTRY *qglVertex3i)(GLint x, GLint y, GLint z);
|
||||
extern void (APIENTRY *qglVertex3iv)(const GLint *v);
|
||||
extern void (APIENTRY *qglVertex3s)(GLshort x, GLshort y, GLshort z);
|
||||
extern void (APIENTRY *qglVertex3sv)(const GLshort *v);
|
||||
extern void (APIENTRY *qglVertex4d)(GLdouble x, GLdouble y, GLdouble z,
|
||||
GLdouble w);
|
||||
extern void (APIENTRY *qglVertex4dv)(const GLdouble *v);
|
||||
extern void (APIENTRY *qglVertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
extern void (APIENTRY *qglVertex4fv)(const GLfloat *v);
|
||||
extern void (APIENTRY *qglVertex4i)(GLint x, GLint y, GLint z, GLint w);
|
||||
extern void (APIENTRY *qglVertex4iv)(const GLint *v);
|
||||
extern void (APIENTRY *qglVertex4s)(GLshort x, GLshort y, GLshort z, GLshort w);
|
||||
extern void (APIENTRY *qglVertex4sv)(const GLshort *v);
|
||||
extern void (APIENTRY *qglVertexPointer)(GLint size, GLenum type,
|
||||
GLsizei stride, const GLvoid *pointer);
|
||||
extern void (APIENTRY *qglViewport)(GLint x, GLint y, GLsizei width,
|
||||
GLsizei height);
|
||||
|
||||
extern void ( APIENTRY *qglPointParameterfEXT )( GLenum param, GLfloat value );
|
||||
extern void ( APIENTRY *qglPointParameterfvEXT )( GLenum param, const GLfloat *value );
|
||||
extern void ( APIENTRY *qglColorTableEXT )( GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid * );
|
||||
extern void (APIENTRY *qglPointParameterfEXT)(GLenum param, GLfloat value);
|
||||
extern void (APIENTRY *qglPointParameterfvEXT)(GLenum param,
|
||||
const GLfloat *value);
|
||||
extern void (APIENTRY *qglColorTableEXT)(GLenum, GLenum, GLsizei, GLenum,
|
||||
GLenum, const GLvoid *);
|
||||
|
||||
extern void ( APIENTRY *qglLockArraysEXT )( int, int );
|
||||
extern void (APIENTRY *qglLockArraysEXT)(int, int);
|
||||
|
||||
extern void ( APIENTRY *qglUnlockArraysEXT )( void );
|
||||
extern void ( APIENTRY *qglMTexCoord2fSGIS )( GLenum, GLfloat, GLfloat );
|
||||
extern void ( APIENTRY *qglSelectTextureSGIS )( GLenum );
|
||||
extern void (APIENTRY *qglUnlockArraysEXT)(void);
|
||||
extern void (APIENTRY *qglMTexCoord2fSGIS)(GLenum, GLfloat, GLfloat);
|
||||
extern void (APIENTRY *qglSelectTextureSGIS)(GLenum);
|
||||
|
||||
extern void ( APIENTRY *qglActiveTextureARB )( GLenum );
|
||||
extern void ( APIENTRY *qglClientActiveTextureARB )( GLenum );
|
||||
extern void (APIENTRY *qglActiveTextureARB)(GLenum);
|
||||
extern void (APIENTRY *qglClientActiveTextureARB)(GLenum);
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
extern int ( WINAPI * qwglChoosePixelFormat )(HDC, CONST PIXELFORMATDESCRIPTOR *);
|
||||
extern int ( WINAPI * qwglDescribePixelFormat) (HDC, int, UINT, LPPIXELFORMATDESCRIPTOR);
|
||||
extern int ( WINAPI * qwglGetPixelFormat)(HDC);
|
||||
extern BOOL ( WINAPI * qwglSetPixelFormat)(HDC, int, CONST PIXELFORMATDESCRIPTOR *);
|
||||
extern BOOL ( WINAPI * qwglSwapBuffers)(HDC);
|
||||
extern int (WINAPI *qwglChoosePixelFormat)(HDC, CONST PIXELFORMATDESCRIPTOR *);
|
||||
extern int (WINAPI *qwglDescribePixelFormat)(HDC, int, UINT,
|
||||
LPPIXELFORMATDESCRIPTOR);
|
||||
extern int (WINAPI *qwglGetPixelFormat)(HDC);
|
||||
extern BOOL (WINAPI *qwglSetPixelFormat)(HDC, int,
|
||||
CONST PIXELFORMATDESCRIPTOR *);
|
||||
extern BOOL (WINAPI *qwglSwapBuffers)(HDC);
|
||||
|
||||
extern BOOL ( WINAPI * qwglCopyContext)(HGLRC, HGLRC, UINT);
|
||||
extern HGLRC ( WINAPI * qwglCreateContext)(HDC);
|
||||
extern HGLRC ( WINAPI * qwglCreateLayerContext)(HDC, int);
|
||||
extern BOOL ( WINAPI * qwglDeleteContext)(HGLRC);
|
||||
extern HGLRC ( WINAPI * qwglGetCurrentContext)(VOID);
|
||||
extern HDC ( WINAPI * qwglGetCurrentDC)(VOID);
|
||||
extern PROC ( WINAPI * qwglGetProcAddress)(LPCSTR);
|
||||
extern BOOL ( WINAPI * qwglMakeCurrent)(HDC, HGLRC);
|
||||
extern BOOL ( WINAPI * qwglShareLists)(HGLRC, HGLRC);
|
||||
extern BOOL ( WINAPI * qwglUseFontBitmaps)(HDC, DWORD, DWORD, DWORD);
|
||||
extern BOOL (WINAPI *qwglCopyContext)(HGLRC, HGLRC, UINT);
|
||||
extern HGLRC (WINAPI *qwglCreateContext)(HDC);
|
||||
extern HGLRC (WINAPI *qwglCreateLayerContext)(HDC, int);
|
||||
extern BOOL (WINAPI *qwglDeleteContext)(HGLRC);
|
||||
extern HGLRC (WINAPI *qwglGetCurrentContext)(VOID);
|
||||
extern HDC (WINAPI *qwglGetCurrentDC)(VOID);
|
||||
extern PROC (WINAPI *qwglGetProcAddress)(LPCSTR);
|
||||
extern BOOL (WINAPI *qwglMakeCurrent)(HDC, HGLRC);
|
||||
extern BOOL (WINAPI *qwglShareLists)(HGLRC, HGLRC);
|
||||
extern BOOL (WINAPI *qwglUseFontBitmaps)(HDC, DWORD, DWORD, DWORD);
|
||||
|
||||
extern BOOL ( WINAPI * qwglUseFontOutlines)(HDC, DWORD, DWORD, DWORD, FLOAT, FLOAT, int, LPGLYPHMETRICSFLOAT);
|
||||
extern BOOL (WINAPI *qwglUseFontOutlines)(HDC, DWORD, DWORD, DWORD, FLOAT,
|
||||
FLOAT, int, LPGLYPHMETRICSFLOAT);
|
||||
|
||||
extern BOOL ( WINAPI * qwglDescribeLayerPlane)(HDC, int, int, UINT, LPLAYERPLANEDESCRIPTOR);
|
||||
extern int ( WINAPI * qwglSetLayerPaletteEntries)(HDC, int, int, int, CONST COLORREF *);
|
||||
extern int ( WINAPI * qwglGetLayerPaletteEntries)(HDC, int, int, int, COLORREF *);
|
||||
extern BOOL ( WINAPI * qwglRealizeLayerPalette)(HDC, int, BOOL);
|
||||
extern BOOL ( WINAPI * qwglSwapLayerBuffers)(HDC, UINT);
|
||||
extern BOOL (WINAPI *qwglDescribeLayerPlane)(HDC, int, int, UINT,
|
||||
LPLAYERPLANEDESCRIPTOR);
|
||||
extern int (WINAPI *qwglSetLayerPaletteEntries)(HDC, int, int, int,
|
||||
CONST COLORREF *);
|
||||
extern int (WINAPI *qwglGetLayerPaletteEntries)(HDC, int, int, int, COLORREF *);
|
||||
extern BOOL (WINAPI *qwglRealizeLayerPalette)(HDC, int, BOOL);
|
||||
extern BOOL (WINAPI *qwglSwapLayerBuffers)(HDC, UINT);
|
||||
|
||||
extern BOOL ( WINAPI * qwglSwapIntervalEXT)( int interval );
|
||||
extern BOOL (WINAPI *qwglSwapIntervalEXT)(int interval);
|
||||
|
||||
extern BOOL ( WINAPI * qwglGetDeviceGammaRampEXT ) ( unsigned char *pRed, unsigned char *pGreen, unsigned char *pBlue );
|
||||
extern BOOL ( WINAPI * qwglSetDeviceGammaRampEXT ) ( const unsigned char *pRed, const unsigned char *pGreen, const unsigned char *pBlue );
|
||||
extern BOOL (WINAPI *qwglGetDeviceGammaRampEXT)(unsigned char *pRed,
|
||||
unsigned char *pGreen, unsigned char *pBlue);
|
||||
extern BOOL (WINAPI *qwglSetDeviceGammaRampEXT)(const unsigned char *pRed,
|
||||
const unsigned char *pGreen, const unsigned char *pBlue);
|
||||
|
||||
#else
|
||||
|
||||
/* local function in dll */
|
||||
extern void *qwglGetProcAddress ( char *symbol );
|
||||
extern void *qwglGetProcAddress(char *symbol);
|
||||
|
||||
void Fake_glColorTableEXT(GLenum target, GLenum internalformat, GLsizei width,
|
||||
GLenum format, GLenum type, const GLvoid *table);
|
||||
|
||||
void Fake_glColorTableEXT ( GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table );
|
||||
#endif
|
||||
|
||||
extern int QGL_TEXTURE0, QGL_TEXTURE1;
|
||||
|
||||
#ifndef GL_EXT_texture_env_combine
|
||||
#define GL_COMBINE_EXT 0x8570
|
||||
#define GL_COMBINE_RGB_EXT 0x8571
|
||||
#define GL_COMBINE_ALPHA_EXT 0x8572
|
||||
#define GL_RGB_SCALE_EXT 0x8573
|
||||
#define GL_ADD_SIGNED_EXT 0x8574
|
||||
#define GL_INTERPOLATE_EXT 0x8575
|
||||
#define GL_CONSTANT_EXT 0x8576
|
||||
#define GL_PRIMARY_COLOR_EXT 0x8577
|
||||
#define GL_PREVIOUS_EXT 0x8578
|
||||
#define GL_SOURCE0_RGB_EXT 0x8580
|
||||
#define GL_SOURCE1_RGB_EXT 0x8581
|
||||
#define GL_SOURCE2_RGB_EXT 0x8582
|
||||
#define GL_SOURCE3_RGB_EXT 0x8583
|
||||
#define GL_SOURCE4_RGB_EXT 0x8584
|
||||
#define GL_SOURCE5_RGB_EXT 0x8585
|
||||
#define GL_SOURCE6_RGB_EXT 0x8586
|
||||
#define GL_SOURCE7_RGB_EXT 0x8587
|
||||
#define GL_SOURCE0_ALPHA_EXT 0x8588
|
||||
#define GL_SOURCE1_ALPHA_EXT 0x8589
|
||||
#define GL_SOURCE2_ALPHA_EXT 0x858A
|
||||
#define GL_SOURCE3_ALPHA_EXT 0x858B
|
||||
#define GL_SOURCE4_ALPHA_EXT 0x858C
|
||||
#define GL_SOURCE5_ALPHA_EXT 0x858D
|
||||
#define GL_SOURCE6_ALPHA_EXT 0x858E
|
||||
#define GL_SOURCE7_ALPHA_EXT 0x858F
|
||||
#define GL_OPERAND0_RGB_EXT 0x8590
|
||||
#define GL_OPERAND1_RGB_EXT 0x8591
|
||||
#define GL_OPERAND2_RGB_EXT 0x8592
|
||||
#define GL_OPERAND3_RGB_EXT 0x8593
|
||||
#define GL_OPERAND4_RGB_EXT 0x8594
|
||||
#define GL_OPERAND5_RGB_EXT 0x8595
|
||||
#define GL_OPERAND6_RGB_EXT 0x8596
|
||||
#define GL_OPERAND7_RGB_EXT 0x8597
|
||||
#define GL_OPERAND0_ALPHA_EXT 0x8598
|
||||
#define GL_OPERAND1_ALPHA_EXT 0x8599
|
||||
#define GL_OPERAND2_ALPHA_EXT 0x859A
|
||||
#define GL_OPERAND3_ALPHA_EXT 0x859B
|
||||
#define GL_OPERAND4_ALPHA_EXT 0x859C
|
||||
#define GL_OPERAND5_ALPHA_EXT 0x859D
|
||||
#define GL_OPERAND6_ALPHA_EXT 0x859E
|
||||
#define GL_OPERAND7_ALPHA_EXT 0x859F
|
||||
#define GL_COMBINE_EXT 0x8570
|
||||
#define GL_COMBINE_RGB_EXT 0x8571
|
||||
#define GL_COMBINE_ALPHA_EXT 0x8572
|
||||
#define GL_RGB_SCALE_EXT 0x8573
|
||||
#define GL_ADD_SIGNED_EXT 0x8574
|
||||
#define GL_INTERPOLATE_EXT 0x8575
|
||||
#define GL_CONSTANT_EXT 0x8576
|
||||
#define GL_PRIMARY_COLOR_EXT 0x8577
|
||||
#define GL_PREVIOUS_EXT 0x8578
|
||||
#define GL_SOURCE0_RGB_EXT 0x8580
|
||||
#define GL_SOURCE1_RGB_EXT 0x8581
|
||||
#define GL_SOURCE2_RGB_EXT 0x8582
|
||||
#define GL_SOURCE3_RGB_EXT 0x8583
|
||||
#define GL_SOURCE4_RGB_EXT 0x8584
|
||||
#define GL_SOURCE5_RGB_EXT 0x8585
|
||||
#define GL_SOURCE6_RGB_EXT 0x8586
|
||||
#define GL_SOURCE7_RGB_EXT 0x8587
|
||||
#define GL_SOURCE0_ALPHA_EXT 0x8588
|
||||
#define GL_SOURCE1_ALPHA_EXT 0x8589
|
||||
#define GL_SOURCE2_ALPHA_EXT 0x858A
|
||||
#define GL_SOURCE3_ALPHA_EXT 0x858B
|
||||
#define GL_SOURCE4_ALPHA_EXT 0x858C
|
||||
#define GL_SOURCE5_ALPHA_EXT 0x858D
|
||||
#define GL_SOURCE6_ALPHA_EXT 0x858E
|
||||
#define GL_SOURCE7_ALPHA_EXT 0x858F
|
||||
#define GL_OPERAND0_RGB_EXT 0x8590
|
||||
#define GL_OPERAND1_RGB_EXT 0x8591
|
||||
#define GL_OPERAND2_RGB_EXT 0x8592
|
||||
#define GL_OPERAND3_RGB_EXT 0x8593
|
||||
#define GL_OPERAND4_RGB_EXT 0x8594
|
||||
#define GL_OPERAND5_RGB_EXT 0x8595
|
||||
#define GL_OPERAND6_RGB_EXT 0x8596
|
||||
#define GL_OPERAND7_RGB_EXT 0x8597
|
||||
#define GL_OPERAND0_ALPHA_EXT 0x8598
|
||||
#define GL_OPERAND1_ALPHA_EXT 0x8599
|
||||
#define GL_OPERAND2_ALPHA_EXT 0x859A
|
||||
#define GL_OPERAND3_ALPHA_EXT 0x859B
|
||||
#define GL_OPERAND4_ALPHA_EXT 0x859C
|
||||
#define GL_OPERAND5_ALPHA_EXT 0x859D
|
||||
#define GL_OPERAND6_ALPHA_EXT 0x859E
|
||||
#define GL_OPERAND7_ALPHA_EXT 0x859F
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -26,20 +26,21 @@
|
|||
|
||||
#include "header/local.h"
|
||||
|
||||
image_t *draw_chars;
|
||||
image_t *draw_chars;
|
||||
|
||||
extern qboolean scrap_dirty;
|
||||
void Scrap_Upload ( void );
|
||||
extern unsigned r_rawpalette [ 256 ];
|
||||
void Scrap_Upload(void);
|
||||
|
||||
extern unsigned r_rawpalette[256];
|
||||
|
||||
void
|
||||
Draw_InitLocal ( void )
|
||||
Draw_InitLocal(void)
|
||||
{
|
||||
/* load console characters (don't bilerp characters) */
|
||||
draw_chars = R_FindImage( "pics/conchars.pcx", it_pic );
|
||||
R_Bind( draw_chars->texnum );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
|
||||
draw_chars = R_FindImage("pics/conchars.pcx", it_pic);
|
||||
R_Bind(draw_chars->texnum);
|
||||
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -48,19 +49,19 @@ Draw_InitLocal ( void )
|
|||
* smoothly scrolled off.
|
||||
*/
|
||||
void
|
||||
Draw_Char ( int x, int y, int num )
|
||||
Draw_Char(int x, int y, int num)
|
||||
{
|
||||
int row, col;
|
||||
float frow, fcol, size;
|
||||
|
||||
num &= 255;
|
||||
|
||||
if ( ( num & 127 ) == 32 )
|
||||
if ((num & 127) == 32)
|
||||
{
|
||||
return; /* space */
|
||||
}
|
||||
|
||||
if ( y <= -8 )
|
||||
if (y <= -8)
|
||||
{
|
||||
return; /* totally off screen */
|
||||
}
|
||||
|
@ -72,47 +73,47 @@ Draw_Char ( int x, int y, int num )
|
|||
fcol = col * 0.0625;
|
||||
size = 0.0625;
|
||||
|
||||
R_Bind( draw_chars->texnum );
|
||||
R_Bind(draw_chars->texnum);
|
||||
|
||||
qglBegin( GL_QUADS );
|
||||
qglTexCoord2f( fcol, frow );
|
||||
qglVertex2f( x, y );
|
||||
qglTexCoord2f( fcol + size, frow );
|
||||
qglVertex2f( x + 8, y );
|
||||
qglTexCoord2f( fcol + size, frow + size );
|
||||
qglVertex2f( x + 8, y + 8 );
|
||||
qglTexCoord2f( fcol, frow + size );
|
||||
qglVertex2f( x, y + 8 );
|
||||
qglBegin(GL_QUADS);
|
||||
qglTexCoord2f(fcol, frow);
|
||||
qglVertex2f(x, y);
|
||||
qglTexCoord2f(fcol + size, frow);
|
||||
qglVertex2f(x + 8, y);
|
||||
qglTexCoord2f(fcol + size, frow + size);
|
||||
qglVertex2f(x + 8, y + 8);
|
||||
qglTexCoord2f(fcol, frow + size);
|
||||
qglVertex2f(x, y + 8);
|
||||
qglEnd();
|
||||
}
|
||||
|
||||
image_t *
|
||||
Draw_FindPic ( char *name )
|
||||
Draw_FindPic(char *name)
|
||||
{
|
||||
image_t *gl;
|
||||
char fullname [ MAX_QPATH ];
|
||||
char fullname[MAX_QPATH];
|
||||
|
||||
if ( ( name [ 0 ] != '/' ) && ( name [ 0 ] != '\\' ) )
|
||||
if ((name[0] != '/') && (name[0] != '\\'))
|
||||
{
|
||||
Com_sprintf( fullname, sizeof ( fullname ), "pics/%s.pcx", name );
|
||||
gl = R_FindImage( fullname, it_pic );
|
||||
Com_sprintf(fullname, sizeof(fullname), "pics/%s.pcx", name);
|
||||
gl = R_FindImage(fullname, it_pic);
|
||||
}
|
||||
else
|
||||
{
|
||||
gl = R_FindImage( name + 1, it_pic );
|
||||
gl = R_FindImage(name + 1, it_pic);
|
||||
}
|
||||
|
||||
return ( gl );
|
||||
return gl;
|
||||
}
|
||||
|
||||
void
|
||||
Draw_GetPicSize ( int *w, int *h, char *pic )
|
||||
Draw_GetPicSize(int *w, int *h, char *pic)
|
||||
{
|
||||
image_t *gl;
|
||||
|
||||
gl = Draw_FindPic( pic );
|
||||
gl = Draw_FindPic(pic);
|
||||
|
||||
if ( !gl )
|
||||
if (!gl)
|
||||
{
|
||||
*w = *h = -1;
|
||||
return;
|
||||
|
@ -123,64 +124,64 @@ Draw_GetPicSize ( int *w, int *h, char *pic )
|
|||
}
|
||||
|
||||
void
|
||||
Draw_StretchPic ( int x, int y, int w, int h, char *pic )
|
||||
Draw_StretchPic(int x, int y, int w, int h, char *pic)
|
||||
{
|
||||
image_t *gl;
|
||||
|
||||
gl = Draw_FindPic( pic );
|
||||
gl = Draw_FindPic(pic);
|
||||
|
||||
if ( !gl )
|
||||
if (!gl)
|
||||
{
|
||||
ri.Con_Printf( PRINT_ALL, "Can't find pic: %s\n", pic );
|
||||
ri.Con_Printf(PRINT_ALL, "Can't find pic: %s\n", pic);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( scrap_dirty )
|
||||
if (scrap_dirty)
|
||||
{
|
||||
Scrap_Upload();
|
||||
}
|
||||
|
||||
R_Bind( gl->texnum );
|
||||
qglBegin( GL_QUADS );
|
||||
qglTexCoord2f( gl->sl, gl->tl );
|
||||
qglVertex2f( x, y );
|
||||
qglTexCoord2f( gl->sh, gl->tl );
|
||||
qglVertex2f( x + w, y );
|
||||
qglTexCoord2f( gl->sh, gl->th );
|
||||
qglVertex2f( x + w, y + h );
|
||||
qglTexCoord2f( gl->sl, gl->th );
|
||||
qglVertex2f( x, y + h );
|
||||
R_Bind(gl->texnum);
|
||||
qglBegin(GL_QUADS);
|
||||
qglTexCoord2f(gl->sl, gl->tl);
|
||||
qglVertex2f(x, y);
|
||||
qglTexCoord2f(gl->sh, gl->tl);
|
||||
qglVertex2f(x + w, y);
|
||||
qglTexCoord2f(gl->sh, gl->th);
|
||||
qglVertex2f(x + w, y + h);
|
||||
qglTexCoord2f(gl->sl, gl->th);
|
||||
qglVertex2f(x, y + h);
|
||||
qglEnd();
|
||||
}
|
||||
|
||||
void
|
||||
Draw_Pic ( int x, int y, char *pic )
|
||||
Draw_Pic(int x, int y, char *pic)
|
||||
{
|
||||
image_t *gl;
|
||||
|
||||
gl = Draw_FindPic( pic );
|
||||
gl = Draw_FindPic(pic);
|
||||
|
||||
if ( !gl )
|
||||
if (!gl)
|
||||
{
|
||||
ri.Con_Printf( PRINT_ALL, "Can't find pic: %s\n", pic );
|
||||
ri.Con_Printf(PRINT_ALL, "Can't find pic: %s\n", pic);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( scrap_dirty )
|
||||
if (scrap_dirty)
|
||||
{
|
||||
Scrap_Upload();
|
||||
}
|
||||
|
||||
R_Bind( gl->texnum );
|
||||
qglBegin( GL_QUADS );
|
||||
qglTexCoord2f( gl->sl, gl->tl );
|
||||
qglVertex2f( x, y );
|
||||
qglTexCoord2f( gl->sh, gl->tl );
|
||||
qglVertex2f( x + gl->width, y );
|
||||
qglTexCoord2f( gl->sh, gl->th );
|
||||
qglVertex2f( x + gl->width, y + gl->height );
|
||||
qglTexCoord2f( gl->sl, gl->th );
|
||||
qglVertex2f( x, y + gl->height );
|
||||
R_Bind(gl->texnum);
|
||||
qglBegin(GL_QUADS);
|
||||
qglTexCoord2f(gl->sl, gl->tl);
|
||||
qglVertex2f(x, y);
|
||||
qglTexCoord2f(gl->sh, gl->tl);
|
||||
qglVertex2f(x + gl->width, y);
|
||||
qglTexCoord2f(gl->sh, gl->th);
|
||||
qglVertex2f(x + gl->width, y + gl->height);
|
||||
qglTexCoord2f(gl->sl, gl->th);
|
||||
qglVertex2f(x, y + gl->height);
|
||||
qglEnd();
|
||||
}
|
||||
|
||||
|
@ -190,28 +191,28 @@ Draw_Pic ( int x, int y, char *pic )
|
|||
* refresh window.
|
||||
*/
|
||||
void
|
||||
Draw_TileClear ( int x, int y, int w, int h, char *pic )
|
||||
Draw_TileClear(int x, int y, int w, int h, char *pic)
|
||||
{
|
||||
image_t *image;
|
||||
|
||||
image = Draw_FindPic( pic );
|
||||
image = Draw_FindPic(pic);
|
||||
|
||||
if ( !image )
|
||||
if (!image)
|
||||
{
|
||||
ri.Con_Printf( PRINT_ALL, "Can't find pic: %s\n", pic );
|
||||
ri.Con_Printf(PRINT_ALL, "Can't find pic: %s\n", pic);
|
||||
return;
|
||||
}
|
||||
|
||||
R_Bind( image->texnum );
|
||||
qglBegin( GL_QUADS );
|
||||
qglTexCoord2f( x / 64.0, y / 64.0 );
|
||||
qglVertex2f( x, y );
|
||||
qglTexCoord2f( ( x + w ) / 64.0, y / 64.0 );
|
||||
qglVertex2f( x + w, y );
|
||||
qglTexCoord2f( ( x + w ) / 64.0, ( y + h ) / 64.0 );
|
||||
qglVertex2f( x + w, y + h );
|
||||
qglTexCoord2f( x / 64.0, ( y + h ) / 64.0 );
|
||||
qglVertex2f( x, y + h );
|
||||
R_Bind(image->texnum);
|
||||
qglBegin(GL_QUADS);
|
||||
qglTexCoord2f(x / 64.0, y / 64.0);
|
||||
qglVertex2f(x, y);
|
||||
qglTexCoord2f((x + w) / 64.0, y / 64.0);
|
||||
qglVertex2f(x + w, y);
|
||||
qglTexCoord2f((x + w) / 64.0, (y + h) / 64.0);
|
||||
qglVertex2f(x + w, y + h);
|
||||
qglTexCoord2f(x / 64.0, (y + h) / 64.0);
|
||||
qglVertex2f(x, y + h);
|
||||
qglEnd();
|
||||
}
|
||||
|
||||
|
@ -219,63 +220,61 @@ Draw_TileClear ( int x, int y, int w, int h, char *pic )
|
|||
* Fills a box of pixels with a single color
|
||||
*/
|
||||
void
|
||||
Draw_Fill ( int x, int y, int w, int h, int c )
|
||||
Draw_Fill(int x, int y, int w, int h, int c)
|
||||
{
|
||||
union
|
||||
{
|
||||
unsigned c;
|
||||
byte v [ 4 ];
|
||||
byte v[4];
|
||||
} color;
|
||||
|
||||
if ( (unsigned) c > 255 )
|
||||
if ((unsigned)c > 255)
|
||||
{
|
||||
ri.Sys_Error( ERR_FATAL, "Draw_Fill: bad color" );
|
||||
ri.Sys_Error(ERR_FATAL, "Draw_Fill: bad color");
|
||||
}
|
||||
|
||||
qglDisable( GL_TEXTURE_2D );
|
||||
qglDisable(GL_TEXTURE_2D);
|
||||
|
||||
color.c = d_8to24table [ c ];
|
||||
qglColor3f( color.v [ 0 ] / 255.0,
|
||||
color.v [ 1 ] / 255.0,
|
||||
color.v [ 2 ] / 255.0 );
|
||||
color.c = d_8to24table[c];
|
||||
qglColor3f(color.v[0] / 255.0, color.v[1] / 255.0,
|
||||
color.v[2] / 255.0);
|
||||
|
||||
qglBegin( GL_QUADS );
|
||||
qglBegin(GL_QUADS);
|
||||
|
||||
qglVertex2f( x, y );
|
||||
qglVertex2f( x + w, y );
|
||||
qglVertex2f( x + w, y + h );
|
||||
qglVertex2f( x, y + h );
|
||||
qglVertex2f(x, y);
|
||||
qglVertex2f(x + w, y);
|
||||
qglVertex2f(x + w, y + h);
|
||||
qglVertex2f(x, y + h);
|
||||
|
||||
qglEnd();
|
||||
qglColor3f( 1, 1, 1 );
|
||||
qglEnable( GL_TEXTURE_2D );
|
||||
qglColor3f(1, 1, 1);
|
||||
qglEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
void
|
||||
Draw_FadeScreen ( void )
|
||||
Draw_FadeScreen(void)
|
||||
{
|
||||
qglEnable( GL_BLEND );
|
||||
qglDisable( GL_TEXTURE_2D );
|
||||
qglColor4f( 0, 0, 0, 0.8 );
|
||||
qglBegin( GL_QUADS );
|
||||
qglEnable(GL_BLEND);
|
||||
qglDisable(GL_TEXTURE_2D);
|
||||
qglColor4f(0, 0, 0, 0.8);
|
||||
qglBegin(GL_QUADS);
|
||||
|
||||
qglVertex2f( 0, 0 );
|
||||
qglVertex2f( vid.width, 0 );
|
||||
qglVertex2f( vid.width, vid.height );
|
||||
qglVertex2f( 0, vid.height );
|
||||
qglVertex2f(0, 0);
|
||||
qglVertex2f(vid.width, 0);
|
||||
qglVertex2f(vid.width, vid.height);
|
||||
qglVertex2f(0, vid.height);
|
||||
|
||||
qglEnd();
|
||||
qglColor4f( 1, 1, 1, 1 );
|
||||
qglEnable( GL_TEXTURE_2D );
|
||||
qglDisable( GL_BLEND );
|
||||
qglColor4f(1, 1, 1, 1);
|
||||
qglEnable(GL_TEXTURE_2D);
|
||||
qglDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Draw_StretchRaw ( int x, int y, int w, int h, int cols, int rows, byte *data )
|
||||
Draw_StretchRaw(int x, int y, int w, int h, int cols, int rows, byte *data)
|
||||
{
|
||||
unsigned image32 [ 256 * 256 ];
|
||||
unsigned char image8 [ 256 * 256 ];
|
||||
unsigned image32[256 * 256];
|
||||
unsigned char image8[256 * 256];
|
||||
int i, j, trows;
|
||||
byte *source;
|
||||
int frac, fracstep;
|
||||
|
@ -283,9 +282,9 @@ Draw_StretchRaw ( int x, int y, int w, int h, int cols, int rows, byte *data )
|
|||
int row;
|
||||
float t;
|
||||
|
||||
R_Bind( 0 );
|
||||
R_Bind(0);
|
||||
|
||||
if ( rows <= 256 )
|
||||
if (rows <= 256)
|
||||
{
|
||||
hscale = 1;
|
||||
trows = rows;
|
||||
|
@ -298,114 +297,117 @@ Draw_StretchRaw ( int x, int y, int w, int h, int cols, int rows, byte *data )
|
|||
|
||||
t = rows * hscale / 256 - 1.0 / 512.0;
|
||||
|
||||
if ( !qglColorTableEXT )
|
||||
if (!qglColorTableEXT)
|
||||
{
|
||||
unsigned *dest;
|
||||
|
||||
for ( i = 0; i < trows; i++ )
|
||||
for (i = 0; i < trows; i++)
|
||||
{
|
||||
row = (int) ( i * hscale );
|
||||
row = (int)(i * hscale);
|
||||
|
||||
if ( row > rows )
|
||||
if (row > rows)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
source = data + cols * row;
|
||||
dest = &image32 [ i * 256 ];
|
||||
dest = &image32[i * 256];
|
||||
fracstep = cols * 0x10000 / 256;
|
||||
frac = fracstep >> 1;
|
||||
|
||||
for ( j = 0; j < 256; j++ )
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
dest [ j ] = r_rawpalette [ source [ frac >> 16 ] ];
|
||||
dest[j] = r_rawpalette[source[frac >> 16]];
|
||||
frac += fracstep;
|
||||
}
|
||||
}
|
||||
|
||||
qglTexImage2D( GL_TEXTURE_2D, 0, gl_tex_solid_format, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, image32 );
|
||||
qglTexImage2D(GL_TEXTURE_2D, 0, gl_tex_solid_format,
|
||||
256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
image32);
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned char *dest;
|
||||
|
||||
for ( i = 0; i < trows; i++ )
|
||||
for (i = 0; i < trows; i++)
|
||||
{
|
||||
row = (int) ( i * hscale );
|
||||
row = (int)(i * hscale);
|
||||
|
||||
if ( row > rows )
|
||||
if (row > rows)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
source = data + cols * row;
|
||||
dest = &image8 [ i * 256 ];
|
||||
dest = &image8[i * 256];
|
||||
fracstep = cols * 0x10000 / 256;
|
||||
frac = fracstep >> 1;
|
||||
|
||||
for ( j = 0; j < 256; j++ )
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
dest [ j ] = source [ frac >> 16 ];
|
||||
dest[j] = source[frac >> 16];
|
||||
frac += fracstep;
|
||||
}
|
||||
}
|
||||
|
||||
qglTexImage2D( GL_TEXTURE_2D,
|
||||
qglTexImage2D(GL_TEXTURE_2D,
|
||||
0,
|
||||
GL_COLOR_INDEX8_EXT,
|
||||
256, 256,
|
||||
0,
|
||||
GL_COLOR_INDEX,
|
||||
GL_UNSIGNED_BYTE,
|
||||
image8 );
|
||||
image8);
|
||||
}
|
||||
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
qglBegin( GL_QUADS );
|
||||
qglTexCoord2f( 1.0 / 512.0, 1.0 / 512.0 );
|
||||
qglVertex2f( x, y );
|
||||
qglTexCoord2f( 511.0 / 512.0, 1.0 / 512.0 );
|
||||
qglVertex2f( x + w, y );
|
||||
qglTexCoord2f( 511.0 / 512.0, t );
|
||||
qglVertex2f( x + w, y + h );
|
||||
qglTexCoord2f( 1.0 / 512.0, t );
|
||||
qglVertex2f( x, y + h );
|
||||
qglBegin(GL_QUADS);
|
||||
qglTexCoord2f(1.0 / 512.0, 1.0 / 512.0);
|
||||
qglVertex2f(x, y);
|
||||
qglTexCoord2f(511.0 / 512.0, 1.0 / 512.0);
|
||||
qglVertex2f(x + w, y);
|
||||
qglTexCoord2f(511.0 / 512.0, t);
|
||||
qglVertex2f(x + w, y + h);
|
||||
qglTexCoord2f(1.0 / 512.0, t);
|
||||
qglVertex2f(x, y + h);
|
||||
qglEnd();
|
||||
}
|
||||
|
||||
int
|
||||
Draw_GetPalette ( void )
|
||||
Draw_GetPalette(void)
|
||||
{
|
||||
int i;
|
||||
int r, g, b;
|
||||
unsigned v;
|
||||
byte *pic, *pal;
|
||||
byte *pic, *pal;
|
||||
int width, height;
|
||||
|
||||
/* get the palette */
|
||||
LoadPCX( "pics/colormap.pcx", &pic, &pal, &width, &height );
|
||||
LoadPCX("pics/colormap.pcx", &pic, &pal, &width, &height);
|
||||
|
||||
if ( !pal )
|
||||
if (!pal)
|
||||
{
|
||||
ri.Sys_Error( ERR_FATAL, "Couldn't load pics/colormap.pcx" );
|
||||
ri.Sys_Error(ERR_FATAL, "Couldn't load pics/colormap.pcx");
|
||||
}
|
||||
|
||||
for ( i = 0; i < 256; i++ )
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
r = pal [ i * 3 + 0 ];
|
||||
g = pal [ i * 3 + 1 ];
|
||||
b = pal [ i * 3 + 2 ];
|
||||
r = pal[i * 3 + 0];
|
||||
g = pal[i * 3 + 1];
|
||||
b = pal[i * 3 + 2];
|
||||
|
||||
v = ( 255 << 24 ) + ( r << 0 ) + ( g << 8 ) + ( b << 16 );
|
||||
d_8to24table [ i ] = LittleLong( v );
|
||||
v = (255 << 24) + (r << 0) + (g << 8) + (b << 16);
|
||||
d_8to24table[i] = LittleLong(v);
|
||||
}
|
||||
|
||||
d_8to24table [ 255 ] &= LittleLong( 0xffffff ); /* 255 is transparent */
|
||||
d_8to24table[255] &= LittleLong(0xffffff); /* 255 is transparent */
|
||||
|
||||
free( pic );
|
||||
free( pal );
|
||||
free(pic);
|
||||
free(pal);
|
||||
|
||||
return ( 0 );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -26,16 +26,16 @@
|
|||
|
||||
#include "header/local.h"
|
||||
|
||||
#define DLIGHT_CUTOFF 64
|
||||
#define DLIGHT_CUTOFF 64
|
||||
|
||||
int r_dlightframecount;
|
||||
vec3_t pointcolor;
|
||||
cplane_t *lightplane; /* used as shadow plane */
|
||||
vec3_t lightspot;
|
||||
static float s_blocklights [ 34 * 34 * 3 ];
|
||||
static float s_blocklights[34 * 34 * 3];
|
||||
|
||||
void
|
||||
R_RenderDlight ( dlight_t *light )
|
||||
R_RenderDlight(dlight_t *light)
|
||||
{
|
||||
int i, j;
|
||||
float a;
|
||||
|
@ -44,42 +44,43 @@ R_RenderDlight ( dlight_t *light )
|
|||
|
||||
rad = light->intensity * 0.35;
|
||||
|
||||
VectorSubtract( light->origin, r_origin, v );
|
||||
VectorSubtract(light->origin, r_origin, v);
|
||||
|
||||
qglBegin( GL_TRIANGLE_FAN );
|
||||
qglColor3f( light->color [ 0 ] * 0.2, light->color [ 1 ] * 0.2, light->color [ 2 ] * 0.2 );
|
||||
qglBegin(GL_TRIANGLE_FAN);
|
||||
qglColor3f(light->color[0] * 0.2, light->color[1] * 0.2,
|
||||
light->color[2] * 0.2);
|
||||
|
||||
for ( i = 0; i < 3; i++ )
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
v [ i ] = light->origin [ i ] - vpn [ i ] * rad;
|
||||
v[i] = light->origin[i] - vpn[i] * rad;
|
||||
}
|
||||
|
||||
qglVertex3fv( v );
|
||||
qglColor3f( 0, 0, 0 );
|
||||
qglVertex3fv(v);
|
||||
qglColor3f(0, 0, 0);
|
||||
|
||||
for ( i = 16; i >= 0; i-- )
|
||||
for (i = 16; i >= 0; i--)
|
||||
{
|
||||
a = i / 16.0 * M_PI * 2;
|
||||
|
||||
for ( j = 0; j < 3; j++ )
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
v [ j ] = light->origin [ j ] + vright [ j ] * cos( a ) * rad
|
||||
+ vup [ j ] * sin( a ) * rad;
|
||||
v[j] = light->origin[j] + vright[j] * cos(a) * rad
|
||||
+ vup[j] * sin(a) * rad;
|
||||
}
|
||||
|
||||
qglVertex3fv( v );
|
||||
qglVertex3fv(v);
|
||||
}
|
||||
|
||||
qglEnd();
|
||||
}
|
||||
|
||||
void
|
||||
R_RenderDlights ( void )
|
||||
R_RenderDlights(void)
|
||||
{
|
||||
int i;
|
||||
dlight_t *l;
|
||||
dlight_t *l;
|
||||
|
||||
if ( !gl_flashblend->value )
|
||||
if (!gl_flashblend->value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -87,72 +88,77 @@ R_RenderDlights ( void )
|
|||
/* because the count hasn't advanced yet for this frame */
|
||||
r_dlightframecount = r_framecount + 1;
|
||||
|
||||
qglDepthMask( 0 );
|
||||
qglDisable( GL_TEXTURE_2D );
|
||||
qglShadeModel( GL_SMOOTH );
|
||||
qglEnable( GL_BLEND );
|
||||
qglBlendFunc( GL_ONE, GL_ONE );
|
||||
qglDepthMask(0);
|
||||
qglDisable(GL_TEXTURE_2D);
|
||||
qglShadeModel(GL_SMOOTH);
|
||||
qglEnable(GL_BLEND);
|
||||
qglBlendFunc(GL_ONE, GL_ONE);
|
||||
|
||||
l = r_newrefdef.dlights;
|
||||
|
||||
for ( i = 0; i < r_newrefdef.num_dlights; i++, l++ )
|
||||
for (i = 0; i < r_newrefdef.num_dlights; i++, l++)
|
||||
{
|
||||
R_RenderDlight( l );
|
||||
R_RenderDlight(l);
|
||||
}
|
||||
|
||||
qglColor3f( 1, 1, 1 );
|
||||
qglDisable( GL_BLEND );
|
||||
qglEnable( GL_TEXTURE_2D );
|
||||
qglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||
qglDepthMask( 1 );
|
||||
qglColor3f(1, 1, 1);
|
||||
qglDisable(GL_BLEND);
|
||||
qglEnable(GL_TEXTURE_2D);
|
||||
qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
qglDepthMask(1);
|
||||
}
|
||||
|
||||
void
|
||||
R_MarkLights ( dlight_t *light, int bit, mnode_t *node )
|
||||
R_MarkLights(dlight_t *light, int bit, mnode_t *node)
|
||||
{
|
||||
cplane_t *splitplane;
|
||||
cplane_t *splitplane;
|
||||
float dist;
|
||||
msurface_t *surf;
|
||||
msurface_t *surf;
|
||||
int i;
|
||||
int sidebit;
|
||||
|
||||
if ( node->contents != -1 )
|
||||
if (node->contents != -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
splitplane = node->plane;
|
||||
dist = DotProduct( light->origin, splitplane->normal ) - splitplane->dist;
|
||||
dist = DotProduct(light->origin, splitplane->normal) - splitplane->dist;
|
||||
|
||||
if ( dist > light->intensity - DLIGHT_CUTOFF )
|
||||
if (dist > light->intensity - DLIGHT_CUTOFF)
|
||||
{
|
||||
R_MarkLights( light, bit, node->children [ 0 ] );
|
||||
R_MarkLights(light, bit, node->children[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( dist < -light->intensity + DLIGHT_CUTOFF )
|
||||
if (dist < -light->intensity + DLIGHT_CUTOFF)
|
||||
{
|
||||
R_MarkLights( light, bit, node->children [ 1 ] );
|
||||
R_MarkLights(light, bit, node->children[1]);
|
||||
return;
|
||||
}
|
||||
|
||||
/* mark the polygons */
|
||||
surf = r_worldmodel->surfaces + node->firstsurface;
|
||||
|
||||
for ( i = 0; i < node->numsurfaces; i++, surf++ )
|
||||
for (i = 0; i < node->numsurfaces; i++, surf++)
|
||||
{
|
||||
dist = DotProduct (light->origin, surf->plane->normal) - surf->plane->dist;
|
||||
dist = DotProduct(light->origin, surf->plane->normal) - surf->plane->dist;
|
||||
|
||||
if (dist >= 0)
|
||||
if (dist >= 0)
|
||||
{
|
||||
sidebit = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
sidebit = SURF_PLANEBACK;
|
||||
}
|
||||
|
||||
|
||||
if ( (surf->flags & SURF_PLANEBACK) != sidebit )
|
||||
if ((surf->flags & SURF_PLANEBACK) != sidebit)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( surf->dlightframe != r_dlightframecount )
|
||||
if (surf->dlightframe != r_dlightframecount)
|
||||
{
|
||||
surf->dlightbits = 0;
|
||||
surf->dlightframe = r_dlightframecount;
|
||||
|
@ -161,17 +167,17 @@ R_MarkLights ( dlight_t *light, int bit, mnode_t *node )
|
|||
surf->dlightbits |= bit;
|
||||
}
|
||||
|
||||
R_MarkLights( light, bit, node->children [ 0 ] );
|
||||
R_MarkLights( light, bit, node->children [ 1 ] );
|
||||
R_MarkLights(light, bit, node->children[0]);
|
||||
R_MarkLights(light, bit, node->children[1]);
|
||||
}
|
||||
|
||||
void
|
||||
R_PushDlights ( void )
|
||||
R_PushDlights(void)
|
||||
{
|
||||
int i;
|
||||
dlight_t *l;
|
||||
dlight_t *l;
|
||||
|
||||
if ( gl_flashblend->value )
|
||||
if (gl_flashblend->value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -181,186 +187,186 @@ R_PushDlights ( void )
|
|||
|
||||
l = r_newrefdef.dlights;
|
||||
|
||||
for ( i = 0; i < r_newrefdef.num_dlights; i++, l++ )
|
||||
for (i = 0; i < r_newrefdef.num_dlights; i++, l++)
|
||||
{
|
||||
R_MarkLights( l, 1 << i, r_worldmodel->nodes );
|
||||
R_MarkLights(l, 1 << i, r_worldmodel->nodes);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
R_RecursiveLightPoint ( mnode_t *node, vec3_t start, vec3_t end )
|
||||
R_RecursiveLightPoint(mnode_t *node, vec3_t start, vec3_t end)
|
||||
{
|
||||
float front, back, frac;
|
||||
int side;
|
||||
cplane_t *plane;
|
||||
cplane_t *plane;
|
||||
vec3_t mid;
|
||||
msurface_t *surf;
|
||||
msurface_t *surf;
|
||||
int s, t, ds, dt;
|
||||
int i;
|
||||
mtexinfo_t *tex;
|
||||
byte *lightmap;
|
||||
mtexinfo_t *tex;
|
||||
byte *lightmap;
|
||||
int maps;
|
||||
int r;
|
||||
|
||||
if ( node->contents != -1 )
|
||||
if (node->contents != -1)
|
||||
{
|
||||
return ( -1 ); /* didn't hit anything */
|
||||
return -1; /* didn't hit anything */
|
||||
}
|
||||
|
||||
/* calculate mid point */
|
||||
plane = node->plane;
|
||||
front = DotProduct( start, plane->normal ) - plane->dist;
|
||||
back = DotProduct( end, plane->normal ) - plane->dist;
|
||||
front = DotProduct(start, plane->normal) - plane->dist;
|
||||
back = DotProduct(end, plane->normal) - plane->dist;
|
||||
side = front < 0;
|
||||
|
||||
if ( ( back < 0 ) == side )
|
||||
if ((back < 0) == side)
|
||||
{
|
||||
return ( R_RecursiveLightPoint( node->children [ side ], start, end ) );
|
||||
return R_RecursiveLightPoint(node->children[side], start, end);
|
||||
}
|
||||
|
||||
frac = front / ( front - back );
|
||||
mid [ 0 ] = start [ 0 ] + ( end [ 0 ] - start [ 0 ] ) * frac;
|
||||
mid [ 1 ] = start [ 1 ] + ( end [ 1 ] - start [ 1 ] ) * frac;
|
||||
mid [ 2 ] = start [ 2 ] + ( end [ 2 ] - start [ 2 ] ) * frac;
|
||||
frac = front / (front - back);
|
||||
mid[0] = start[0] + (end[0] - start[0]) * frac;
|
||||
mid[1] = start[1] + (end[1] - start[1]) * frac;
|
||||
mid[2] = start[2] + (end[2] - start[2]) * frac;
|
||||
|
||||
/* go down front side */
|
||||
r = R_RecursiveLightPoint( node->children [ side ], start, mid );
|
||||
r = R_RecursiveLightPoint(node->children[side], start, mid);
|
||||
|
||||
if ( r >= 0 )
|
||||
if (r >= 0)
|
||||
{
|
||||
return ( r ); /* hit something */
|
||||
return r; /* hit something */
|
||||
}
|
||||
|
||||
if ( ( back < 0 ) == side )
|
||||
if ((back < 0) == side)
|
||||
{
|
||||
return ( -1 ); /* didn't hit anuthing */
|
||||
return -1; /* didn't hit anuthing */
|
||||
}
|
||||
|
||||
/* check for impact on this node */
|
||||
VectorCopy( mid, lightspot );
|
||||
VectorCopy(mid, lightspot);
|
||||
lightplane = plane;
|
||||
|
||||
surf = r_worldmodel->surfaces + node->firstsurface;
|
||||
|
||||
for ( i = 0; i < node->numsurfaces; i++, surf++ )
|
||||
for (i = 0; i < node->numsurfaces; i++, surf++)
|
||||
{
|
||||
if ( surf->flags & ( SURF_DRAWTURB | SURF_DRAWSKY ) )
|
||||
if (surf->flags & (SURF_DRAWTURB | SURF_DRAWSKY))
|
||||
{
|
||||
continue; /* no lightmaps */
|
||||
}
|
||||
|
||||
tex = surf->texinfo;
|
||||
|
||||
s = DotProduct( mid, tex->vecs [ 0 ] ) + tex->vecs [ 0 ] [ 3 ];
|
||||
t = DotProduct( mid, tex->vecs [ 1 ] ) + tex->vecs [ 1 ] [ 3 ];
|
||||
s = DotProduct(mid, tex->vecs[0]) + tex->vecs[0][3];
|
||||
t = DotProduct(mid, tex->vecs[1]) + tex->vecs[1][3];
|
||||
|
||||
if ( ( s < surf->texturemins [ 0 ] ) ||
|
||||
( t < surf->texturemins [ 1 ] ) )
|
||||
if ((s < surf->texturemins[0]) ||
|
||||
(t < surf->texturemins[1]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ds = s - surf->texturemins [ 0 ];
|
||||
dt = t - surf->texturemins [ 1 ];
|
||||
ds = s - surf->texturemins[0];
|
||||
dt = t - surf->texturemins[1];
|
||||
|
||||
if ( ( ds > surf->extents [ 0 ] ) || ( dt > surf->extents [ 1 ] ) )
|
||||
if ((ds > surf->extents[0]) || (dt > surf->extents[1]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !surf->samples )
|
||||
if (!surf->samples)
|
||||
{
|
||||
return ( 0 );
|
||||
return 0;
|
||||
}
|
||||
|
||||
ds >>= 4;
|
||||
dt >>= 4;
|
||||
|
||||
lightmap = surf->samples;
|
||||
VectorCopy( vec3_origin, pointcolor );
|
||||
VectorCopy(vec3_origin, pointcolor);
|
||||
|
||||
if ( lightmap )
|
||||
if (lightmap)
|
||||
{
|
||||
vec3_t scale;
|
||||
|
||||
lightmap += 3 * ( dt * ( ( surf->extents [ 0 ] >> 4 ) + 1 ) + ds );
|
||||
lightmap += 3 * (dt * ((surf->extents[0] >> 4) + 1) + ds);
|
||||
|
||||
for ( maps = 0; maps < MAXLIGHTMAPS && surf->styles [ maps ] != 255;
|
||||
maps++ )
|
||||
for (maps = 0; maps < MAXLIGHTMAPS && surf->styles[maps] != 255;
|
||||
maps++)
|
||||
{
|
||||
for ( i = 0; i < 3; i++ )
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
scale [ i ] = gl_modulate->value * r_newrefdef.lightstyles [ surf->styles [ maps ] ].rgb [ i ];
|
||||
scale[i] = gl_modulate->value *
|
||||
r_newrefdef.lightstyles[surf->styles[maps]].rgb[i];
|
||||
}
|
||||
|
||||
pointcolor [ 0 ] += lightmap [ 0 ] * scale [ 0 ] * ( 1.0 / 255 );
|
||||
pointcolor [ 1 ] += lightmap [ 1 ] * scale [ 1 ] * ( 1.0 / 255 );
|
||||
pointcolor [ 2 ] += lightmap [ 2 ] * scale [ 2 ] * ( 1.0 / 255 );
|
||||
lightmap += 3 * ( ( surf->extents [ 0 ] >> 4 ) + 1 ) *
|
||||
( ( surf->extents [ 1 ] >> 4 ) + 1 );
|
||||
pointcolor[0] += lightmap[0] * scale[0] * (1.0 / 255);
|
||||
pointcolor[1] += lightmap[1] * scale[1] * (1.0 / 255);
|
||||
pointcolor[2] += lightmap[2] * scale[2] * (1.0 / 255);
|
||||
lightmap += 3 * ((surf->extents[0] >> 4) + 1) *
|
||||
((surf->extents[1] >> 4) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
return ( 1 );
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* go down back side */
|
||||
return ( R_RecursiveLightPoint( node->children [ !side ], mid, end ) );
|
||||
return R_RecursiveLightPoint(node->children[!side], mid, end);
|
||||
}
|
||||
|
||||
void
|
||||
R_LightPoint ( vec3_t p, vec3_t color )
|
||||
R_LightPoint(vec3_t p, vec3_t color)
|
||||
{
|
||||
vec3_t end;
|
||||
float r;
|
||||
int lnum;
|
||||
dlight_t *dl;
|
||||
dlight_t *dl;
|
||||
vec3_t dist;
|
||||
float add;
|
||||
|
||||
if ( !r_worldmodel->lightdata )
|
||||
if (!r_worldmodel->lightdata)
|
||||
{
|
||||
color [ 0 ] = color [ 1 ] = color [ 2 ] = 1.0;
|
||||
color[0] = color[1] = color[2] = 1.0;
|
||||
return;
|
||||
}
|
||||
|
||||
end [ 0 ] = p [ 0 ];
|
||||
end [ 1 ] = p [ 1 ];
|
||||
end [ 2 ] = p [ 2 ] - 2048;
|
||||
end[0] = p[0];
|
||||
end[1] = p[1];
|
||||
end[2] = p[2] - 2048;
|
||||
|
||||
r = R_RecursiveLightPoint( r_worldmodel->nodes, p, end );
|
||||
r = R_RecursiveLightPoint(r_worldmodel->nodes, p, end);
|
||||
|
||||
if ( r == -1 )
|
||||
if (r == -1)
|
||||
{
|
||||
VectorCopy( vec3_origin, color );
|
||||
VectorCopy(vec3_origin, color);
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorCopy( pointcolor, color );
|
||||
VectorCopy(pointcolor, color);
|
||||
}
|
||||
|
||||
/* add dynamic lights */
|
||||
dl = r_newrefdef.dlights;
|
||||
|
||||
for ( lnum = 0; lnum < r_newrefdef.num_dlights; lnum++, dl++ )
|
||||
for (lnum = 0; lnum < r_newrefdef.num_dlights; lnum++, dl++)
|
||||
{
|
||||
VectorSubtract( currententity->origin,
|
||||
dl->origin,
|
||||
dist );
|
||||
add = dl->intensity - VectorLength( dist );
|
||||
add *= ( 1.0 / 256 );
|
||||
VectorSubtract(currententity->origin,
|
||||
dl->origin, dist);
|
||||
add = dl->intensity - VectorLength(dist);
|
||||
add *= (1.0 / 256);
|
||||
|
||||
if ( add > 0 )
|
||||
if (add > 0)
|
||||
{
|
||||
VectorMA( color, add, dl->color, color );
|
||||
VectorMA(color, add, dl->color, color);
|
||||
}
|
||||
}
|
||||
|
||||
VectorScale( color, gl_modulate->value, color );
|
||||
VectorScale(color, gl_modulate->value, color);
|
||||
}
|
||||
|
||||
void
|
||||
R_AddDynamicLights ( msurface_t *surf )
|
||||
R_AddDynamicLights(msurface_t *surf)
|
||||
{
|
||||
int lnum;
|
||||
int sd, td;
|
||||
|
@ -369,81 +375,83 @@ R_AddDynamicLights ( msurface_t *surf )
|
|||
int s, t;
|
||||
int i;
|
||||
int smax, tmax;
|
||||
mtexinfo_t *tex;
|
||||
dlight_t *dl;
|
||||
float *pfBL;
|
||||
mtexinfo_t *tex;
|
||||
dlight_t *dl;
|
||||
float *pfBL;
|
||||
float fsacc, ftacc;
|
||||
|
||||
smax = ( surf->extents [ 0 ] >> 4 ) + 1;
|
||||
tmax = ( surf->extents [ 1 ] >> 4 ) + 1;
|
||||
smax = (surf->extents[0] >> 4) + 1;
|
||||
tmax = (surf->extents[1] >> 4) + 1;
|
||||
tex = surf->texinfo;
|
||||
|
||||
for ( lnum = 0; lnum < r_newrefdef.num_dlights; lnum++ )
|
||||
for (lnum = 0; lnum < r_newrefdef.num_dlights; lnum++)
|
||||
{
|
||||
if ( !( surf->dlightbits & ( 1 << lnum ) ) )
|
||||
if (!(surf->dlightbits & (1 << lnum)))
|
||||
{
|
||||
continue; /* not lit by this light */
|
||||
}
|
||||
|
||||
dl = &r_newrefdef.dlights [ lnum ];
|
||||
dl = &r_newrefdef.dlights[lnum];
|
||||
frad = dl->intensity;
|
||||
fdist = DotProduct( dl->origin, surf->plane->normal ) -
|
||||
fdist = DotProduct(dl->origin, surf->plane->normal) -
|
||||
surf->plane->dist;
|
||||
frad -= fabs( fdist );
|
||||
frad -= fabs(fdist);
|
||||
|
||||
/* rad is now the highest intensity on the plane */
|
||||
fminlight = DLIGHT_CUTOFF;
|
||||
|
||||
if ( frad < fminlight )
|
||||
if (frad < fminlight)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
fminlight = frad - fminlight;
|
||||
|
||||
for ( i = 0; i < 3; i++ )
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
impact [ i ] = dl->origin [ i ] -
|
||||
surf->plane->normal [ i ] * fdist;
|
||||
impact[i] = dl->origin[i] -
|
||||
surf->plane->normal[i] * fdist;
|
||||
}
|
||||
|
||||
local [ 0 ] = DotProduct( impact, tex->vecs [ 0 ] ) + tex->vecs [ 0 ] [ 3 ] - surf->texturemins [ 0 ];
|
||||
local [ 1 ] = DotProduct( impact, tex->vecs [ 1 ] ) + tex->vecs [ 1 ] [ 3 ] - surf->texturemins [ 1 ];
|
||||
local[0] = DotProduct(impact,
|
||||
tex->vecs[0]) + tex->vecs[0][3] - surf->texturemins[0];
|
||||
local[1] = DotProduct(impact,
|
||||
tex->vecs[1]) + tex->vecs[1][3] - surf->texturemins[1];
|
||||
|
||||
pfBL = s_blocklights;
|
||||
|
||||
for ( t = 0, ftacc = 0; t < tmax; t++, ftacc += 16 )
|
||||
for (t = 0, ftacc = 0; t < tmax; t++, ftacc += 16)
|
||||
{
|
||||
td = local [ 1 ] - ftacc;
|
||||
td = local[1] - ftacc;
|
||||
|
||||
if ( td < 0 )
|
||||
if (td < 0)
|
||||
{
|
||||
td = -td;
|
||||
}
|
||||
|
||||
for ( s = 0, fsacc = 0; s < smax; s++, fsacc += 16, pfBL += 3 )
|
||||
for (s = 0, fsacc = 0; s < smax; s++, fsacc += 16, pfBL += 3)
|
||||
{
|
||||
sd = Q_ftol( local [ 0 ] - fsacc );
|
||||
sd = Q_ftol(local[0] - fsacc);
|
||||
|
||||
if ( sd < 0 )
|
||||
if (sd < 0)
|
||||
{
|
||||
sd = -sd;
|
||||
}
|
||||
|
||||
if ( sd > td )
|
||||
if (sd > td)
|
||||
{
|
||||
fdist = sd + ( td >> 1 );
|
||||
fdist = sd + (td >> 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
fdist = td + ( sd >> 1 );
|
||||
fdist = td + (sd >> 1);
|
||||
}
|
||||
|
||||
if ( fdist < fminlight )
|
||||
if (fdist < fminlight)
|
||||
{
|
||||
pfBL [ 0 ] += ( frad - fdist ) * dl->color [ 0 ];
|
||||
pfBL [ 1 ] += ( frad - fdist ) * dl->color [ 1 ];
|
||||
pfBL [ 2 ] += ( frad - fdist ) * dl->color [ 2 ];
|
||||
pfBL[0] += (frad - fdist) * dl->color[0];
|
||||
pfBL[1] += (frad - fdist) * dl->color[1];
|
||||
pfBL[2] += (frad - fdist) * dl->color[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -451,14 +459,15 @@ R_AddDynamicLights ( msurface_t *surf )
|
|||
}
|
||||
|
||||
void
|
||||
R_SetCacheState ( msurface_t *surf )
|
||||
R_SetCacheState(msurface_t *surf)
|
||||
{
|
||||
int maps;
|
||||
|
||||
for ( maps = 0; maps < MAXLIGHTMAPS && surf->styles [ maps ] != 255;
|
||||
maps++ )
|
||||
for (maps = 0; maps < MAXLIGHTMAPS && surf->styles[maps] != 255;
|
||||
maps++)
|
||||
{
|
||||
surf->cached_light [ maps ] = r_newrefdef.lightstyles [ surf->styles [ maps ] ].white;
|
||||
surf->cached_light[maps] =
|
||||
r_newrefdef.lightstyles[surf->styles[maps]].white;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -466,122 +475,123 @@ R_SetCacheState ( msurface_t *surf )
|
|||
* Combine and scale multiple lightmaps into the floating format in blocklights
|
||||
*/
|
||||
void
|
||||
R_BuildLightMap ( msurface_t *surf, byte *dest, int stride )
|
||||
R_BuildLightMap(msurface_t *surf, byte *dest, int stride)
|
||||
{
|
||||
int smax, tmax;
|
||||
int r, g, b, a, max;
|
||||
int i, j, size;
|
||||
byte *lightmap;
|
||||
float scale [ 4 ];
|
||||
byte *lightmap;
|
||||
float scale[4];
|
||||
int nummaps;
|
||||
float *bl;
|
||||
float *bl;
|
||||
|
||||
if ( surf->texinfo->flags & ( SURF_SKY | SURF_TRANS33 | SURF_TRANS66 | SURF_WARP ) )
|
||||
if (surf->texinfo->flags &
|
||||
(SURF_SKY | SURF_TRANS33 | SURF_TRANS66 | SURF_WARP))
|
||||
{
|
||||
ri.Sys_Error( ERR_DROP, "R_BuildLightMap called for non-lit surface" );
|
||||
ri.Sys_Error(ERR_DROP, "R_BuildLightMap called for non-lit surface");
|
||||
}
|
||||
|
||||
smax = ( surf->extents [ 0 ] >> 4 ) + 1;
|
||||
tmax = ( surf->extents [ 1 ] >> 4 ) + 1;
|
||||
smax = (surf->extents[0] >> 4) + 1;
|
||||
tmax = (surf->extents[1] >> 4) + 1;
|
||||
size = smax * tmax;
|
||||
|
||||
if ( size > ( sizeof ( s_blocklights ) >> 4 ) )
|
||||
if (size > (sizeof(s_blocklights) >> 4))
|
||||
{
|
||||
ri.Sys_Error( ERR_DROP, "Bad s_blocklights size" );
|
||||
ri.Sys_Error(ERR_DROP, "Bad s_blocklights size");
|
||||
}
|
||||
|
||||
/* set to full bright if no light data */
|
||||
if ( !surf->samples )
|
||||
if (!surf->samples)
|
||||
{
|
||||
for ( i = 0; i < size * 3; i++ )
|
||||
for (i = 0; i < size * 3; i++)
|
||||
{
|
||||
s_blocklights [ i ] = 255;
|
||||
s_blocklights[i] = 255;
|
||||
}
|
||||
|
||||
goto store;
|
||||
}
|
||||
|
||||
/* count the # of maps */
|
||||
for ( nummaps = 0; nummaps < MAXLIGHTMAPS && surf->styles [ nummaps ] != 255;
|
||||
nummaps++ )
|
||||
for (nummaps = 0; nummaps < MAXLIGHTMAPS && surf->styles[nummaps] != 255;
|
||||
nummaps++)
|
||||
{
|
||||
}
|
||||
|
||||
lightmap = surf->samples;
|
||||
|
||||
/* add all the lightmaps */
|
||||
if ( nummaps == 1 )
|
||||
if (nummaps == 1)
|
||||
{
|
||||
int maps;
|
||||
|
||||
for ( maps = 0; maps < MAXLIGHTMAPS && surf->styles [ maps ] != 255;
|
||||
maps++ )
|
||||
for (maps = 0; maps < MAXLIGHTMAPS && surf->styles[maps] != 255; maps++)
|
||||
{
|
||||
bl = s_blocklights;
|
||||
|
||||
for ( i = 0; i < 3; i++ )
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
scale [ i ] = gl_modulate->value * r_newrefdef.lightstyles [ surf->styles [ maps ] ].rgb [ i ];
|
||||
scale[i] = gl_modulate->value *
|
||||
r_newrefdef.lightstyles[surf->styles[maps]].rgb[i];
|
||||
}
|
||||
|
||||
if ( ( scale [ 0 ] == 1.0F ) &&
|
||||
( scale [ 1 ] == 1.0F ) &&
|
||||
( scale [ 2 ] == 1.0F ) )
|
||||
if ((scale[0] == 1.0F) &&
|
||||
(scale[1] == 1.0F) &&
|
||||
(scale[2] == 1.0F))
|
||||
{
|
||||
for ( i = 0; i < size; i++, bl += 3 )
|
||||
for (i = 0; i < size; i++, bl += 3)
|
||||
{
|
||||
bl [ 0 ] = lightmap [ i * 3 + 0 ];
|
||||
bl [ 1 ] = lightmap [ i * 3 + 1 ];
|
||||
bl [ 2 ] = lightmap [ i * 3 + 2 ];
|
||||
bl[0] = lightmap[i * 3 + 0];
|
||||
bl[1] = lightmap[i * 3 + 1];
|
||||
bl[2] = lightmap[i * 3 + 2];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( i = 0; i < size; i++, bl += 3 )
|
||||
for (i = 0; i < size; i++, bl += 3)
|
||||
{
|
||||
bl [ 0 ] = lightmap [ i * 3 + 0 ] * scale [ 0 ];
|
||||
bl [ 1 ] = lightmap [ i * 3 + 1 ] * scale [ 1 ];
|
||||
bl [ 2 ] = lightmap [ i * 3 + 2 ] * scale [ 2 ];
|
||||
bl[0] = lightmap[i * 3 + 0] * scale[0];
|
||||
bl[1] = lightmap[i * 3 + 1] * scale[1];
|
||||
bl[2] = lightmap[i * 3 + 2] * scale[2];
|
||||
}
|
||||
}
|
||||
|
||||
lightmap += size * 3; /* skip to next lightmap */
|
||||
lightmap += size * 3; /* skip to next lightmap */
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int maps;
|
||||
|
||||
memset( s_blocklights, 0, sizeof ( s_blocklights [ 0 ] ) * size * 3 );
|
||||
memset(s_blocklights, 0, sizeof(s_blocklights[0]) * size * 3);
|
||||
|
||||
for ( maps = 0; maps < MAXLIGHTMAPS && surf->styles [ maps ] != 255;
|
||||
maps++ )
|
||||
for (maps = 0; maps < MAXLIGHTMAPS && surf->styles[maps] != 255; maps++)
|
||||
{
|
||||
bl = s_blocklights;
|
||||
|
||||
for ( i = 0; i < 3; i++ )
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
scale [ i ] = gl_modulate->value * r_newrefdef.lightstyles [ surf->styles [ maps ] ].rgb [ i ];
|
||||
scale[i] = gl_modulate->value *
|
||||
r_newrefdef.lightstyles[surf->styles[maps]].rgb[i];
|
||||
}
|
||||
|
||||
if ( ( scale [ 0 ] == 1.0F ) &&
|
||||
( scale [ 1 ] == 1.0F ) &&
|
||||
( scale [ 2 ] == 1.0F ) )
|
||||
if ((scale[0] == 1.0F) &&
|
||||
(scale[1] == 1.0F) &&
|
||||
(scale[2] == 1.0F))
|
||||
{
|
||||
for ( i = 0; i < size; i++, bl += 3 )
|
||||
for (i = 0; i < size; i++, bl += 3)
|
||||
{
|
||||
bl [ 0 ] += lightmap [ i * 3 + 0 ];
|
||||
bl [ 1 ] += lightmap [ i * 3 + 1 ];
|
||||
bl [ 2 ] += lightmap [ i * 3 + 2 ];
|
||||
bl[0] += lightmap[i * 3 + 0];
|
||||
bl[1] += lightmap[i * 3 + 1];
|
||||
bl[2] += lightmap[i * 3 + 2];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( i = 0; i < size; i++, bl += 3 )
|
||||
for (i = 0; i < size; i++, bl += 3)
|
||||
{
|
||||
bl [ 0 ] += lightmap [ i * 3 + 0 ] * scale [ 0 ];
|
||||
bl [ 1 ] += lightmap [ i * 3 + 1 ] * scale [ 1 ];
|
||||
bl [ 2 ] += lightmap [ i * 3 + 2 ] * scale [ 2 ];
|
||||
bl[0] += lightmap[i * 3 + 0] * scale[0];
|
||||
bl[1] += lightmap[i * 3 + 1] * scale[1];
|
||||
bl[2] += lightmap[i * 3 + 2] * scale[2];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -590,42 +600,42 @@ R_BuildLightMap ( msurface_t *surf, byte *dest, int stride )
|
|||
}
|
||||
|
||||
/* add all the dynamic lights */
|
||||
if ( surf->dlightframe == r_framecount )
|
||||
if (surf->dlightframe == r_framecount)
|
||||
{
|
||||
R_AddDynamicLights( surf );
|
||||
R_AddDynamicLights(surf);
|
||||
}
|
||||
|
||||
store:
|
||||
|
||||
stride -= ( smax << 2 );
|
||||
stride -= (smax << 2);
|
||||
bl = s_blocklights;
|
||||
|
||||
for ( i = 0; i < tmax; i++, dest += stride )
|
||||
for (i = 0; i < tmax; i++, dest += stride)
|
||||
{
|
||||
for ( j = 0; j < smax; j++ )
|
||||
for (j = 0; j < smax; j++)
|
||||
{
|
||||
r = Q_ftol( bl [ 0 ] );
|
||||
g = Q_ftol( bl [ 1 ] );
|
||||
b = Q_ftol( bl [ 2 ] );
|
||||
r = Q_ftol(bl[0]);
|
||||
g = Q_ftol(bl[1]);
|
||||
b = Q_ftol(bl[2]);
|
||||
|
||||
/* catch negative lights */
|
||||
if ( r < 0 )
|
||||
if (r < 0)
|
||||
{
|
||||
r = 0;
|
||||
}
|
||||
|
||||
if ( g < 0 )
|
||||
if (g < 0)
|
||||
{
|
||||
g = 0;
|
||||
}
|
||||
|
||||
if ( b < 0 )
|
||||
if (b < 0)
|
||||
{
|
||||
b = 0;
|
||||
}
|
||||
|
||||
/* determine the brightest of the three color components */
|
||||
if ( r > g )
|
||||
if (r > g)
|
||||
{
|
||||
max = r;
|
||||
}
|
||||
|
@ -634,19 +644,20 @@ store:
|
|||
max = g;
|
||||
}
|
||||
|
||||
if ( b > max )
|
||||
if (b > max)
|
||||
{
|
||||
max = b;
|
||||
}
|
||||
|
||||
/* alpha is ONLY used for the mono lightmap case. For this reason
|
||||
we set it to the brightest of the color components so that
|
||||
things don't get too dim. */
|
||||
/* alpha is ONLY used for the mono lightmap case. For this
|
||||
reason we set it to the brightest of the color components
|
||||
so that things don't get too dim. */
|
||||
a = max;
|
||||
|
||||
/* rescale all the color components if the intensity of the greatest
|
||||
channel exceeds 1.0 */
|
||||
if ( max > 255 )
|
||||
/* rescale all the color components if the
|
||||
intensity of the greatest channel exceeds
|
||||
1.0 */
|
||||
if (max > 255)
|
||||
{
|
||||
float t = 255.0F / max;
|
||||
|
||||
|
@ -656,13 +667,14 @@ store:
|
|||
a = a * t;
|
||||
}
|
||||
|
||||
dest [ 0 ] = r;
|
||||
dest [ 1 ] = g;
|
||||
dest [ 2 ] = b;
|
||||
dest [ 3 ] = a;
|
||||
dest[0] = r;
|
||||
dest[1] = g;
|
||||
dest[2] = b;
|
||||
dest[3] = a;
|
||||
|
||||
bl += 3;
|
||||
dest += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,22 +28,22 @@
|
|||
|
||||
extern gllightmapstate_t gl_lms;
|
||||
|
||||
void R_SetCacheState ( msurface_t *surf );
|
||||
void R_BuildLightMap ( msurface_t *surf, byte *dest, int stride );
|
||||
void R_SetCacheState(msurface_t *surf);
|
||||
void R_BuildLightMap(msurface_t *surf, byte *dest, int stride);
|
||||
|
||||
void
|
||||
LM_InitBlock ( void )
|
||||
LM_InitBlock(void)
|
||||
{
|
||||
memset( gl_lms.allocated, 0, sizeof ( gl_lms.allocated ) );
|
||||
memset(gl_lms.allocated, 0, sizeof(gl_lms.allocated));
|
||||
}
|
||||
|
||||
void
|
||||
LM_UploadBlock ( qboolean dynamic )
|
||||
LM_UploadBlock(qboolean dynamic)
|
||||
{
|
||||
int texture;
|
||||
int height = 0;
|
||||
|
||||
if ( dynamic )
|
||||
if (dynamic)
|
||||
{
|
||||
texture = 0;
|
||||
}
|
||||
|
@ -52,75 +52,69 @@ LM_UploadBlock ( qboolean dynamic )
|
|||
texture = gl_lms.current_lightmap_texture;
|
||||
}
|
||||
|
||||
R_Bind( gl_state.lightmap_textures + texture );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
R_Bind(gl_state.lightmap_textures + texture);
|
||||
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
if ( dynamic )
|
||||
if (dynamic)
|
||||
{
|
||||
int i;
|
||||
|
||||
for ( i = 0; i < BLOCK_WIDTH; i++ )
|
||||
for (i = 0; i < BLOCK_WIDTH; i++)
|
||||
{
|
||||
if ( gl_lms.allocated [ i ] > height )
|
||||
if (gl_lms.allocated[i] > height)
|
||||
{
|
||||
height = gl_lms.allocated [ i ];
|
||||
height = gl_lms.allocated[i];
|
||||
}
|
||||
}
|
||||
|
||||
qglTexSubImage2D( GL_TEXTURE_2D,
|
||||
0,
|
||||
0, 0,
|
||||
BLOCK_WIDTH, height,
|
||||
GL_LIGHTMAP_FORMAT,
|
||||
GL_UNSIGNED_BYTE,
|
||||
gl_lms.lightmap_buffer );
|
||||
qglTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, BLOCK_WIDTH,
|
||||
height, GL_LIGHTMAP_FORMAT, GL_UNSIGNED_BYTE,
|
||||
gl_lms.lightmap_buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
qglTexImage2D( GL_TEXTURE_2D,
|
||||
0,
|
||||
gl_lms.internal_format,
|
||||
BLOCK_WIDTH, BLOCK_HEIGHT,
|
||||
0,
|
||||
GL_LIGHTMAP_FORMAT,
|
||||
GL_UNSIGNED_BYTE,
|
||||
gl_lms.lightmap_buffer );
|
||||
qglTexImage2D(GL_TEXTURE_2D, 0, gl_lms.internal_format,
|
||||
BLOCK_WIDTH, BLOCK_HEIGHT, 0, GL_LIGHTMAP_FORMAT,
|
||||
GL_UNSIGNED_BYTE, gl_lms.lightmap_buffer);
|
||||
|
||||
if ( ++gl_lms.current_lightmap_texture == MAX_LIGHTMAPS )
|
||||
if (++gl_lms.current_lightmap_texture == MAX_LIGHTMAPS)
|
||||
{
|
||||
ri.Sys_Error( ERR_DROP, "LM_UploadBlock() - MAX_LIGHTMAPS exceeded\n" );
|
||||
ri.Sys_Error(ERR_DROP,
|
||||
"LM_UploadBlock() - MAX_LIGHTMAPS exceeded\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* returns a texture number and the position inside it */
|
||||
/*
|
||||
* returns a texture number and the position inside it
|
||||
*/
|
||||
qboolean
|
||||
LM_AllocBlock ( int w, int h, int *x, int *y )
|
||||
LM_AllocBlock(int w, int h, int *x, int *y)
|
||||
{
|
||||
int i, j;
|
||||
int best, best2;
|
||||
|
||||
best = BLOCK_HEIGHT;
|
||||
|
||||
for ( i = 0; i < BLOCK_WIDTH - w; i++ )
|
||||
for (i = 0; i < BLOCK_WIDTH - w; i++)
|
||||
{
|
||||
best2 = 0;
|
||||
|
||||
for ( j = 0; j < w; j++ )
|
||||
for (j = 0; j < w; j++)
|
||||
{
|
||||
if ( gl_lms.allocated [ i + j ] >= best )
|
||||
if (gl_lms.allocated[i + j] >= best)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if ( gl_lms.allocated [ i + j ] > best2 )
|
||||
if (gl_lms.allocated[i + j] > best2)
|
||||
{
|
||||
best2 = gl_lms.allocated [ i + j ];
|
||||
best2 = gl_lms.allocated[i + j];
|
||||
}
|
||||
}
|
||||
|
||||
if ( j == w )
|
||||
if (j == w)
|
||||
{
|
||||
/* this is a valid spot */
|
||||
*x = i;
|
||||
|
@ -128,167 +122,172 @@ LM_AllocBlock ( int w, int h, int *x, int *y )
|
|||
}
|
||||
}
|
||||
|
||||
if ( best + h > BLOCK_HEIGHT )
|
||||
if (best + h > BLOCK_HEIGHT)
|
||||
{
|
||||
return ( false );
|
||||
return false;
|
||||
}
|
||||
|
||||
for ( i = 0; i < w; i++ )
|
||||
for (i = 0; i < w; i++)
|
||||
{
|
||||
gl_lms.allocated [ *x + i ] = best + h;
|
||||
gl_lms.allocated[*x + i] = best + h;
|
||||
}
|
||||
|
||||
return ( true );
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
LM_BuildPolygonFromSurface ( msurface_t *fa )
|
||||
LM_BuildPolygonFromSurface(msurface_t *fa)
|
||||
{
|
||||
int i, lindex, lnumverts;
|
||||
medge_t *pedges, *r_pedge;
|
||||
float *vec;
|
||||
medge_t *pedges, *r_pedge;
|
||||
float *vec;
|
||||
float s, t;
|
||||
glpoly_t *poly;
|
||||
glpoly_t *poly;
|
||||
vec3_t total;
|
||||
|
||||
/* reconstruct the polygon */
|
||||
pedges = currentmodel->edges;
|
||||
lnumverts = fa->numedges;
|
||||
|
||||
VectorClear( total );
|
||||
VectorClear(total);
|
||||
|
||||
/* draw texture */
|
||||
poly = Hunk_Alloc( sizeof ( glpoly_t ) + ( lnumverts - 4 ) * VERTEXSIZE * sizeof ( float ) );
|
||||
poly = Hunk_Alloc(sizeof(glpoly_t) +
|
||||
(lnumverts - 4) * VERTEXSIZE * sizeof(float));
|
||||
poly->next = fa->polys;
|
||||
poly->flags = fa->flags;
|
||||
fa->polys = poly;
|
||||
poly->numverts = lnumverts;
|
||||
|
||||
for ( i = 0; i < lnumverts; i++ )
|
||||
for (i = 0; i < lnumverts; i++)
|
||||
{
|
||||
lindex = currentmodel->surfedges [ fa->firstedge + i ];
|
||||
lindex = currentmodel->surfedges[fa->firstedge + i];
|
||||
|
||||
if ( lindex > 0 )
|
||||
if (lindex > 0)
|
||||
{
|
||||
r_pedge = &pedges [ lindex ];
|
||||
vec = currentmodel->vertexes [ r_pedge->v [ 0 ] ].position;
|
||||
r_pedge = &pedges[lindex];
|
||||
vec = currentmodel->vertexes[r_pedge->v[0]].position;
|
||||
}
|
||||
else
|
||||
{
|
||||
r_pedge = &pedges [ -lindex ];
|
||||
vec = currentmodel->vertexes [ r_pedge->v [ 1 ] ].position;
|
||||
r_pedge = &pedges[-lindex];
|
||||
vec = currentmodel->vertexes[r_pedge->v[1]].position;
|
||||
}
|
||||
|
||||
s = DotProduct( vec, fa->texinfo->vecs [ 0 ] ) + fa->texinfo->vecs [ 0 ] [ 3 ];
|
||||
s = DotProduct(vec, fa->texinfo->vecs[0]) + fa->texinfo->vecs[0][3];
|
||||
s /= fa->texinfo->image->width;
|
||||
|
||||
t = DotProduct( vec, fa->texinfo->vecs [ 1 ] ) + fa->texinfo->vecs [ 1 ] [ 3 ];
|
||||
t = DotProduct(vec, fa->texinfo->vecs[1]) + fa->texinfo->vecs[1][3];
|
||||
t /= fa->texinfo->image->height;
|
||||
|
||||
VectorAdd( total, vec, total );
|
||||
VectorCopy( vec, poly->verts [ i ] );
|
||||
poly->verts [ i ] [ 3 ] = s;
|
||||
poly->verts [ i ] [ 4 ] = t;
|
||||
VectorAdd(total, vec, total);
|
||||
VectorCopy(vec, poly->verts[i]);
|
||||
poly->verts[i][3] = s;
|
||||
poly->verts[i][4] = t;
|
||||
|
||||
/* lightmap texture coordinates */
|
||||
s = DotProduct( vec, fa->texinfo->vecs [ 0 ] ) + fa->texinfo->vecs [ 0 ] [ 3 ];
|
||||
s -= fa->texturemins [ 0 ];
|
||||
s = DotProduct(vec, fa->texinfo->vecs[0]) + fa->texinfo->vecs[0][3];
|
||||
s -= fa->texturemins[0];
|
||||
s += fa->light_s * 16;
|
||||
s += 8;
|
||||
s /= BLOCK_WIDTH * 16; /* fa->texinfo->texture->width; */
|
||||
|
||||
t = DotProduct( vec, fa->texinfo->vecs [ 1 ] ) + fa->texinfo->vecs [ 1 ] [ 3 ];
|
||||
t -= fa->texturemins [ 1 ];
|
||||
t = DotProduct(vec, fa->texinfo->vecs[1]) + fa->texinfo->vecs[1][3];
|
||||
t -= fa->texturemins[1];
|
||||
t += fa->light_t * 16;
|
||||
t += 8;
|
||||
t /= BLOCK_HEIGHT * 16; /* fa->texinfo->texture->height; */
|
||||
|
||||
poly->verts [ i ] [ 5 ] = s;
|
||||
poly->verts [ i ] [ 6 ] = t;
|
||||
poly->verts[i][5] = s;
|
||||
poly->verts[i][6] = t;
|
||||
}
|
||||
|
||||
poly->numverts = lnumverts;
|
||||
}
|
||||
|
||||
void
|
||||
LM_CreateSurfaceLightmap ( msurface_t *surf )
|
||||
LM_CreateSurfaceLightmap(msurface_t *surf)
|
||||
{
|
||||
int smax, tmax;
|
||||
byte *base;
|
||||
byte *base;
|
||||
|
||||
if ( surf->flags & ( SURF_DRAWSKY | SURF_DRAWTURB ) )
|
||||
if (surf->flags & (SURF_DRAWSKY | SURF_DRAWTURB))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
smax = ( surf->extents [ 0 ] >> 4 ) + 1;
|
||||
tmax = ( surf->extents [ 1 ] >> 4 ) + 1;
|
||||
smax = (surf->extents[0] >> 4) + 1;
|
||||
tmax = (surf->extents[1] >> 4) + 1;
|
||||
|
||||
if ( !LM_AllocBlock( smax, tmax, &surf->light_s, &surf->light_t ) )
|
||||
if (!LM_AllocBlock(smax, tmax, &surf->light_s, &surf->light_t))
|
||||
{
|
||||
LM_UploadBlock( false );
|
||||
LM_UploadBlock(false);
|
||||
LM_InitBlock();
|
||||
|
||||
if ( !LM_AllocBlock( smax, tmax, &surf->light_s, &surf->light_t ) )
|
||||
if (!LM_AllocBlock(smax, tmax, &surf->light_s, &surf->light_t))
|
||||
{
|
||||
ri.Sys_Error( ERR_FATAL, "Consecutive calls to LM_AllocBlock(%d,%d) failed\n", smax, tmax );
|
||||
ri.Sys_Error(ERR_FATAL, "Consecutive calls to LM_AllocBlock(%d,%d) failed\n",
|
||||
smax, tmax);
|
||||
}
|
||||
}
|
||||
|
||||
surf->lightmaptexturenum = gl_lms.current_lightmap_texture;
|
||||
|
||||
base = gl_lms.lightmap_buffer;
|
||||
base += ( surf->light_t * BLOCK_WIDTH + surf->light_s ) * LIGHTMAP_BYTES;
|
||||
base += (surf->light_t * BLOCK_WIDTH + surf->light_s) * LIGHTMAP_BYTES;
|
||||
|
||||
R_SetCacheState( surf );
|
||||
R_BuildLightMap( surf, base, BLOCK_WIDTH * LIGHTMAP_BYTES );
|
||||
R_SetCacheState(surf);
|
||||
R_BuildLightMap(surf, base, BLOCK_WIDTH * LIGHTMAP_BYTES);
|
||||
}
|
||||
|
||||
void
|
||||
LM_BeginBuildingLightmaps ( model_t *m )
|
||||
LM_BeginBuildingLightmaps(model_t *m)
|
||||
{
|
||||
static lightstyle_t lightstyles [ MAX_LIGHTSTYLES ];
|
||||
static lightstyle_t lightstyles[MAX_LIGHTSTYLES];
|
||||
int i;
|
||||
unsigned dummy [ 128 * 128 ];
|
||||
unsigned dummy[128 * 128];
|
||||
|
||||
memset( gl_lms.allocated, 0, sizeof ( gl_lms.allocated ) );
|
||||
memset(gl_lms.allocated, 0, sizeof(gl_lms.allocated));
|
||||
|
||||
r_framecount = 1; /* no dlightcache */
|
||||
|
||||
R_EnableMultitexture( true );
|
||||
R_SelectTexture( QGL_TEXTURE1 );
|
||||
R_EnableMultitexture(true);
|
||||
R_SelectTexture(QGL_TEXTURE1);
|
||||
|
||||
/* setup the base lightstyles so the lightmaps won't have to be regenerated
|
||||
* the first time they're seen */
|
||||
for ( i = 0; i < MAX_LIGHTSTYLES; i++ )
|
||||
/* setup the base lightstyles so the lightmaps
|
||||
won't have to be regenerated the first time
|
||||
they're seen */
|
||||
for (i = 0; i < MAX_LIGHTSTYLES; i++)
|
||||
{
|
||||
lightstyles [ i ].rgb [ 0 ] = 1;
|
||||
lightstyles [ i ].rgb [ 1 ] = 1;
|
||||
lightstyles [ i ].rgb [ 2 ] = 1;
|
||||
lightstyles [ i ].white = 3;
|
||||
lightstyles[i].rgb[0] = 1;
|
||||
lightstyles[i].rgb[1] = 1;
|
||||
lightstyles[i].rgb[2] = 1;
|
||||
lightstyles[i].white = 3;
|
||||
}
|
||||
|
||||
r_newrefdef.lightstyles = lightstyles;
|
||||
|
||||
if ( !gl_state.lightmap_textures )
|
||||
if (!gl_state.lightmap_textures)
|
||||
{
|
||||
gl_state.lightmap_textures = TEXNUM_LIGHTMAPS;
|
||||
gl_state.lightmap_textures = TEXNUM_LIGHTMAPS;
|
||||
}
|
||||
|
||||
gl_lms.current_lightmap_texture = 1;
|
||||
gl_lms.internal_format = gl_tex_solid_format;
|
||||
|
||||
/* initialize the dynamic lightmap texture */
|
||||
R_Bind( gl_state.lightmap_textures + 0 );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
qglTexImage2D( GL_TEXTURE_2D, 0, gl_lms.internal_format, BLOCK_WIDTH, BLOCK_HEIGHT,
|
||||
0, GL_LIGHTMAP_FORMAT, GL_UNSIGNED_BYTE, dummy );
|
||||
R_Bind(gl_state.lightmap_textures + 0);
|
||||
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
qglTexImage2D(GL_TEXTURE_2D, 0, gl_lms.internal_format,
|
||||
BLOCK_WIDTH, BLOCK_HEIGHT, 0, GL_LIGHTMAP_FORMAT,
|
||||
GL_UNSIGNED_BYTE, dummy);
|
||||
}
|
||||
|
||||
void
|
||||
LM_EndBuildingLightmaps ( void )
|
||||
LM_EndBuildingLightmaps(void)
|
||||
{
|
||||
LM_UploadBlock( false );
|
||||
R_EnableMultitexture( false );
|
||||
LM_UploadBlock(false);
|
||||
R_EnableMultitexture(false);
|
||||
}
|
||||
|
||||
|
|
1350
src/refresh/r_main.c
1350
src/refresh/r_main.c
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -26,15 +26,15 @@
|
|||
|
||||
#include "header/local.h"
|
||||
|
||||
byte dottexture [ 8 ] [ 8 ] = {
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 1, 1, 0, 0, 0, 0 },
|
||||
{ 0, 1, 1, 1, 1, 0, 0, 0 },
|
||||
{ 0, 1, 1, 1, 1, 0, 0, 0 },
|
||||
{ 0, 0, 1, 1, 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
byte dottexture[8][8] = {
|
||||
{0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{0, 0, 1, 1, 0, 0, 0, 0},
|
||||
{0, 1, 1, 1, 1, 0, 0, 0},
|
||||
{0, 1, 1, 1, 1, 0, 0, 0},
|
||||
{0, 0, 1, 1, 0, 0, 0, 0},
|
||||
{0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{0, 0, 0, 0, 0, 0, 0, 0},
|
||||
{0, 0, 0, 0, 0, 0, 0, 0},
|
||||
};
|
||||
|
||||
typedef struct _TargaHeader
|
||||
|
@ -47,181 +47,188 @@ typedef struct _TargaHeader
|
|||
} TargaHeader;
|
||||
|
||||
void
|
||||
R_InitParticleTexture ( void )
|
||||
R_InitParticleTexture(void)
|
||||
{
|
||||
int x, y;
|
||||
byte data [ 8 ] [ 8 ] [ 4 ];
|
||||
byte data[8][8][4];
|
||||
|
||||
/* particle texture */
|
||||
for ( x = 0; x < 8; x++ )
|
||||
for (x = 0; x < 8; x++)
|
||||
{
|
||||
for ( y = 0; y < 8; y++ )
|
||||
for (y = 0; y < 8; y++)
|
||||
{
|
||||
data [ y ] [ x ] [ 0 ] = 255;
|
||||
data [ y ] [ x ] [ 1 ] = 255;
|
||||
data [ y ] [ x ] [ 2 ] = 255;
|
||||
data [ y ] [ x ] [ 3 ] = dottexture [ x ] [ y ] * 255;
|
||||
data[y][x][0] = 255;
|
||||
data[y][x][1] = 255;
|
||||
data[y][x][2] = 255;
|
||||
data[y][x][3] = dottexture[x][y] * 255;
|
||||
}
|
||||
}
|
||||
|
||||
r_particletexture = R_LoadPic( "***particle***", (byte *) data, 8, 0, 8, 0, it_sprite, 32 );
|
||||
r_particletexture = R_LoadPic("***particle***", (byte *)data,
|
||||
8, 0, 8, 0, it_sprite, 32);
|
||||
|
||||
/* also use this for bad textures, but without alpha */
|
||||
for ( x = 0; x < 8; x++ )
|
||||
for (x = 0; x < 8; x++)
|
||||
{
|
||||
for ( y = 0; y < 8; y++ )
|
||||
for (y = 0; y < 8; y++)
|
||||
{
|
||||
data [ y ] [ x ] [ 0 ] = dottexture [ x & 3 ] [ y & 3 ] * 255;
|
||||
data [ y ] [ x ] [ 1 ] = 0;
|
||||
data [ y ] [ x ] [ 2 ] = 0;
|
||||
data [ y ] [ x ] [ 3 ] = 255;
|
||||
data[y][x][0] = dottexture[x & 3][y & 3] * 255;
|
||||
data[y][x][1] = 0;
|
||||
data[y][x][2] = 0;
|
||||
data[y][x][3] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
r_notexture = R_LoadPic( "***r_notexture***", (byte *) data, 8, 0, 8, 0, it_wall, 32 );
|
||||
r_notexture = R_LoadPic("***r_notexture***", (byte *)data,
|
||||
8, 0, 8, 0, it_wall, 32);
|
||||
}
|
||||
|
||||
void
|
||||
R_ScreenShot ( void )
|
||||
R_ScreenShot(void)
|
||||
{
|
||||
byte *buffer;
|
||||
char picname [ 80 ];
|
||||
char checkname [ MAX_OSPATH ];
|
||||
byte *buffer;
|
||||
char picname[80];
|
||||
char checkname[MAX_OSPATH];
|
||||
int i, c, temp;
|
||||
FILE *f;
|
||||
FILE *f;
|
||||
|
||||
/* create the scrnshots directory if it doesn't exist */
|
||||
Com_sprintf( checkname, sizeof ( checkname ), "%s/scrnshot", ri.FS_Gamedir() );
|
||||
ri.Sys_Mkdir( checkname );
|
||||
Com_sprintf(checkname, sizeof(checkname), "%s/scrnshot", ri.FS_Gamedir());
|
||||
ri.Sys_Mkdir(checkname);
|
||||
|
||||
/* find a file name to save it to */
|
||||
strcpy( picname, "quake00.tga" );
|
||||
strcpy(picname, "quake00.tga");
|
||||
|
||||
for ( i = 0; i <= 99; i++ )
|
||||
for (i = 0; i <= 99; i++)
|
||||
{
|
||||
picname [ 5 ] = i / 10 + '0';
|
||||
picname [ 6 ] = i % 10 + '0';
|
||||
Com_sprintf( checkname, sizeof ( checkname ), "%s/scrnshot/%s", ri.FS_Gamedir(), picname );
|
||||
f = fopen( checkname, "rb" );
|
||||
picname[5] = i / 10 + '0';
|
||||
picname[6] = i % 10 + '0';
|
||||
Com_sprintf(checkname, sizeof(checkname), "%s/scrnshot/%s",
|
||||
ri.FS_Gamedir(), picname);
|
||||
f = fopen(checkname, "rb");
|
||||
|
||||
if ( !f )
|
||||
if (!f)
|
||||
{
|
||||
break; /* file doesn't exist */
|
||||
break; /* file doesn't exist */
|
||||
}
|
||||
|
||||
fclose( f );
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
if ( i == 100 )
|
||||
if (i == 100)
|
||||
{
|
||||
ri.Con_Printf( PRINT_ALL, "SCR_ScreenShot_f: Couldn't create a file\n" );
|
||||
ri.Con_Printf(PRINT_ALL, "SCR_ScreenShot_f: Couldn't create a file\n");
|
||||
return;
|
||||
}
|
||||
|
||||
buffer = malloc( vid.width * vid.height * 3 + 18 );
|
||||
memset( buffer, 0, 18 );
|
||||
buffer [ 2 ] = 2; /* uncompressed type */
|
||||
buffer [ 12 ] = vid.width & 255;
|
||||
buffer [ 13 ] = vid.width >> 8;
|
||||
buffer [ 14 ] = vid.height & 255;
|
||||
buffer [ 15 ] = vid.height >> 8;
|
||||
buffer [ 16 ] = 24; /* pixel size */
|
||||
buffer = malloc(vid.width * vid.height * 3 + 18);
|
||||
memset(buffer, 0, 18);
|
||||
buffer[2] = 2; /* uncompressed type */
|
||||
buffer[12] = vid.width & 255;
|
||||
buffer[13] = vid.width >> 8;
|
||||
buffer[14] = vid.height & 255;
|
||||
buffer[15] = vid.height >> 8;
|
||||
buffer[16] = 24; /* pixel size */
|
||||
|
||||
qglReadPixels( 0, 0, vid.width, vid.height, GL_RGB, GL_UNSIGNED_BYTE, buffer + 18 );
|
||||
qglReadPixels(0, 0, vid.width, vid.height, GL_RGB,
|
||||
GL_UNSIGNED_BYTE, buffer + 18);
|
||||
|
||||
/* swap rgb to bgr */
|
||||
c = 18 + vid.width * vid.height * 3;
|
||||
|
||||
for ( i = 18; i < c; i += 3 )
|
||||
for (i = 18; i < c; i += 3)
|
||||
{
|
||||
temp = buffer [ i ];
|
||||
buffer [ i ] = buffer [ i + 2 ];
|
||||
buffer [ i + 2 ] = temp;
|
||||
temp = buffer[i];
|
||||
buffer[i] = buffer[i + 2];
|
||||
buffer[i + 2] = temp;
|
||||
}
|
||||
|
||||
f = fopen( checkname, "wb" );
|
||||
fwrite( buffer, 1, c, f );
|
||||
fclose( f );
|
||||
f = fopen(checkname, "wb");
|
||||
fwrite(buffer, 1, c, f);
|
||||
fclose(f);
|
||||
|
||||
free( buffer );
|
||||
ri.Con_Printf( PRINT_ALL, "Wrote %s\n", picname );
|
||||
free(buffer);
|
||||
ri.Con_Printf(PRINT_ALL, "Wrote %s\n", picname);
|
||||
}
|
||||
|
||||
void
|
||||
R_Strings ( void )
|
||||
R_Strings(void)
|
||||
{
|
||||
ri.Con_Printf( PRINT_ALL, "GL_VENDOR: %s\n", gl_config.vendor_string );
|
||||
ri.Con_Printf( PRINT_ALL, "GL_RENDERER: %s\n", gl_config.renderer_string );
|
||||
ri.Con_Printf( PRINT_ALL, "GL_VERSION: %s\n", gl_config.version_string );
|
||||
ri.Con_Printf( PRINT_ALL, "GL_EXTENSIONS: %s\n", gl_config.extensions_string );
|
||||
ri.Con_Printf(PRINT_ALL, "GL_VENDOR: %s\n", gl_config.vendor_string);
|
||||
ri.Con_Printf(PRINT_ALL, "GL_RENDERER: %s\n", gl_config.renderer_string);
|
||||
ri.Con_Printf(PRINT_ALL, "GL_VERSION: %s\n", gl_config.version_string);
|
||||
ri.Con_Printf(PRINT_ALL, "GL_EXTENSIONS: %s\n", gl_config.extensions_string);
|
||||
}
|
||||
|
||||
void
|
||||
R_SetDefaultState ( void )
|
||||
R_SetDefaultState(void)
|
||||
{
|
||||
qglClearColor( 1, 0, 0.5, 0.5 );
|
||||
qglCullFace( GL_FRONT );
|
||||
qglEnable( GL_TEXTURE_2D );
|
||||
qglClearColor(1, 0, 0.5, 0.5);
|
||||
qglCullFace(GL_FRONT);
|
||||
qglEnable(GL_TEXTURE_2D);
|
||||
|
||||
qglEnable( GL_ALPHA_TEST );
|
||||
qglAlphaFunc( GL_GREATER, 0.666 );
|
||||
qglEnable(GL_ALPHA_TEST);
|
||||
qglAlphaFunc(GL_GREATER, 0.666);
|
||||
|
||||
qglDisable( GL_DEPTH_TEST );
|
||||
qglDisable( GL_CULL_FACE );
|
||||
qglDisable( GL_BLEND );
|
||||
qglDisable(GL_DEPTH_TEST);
|
||||
qglDisable(GL_CULL_FACE);
|
||||
qglDisable(GL_BLEND);
|
||||
|
||||
qglColor4f( 1, 1, 1, 1 );
|
||||
qglColor4f(1, 1, 1, 1);
|
||||
|
||||
qglPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
|
||||
qglShadeModel( GL_FLAT );
|
||||
qglPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
qglShadeModel(GL_FLAT);
|
||||
|
||||
R_TextureMode( gl_texturemode->string );
|
||||
R_TextureAlphaMode( gl_texturealphamode->string );
|
||||
R_TextureSolidMode( gl_texturesolidmode->string );
|
||||
R_TextureMode(gl_texturemode->string);
|
||||
R_TextureAlphaMode(gl_texturealphamode->string);
|
||||
R_TextureSolidMode(gl_texturesolidmode->string);
|
||||
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max );
|
||||
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
|
||||
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
|
||||
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
|
||||
qglTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
|
||||
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
|
||||
qglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||
qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
R_TexEnv( GL_REPLACE );
|
||||
R_TexEnv(GL_REPLACE);
|
||||
|
||||
if ( qglPointParameterfEXT )
|
||||
if (qglPointParameterfEXT)
|
||||
{
|
||||
float attenuations [ 3 ];
|
||||
float attenuations[3];
|
||||
|
||||
attenuations [ 0 ] = gl_particle_att_a->value;
|
||||
attenuations [ 1 ] = gl_particle_att_b->value;
|
||||
attenuations [ 2 ] = gl_particle_att_c->value;
|
||||
attenuations[0] = gl_particle_att_a->value;
|
||||
attenuations[1] = gl_particle_att_b->value;
|
||||
attenuations[2] = gl_particle_att_c->value;
|
||||
|
||||
/* GL_POINT_SMOOTH is not implemented by some OpenGL
|
||||
drivers, especially the crappy Mesa3D backends like
|
||||
i915.so. That the points are squares and not circles
|
||||
is not a problem by Quake II! */
|
||||
qglEnable( GL_POINT_SMOOTH );
|
||||
qglPointParameterfEXT( GL_POINT_SIZE_MIN_EXT, gl_particle_min_size->value );
|
||||
qglPointParameterfEXT( GL_POINT_SIZE_MAX_EXT, gl_particle_max_size->value );
|
||||
qglPointParameterfvEXT( GL_DISTANCE_ATTENUATION_EXT, attenuations );
|
||||
qglEnable(GL_POINT_SMOOTH);
|
||||
qglPointParameterfEXT(GL_POINT_SIZE_MIN_EXT,
|
||||
gl_particle_min_size->value);
|
||||
qglPointParameterfEXT(GL_POINT_SIZE_MAX_EXT,
|
||||
gl_particle_max_size->value);
|
||||
qglPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, attenuations);
|
||||
}
|
||||
|
||||
if ( qglColorTableEXT && gl_ext_palettedtexture->value )
|
||||
if (qglColorTableEXT && gl_ext_palettedtexture->value)
|
||||
{
|
||||
qglEnable( GL_SHARED_TEXTURE_PALETTE_EXT );
|
||||
qglEnable(GL_SHARED_TEXTURE_PALETTE_EXT);
|
||||
|
||||
R_SetTexturePalette( d_8to24table );
|
||||
R_SetTexturePalette(d_8to24table);
|
||||
}
|
||||
|
||||
R_UpdateSwapInterval();
|
||||
}
|
||||
|
||||
void
|
||||
R_UpdateSwapInterval ( void )
|
||||
R_UpdateSwapInterval(void)
|
||||
{
|
||||
if ( gl_swapinterval->modified )
|
||||
if (gl_swapinterval->modified)
|
||||
{
|
||||
gl_swapinterval->modified = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -27,70 +27,75 @@
|
|||
|
||||
#include "header/local.h"
|
||||
|
||||
int scrap_allocated [ MAX_SCRAPS ] [ BLOCK_WIDTH ];
|
||||
byte scrap_texels [ MAX_SCRAPS ] [ BLOCK_WIDTH * BLOCK_HEIGHT ];
|
||||
int scrap_allocated[MAX_SCRAPS][BLOCK_WIDTH];
|
||||
byte scrap_texels[MAX_SCRAPS][BLOCK_WIDTH * BLOCK_HEIGHT];
|
||||
qboolean scrap_dirty;
|
||||
int scrap_uploads;
|
||||
|
||||
qboolean R_Upload8 ( byte *data, int width, int height, qboolean mipmap, qboolean is_sky );
|
||||
qboolean R_Upload8(byte *data,
|
||||
int width,
|
||||
int height,
|
||||
qboolean mipmap,
|
||||
qboolean is_sky);
|
||||
|
||||
/* returns a texture number and the position inside it */
|
||||
int
|
||||
Scrap_AllocBlock ( int w, int h, int *x, int *y )
|
||||
Scrap_AllocBlock(int w, int h, int *x, int *y)
|
||||
{
|
||||
int i, j;
|
||||
int best, best2;
|
||||
int texnum;
|
||||
|
||||
for ( texnum = 0; texnum < MAX_SCRAPS; texnum++ )
|
||||
for (texnum = 0; texnum < MAX_SCRAPS; texnum++)
|
||||
{
|
||||
best = BLOCK_HEIGHT;
|
||||
|
||||
for ( i = 0; i < BLOCK_WIDTH - w; i++ )
|
||||
for (i = 0; i < BLOCK_WIDTH - w; i++)
|
||||
{
|
||||
best2 = 0;
|
||||
|
||||
for ( j = 0; j < w; j++ )
|
||||
for (j = 0; j < w; j++)
|
||||
{
|
||||
if ( scrap_allocated [ texnum ] [ i + j ] >= best )
|
||||
if (scrap_allocated[texnum][i + j] >= best)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if ( scrap_allocated [ texnum ] [ i + j ] > best2 )
|
||||
if (scrap_allocated[texnum][i + j] > best2)
|
||||
{
|
||||
best2 = scrap_allocated [ texnum ] [ i + j ];
|
||||
best2 = scrap_allocated[texnum][i + j];
|
||||
}
|
||||
}
|
||||
|
||||
if ( j == w )
|
||||
if (j == w)
|
||||
{ /* this is a valid spot */
|
||||
*x = i;
|
||||
*y = best = best2;
|
||||
}
|
||||
}
|
||||
|
||||
if ( best + h > BLOCK_HEIGHT )
|
||||
if (best + h > BLOCK_HEIGHT)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for ( i = 0; i < w; i++ )
|
||||
for (i = 0; i < w; i++)
|
||||
{
|
||||
scrap_allocated [ texnum ] [ *x + i ] = best + h;
|
||||
scrap_allocated[texnum][*x + i] = best + h;
|
||||
}
|
||||
|
||||
return ( texnum );
|
||||
return texnum;
|
||||
}
|
||||
|
||||
return ( -1 );
|
||||
return -1;
|
||||
}
|
||||
|
||||
void
|
||||
Scrap_Upload ( void )
|
||||
Scrap_Upload(void)
|
||||
{
|
||||
scrap_uploads++;
|
||||
R_Bind( TEXNUM_SCRAPS );
|
||||
R_Upload8( scrap_texels [ 0 ], BLOCK_WIDTH, BLOCK_HEIGHT, false, false );
|
||||
R_Bind(TEXNUM_SCRAPS);
|
||||
R_Upload8(scrap_texels[0], BLOCK_WIDTH, BLOCK_HEIGHT, false, false);
|
||||
scrap_dirty = false;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -26,122 +26,122 @@
|
|||
|
||||
#include "header/local.h"
|
||||
|
||||
#define TURBSCALE ( 256.0 / ( 2 * M_PI ) )
|
||||
#define SUBDIVIDE_SIZE 64
|
||||
#define ON_EPSILON 0.1 /* point on plane side epsilon */
|
||||
#define MAX_CLIP_VERTS 64
|
||||
#define TURBSCALE (256.0 / (2 * M_PI))
|
||||
#define SUBDIVIDE_SIZE 64
|
||||
#define ON_EPSILON 0.1 /* point on plane side epsilon */
|
||||
#define MAX_CLIP_VERTS 64
|
||||
|
||||
extern model_t *loadmodel;
|
||||
char skyname [ MAX_QPATH ];
|
||||
char skyname[MAX_QPATH];
|
||||
float skyrotate;
|
||||
vec3_t skyaxis;
|
||||
image_t *sky_images [ 6 ];
|
||||
msurface_t *warpface;
|
||||
int skytexorder [ 6 ] = { 0, 2, 1, 3, 4, 5 };
|
||||
image_t *sky_images[6];
|
||||
msurface_t *warpface;
|
||||
int skytexorder[6] = {0, 2, 1, 3, 4, 5};
|
||||
|
||||
/* 3dstudio environment map names */
|
||||
char *suf [ 6 ] = { "rt", "bk", "lf", "ft", "up", "dn" };
|
||||
char *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"};
|
||||
|
||||
float r_turbsin[] = {
|
||||
#include "constants/warpsin.h"
|
||||
};
|
||||
|
||||
vec3_t skyclip [ 6 ] = {
|
||||
{ 1, 1, 0 },
|
||||
{ 1, -1, 0 },
|
||||
{ 0, -1, 1 },
|
||||
{ 0, 1, 1 },
|
||||
{ 1, 0, 1 },
|
||||
{ -1, 0, 1 }
|
||||
vec3_t skyclip[6] = {
|
||||
{1, 1, 0},
|
||||
{1, -1, 0},
|
||||
{0, -1, 1},
|
||||
{0, 1, 1},
|
||||
{1, 0, 1},
|
||||
{-1, 0, 1}
|
||||
};
|
||||
int c_sky;
|
||||
|
||||
int st_to_vec [ 6 ] [ 3 ] = {
|
||||
{ 3, -1, 2 },
|
||||
{ -3, 1, 2 },
|
||||
int st_to_vec[6][3] = {
|
||||
{3, -1, 2},
|
||||
{-3, 1, 2},
|
||||
|
||||
{ 1, 3, 2 },
|
||||
{ -1, -3, 2 },
|
||||
{1, 3, 2},
|
||||
{-1, -3, 2},
|
||||
|
||||
{ -2, -1, 3 }, /* 0 degrees yaw, look straight up */
|
||||
{ 2, -1, -3 } /* look straight down */
|
||||
{-2, -1, 3}, /* 0 degrees yaw, look straight up */
|
||||
{2, -1, -3} /* look straight down */
|
||||
};
|
||||
|
||||
int vec_to_st [ 6 ] [ 3 ] = {
|
||||
{ -2, 3, 1 },
|
||||
{ 2, 3, -1 },
|
||||
int vec_to_st[6][3] = {
|
||||
{-2, 3, 1},
|
||||
{2, 3, -1},
|
||||
|
||||
{ 1, 3, 2 },
|
||||
{ -1, 3, -2 },
|
||||
{1, 3, 2},
|
||||
{-1, 3, -2},
|
||||
|
||||
{ -2, -1, 3 },
|
||||
{ -2, 1, -3 }
|
||||
{-2, -1, 3},
|
||||
{-2, 1, -3}
|
||||
};
|
||||
|
||||
float skymins [ 2 ] [ 6 ], skymaxs [ 2 ] [ 6 ];
|
||||
float skymins[2][6], skymaxs[2][6];
|
||||
float sky_min, sky_max;
|
||||
|
||||
void
|
||||
R_BoundPoly ( int numverts, float *verts, vec3_t mins, vec3_t maxs )
|
||||
R_BoundPoly(int numverts, float *verts, vec3_t mins, vec3_t maxs)
|
||||
{
|
||||
int i, j;
|
||||
float *v;
|
||||
float *v;
|
||||
|
||||
mins [ 0 ] = mins [ 1 ] = mins [ 2 ] = 9999;
|
||||
maxs [ 0 ] = maxs [ 1 ] = maxs [ 2 ] = -9999;
|
||||
mins[0] = mins[1] = mins[2] = 9999;
|
||||
maxs[0] = maxs[1] = maxs[2] = -9999;
|
||||
v = verts;
|
||||
|
||||
for ( i = 0; i < numverts; i++ )
|
||||
for (i = 0; i < numverts; i++)
|
||||
{
|
||||
for ( j = 0; j < 3; j++, v++ )
|
||||
for (j = 0; j < 3; j++, v++)
|
||||
{
|
||||
if ( *v < mins [ j ] )
|
||||
if (*v < mins[j])
|
||||
{
|
||||
mins [ j ] = *v;
|
||||
mins[j] = *v;
|
||||
}
|
||||
|
||||
if ( *v > maxs [ j ] )
|
||||
if (*v > maxs[j])
|
||||
{
|
||||
maxs [ j ] = *v;
|
||||
maxs[j] = *v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
R_SubdividePolygon ( int numverts, float *verts )
|
||||
R_SubdividePolygon(int numverts, float *verts)
|
||||
{
|
||||
int i, j, k;
|
||||
vec3_t mins, maxs;
|
||||
float m;
|
||||
float *v;
|
||||
vec3_t front [ 64 ], back [ 64 ];
|
||||
float *v;
|
||||
vec3_t front[64], back[64];
|
||||
int f, b;
|
||||
float dist [ 64 ];
|
||||
float dist[64];
|
||||
float frac;
|
||||
glpoly_t *poly;
|
||||
glpoly_t *poly;
|
||||
float s, t;
|
||||
vec3_t total;
|
||||
float total_s, total_t;
|
||||
|
||||
if ( numverts > 60 )
|
||||
if (numverts > 60)
|
||||
{
|
||||
ri.Sys_Error( ERR_DROP, "numverts = %i", numverts );
|
||||
ri.Sys_Error(ERR_DROP, "numverts = %i", numverts);
|
||||
}
|
||||
|
||||
R_BoundPoly( numverts, verts, mins, maxs );
|
||||
R_BoundPoly(numverts, verts, mins, maxs);
|
||||
|
||||
for ( i = 0; i < 3; i++ )
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
m = ( mins [ i ] + maxs [ i ] ) * 0.5;
|
||||
m = SUBDIVIDE_SIZE * floor( m / SUBDIVIDE_SIZE + 0.5 );
|
||||
m = (mins[i] + maxs[i]) * 0.5;
|
||||
m = SUBDIVIDE_SIZE * floor(m / SUBDIVIDE_SIZE + 0.5);
|
||||
|
||||
if ( maxs [ i ] - m < 8 )
|
||||
if (maxs[i] - m < 8)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( m - mins [ i ] < 8 )
|
||||
if (m - mins[i] < 8)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -149,46 +149,46 @@ R_SubdividePolygon ( int numverts, float *verts )
|
|||
/* cut it */
|
||||
v = verts + i;
|
||||
|
||||
for ( j = 0; j < numverts; j++, v += 3 )
|
||||
for (j = 0; j < numverts; j++, v += 3)
|
||||
{
|
||||
dist [ j ] = *v - m;
|
||||
dist[j] = *v - m;
|
||||
}
|
||||
|
||||
/* wrap cases */
|
||||
dist [ j ] = dist [ 0 ];
|
||||
dist[j] = dist[0];
|
||||
v -= i;
|
||||
VectorCopy( verts, v );
|
||||
VectorCopy(verts, v);
|
||||
|
||||
f = b = 0;
|
||||
v = verts;
|
||||
|
||||
for ( j = 0; j < numverts; j++, v += 3 )
|
||||
for (j = 0; j < numverts; j++, v += 3)
|
||||
{
|
||||
if ( dist [ j ] >= 0 )
|
||||
if (dist[j] >= 0)
|
||||
{
|
||||
VectorCopy( v, front [ f ] );
|
||||
VectorCopy(v, front[f]);
|
||||
f++;
|
||||
}
|
||||
|
||||
if ( dist [ j ] <= 0 )
|
||||
if (dist[j] <= 0)
|
||||
{
|
||||
VectorCopy( v, back [ b ] );
|
||||
VectorCopy(v, back[b]);
|
||||
b++;
|
||||
}
|
||||
|
||||
if ( ( dist [ j ] == 0 ) || ( dist [ j + 1 ] == 0 ) )
|
||||
if ((dist[j] == 0) || (dist[j + 1] == 0))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ( dist [ j ] > 0 ) != ( dist [ j + 1 ] > 0 ) )
|
||||
if ((dist[j] > 0) != (dist[j + 1] > 0))
|
||||
{
|
||||
/* clip point */
|
||||
frac = dist [ j ] / ( dist [ j ] - dist [ j + 1 ] );
|
||||
frac = dist[j] / (dist[j] - dist[j + 1]);
|
||||
|
||||
for ( k = 0; k < 3; k++ )
|
||||
for (k = 0; k < 3; k++)
|
||||
{
|
||||
front [ f ] [ k ] = back [ b ] [ k ] = v [ k ] + frac * ( v [ 3 + k ] - v [ k ] );
|
||||
front[f][k] = back[b][k] = v[k] + frac * (v[3 + k] - v[k]);
|
||||
}
|
||||
|
||||
f++;
|
||||
|
@ -196,40 +196,40 @@ R_SubdividePolygon ( int numverts, float *verts )
|
|||
}
|
||||
}
|
||||
|
||||
R_SubdividePolygon( f, front [ 0 ] );
|
||||
R_SubdividePolygon( b, back [ 0 ] );
|
||||
R_SubdividePolygon(f, front[0]);
|
||||
R_SubdividePolygon(b, back[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
/* add a point in the center to help keep warp valid */
|
||||
poly = Hunk_Alloc( sizeof ( glpoly_t ) + ( ( numverts - 4 ) + 2 ) * VERTEXSIZE * sizeof ( float ) );
|
||||
poly = Hunk_Alloc(sizeof(glpoly_t) + ((numverts - 4) + 2) * VERTEXSIZE * sizeof(float));
|
||||
poly->next = warpface->polys;
|
||||
warpface->polys = poly;
|
||||
poly->numverts = numverts + 2;
|
||||
VectorClear( total );
|
||||
VectorClear(total);
|
||||
total_s = 0;
|
||||
total_t = 0;
|
||||
|
||||
for ( i = 0; i < numverts; i++, verts += 3 )
|
||||
for (i = 0; i < numverts; i++, verts += 3)
|
||||
{
|
||||
VectorCopy( verts, poly->verts [ i + 1 ] );
|
||||
s = DotProduct( verts, warpface->texinfo->vecs [ 0 ] );
|
||||
t = DotProduct( verts, warpface->texinfo->vecs [ 1 ] );
|
||||
VectorCopy(verts, poly->verts[i + 1]);
|
||||
s = DotProduct(verts, warpface->texinfo->vecs[0]);
|
||||
t = DotProduct(verts, warpface->texinfo->vecs[1]);
|
||||
|
||||
total_s += s;
|
||||
total_t += t;
|
||||
VectorAdd( total, verts, total );
|
||||
VectorAdd(total, verts, total);
|
||||
|
||||
poly->verts [ i + 1 ] [ 3 ] = s;
|
||||
poly->verts [ i + 1 ] [ 4 ] = t;
|
||||
poly->verts[i + 1][3] = s;
|
||||
poly->verts[i + 1][4] = t;
|
||||
}
|
||||
|
||||
VectorScale( total, ( 1.0 / numverts ), poly->verts [ 0 ] );
|
||||
poly->verts [ 0 ] [ 3 ] = total_s / numverts;
|
||||
poly->verts [ 0 ] [ 4 ] = total_t / numverts;
|
||||
VectorScale(total, (1.0 / numverts), poly->verts[0]);
|
||||
poly->verts[0][3] = total_s / numverts;
|
||||
poly->verts[0][4] = total_t / numverts;
|
||||
|
||||
/* copy first vertex to last */
|
||||
memcpy( poly->verts [ i + 1 ], poly->verts [ 1 ], sizeof ( poly->verts [ 0 ] ) );
|
||||
memcpy(poly->verts[i + 1], poly->verts[1], sizeof(poly->verts[0]));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -238,81 +238,81 @@ R_SubdividePolygon ( int numverts, float *verts )
|
|||
* can be done reasonably.
|
||||
*/
|
||||
void
|
||||
R_SubdivideSurface ( msurface_t *fa )
|
||||
R_SubdivideSurface(msurface_t *fa)
|
||||
{
|
||||
vec3_t verts [ 64 ];
|
||||
vec3_t verts[64];
|
||||
int numverts;
|
||||
int i;
|
||||
int lindex;
|
||||
float *vec;
|
||||
float *vec;
|
||||
|
||||
warpface = fa;
|
||||
|
||||
/* convert edges back to a normal polygon */
|
||||
numverts = 0;
|
||||
|
||||
for ( i = 0; i < fa->numedges; i++ )
|
||||
for (i = 0; i < fa->numedges; i++)
|
||||
{
|
||||
lindex = loadmodel->surfedges [ fa->firstedge + i ];
|
||||
lindex = loadmodel->surfedges[fa->firstedge + i];
|
||||
|
||||
if ( lindex > 0 )
|
||||
if (lindex > 0)
|
||||
{
|
||||
vec = loadmodel->vertexes [ loadmodel->edges [ lindex ].v [ 0 ] ].position;
|
||||
vec = loadmodel->vertexes[loadmodel->edges[lindex].v[0]].position;
|
||||
}
|
||||
else
|
||||
{
|
||||
vec = loadmodel->vertexes [ loadmodel->edges [ -lindex ].v [ 1 ] ].position;
|
||||
vec = loadmodel->vertexes[loadmodel->edges[-lindex].v[1]].position;
|
||||
}
|
||||
|
||||
VectorCopy( vec, verts [ numverts ] );
|
||||
VectorCopy(vec, verts[numverts]);
|
||||
numverts++;
|
||||
}
|
||||
|
||||
R_SubdividePolygon( numverts, verts [ 0 ] );
|
||||
R_SubdividePolygon(numverts, verts[0]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Does a water warp on the pre-fragmented glpoly_t chain
|
||||
*/
|
||||
void
|
||||
R_EmitWaterPolys ( msurface_t *fa )
|
||||
R_EmitWaterPolys(msurface_t *fa)
|
||||
{
|
||||
glpoly_t *p, *bp;
|
||||
float *v;
|
||||
glpoly_t *p, *bp;
|
||||
float *v;
|
||||
int i;
|
||||
float s, t, os, ot;
|
||||
float scroll;
|
||||
float rdt = r_newrefdef.time;
|
||||
|
||||
if ( fa->texinfo->flags & SURF_FLOWING )
|
||||
if (fa->texinfo->flags & SURF_FLOWING)
|
||||
{
|
||||
scroll = -64 * ( ( r_newrefdef.time * 0.5 ) - (int) ( r_newrefdef.time * 0.5 ) );
|
||||
scroll = -64 * ((r_newrefdef.time * 0.5) - (int)(r_newrefdef.time * 0.5));
|
||||
}
|
||||
else
|
||||
{
|
||||
scroll = 0;
|
||||
}
|
||||
|
||||
for ( bp = fa->polys; bp; bp = bp->next )
|
||||
for (bp = fa->polys; bp; bp = bp->next)
|
||||
{
|
||||
p = bp;
|
||||
|
||||
qglBegin( GL_TRIANGLE_FAN );
|
||||
qglBegin(GL_TRIANGLE_FAN);
|
||||
|
||||
for ( i = 0, v = p->verts [ 0 ]; i < p->numverts; i++, v += VERTEXSIZE )
|
||||
for (i = 0, v = p->verts[0]; i < p->numverts; i++, v += VERTEXSIZE)
|
||||
{
|
||||
os = v [ 3 ];
|
||||
ot = v [ 4 ];
|
||||
os = v[3];
|
||||
ot = v[4];
|
||||
|
||||
s = os + r_turbsin [ (int) ( ( ot * 0.125 + r_newrefdef.time ) * TURBSCALE ) & 255 ];
|
||||
s = os + r_turbsin[(int)((ot * 0.125 + r_newrefdef.time) * TURBSCALE) & 255];
|
||||
s += scroll;
|
||||
s *= ( 1.0 / 64 );
|
||||
s *= (1.0 / 64);
|
||||
|
||||
t = ot + r_turbsin [ (int) ( ( os * 0.125 + rdt ) * TURBSCALE ) & 255 ];
|
||||
t *= ( 1.0 / 64 );
|
||||
t = ot + r_turbsin[(int)((os * 0.125 + rdt) * TURBSCALE) & 255];
|
||||
t *= (1.0 / 64);
|
||||
|
||||
qglTexCoord2f( s, t );
|
||||
qglVertex3fv( v );
|
||||
qglTexCoord2f(s, t);
|
||||
qglVertex3fv(v);
|
||||
}
|
||||
|
||||
qglEnd();
|
||||
|
@ -320,31 +320,31 @@ R_EmitWaterPolys ( msurface_t *fa )
|
|||
}
|
||||
|
||||
void
|
||||
R_DrawSkyPolygon ( int nump, vec3_t vecs )
|
||||
R_DrawSkyPolygon(int nump, vec3_t vecs)
|
||||
{
|
||||
int i, j;
|
||||
vec3_t v, av;
|
||||
float s, t, dv;
|
||||
int axis;
|
||||
float *vp;
|
||||
float *vp;
|
||||
|
||||
c_sky++;
|
||||
|
||||
/* decide which face it maps to */
|
||||
VectorCopy( vec3_origin, v );
|
||||
VectorCopy(vec3_origin, v);
|
||||
|
||||
for ( i = 0, vp = vecs; i < nump; i++, vp += 3 )
|
||||
for (i = 0, vp = vecs; i < nump; i++, vp += 3)
|
||||
{
|
||||
VectorAdd( vp, v, v );
|
||||
VectorAdd(vp, v, v);
|
||||
}
|
||||
|
||||
av [ 0 ] = fabs( v [ 0 ] );
|
||||
av [ 1 ] = fabs( v [ 1 ] );
|
||||
av [ 2 ] = fabs( v [ 2 ] );
|
||||
av[0] = fabs(v[0]);
|
||||
av[1] = fabs(v[1]);
|
||||
av[2] = fabs(v[2]);
|
||||
|
||||
if ( ( av [ 0 ] > av [ 1 ] ) && ( av [ 0 ] > av [ 2 ] ) )
|
||||
if ((av[0] > av[1]) && (av[0] > av[2]))
|
||||
{
|
||||
if ( v [ 0 ] < 0 )
|
||||
if (v[0] < 0)
|
||||
{
|
||||
axis = 1;
|
||||
}
|
||||
|
@ -353,9 +353,9 @@ R_DrawSkyPolygon ( int nump, vec3_t vecs )
|
|||
axis = 0;
|
||||
}
|
||||
}
|
||||
else if ( ( av [ 1 ] > av [ 2 ] ) && ( av [ 1 ] > av [ 0 ] ) )
|
||||
else if ((av[1] > av[2]) && (av[1] > av[0]))
|
||||
{
|
||||
if ( v [ 1 ] < 0 )
|
||||
if (v[1] < 0)
|
||||
{
|
||||
axis = 3;
|
||||
}
|
||||
|
@ -366,7 +366,7 @@ R_DrawSkyPolygon ( int nump, vec3_t vecs )
|
|||
}
|
||||
else
|
||||
{
|
||||
if ( v [ 2 ] < 0 )
|
||||
if (v[2] < 0)
|
||||
{
|
||||
axis = 5;
|
||||
}
|
||||
|
@ -377,312 +377,316 @@ R_DrawSkyPolygon ( int nump, vec3_t vecs )
|
|||
}
|
||||
|
||||
/* project new texture coords */
|
||||
for ( i = 0; i < nump; i++, vecs += 3 )
|
||||
for (i = 0; i < nump; i++, vecs += 3)
|
||||
{
|
||||
j = vec_to_st [ axis ] [ 2 ];
|
||||
j = vec_to_st[axis][2];
|
||||
|
||||
if ( j > 0 )
|
||||
if (j > 0)
|
||||
{
|
||||
dv = vecs [ j - 1 ];
|
||||
dv = vecs[j - 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
dv = -vecs [ -j - 1 ];
|
||||
dv = -vecs[-j - 1];
|
||||
}
|
||||
|
||||
if ( dv < 0.001 )
|
||||
if (dv < 0.001)
|
||||
{
|
||||
continue; /* don't divide by zero */
|
||||
}
|
||||
|
||||
j = vec_to_st [ axis ] [ 0 ];
|
||||
j = vec_to_st[axis][0];
|
||||
|
||||
if ( j < 0 )
|
||||
if (j < 0)
|
||||
{
|
||||
s = -vecs [ -j - 1 ] / dv;
|
||||
s = -vecs[-j - 1] / dv;
|
||||
}
|
||||
else
|
||||
{
|
||||
s = vecs [ j - 1 ] / dv;
|
||||
s = vecs[j - 1] / dv;
|
||||
}
|
||||
|
||||
j = vec_to_st [ axis ] [ 1 ];
|
||||
j = vec_to_st[axis][1];
|
||||
|
||||
if ( j < 0 )
|
||||
if (j < 0)
|
||||
{
|
||||
t = -vecs [ -j - 1 ] / dv;
|
||||
t = -vecs[-j - 1] / dv;
|
||||
}
|
||||
else
|
||||
{
|
||||
t = vecs [ j - 1 ] / dv;
|
||||
t = vecs[j - 1] / dv;
|
||||
}
|
||||
|
||||
if ( s < skymins [ 0 ] [ axis ] )
|
||||
if (s < skymins[0][axis])
|
||||
{
|
||||
skymins [ 0 ] [ axis ] = s;
|
||||
skymins[0][axis] = s;
|
||||
}
|
||||
|
||||
if ( t < skymins [ 1 ] [ axis ] )
|
||||
if (t < skymins[1][axis])
|
||||
{
|
||||
skymins [ 1 ] [ axis ] = t;
|
||||
skymins[1][axis] = t;
|
||||
}
|
||||
|
||||
if ( s > skymaxs [ 0 ] [ axis ] )
|
||||
if (s > skymaxs[0][axis])
|
||||
{
|
||||
skymaxs [ 0 ] [ axis ] = s;
|
||||
skymaxs[0][axis] = s;
|
||||
}
|
||||
|
||||
if ( t > skymaxs [ 1 ] [ axis ] )
|
||||
if (t > skymaxs[1][axis])
|
||||
{
|
||||
skymaxs [ 1 ] [ axis ] = t;
|
||||
skymaxs[1][axis] = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
R_ClipSkyPolygon ( int nump, vec3_t vecs, int stage )
|
||||
R_ClipSkyPolygon(int nump, vec3_t vecs, int stage)
|
||||
{
|
||||
float *norm;
|
||||
float *v;
|
||||
float *norm;
|
||||
float *v;
|
||||
qboolean front, back;
|
||||
float d, e;
|
||||
float dists [ MAX_CLIP_VERTS ];
|
||||
int sides [ MAX_CLIP_VERTS ];
|
||||
vec3_t newv [ 2 ] [ MAX_CLIP_VERTS ];
|
||||
int newc [ 2 ];
|
||||
float dists[MAX_CLIP_VERTS];
|
||||
int sides[MAX_CLIP_VERTS];
|
||||
vec3_t newv[2][MAX_CLIP_VERTS];
|
||||
int newc[2];
|
||||
int i, j;
|
||||
|
||||
if ( nump > MAX_CLIP_VERTS - 2 )
|
||||
if (nump > MAX_CLIP_VERTS - 2)
|
||||
{
|
||||
ri.Sys_Error( ERR_DROP, "R_ClipSkyPolygon: MAX_CLIP_VERTS" );
|
||||
ri.Sys_Error(ERR_DROP, "R_ClipSkyPolygon: MAX_CLIP_VERTS");
|
||||
}
|
||||
|
||||
if ( stage == 6 )
|
||||
if (stage == 6)
|
||||
{
|
||||
/* fully clipped, so draw it */
|
||||
R_DrawSkyPolygon( nump, vecs );
|
||||
R_DrawSkyPolygon(nump, vecs);
|
||||
return;
|
||||
}
|
||||
|
||||
front = back = false;
|
||||
norm = skyclip [ stage ];
|
||||
norm = skyclip[stage];
|
||||
|
||||
for ( i = 0, v = vecs; i < nump; i++, v += 3 )
|
||||
for (i = 0, v = vecs; i < nump; i++, v += 3)
|
||||
{
|
||||
d = DotProduct( v, norm );
|
||||
d = DotProduct(v, norm);
|
||||
|
||||
if ( d > ON_EPSILON )
|
||||
if (d > ON_EPSILON)
|
||||
{
|
||||
front = true;
|
||||
sides [ i ] = SIDE_FRONT;
|
||||
sides[i] = SIDE_FRONT;
|
||||
}
|
||||
else if ( d < -ON_EPSILON )
|
||||
else if (d < -ON_EPSILON)
|
||||
{
|
||||
back = true;
|
||||
sides [ i ] = SIDE_BACK;
|
||||
sides[i] = SIDE_BACK;
|
||||
}
|
||||
else
|
||||
{
|
||||
sides [ i ] = SIDE_ON;
|
||||
sides[i] = SIDE_ON;
|
||||
}
|
||||
|
||||
dists [ i ] = d;
|
||||
dists[i] = d;
|
||||
}
|
||||
|
||||
if ( !front || !back )
|
||||
if (!front || !back)
|
||||
{
|
||||
/* not clipped */
|
||||
R_ClipSkyPolygon( nump, vecs, stage + 1 );
|
||||
R_ClipSkyPolygon(nump, vecs, stage + 1);
|
||||
return;
|
||||
}
|
||||
|
||||
/* clip it */
|
||||
sides [ i ] = sides [ 0 ];
|
||||
dists [ i ] = dists [ 0 ];
|
||||
VectorCopy( vecs, ( vecs + ( i * 3 ) ) );
|
||||
newc [ 0 ] = newc [ 1 ] = 0;
|
||||
sides[i] = sides[0];
|
||||
dists[i] = dists[0];
|
||||
VectorCopy(vecs, (vecs + (i * 3)));
|
||||
newc[0] = newc[1] = 0;
|
||||
|
||||
for ( i = 0, v = vecs; i < nump; i++, v += 3 )
|
||||
for (i = 0, v = vecs; i < nump; i++, v += 3)
|
||||
{
|
||||
switch ( sides [ i ] )
|
||||
switch (sides[i])
|
||||
{
|
||||
case SIDE_FRONT:
|
||||
VectorCopy( v, newv [ 0 ] [ newc [ 0 ] ] );
|
||||
newc [ 0 ]++;
|
||||
VectorCopy(v, newv[0][newc[0]]);
|
||||
newc[0]++;
|
||||
break;
|
||||
case SIDE_BACK:
|
||||
VectorCopy( v, newv [ 1 ] [ newc [ 1 ] ] );
|
||||
newc [ 1 ]++;
|
||||
VectorCopy(v, newv[1][newc[1]]);
|
||||
newc[1]++;
|
||||
break;
|
||||
case SIDE_ON:
|
||||
VectorCopy( v, newv [ 0 ] [ newc [ 0 ] ] );
|
||||
newc [ 0 ]++;
|
||||
VectorCopy( v, newv [ 1 ] [ newc [ 1 ] ] );
|
||||
newc [ 1 ]++;
|
||||
VectorCopy(v, newv[0][newc[0]]);
|
||||
newc[0]++;
|
||||
VectorCopy(v, newv[1][newc[1]]);
|
||||
newc[1]++;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( ( sides [ i ] == SIDE_ON ) || ( sides [ i + 1 ] == SIDE_ON ) || ( sides [ i + 1 ] == sides [ i ] ) )
|
||||
if ((sides[i] == SIDE_ON) ||
|
||||
(sides[i + 1] == SIDE_ON) ||
|
||||
(sides[i + 1] == sides[i]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
d = dists [ i ] / ( dists [ i ] - dists [ i + 1 ] );
|
||||
d = dists[i] / (dists[i] - dists[i + 1]);
|
||||
|
||||
for ( j = 0; j < 3; j++ )
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
e = v [ j ] + d * ( v [ j + 3 ] - v [ j ] );
|
||||
newv [ 0 ] [ newc [ 0 ] ] [ j ] = e;
|
||||
newv [ 1 ] [ newc [ 1 ] ] [ j ] = e;
|
||||
e = v[j] + d * (v[j + 3] - v[j]);
|
||||
newv[0][newc[0]][j] = e;
|
||||
newv[1][newc[1]][j] = e;
|
||||
}
|
||||
|
||||
newc [ 0 ]++;
|
||||
newc [ 1 ]++;
|
||||
newc[0]++;
|
||||
newc[1]++;
|
||||
}
|
||||
|
||||
/* continue */
|
||||
R_ClipSkyPolygon( newc [ 0 ], newv [ 0 ] [ 0 ], stage + 1 );
|
||||
R_ClipSkyPolygon( newc [ 1 ], newv [ 1 ] [ 0 ], stage + 1 );
|
||||
R_ClipSkyPolygon(newc[0], newv[0][0], stage + 1);
|
||||
R_ClipSkyPolygon(newc[1], newv[1][0], stage + 1);
|
||||
}
|
||||
|
||||
void
|
||||
R_AddSkySurface ( msurface_t *fa )
|
||||
R_AddSkySurface(msurface_t *fa)
|
||||
{
|
||||
int i;
|
||||
vec3_t verts [ MAX_CLIP_VERTS ];
|
||||
glpoly_t *p;
|
||||
vec3_t verts[MAX_CLIP_VERTS];
|
||||
glpoly_t *p;
|
||||
|
||||
/* calculate vertex values for sky box */
|
||||
for ( p = fa->polys; p; p = p->next )
|
||||
for (p = fa->polys; p; p = p->next)
|
||||
{
|
||||
for ( i = 0; i < p->numverts; i++ )
|
||||
for (i = 0; i < p->numverts; i++)
|
||||
{
|
||||
VectorSubtract( p->verts [ i ], r_origin, verts [ i ] );
|
||||
VectorSubtract(p->verts[i], r_origin, verts[i]);
|
||||
}
|
||||
|
||||
R_ClipSkyPolygon( p->numverts, verts [ 0 ], 0 );
|
||||
R_ClipSkyPolygon(p->numverts, verts[0], 0);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
R_ClearSkyBox ( void )
|
||||
R_ClearSkyBox(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for ( i = 0; i < 6; i++ )
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
skymins [ 0 ] [ i ] = skymins [ 1 ] [ i ] = 9999;
|
||||
skymaxs [ 0 ] [ i ] = skymaxs [ 1 ] [ i ] = -9999;
|
||||
skymins[0][i] = skymins[1][i] = 9999;
|
||||
skymaxs[0][i] = skymaxs[1][i] = -9999;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
R_MakeSkyVec ( float s, float t, int axis )
|
||||
R_MakeSkyVec(float s, float t, int axis)
|
||||
{
|
||||
vec3_t v, b;
|
||||
int j, k;
|
||||
|
||||
if ( gl_farsee->value == 0 ) {
|
||||
b [ 0 ] = s * 2300;
|
||||
b [ 1 ] = t * 2300;
|
||||
b [ 2 ] = 2300;
|
||||
} else {
|
||||
b [ 0 ] = s * 4096;
|
||||
b [ 1 ] = t * 4096;
|
||||
b [ 2 ] = 4096;
|
||||
if (gl_farsee->value == 0)
|
||||
{
|
||||
b[0] = s * 2300;
|
||||
b[1] = t * 2300;
|
||||
b[2] = 2300;
|
||||
}
|
||||
else
|
||||
{
|
||||
b[0] = s * 4096;
|
||||
b[1] = t * 4096;
|
||||
b[2] = 4096;
|
||||
}
|
||||
|
||||
|
||||
for ( j = 0; j < 3; j++ )
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
k = st_to_vec [ axis ] [ j ];
|
||||
k = st_to_vec[axis][j];
|
||||
|
||||
if ( k < 0 )
|
||||
if (k < 0)
|
||||
{
|
||||
v [ j ] = -b [ -k - 1 ];
|
||||
v[j] = -b[-k - 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
v [ j ] = b [ k - 1 ];
|
||||
v[j] = b[k - 1];
|
||||
}
|
||||
}
|
||||
|
||||
/* avoid bilerp seam */
|
||||
s = ( s + 1 ) * 0.5;
|
||||
t = ( t + 1 ) * 0.5;
|
||||
s = (s + 1) * 0.5;
|
||||
t = (t + 1) * 0.5;
|
||||
|
||||
if ( s < sky_min )
|
||||
if (s < sky_min)
|
||||
{
|
||||
s = sky_min;
|
||||
}
|
||||
else if ( s > sky_max )
|
||||
else if (s > sky_max)
|
||||
{
|
||||
s = sky_max;
|
||||
}
|
||||
|
||||
if ( t < sky_min )
|
||||
if (t < sky_min)
|
||||
{
|
||||
t = sky_min;
|
||||
}
|
||||
else if ( t > sky_max )
|
||||
else if (t > sky_max)
|
||||
{
|
||||
t = sky_max;
|
||||
}
|
||||
|
||||
t = 1.0 - t;
|
||||
qglTexCoord2f( s, t );
|
||||
qglVertex3fv( v );
|
||||
qglTexCoord2f(s, t);
|
||||
qglVertex3fv(v);
|
||||
}
|
||||
|
||||
void
|
||||
R_DrawSkyBox ( void )
|
||||
R_DrawSkyBox(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if ( skyrotate )
|
||||
if (skyrotate)
|
||||
{ /* check for no sky at all */
|
||||
for ( i = 0; i < 6; i++ )
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
if ( ( skymins [ 0 ] [ i ] < skymaxs [ 0 ] [ i ] ) &&
|
||||
( skymins [ 1 ] [ i ] < skymaxs [ 1 ] [ i ] ) )
|
||||
if ((skymins[0][i] < skymaxs[0][i]) &&
|
||||
(skymins[1][i] < skymaxs[1][i]))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( i == 6 )
|
||||
if (i == 6)
|
||||
{
|
||||
return; /* nothing visible */
|
||||
}
|
||||
}
|
||||
|
||||
qglPushMatrix();
|
||||
qglTranslatef( r_origin [ 0 ], r_origin [ 1 ], r_origin [ 2 ] );
|
||||
qglRotatef( r_newrefdef.time * skyrotate, skyaxis [ 0 ], skyaxis [ 1 ], skyaxis [ 2 ] );
|
||||
qglTranslatef(r_origin[0], r_origin[1], r_origin[2]);
|
||||
qglRotatef(r_newrefdef.time * skyrotate, skyaxis[0], skyaxis[1], skyaxis[2]);
|
||||
|
||||
for ( i = 0; i < 6; i++ )
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
if ( skyrotate )
|
||||
if (skyrotate)
|
||||
{
|
||||
skymins [ 0 ] [ i ] = -1;
|
||||
skymins [ 1 ] [ i ] = -1;
|
||||
skymaxs [ 0 ] [ i ] = 1;
|
||||
skymaxs [ 1 ] [ i ] = 1;
|
||||
skymins[0][i] = -1;
|
||||
skymins[1][i] = -1;
|
||||
skymaxs[0][i] = 1;
|
||||
skymaxs[1][i] = 1;
|
||||
}
|
||||
|
||||
if ( ( skymins [ 0 ] [ i ] >= skymaxs [ 0 ] [ i ] ) ||
|
||||
( skymins [ 1 ] [ i ] >= skymaxs [ 1 ] [ i ] ) )
|
||||
if ((skymins[0][i] >= skymaxs[0][i]) ||
|
||||
(skymins[1][i] >= skymaxs[1][i]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
R_Bind( sky_images [ skytexorder [ i ] ]->texnum );
|
||||
R_Bind(sky_images[skytexorder[i]]->texnum);
|
||||
|
||||
qglBegin( GL_QUADS );
|
||||
R_MakeSkyVec( skymins [ 0 ] [ i ], skymins [ 1 ] [ i ], i );
|
||||
R_MakeSkyVec( skymins [ 0 ] [ i ], skymaxs [ 1 ] [ i ], i );
|
||||
R_MakeSkyVec( skymaxs [ 0 ] [ i ], skymaxs [ 1 ] [ i ], i );
|
||||
R_MakeSkyVec( skymaxs [ 0 ] [ i ], skymins [ 1 ] [ i ], i );
|
||||
qglBegin(GL_QUADS);
|
||||
R_MakeSkyVec(skymins[0][i], skymins[1][i], i);
|
||||
R_MakeSkyVec(skymins[0][i], skymaxs[1][i], i);
|
||||
R_MakeSkyVec(skymaxs[0][i], skymaxs[1][i], i);
|
||||
R_MakeSkyVec(skymaxs[0][i], skymins[1][i], i);
|
||||
qglEnd();
|
||||
}
|
||||
|
||||
|
@ -690,34 +694,37 @@ R_DrawSkyBox ( void )
|
|||
}
|
||||
|
||||
void
|
||||
R_SetSky ( char *name, float rotate, vec3_t axis )
|
||||
R_SetSky(char *name, float rotate, vec3_t axis)
|
||||
{
|
||||
int i;
|
||||
char pathname [ MAX_QPATH ];
|
||||
char pathname[MAX_QPATH];
|
||||
|
||||
strncpy( skyname, name, sizeof ( skyname ) - 1 );
|
||||
strncpy(skyname, name, sizeof(skyname) - 1);
|
||||
skyrotate = rotate;
|
||||
VectorCopy( axis, skyaxis );
|
||||
VectorCopy(axis, skyaxis);
|
||||
|
||||
for ( i = 0; i < 6; i++ )
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
if ( qglColorTableEXT && gl_ext_palettedtexture->value )
|
||||
if (qglColorTableEXT && gl_ext_palettedtexture->value)
|
||||
{
|
||||
Com_sprintf( pathname, sizeof ( pathname ), "env/%s%s.pcx", skyname, suf [ i ] );
|
||||
Com_sprintf(pathname, sizeof(pathname), "env/%s%s.pcx",
|
||||
skyname, suf[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
Com_sprintf( pathname, sizeof ( pathname ), "env/%s%s.tga", skyname, suf [ i ] );
|
||||
Com_sprintf(pathname, sizeof(pathname), "env/%s%s.tga",
|
||||
skyname, suf[i]);
|
||||
}
|
||||
|
||||
sky_images [ i ] = R_FindImage( pathname, it_sky );
|
||||
sky_images[i] = R_FindImage(pathname, it_sky);
|
||||
|
||||
if ( !sky_images [ i ] )
|
||||
if (!sky_images[i])
|
||||
{
|
||||
sky_images [ i ] = r_notexture;
|
||||
sky_images[i] = r_notexture;
|
||||
}
|
||||
|
||||
sky_min = 1.0 / 512;
|
||||
sky_max = 511.0 / 512;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue