2009-03-05 09:07:55 +00:00
|
|
|
/*
|
2010-10-22 07:49:17 +00:00
|
|
|
* Copyright (C) 1997-2001 Id Software, Inc.
|
|
|
|
*
|
2010-10-23 06:58:56 +00:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or (at
|
|
|
|
* your option) any later version.
|
2010-10-22 07:49:17 +00:00
|
|
|
*
|
2010-10-23 06:58:56 +00:00
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
2010-10-22 07:49:17 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
*
|
|
|
|
* See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2010-10-23 06:58:56 +00:00
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
* 02111-1307, USA.
|
2010-10-22 07:49:17 +00:00
|
|
|
*
|
2010-10-23 06:58:56 +00:00
|
|
|
* =======================================================================
|
|
|
|
*
|
|
|
|
* Refresher setup and main part of the frame generation
|
|
|
|
*
|
|
|
|
* =======================================================================
|
|
|
|
*/
|
2009-03-05 12:42:43 +00:00
|
|
|
|
2009-03-05 11:03:08 +00:00
|
|
|
#include "header/local.h"
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
#define NUM_BEAM_SEGS 6
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
void R_Clear ( void );
|
|
|
|
void R_BeginRegistration ( char *map );
|
|
|
|
struct model_s *R_RegisterModel ( char *name );
|
|
|
|
struct image_s *R_RegisterSkin ( char *name );
|
|
|
|
void R_SetSky ( char *name, float rotate, vec3_t axis );
|
|
|
|
void R_EndRegistration ( void );
|
|
|
|
void R_RenderFrame ( refdef_t *fd );
|
|
|
|
struct image_s *Draw_FindPic ( char *name );
|
|
|
|
|
|
|
|
void Draw_Pic ( int x, int y, 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 );
|
|
|
|
|
|
|
|
viddef_t vid;
|
|
|
|
|
|
|
|
refimport_t ri;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
int QGL_TEXTURE0, QGL_TEXTURE1;
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
model_t *r_worldmodel;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
float gldepthmin, gldepthmax;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
glconfig_t gl_config;
|
2010-10-22 07:49:17 +00:00
|
|
|
glstate_t gl_state;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
image_t *r_notexture; /* use for bad textures */
|
|
|
|
image_t *r_particletexture; /* little dot for particles */
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
entity_t *currententity;
|
|
|
|
model_t *currentmodel;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
cplane_t frustum [ 4 ];
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
int r_visframecount; /* bumped when going to a new PVS */
|
|
|
|
int r_framecount; /* used for dlight push checking */
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
int c_brush_polys, c_alias_polys;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
float v_blend [ 4 ]; /* final blending color */
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-23 07:19:40 +00:00
|
|
|
void R_Strings ( void );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/* view origin */
|
|
|
|
vec3_t vup;
|
|
|
|
vec3_t vpn;
|
|
|
|
vec3_t vright;
|
|
|
|
vec3_t r_origin;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
float r_world_matrix [ 16 ];
|
|
|
|
float r_base_world_matrix [ 16 ];
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/* screen size info */
|
|
|
|
refdef_t r_newrefdef;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
int r_viewcluster, r_viewcluster2, r_oldviewcluster, r_oldviewcluster2;
|
|
|
|
extern qboolean have_stencil;
|
|
|
|
unsigned r_rawpalette [ 256 ];
|
|
|
|
|
|
|
|
cvar_t *r_norefresh;
|
|
|
|
cvar_t *r_drawentities;
|
|
|
|
cvar_t *r_drawworld;
|
|
|
|
cvar_t *r_speeds;
|
|
|
|
cvar_t *r_fullbright;
|
|
|
|
cvar_t *r_novis;
|
|
|
|
cvar_t *r_nocull;
|
|
|
|
cvar_t *r_lerpmodels;
|
|
|
|
cvar_t *r_lefthand;
|
|
|
|
|
|
|
|
cvar_t *r_lightlevel;
|
|
|
|
|
|
|
|
cvar_t *gl_nosubimage;
|
|
|
|
cvar_t *gl_allow_software;
|
|
|
|
|
|
|
|
cvar_t *gl_vertex_arrays;
|
|
|
|
|
|
|
|
cvar_t *gl_particle_min_size;
|
|
|
|
cvar_t *gl_particle_max_size;
|
|
|
|
cvar_t *gl_particle_size;
|
|
|
|
cvar_t *gl_particle_att_a;
|
|
|
|
cvar_t *gl_particle_att_b;
|
|
|
|
cvar_t *gl_particle_att_c;
|
|
|
|
|
|
|
|
cvar_t *gl_ext_swapinterval;
|
|
|
|
cvar_t *gl_ext_pointparameters;
|
|
|
|
cvar_t *gl_ext_compiled_vertex_array;
|
|
|
|
|
|
|
|
cvar_t *gl_log;
|
|
|
|
cvar_t *gl_bitdepth;
|
|
|
|
cvar_t *gl_drawbuffer;
|
2009-03-05 09:07:55 +00:00
|
|
|
cvar_t *gl_driver;
|
2010-10-22 07:49:17 +00:00
|
|
|
cvar_t *gl_lightmap;
|
|
|
|
cvar_t *gl_shadows;
|
|
|
|
cvar_t *gl_stencilshadow;
|
|
|
|
cvar_t *gl_mode;
|
2010-01-08 14:19:29 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
cvar_t *gl_customwidth;
|
|
|
|
cvar_t *gl_customheight;
|
2010-01-08 14:19:29 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
cvar_t *gl_dynamic;
|
|
|
|
cvar_t *gl_modulate;
|
|
|
|
cvar_t *gl_nobind;
|
|
|
|
cvar_t *gl_round_down;
|
|
|
|
cvar_t *gl_picmip;
|
|
|
|
cvar_t *gl_skymip;
|
|
|
|
cvar_t *gl_showtris;
|
|
|
|
cvar_t *gl_ztrick;
|
|
|
|
cvar_t *gl_finish;
|
|
|
|
cvar_t *gl_clear;
|
|
|
|
cvar_t *gl_cull;
|
|
|
|
cvar_t *gl_polyblend;
|
|
|
|
cvar_t *gl_flashblend;
|
|
|
|
cvar_t *gl_playermip;
|
2009-03-05 09:07:55 +00:00
|
|
|
cvar_t *gl_saturatelighting;
|
2010-10-22 07:49:17 +00:00
|
|
|
cvar_t *gl_swapinterval;
|
|
|
|
cvar_t *gl_texturemode;
|
|
|
|
cvar_t *gl_texturealphamode;
|
|
|
|
cvar_t *gl_texturesolidmode;
|
|
|
|
cvar_t *gl_lockpvs;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
cvar_t *vid_fullscreen;
|
|
|
|
cvar_t *vid_gamma;
|
|
|
|
cvar_t *vid_ref;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
/*
|
2010-10-22 07:49:17 +00:00
|
|
|
* Returns true if the box is completely outside the frustom
|
|
|
|
*/
|
|
|
|
qboolean
|
|
|
|
R_CullBox ( vec3_t mins, vec3_t maxs )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
int i;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
if ( r_nocull->value )
|
|
|
|
{
|
|
|
|
return ( false );
|
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
for ( i = 0; i < 4; i++ )
|
|
|
|
{
|
|
|
|
if ( BOX_ON_PLANE_SIDE( mins, maxs, &frustum [ i ] ) == 2 )
|
|
|
|
{
|
|
|
|
return ( true );
|
|
|
|
}
|
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
return ( false );
|
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
void
|
|
|
|
R_RotateForEntity ( entity_t *e )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
qglTranslatef( e->origin [ 0 ], e->origin [ 1 ], e->origin [ 2 ] );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglRotatef( e->angles [ 1 ], 0, 0, 1 );
|
|
|
|
qglRotatef( -e->angles [ 0 ], 0, 1, 0 );
|
|
|
|
qglRotatef( -e->angles [ 2 ], 1, 0, 0 );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
void
|
|
|
|
R_DrawSpriteModel ( entity_t *e )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
|
|
|
float alpha = 1.0F;
|
2010-10-22 07:49:17 +00:00
|
|
|
vec3_t point;
|
|
|
|
dsprframe_t *frame;
|
|
|
|
float *up, *right;
|
|
|
|
dsprite_t *psprite;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/* don't even bother culling, because it's just a single
|
|
|
|
polygon without a surface cache */
|
|
|
|
psprite = (dsprite_t *) currentmodel->extradata;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
e->frame %= psprite->numframes;
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
frame = &psprite->frames [ e->frame ];
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
{
|
|
|
|
/* normal sprite */
|
2009-03-05 09:07:55 +00:00
|
|
|
up = vup;
|
|
|
|
right = vright;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( e->flags & RF_TRANSLUCENT )
|
2010-10-22 07:49:17 +00:00
|
|
|
{
|
2009-03-05 09:07:55 +00:00
|
|
|
alpha = e->alpha;
|
2010-10-22 07:49:17 +00:00
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
if ( alpha != 1.0F )
|
2010-10-22 07:49:17 +00:00
|
|
|
{
|
2009-03-05 09:07:55 +00:00
|
|
|
qglEnable( GL_BLEND );
|
2010-10-22 07:49:17 +00:00
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
qglColor4f( 1, 1, 1, alpha );
|
|
|
|
|
2010-10-22 09:12:38 +00:00
|
|
|
R_Bind( currentmodel->skins [ e->frame ]->texnum );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 09:12:38 +00:00
|
|
|
R_TexEnv( GL_MODULATE );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
if ( alpha == 1.0 )
|
2010-10-22 07:49:17 +00:00
|
|
|
{
|
|
|
|
qglEnable( GL_ALPHA_TEST );
|
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
else
|
2010-10-22 07:49:17 +00:00
|
|
|
{
|
2009-03-05 09:07:55 +00:00
|
|
|
qglDisable( GL_ALPHA_TEST );
|
2010-10-22 07:49:17 +00:00
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglBegin( GL_QUADS );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglTexCoord2f( 0, 1 );
|
|
|
|
VectorMA( e->origin, -frame->origin_y, up, point );
|
|
|
|
VectorMA( point, -frame->origin_x, right, point );
|
|
|
|
qglVertex3fv( point );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglTexCoord2f( 0, 0 );
|
|
|
|
VectorMA( e->origin, frame->height - frame->origin_y, up, point );
|
|
|
|
VectorMA( point, -frame->origin_x, right, point );
|
|
|
|
qglVertex3fv( point );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglTexCoord2f( 1, 0 );
|
|
|
|
VectorMA( e->origin, frame->height - frame->origin_y, up, point );
|
|
|
|
VectorMA( point, frame->width - frame->origin_x, right, point );
|
|
|
|
qglVertex3fv( point );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglTexCoord2f( 1, 1 );
|
|
|
|
VectorMA( e->origin, -frame->origin_y, up, point );
|
|
|
|
VectorMA( point, frame->width - frame->origin_x, right, point );
|
|
|
|
qglVertex3fv( point );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglEnd();
|
|
|
|
|
|
|
|
qglDisable( GL_ALPHA_TEST );
|
2010-10-22 09:12:38 +00:00
|
|
|
R_TexEnv( GL_REPLACE );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
if ( alpha != 1.0F )
|
2010-10-22 07:49:17 +00:00
|
|
|
{
|
2009-03-05 09:07:55 +00:00
|
|
|
qglDisable( GL_BLEND );
|
2010-10-22 07:49:17 +00:00
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
qglColor4f( 1, 1, 1, 1 );
|
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
void
|
|
|
|
R_DrawNullModel ( void )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
vec3_t shadelight;
|
|
|
|
int i;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
if ( currententity->flags & RF_FULLBRIGHT )
|
2010-10-22 07:49:17 +00:00
|
|
|
{
|
|
|
|
shadelight [ 0 ] = shadelight [ 1 ] = shadelight [ 2 ] = 1.0F;
|
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
else
|
2010-10-22 07:49:17 +00:00
|
|
|
{
|
|
|
|
R_LightPoint( currententity->origin, shadelight );
|
|
|
|
}
|
|
|
|
|
|
|
|
qglPushMatrix();
|
|
|
|
R_RotateForEntity( currententity );
|
|
|
|
|
|
|
|
qglDisable( GL_TEXTURE_2D );
|
|
|
|
qglColor3fv( shadelight );
|
|
|
|
|
|
|
|
qglBegin( GL_TRIANGLE_FAN );
|
|
|
|
qglVertex3f( 0, 0, -16 );
|
|
|
|
|
|
|
|
for ( i = 0; i <= 4; i++ )
|
|
|
|
{
|
|
|
|
qglVertex3f( 16 * cos( i * M_PI / 2 ), 16 * sin( i * M_PI / 2 ), 0 );
|
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglEnd();
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglBegin( GL_TRIANGLE_FAN );
|
|
|
|
qglVertex3f( 0, 0, 16 );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
for ( i = 4; i >= 0; i-- )
|
|
|
|
{
|
|
|
|
qglVertex3f( 16 * cos( i * M_PI / 2 ), 16 * sin( i * M_PI / 2 ), 0 );
|
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglEnd();
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglColor3f( 1, 1, 1 );
|
|
|
|
qglPopMatrix();
|
|
|
|
qglEnable( GL_TEXTURE_2D );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
void
|
|
|
|
R_DrawEntitiesOnList ( void )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
int i;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
if ( !r_drawentities->value )
|
|
|
|
{
|
2009-03-05 09:07:55 +00:00
|
|
|
return;
|
2010-10-22 07:49:17 +00:00
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/* draw non-transparent first */
|
|
|
|
for ( i = 0; i < r_newrefdef.num_entities; i++ )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
currententity = &r_newrefdef.entities [ i ];
|
|
|
|
|
|
|
|
if ( currententity->flags & RF_TRANSLUCENT )
|
|
|
|
{
|
|
|
|
continue; /* solid */
|
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
if ( currententity->flags & RF_BEAM )
|
|
|
|
{
|
|
|
|
R_DrawBeam( currententity );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
currentmodel = currententity->model;
|
2010-10-22 07:49:17 +00:00
|
|
|
|
|
|
|
if ( !currentmodel )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
R_DrawNullModel();
|
2009-03-05 09:07:55 +00:00
|
|
|
continue;
|
|
|
|
}
|
2010-10-22 07:49:17 +00:00
|
|
|
|
|
|
|
switch ( currentmodel->type )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
case mod_alias:
|
|
|
|
R_DrawAliasModel( currententity );
|
|
|
|
break;
|
|
|
|
case mod_brush:
|
|
|
|
R_DrawBrushModel( currententity );
|
|
|
|
break;
|
|
|
|
case mod_sprite:
|
|
|
|
R_DrawSpriteModel( currententity );
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ri.Sys_Error( ERR_DROP, "Bad modeltype" );
|
|
|
|
break;
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/* draw transparent entities
|
|
|
|
we could sort these if it ever
|
|
|
|
becomes a problem... */
|
|
|
|
qglDepthMask( 0 ); /* no z writes */
|
|
|
|
|
|
|
|
for ( i = 0; i < r_newrefdef.num_entities; i++ )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
currententity = &r_newrefdef.entities [ i ];
|
|
|
|
|
|
|
|
if ( !( currententity->flags & RF_TRANSLUCENT ) )
|
|
|
|
{
|
|
|
|
continue; /* solid */
|
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
if ( currententity->flags & RF_BEAM )
|
|
|
|
{
|
|
|
|
R_DrawBeam( currententity );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
currentmodel = currententity->model;
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
if ( !currentmodel )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
R_DrawNullModel();
|
2009-03-05 09:07:55 +00:00
|
|
|
continue;
|
|
|
|
}
|
2010-10-22 07:49:17 +00:00
|
|
|
|
|
|
|
switch ( currentmodel->type )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
case mod_alias:
|
|
|
|
R_DrawAliasModel( currententity );
|
|
|
|
break;
|
|
|
|
case mod_brush:
|
|
|
|
R_DrawBrushModel( currententity );
|
|
|
|
break;
|
|
|
|
case mod_sprite:
|
|
|
|
R_DrawSpriteModel( currententity );
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ri.Sys_Error( ERR_DROP, "Bad modeltype" );
|
|
|
|
break;
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglDepthMask( 1 ); /* back to writing */
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
void
|
2010-10-23 06:29:01 +00:00
|
|
|
R_DrawParticles2 ( int num_particles, const particle_t particles[], const unsigned colortable [ 768 ] )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
|
|
|
const particle_t *p;
|
2010-10-22 07:49:17 +00:00
|
|
|
int i;
|
|
|
|
vec3_t up, right;
|
|
|
|
float scale;
|
|
|
|
byte color [ 4 ];
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 09:12:38 +00:00
|
|
|
R_Bind( r_particletexture->texnum );
|
2010-10-22 07:49:17 +00:00
|
|
|
qglDepthMask( GL_FALSE ); /* no z buffering */
|
2009-03-05 09:07:55 +00:00
|
|
|
qglEnable( GL_BLEND );
|
2010-10-22 09:12:38 +00:00
|
|
|
R_TexEnv( GL_MODULATE );
|
2009-03-05 09:07:55 +00:00
|
|
|
qglBegin( GL_TRIANGLES );
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
VectorScale( vup, 1.5, up );
|
|
|
|
VectorScale( vright, 1.5, right );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
for ( p = particles, i = 0; i < num_particles; i++, p++ )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
/* hack a scale up to keep particles from disapearing */
|
|
|
|
scale = ( p->origin [ 0 ] - r_origin [ 0 ] ) * vpn [ 0 ] +
|
|
|
|
( p->origin [ 1 ] - r_origin [ 1 ] ) * vpn [ 1 ] +
|
|
|
|
( p->origin [ 2 ] - r_origin [ 2 ] ) * vpn [ 2 ];
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
if ( scale < 20 )
|
|
|
|
{
|
2009-03-05 09:07:55 +00:00
|
|
|
scale = 1;
|
2010-10-22 07:49:17 +00:00
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
else
|
2010-10-22 07:49:17 +00:00
|
|
|
{
|
2009-03-05 09:07:55 +00:00
|
|
|
scale = 1 + scale * 0.004;
|
2010-10-22 07:49:17 +00:00
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
*(int *) color = colortable [ p->color ];
|
|
|
|
color [ 3 ] = p->alpha * 255;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
qglColor4ubv( color );
|
|
|
|
|
|
|
|
qglTexCoord2f( 0.0625, 0.0625 );
|
|
|
|
qglVertex3fv( p->origin );
|
|
|
|
|
|
|
|
qglTexCoord2f( 1.0625, 0.0625 );
|
2010-10-22 07:49:17 +00:00
|
|
|
qglVertex3f( p->origin [ 0 ] + up [ 0 ] * scale,
|
|
|
|
p->origin [ 1 ] + up [ 1 ] * scale,
|
|
|
|
p->origin [ 2 ] + up [ 2 ] * scale );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
qglTexCoord2f( 0.0625, 1.0625 );
|
2010-10-22 07:49:17 +00:00
|
|
|
qglVertex3f( p->origin [ 0 ] + right [ 0 ] * scale,
|
|
|
|
p->origin [ 1 ] + right [ 1 ] * scale,
|
|
|
|
p->origin [ 2 ] + right [ 2 ] * scale );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglEnd();
|
2009-03-05 09:07:55 +00:00
|
|
|
qglDisable( GL_BLEND );
|
2010-10-22 07:49:17 +00:00
|
|
|
qglColor4f( 1, 1, 1, 1 );
|
|
|
|
qglDepthMask( 1 ); /* back to normal Z buffering */
|
2010-10-22 09:12:38 +00:00
|
|
|
R_TexEnv( GL_REPLACE );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
void
|
|
|
|
R_DrawParticles ( void )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
|
|
|
if ( gl_ext_pointparameters->value && qglPointParameterfEXT )
|
|
|
|
{
|
|
|
|
int i;
|
2010-10-22 07:49:17 +00:00
|
|
|
unsigned char color [ 4 ];
|
2009-03-05 09:07:55 +00:00
|
|
|
const particle_t *p;
|
|
|
|
|
|
|
|
qglDepthMask( GL_FALSE );
|
|
|
|
qglEnable( GL_BLEND );
|
|
|
|
qglDisable( GL_TEXTURE_2D );
|
|
|
|
|
|
|
|
qglPointSize( gl_particle_size->value );
|
|
|
|
|
|
|
|
qglBegin( GL_POINTS );
|
2010-10-22 07:49:17 +00:00
|
|
|
|
2009-03-05 09:07:55 +00:00
|
|
|
for ( i = 0, p = r_newrefdef.particles; i < r_newrefdef.num_particles; i++, p++ )
|
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
*(int *) color = d_8to24table [ p->color ];
|
|
|
|
color [ 3 ] = p->alpha * 255;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
qglColor4ubv( color );
|
|
|
|
|
|
|
|
qglVertex3fv( p->origin );
|
|
|
|
}
|
2010-10-22 07:49:17 +00:00
|
|
|
|
2009-03-05 09:07:55 +00:00
|
|
|
qglEnd();
|
|
|
|
|
|
|
|
qglDisable( GL_BLEND );
|
|
|
|
qglColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
|
|
|
qglDepthMask( GL_TRUE );
|
|
|
|
qglEnable( GL_TEXTURE_2D );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-10-23 06:29:01 +00:00
|
|
|
R_DrawParticles2( r_newrefdef.num_particles, r_newrefdef.particles, d_8to24table );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
void
|
|
|
|
R_PolyBlend ( void )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
if ( !gl_polyblend->value )
|
|
|
|
{
|
2009-03-05 09:07:55 +00:00
|
|
|
return;
|
2010-10-22 07:49:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( !v_blend [ 3 ] )
|
|
|
|
{
|
2009-03-05 09:07:55 +00:00
|
|
|
return;
|
2010-10-22 07:49:17 +00:00
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglDisable( GL_ALPHA_TEST );
|
|
|
|
qglEnable( GL_BLEND );
|
|
|
|
qglDisable( GL_DEPTH_TEST );
|
|
|
|
qglDisable( GL_TEXTURE_2D );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglLoadIdentity();
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglRotatef( -90, 1, 0, 0 ); /* put Z going up */
|
|
|
|
qglRotatef( 90, 0, 0, 1 ); /* put Z going up */
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglColor4fv( v_blend );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglBegin( GL_QUADS );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglVertex3f( 10, 100, 100 );
|
|
|
|
qglVertex3f( 10, -100, 100 );
|
|
|
|
qglVertex3f( 10, -100, -100 );
|
|
|
|
qglVertex3f( 10, 100, -100 );
|
|
|
|
qglEnd();
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglDisable( GL_BLEND );
|
|
|
|
qglEnable( GL_TEXTURE_2D );
|
|
|
|
qglEnable( GL_ALPHA_TEST );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglColor4f( 1, 1, 1, 1 );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
int
|
2010-10-23 06:29:01 +00:00
|
|
|
R_SignbitsForPlane ( cplane_t *out )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
int bits, j;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/* for fast box on planeside test */
|
2009-03-05 09:07:55 +00:00
|
|
|
bits = 0;
|
2010-10-22 07:49:17 +00:00
|
|
|
|
|
|
|
for ( j = 0; j < 3; j++ )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
if ( out->normal [ j ] < 0 )
|
|
|
|
{
|
|
|
|
bits |= 1 << j;
|
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
return ( bits );
|
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
void
|
|
|
|
R_SetFrustum ( void )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
/* rotate VPN right by FOV_X/2 degrees */
|
|
|
|
RotatePointAroundVector( frustum [ 0 ].normal, vup, vpn, -( 90 - r_newrefdef.fov_x / 2 ) );
|
|
|
|
/* rotate VPN left by FOV_X/2 degrees */
|
|
|
|
RotatePointAroundVector( frustum [ 1 ].normal, vup, vpn, 90 - r_newrefdef.fov_x / 2 );
|
|
|
|
/* rotate VPN up by FOV_X/2 degrees */
|
|
|
|
RotatePointAroundVector( frustum [ 2 ].normal, vright, vpn, 90 - r_newrefdef.fov_y / 2 );
|
|
|
|
/* rotate VPN down by FOV_X/2 degrees */
|
|
|
|
RotatePointAroundVector( frustum [ 3 ].normal, vright, vpn, -( 90 - r_newrefdef.fov_y / 2 ) );
|
|
|
|
|
|
|
|
for ( i = 0; i < 4; i++ )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
frustum [ i ].type = PLANE_ANYZ;
|
|
|
|
frustum [ i ].dist = DotProduct( r_origin, frustum [ i ].normal );
|
2010-10-23 06:29:01 +00:00
|
|
|
frustum [ i ].signbits = R_SignbitsForPlane( &frustum [ i ] );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
void
|
|
|
|
R_SetupFrame ( void )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
|
|
|
int i;
|
2010-10-22 07:49:17 +00:00
|
|
|
mleaf_t *leaf;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
r_framecount++;
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/* build the transformation matrix for the given view angles */
|
|
|
|
VectorCopy( r_newrefdef.vieworg, r_origin );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
AngleVectors( r_newrefdef.viewangles, vpn, vright, vup );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/* current viewcluster */
|
2009-03-05 09:07:55 +00:00
|
|
|
if ( !( r_newrefdef.rdflags & RDF_NOWORLDMODEL ) )
|
|
|
|
{
|
|
|
|
r_oldviewcluster = r_viewcluster;
|
|
|
|
r_oldviewcluster2 = r_viewcluster2;
|
2010-10-22 07:49:17 +00:00
|
|
|
leaf = Mod_PointInLeaf( r_origin, r_worldmodel );
|
2009-03-05 09:07:55 +00:00
|
|
|
r_viewcluster = r_viewcluster2 = leaf->cluster;
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/* check above and below so crossing solid water doesn't draw wrong */
|
|
|
|
if ( !leaf->contents )
|
|
|
|
{ /* look down a bit */
|
|
|
|
vec3_t temp;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
VectorCopy( r_origin, temp );
|
|
|
|
temp [ 2 ] -= 16;
|
|
|
|
leaf = Mod_PointInLeaf( temp, r_worldmodel );
|
|
|
|
|
|
|
|
if ( !( leaf->contents & CONTENTS_SOLID ) &&
|
|
|
|
( leaf->cluster != r_viewcluster2 ) )
|
|
|
|
{
|
2009-03-05 09:07:55 +00:00
|
|
|
r_viewcluster2 = leaf->cluster;
|
2010-10-22 07:49:17 +00:00
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
else
|
2010-10-22 07:49:17 +00:00
|
|
|
{
|
|
|
|
/* look up a bit */
|
|
|
|
vec3_t temp;
|
|
|
|
|
|
|
|
VectorCopy( r_origin, temp );
|
|
|
|
temp [ 2 ] += 16;
|
|
|
|
leaf = Mod_PointInLeaf( temp, r_worldmodel );
|
|
|
|
|
|
|
|
if ( !( leaf->contents & CONTENTS_SOLID ) &&
|
|
|
|
( leaf->cluster != r_viewcluster2 ) )
|
|
|
|
{
|
2009-03-05 09:07:55 +00:00
|
|
|
r_viewcluster2 = leaf->cluster;
|
2010-10-22 07:49:17 +00:00
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
for ( i = 0; i < 4; i++ )
|
|
|
|
{
|
|
|
|
v_blend [ i ] = r_newrefdef.blend [ i ];
|
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
c_brush_polys = 0;
|
|
|
|
c_alias_polys = 0;
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/* clear out the portion of the screen that the NOWORLDMODEL defines */
|
2009-03-05 09:07:55 +00:00
|
|
|
if ( r_newrefdef.rdflags & RDF_NOWORLDMODEL )
|
|
|
|
{
|
|
|
|
qglEnable( GL_SCISSOR_TEST );
|
|
|
|
qglClearColor( 0.3, 0.3, 0.3, 1 );
|
|
|
|
qglScissor( r_newrefdef.x, vid.height - r_newrefdef.height - r_newrefdef.y, r_newrefdef.width, r_newrefdef.height );
|
|
|
|
qglClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
|
|
|
qglClearColor( 1, 0, 0.5, 0.5 );
|
|
|
|
qglDisable( GL_SCISSOR_TEST );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
void
|
2010-10-23 06:29:01 +00:00
|
|
|
R_MYgluPerspective ( GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
GLdouble xmin, xmax, ymin, ymax;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
ymax = zNear * tan( fovy * M_PI / 360.0 );
|
|
|
|
ymin = -ymax;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
xmin = ymin * aspect;
|
|
|
|
xmax = ymax * aspect;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
xmin += -( 2 * gl_state.camera_separation ) / zNear;
|
|
|
|
xmax += -( 2 * gl_state.camera_separation ) / zNear;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglFrustum( xmin, xmax, ymin, ymax, zNear, zFar );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
void
|
|
|
|
R_SetupGL ( void )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
float screenaspect;
|
|
|
|
int x, x2, y2, y, w, h;
|
|
|
|
|
|
|
|
/* set up viewport */
|
|
|
|
x = floor( r_newrefdef.x * vid.width / vid.width );
|
|
|
|
x2 = ceil( ( r_newrefdef.x + r_newrefdef.width ) * vid.width / vid.width );
|
|
|
|
y = floor( vid.height - r_newrefdef.y * vid.height / vid.height );
|
|
|
|
y2 = ceil( vid.height - ( r_newrefdef.y + r_newrefdef.height ) * vid.height / vid.height );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
w = x2 - x;
|
|
|
|
h = y - y2;
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglViewport( x, y2, w, h );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/* set up projection matrix */
|
|
|
|
screenaspect = (float) r_newrefdef.width / r_newrefdef.height;
|
|
|
|
qglMatrixMode( GL_PROJECTION );
|
|
|
|
qglLoadIdentity();
|
2010-10-23 06:29:01 +00:00
|
|
|
R_MYgluPerspective( r_newrefdef.fov_y, screenaspect, 4, 4096 );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglCullFace( GL_FRONT );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglMatrixMode( GL_MODELVIEW );
|
|
|
|
qglLoadIdentity();
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglRotatef( -90, 1, 0, 0 ); /* put Z going up */
|
|
|
|
qglRotatef( 90, 0, 0, 1 ); /* put Z going up */
|
|
|
|
qglRotatef( -r_newrefdef.viewangles [ 2 ], 1, 0, 0 );
|
|
|
|
qglRotatef( -r_newrefdef.viewangles [ 0 ], 0, 1, 0 );
|
|
|
|
qglRotatef( -r_newrefdef.viewangles [ 1 ], 0, 0, 1 );
|
|
|
|
qglTranslatef( -r_newrefdef.vieworg [ 0 ], -r_newrefdef.vieworg [ 1 ], -r_newrefdef.vieworg [ 2 ] );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglGetFloatv( GL_MODELVIEW_MATRIX, r_world_matrix );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/* set drawing parms */
|
|
|
|
if ( gl_cull->value )
|
|
|
|
{
|
|
|
|
qglEnable( GL_CULL_FACE );
|
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
else
|
2010-10-22 07:49:17 +00:00
|
|
|
{
|
|
|
|
qglDisable( GL_CULL_FACE );
|
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglDisable( GL_BLEND );
|
|
|
|
qglDisable( GL_ALPHA_TEST );
|
|
|
|
qglEnable( GL_DEPTH_TEST );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
void
|
|
|
|
R_Clear ( void )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
if ( gl_ztrick->value )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
|
|
|
static int trickframe;
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
if ( gl_clear->value )
|
|
|
|
{
|
|
|
|
qglClear( GL_COLOR_BUFFER_BIT );
|
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
trickframe++;
|
2010-10-22 07:49:17 +00:00
|
|
|
|
|
|
|
if ( trickframe & 1 )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
|
|
|
gldepthmin = 0;
|
|
|
|
gldepthmax = 0.49999;
|
2010-10-22 07:49:17 +00:00
|
|
|
qglDepthFunc( GL_LEQUAL );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gldepthmin = 1;
|
|
|
|
gldepthmax = 0.5;
|
2010-10-22 07:49:17 +00:00
|
|
|
qglDepthFunc( GL_GEQUAL );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
if ( gl_clear->value )
|
|
|
|
{
|
|
|
|
qglClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
else
|
2010-10-22 07:49:17 +00:00
|
|
|
{
|
|
|
|
qglClear( GL_DEPTH_BUFFER_BIT );
|
|
|
|
}
|
|
|
|
|
2009-03-05 09:07:55 +00:00
|
|
|
gldepthmin = 0;
|
|
|
|
gldepthmax = 1;
|
2010-10-22 07:49:17 +00:00
|
|
|
qglDepthFunc( GL_LEQUAL );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglDepthRange( gldepthmin, gldepthmax );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
/* stencilbuffer shadows */
|
2010-10-22 07:49:17 +00:00
|
|
|
if ( gl_shadows->value && have_stencil && gl_stencilshadow->value )
|
|
|
|
{
|
|
|
|
qglClearStencil( 1 );
|
|
|
|
qglClear( GL_STENCIL_BUFFER_BIT );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
void
|
|
|
|
R_Flash ( void )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
R_PolyBlend();
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2010-10-22 07:49:17 +00:00
|
|
|
* r_newrefdef must be set before the first call
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
R_RenderView ( refdef_t *fd )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
if ( r_norefresh->value )
|
|
|
|
{
|
2009-03-05 09:07:55 +00:00
|
|
|
return;
|
2010-10-22 07:49:17 +00:00
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
r_newrefdef = *fd;
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
if ( !r_worldmodel && !( r_newrefdef.rdflags & RDF_NOWORLDMODEL ) )
|
|
|
|
{
|
|
|
|
ri.Sys_Error( ERR_DROP, "R_RenderView: NULL worldmodel" );
|
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
if ( r_speeds->value )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
|
|
|
c_brush_polys = 0;
|
|
|
|
c_alias_polys = 0;
|
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
R_PushDlights();
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
if ( gl_finish->value )
|
|
|
|
{
|
|
|
|
qglFinish();
|
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
R_SetupFrame();
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
R_SetFrustum();
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
R_SetupGL();
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
R_MarkLeaves(); /* done here so we know if we're in water */
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
R_DrawWorld();
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
R_DrawEntitiesOnList();
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
R_RenderDlights();
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
R_DrawParticles();
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
R_DrawAlphaSurfaces();
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
R_Flash();
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
if ( r_speeds->value )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
ri.Con_Printf( PRINT_ALL, "%4i wpoly %4i epoly %i tex %i lmaps\n",
|
|
|
|
c_brush_polys,
|
|
|
|
c_alias_polys,
|
|
|
|
c_visible_textures,
|
|
|
|
c_visible_lightmaps );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
void
|
|
|
|
R_SetGL2D ( void )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
/* set 2D virtual screen size */
|
|
|
|
qglViewport( 0, 0, vid.width, vid.height );
|
|
|
|
qglMatrixMode( GL_PROJECTION );
|
|
|
|
qglLoadIdentity();
|
|
|
|
qglOrtho( 0, vid.width, vid.height, 0, -99999, 99999 );
|
|
|
|
qglMatrixMode( GL_MODELVIEW );
|
|
|
|
qglLoadIdentity();
|
|
|
|
qglDisable( GL_DEPTH_TEST );
|
|
|
|
qglDisable( GL_CULL_FACE );
|
|
|
|
qglDisable( GL_BLEND );
|
|
|
|
qglEnable( GL_ALPHA_TEST );
|
|
|
|
qglColor4f( 1, 1, 1, 1 );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
void
|
|
|
|
R_SetLightLevel ( void )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
vec3_t shadelight;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
if ( r_newrefdef.rdflags & RDF_NOWORLDMODEL )
|
|
|
|
{
|
2009-03-05 09:07:55 +00:00
|
|
|
return;
|
2010-10-22 07:49:17 +00:00
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/* save off light value for server to look at */
|
|
|
|
R_LightPoint( r_newrefdef.vieworg, shadelight );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/* pick the greatest component, which should be the same
|
|
|
|
as the mono value returned by software */
|
|
|
|
if ( shadelight [ 0 ] > shadelight [ 1 ] )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
if ( shadelight [ 0 ] > shadelight [ 2 ] )
|
|
|
|
{
|
|
|
|
r_lightlevel->value = 150 * shadelight [ 0 ];
|
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
else
|
2010-10-22 07:49:17 +00:00
|
|
|
{
|
|
|
|
r_lightlevel->value = 150 * shadelight [ 2 ];
|
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
if ( shadelight [ 1 ] > shadelight [ 2 ] )
|
|
|
|
{
|
|
|
|
r_lightlevel->value = 150 * shadelight [ 1 ];
|
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
else
|
2010-10-22 07:49:17 +00:00
|
|
|
{
|
|
|
|
r_lightlevel->value = 150 * shadelight [ 2 ];
|
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
void
|
|
|
|
R_RenderFrame ( refdef_t *fd )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
|
|
|
R_RenderView( fd );
|
2010-10-22 07:49:17 +00:00
|
|
|
R_SetLightLevel();
|
|
|
|
R_SetGL2D();
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
void
|
|
|
|
R_Register ( void )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
|
|
|
r_lefthand = ri.Cvar_Get( "hand", "0", CVAR_USERINFO | CVAR_ARCHIVE );
|
2010-10-22 07:49:17 +00:00
|
|
|
r_norefresh = ri.Cvar_Get( "r_norefresh", "0", 0 );
|
|
|
|
r_fullbright = ri.Cvar_Get( "r_fullbright", "0", 0 );
|
|
|
|
r_drawentities = ri.Cvar_Get( "r_drawentities", "1", 0 );
|
|
|
|
r_drawworld = ri.Cvar_Get( "r_drawworld", "1", 0 );
|
|
|
|
r_novis = ri.Cvar_Get( "r_novis", "0", 0 );
|
|
|
|
r_nocull = ri.Cvar_Get( "r_nocull", "0", 0 );
|
|
|
|
r_lerpmodels = ri.Cvar_Get( "r_lerpmodels", "1", 0 );
|
|
|
|
r_speeds = ri.Cvar_Get( "r_speeds", "0", 0 );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
r_lightlevel = ri.Cvar_Get( "r_lightlevel", "0", 0 );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
gl_nosubimage = ri.Cvar_Get( "gl_nosubimage", "0", 0 );
|
|
|
|
gl_allow_software = ri.Cvar_Get( "gl_allow_software", "0", 0 );
|
|
|
|
|
|
|
|
gl_particle_min_size = ri.Cvar_Get( "gl_particle_min_size", "2", CVAR_ARCHIVE );
|
|
|
|
gl_particle_max_size = ri.Cvar_Get( "gl_particle_max_size", "40", CVAR_ARCHIVE );
|
|
|
|
gl_particle_size = ri.Cvar_Get( "gl_particle_size", "40", CVAR_ARCHIVE );
|
|
|
|
gl_particle_att_a = ri.Cvar_Get( "gl_particle_att_a", "0.01", CVAR_ARCHIVE );
|
|
|
|
gl_particle_att_b = ri.Cvar_Get( "gl_particle_att_b", "0.0", CVAR_ARCHIVE );
|
|
|
|
gl_particle_att_c = ri.Cvar_Get( "gl_particle_att_c", "0.01", CVAR_ARCHIVE );
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
gl_modulate = ri.Cvar_Get( "gl_modulate", "1", CVAR_ARCHIVE );
|
2009-03-05 09:07:55 +00:00
|
|
|
gl_log = ri.Cvar_Get( "gl_log", "0", 0 );
|
|
|
|
gl_bitdepth = ri.Cvar_Get( "gl_bitdepth", "0", 0 );
|
|
|
|
gl_mode = ri.Cvar_Get( "gl_mode", "3", CVAR_ARCHIVE );
|
2010-10-22 07:49:17 +00:00
|
|
|
gl_lightmap = ri.Cvar_Get( "gl_lightmap", "0", 0 );
|
|
|
|
gl_shadows = ri.Cvar_Get( "gl_shadows", "0", CVAR_ARCHIVE );
|
|
|
|
gl_stencilshadow = ri.Cvar_Get( "gl_stencilshadow", "0", CVAR_ARCHIVE );
|
|
|
|
gl_dynamic = ri.Cvar_Get( "gl_dynamic", "1", 0 );
|
|
|
|
gl_nobind = ri.Cvar_Get( "gl_nobind", "0", 0 );
|
|
|
|
gl_round_down = ri.Cvar_Get( "gl_round_down", "1", 0 );
|
|
|
|
gl_picmip = ri.Cvar_Get( "gl_picmip", "0", 0 );
|
|
|
|
gl_skymip = ri.Cvar_Get( "gl_skymip", "0", 0 );
|
|
|
|
gl_showtris = ri.Cvar_Get( "gl_showtris", "0", 0 );
|
|
|
|
gl_ztrick = ri.Cvar_Get( "gl_ztrick", "0", 0 );
|
|
|
|
gl_finish = ri.Cvar_Get( "gl_finish", "0", CVAR_ARCHIVE );
|
|
|
|
gl_clear = ri.Cvar_Get( "gl_clear", "0", 0 );
|
|
|
|
gl_cull = ri.Cvar_Get( "gl_cull", "1", 0 );
|
|
|
|
gl_polyblend = ri.Cvar_Get( "gl_polyblend", "1", 0 );
|
|
|
|
gl_flashblend = ri.Cvar_Get( "gl_flashblend", "0", 0 );
|
|
|
|
gl_playermip = ri.Cvar_Get( "gl_playermip", "0", 0 );
|
2009-11-21 11:07:08 +00:00
|
|
|
gl_driver = ri.Cvar_Get( "gl_driver", "libGL.so.1", CVAR_ARCHIVE );
|
2009-03-05 09:07:55 +00:00
|
|
|
gl_texturemode = ri.Cvar_Get( "gl_texturemode", "GL_LINEAR_MIPMAP_NEAREST", CVAR_ARCHIVE );
|
|
|
|
gl_texturealphamode = ri.Cvar_Get( "gl_texturealphamode", "default", CVAR_ARCHIVE );
|
|
|
|
gl_texturesolidmode = ri.Cvar_Get( "gl_texturesolidmode", "default", CVAR_ARCHIVE );
|
|
|
|
gl_lockpvs = ri.Cvar_Get( "gl_lockpvs", "0", 0 );
|
|
|
|
|
|
|
|
gl_vertex_arrays = ri.Cvar_Get( "gl_vertex_arrays", "0", CVAR_ARCHIVE );
|
|
|
|
|
|
|
|
gl_ext_swapinterval = ri.Cvar_Get( "gl_ext_swapinterval", "1", CVAR_ARCHIVE );
|
|
|
|
gl_ext_pointparameters = ri.Cvar_Get( "gl_ext_pointparameters", "1", CVAR_ARCHIVE );
|
|
|
|
gl_ext_compiled_vertex_array = ri.Cvar_Get( "gl_ext_compiled_vertex_array", "1", CVAR_ARCHIVE );
|
|
|
|
|
|
|
|
gl_drawbuffer = ri.Cvar_Get( "gl_drawbuffer", "GL_BACK", 0 );
|
|
|
|
gl_swapinterval = ri.Cvar_Get( "gl_swapinterval", "1", CVAR_ARCHIVE );
|
|
|
|
|
|
|
|
gl_saturatelighting = ri.Cvar_Get( "gl_saturatelighting", "0", 0 );
|
|
|
|
|
|
|
|
vid_fullscreen = ri.Cvar_Get( "vid_fullscreen", "0", CVAR_ARCHIVE );
|
|
|
|
vid_gamma = ri.Cvar_Get( "vid_gamma", "1.0", CVAR_ARCHIVE );
|
|
|
|
vid_ref = ri.Cvar_Get( "vid_ref", "soft", CVAR_ARCHIVE );
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
gl_customwidth = ri.Cvar_Get( "gl_customwidth", "1024", CVAR_ARCHIVE );
|
|
|
|
gl_customheight = ri.Cvar_Get( "gl_customheight", "768", CVAR_ARCHIVE );
|
2010-05-22 06:58:09 +00:00
|
|
|
|
2010-10-22 09:12:38 +00:00
|
|
|
ri.Cmd_AddCommand( "imagelist", R_ImageList_f );
|
2010-10-23 07:19:40 +00:00
|
|
|
ri.Cmd_AddCommand( "screenshot", R_ScreenShot );
|
2009-03-05 09:07:55 +00:00
|
|
|
ri.Cmd_AddCommand( "modellist", Mod_Modellist_f );
|
2010-10-23 07:19:40 +00:00
|
|
|
ri.Cmd_AddCommand( "gl_strings", R_Strings );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qboolean
|
|
|
|
R_SetMode ( void )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
|
|
|
rserr_t err;
|
|
|
|
qboolean fullscreen;
|
|
|
|
|
|
|
|
fullscreen = vid_fullscreen->value;
|
|
|
|
|
|
|
|
vid_fullscreen->modified = false;
|
|
|
|
gl_mode->modified = false;
|
2010-10-22 07:49:17 +00:00
|
|
|
|
|
|
|
/* a bit hackish approach to enable custom resolutions:
|
|
|
|
Glimp_SetMode needs these values set for mode -1 */
|
2010-01-08 14:19:29 +00:00
|
|
|
vid.width = gl_customwidth->value;
|
|
|
|
vid.height = gl_customheight->value;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
if ( ( err = GLimp_SetMode( &vid.width, &vid.height, gl_mode->value, fullscreen ) ) == rserr_ok )
|
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
if ( gl_mode->value == -1 )
|
|
|
|
{
|
|
|
|
gl_state.prev_mode = 3; /* safe default for custom mode */
|
|
|
|
}
|
2010-01-08 14:19:29 +00:00
|
|
|
else
|
2010-10-22 07:49:17 +00:00
|
|
|
{
|
2010-01-08 14:19:29 +00:00
|
|
|
gl_state.prev_mode = gl_mode->value;
|
2010-10-22 07:49:17 +00:00
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( err == rserr_invalid_fullscreen )
|
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
ri.Cvar_SetValue( "vid_fullscreen", 0 );
|
2009-03-05 09:07:55 +00:00
|
|
|
vid_fullscreen->modified = false;
|
|
|
|
ri.Con_Printf( PRINT_ALL, "ref_gl::R_SetMode() - fullscreen unavailable in this mode\n" );
|
2010-10-22 07:49:17 +00:00
|
|
|
|
2009-03-05 09:07:55 +00:00
|
|
|
if ( ( err = GLimp_SetMode( &vid.width, &vid.height, gl_mode->value, false ) ) == rserr_ok )
|
2010-10-22 07:49:17 +00:00
|
|
|
{
|
|
|
|
return ( true );
|
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
else if ( err == rserr_invalid_mode )
|
|
|
|
{
|
|
|
|
ri.Cvar_SetValue( "gl_mode", gl_state.prev_mode );
|
|
|
|
gl_mode->modified = false;
|
|
|
|
ri.Con_Printf( PRINT_ALL, "ref_gl::R_SetMode() - invalid mode\n" );
|
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/* try setting it back to something safe */
|
2009-03-05 09:07:55 +00:00
|
|
|
if ( ( err = GLimp_SetMode( &vid.width, &vid.height, gl_state.prev_mode, false ) ) != rserr_ok )
|
|
|
|
{
|
|
|
|
ri.Con_Printf( PRINT_ALL, "ref_gl::R_SetMode() - could not revert to safe mode\n" );
|
2010-10-22 07:49:17 +00:00
|
|
|
return ( false );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
}
|
2010-10-22 07:49:17 +00:00
|
|
|
|
|
|
|
return ( true );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
int
|
|
|
|
R_Init ( void *hinstance, void *hWnd )
|
|
|
|
{
|
|
|
|
char renderer_buffer [ 1000 ];
|
|
|
|
char vendor_buffer [ 1000 ];
|
|
|
|
int err;
|
|
|
|
int j;
|
|
|
|
extern float r_turbsin [ 256 ];
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
for ( j = 0; j < 256; j++ )
|
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
r_turbsin [ j ] *= 0.5;
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
ri.Con_Printf( PRINT_ALL, "Refresh: " REF_VERSION "\n" );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
Draw_GetPalette();
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
R_Register();
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/* initialize our QGL dynamic bindings */
|
2009-03-05 09:07:55 +00:00
|
|
|
if ( !QGL_Init( gl_driver->string ) )
|
|
|
|
{
|
|
|
|
QGL_Shutdown();
|
2010-10-22 07:49:17 +00:00
|
|
|
ri.Con_Printf( PRINT_ALL, "ref_gl::R_Init() - could not load \"%s\"\n", gl_driver->string );
|
|
|
|
return ( -1 );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/* initialize OS-specific parts of OpenGL */
|
2010-10-19 12:43:11 +00:00
|
|
|
if ( !GLimp_Init() )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
|
|
|
QGL_Shutdown();
|
2010-10-22 07:49:17 +00:00
|
|
|
return ( -1 );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/* set our "safe" modes */
|
2009-03-05 09:07:55 +00:00
|
|
|
gl_state.prev_mode = 3;
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/* create the window and set up the context */
|
|
|
|
if ( !R_SetMode() )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
|
|
|
QGL_Shutdown();
|
2010-10-22 07:49:17 +00:00
|
|
|
ri.Con_Printf( PRINT_ALL, "ref_gl::R_Init() - could not R_SetMode()\n" );
|
|
|
|
return ( -1 );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ri.Vid_MenuInit();
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/* get our various GL strings */
|
|
|
|
ri.Con_Printf( PRINT_ALL, "\nOpenGL setting:\n", gl_config.vendor_string );
|
|
|
|
gl_config.vendor_string = (char *) qglGetString( GL_VENDOR );
|
|
|
|
ri.Con_Printf( PRINT_ALL, "GL_VENDOR: %s\n", gl_config.vendor_string );
|
|
|
|
gl_config.renderer_string = (char *) qglGetString( GL_RENDERER );
|
|
|
|
ri.Con_Printf( PRINT_ALL, "GL_RENDERER: %s\n", gl_config.renderer_string );
|
|
|
|
gl_config.version_string = (char *) qglGetString( GL_VERSION );
|
|
|
|
ri.Con_Printf( PRINT_ALL, "GL_VERSION: %s\n", gl_config.version_string );
|
|
|
|
gl_config.extensions_string = (char *) qglGetString( GL_EXTENSIONS );
|
|
|
|
ri.Con_Printf( PRINT_ALL, "GL_EXTENSIONS: %s\n", gl_config.extensions_string );
|
|
|
|
|
|
|
|
strncpy( renderer_buffer, gl_config.renderer_string, sizeof ( renderer_buffer ) );
|
|
|
|
renderer_buffer [ sizeof ( renderer_buffer ) - 1 ] = 0;
|
2009-03-05 09:07:55 +00:00
|
|
|
strlwr( renderer_buffer );
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
strncpy( vendor_buffer, gl_config.vendor_string, sizeof ( vendor_buffer ) );
|
|
|
|
vendor_buffer [ sizeof ( vendor_buffer ) - 1 ] = 0;
|
2009-03-05 09:07:55 +00:00
|
|
|
strlwr( vendor_buffer );
|
2010-10-22 07:49:17 +00:00
|
|
|
|
|
|
|
ri.Cvar_Set( "scr_drawall", "0" );
|
|
|
|
gl_config.allow_cds = true;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/* grab extensions */
|
|
|
|
if ( strstr( gl_config.extensions_string, "GL_EXT_compiled_vertex_array" ) ||
|
2009-03-05 09:07:55 +00:00
|
|
|
strstr( gl_config.extensions_string, "GL_SGI_compiled_vertex_array" ) )
|
|
|
|
{
|
|
|
|
ri.Con_Printf( PRINT_ALL, "...enabling GL_EXT_compiled_vertex_array\n" );
|
2010-10-22 07:49:17 +00:00
|
|
|
qglLockArraysEXT = (void *) qwglGetProcAddress( "glLockArraysEXT" );
|
|
|
|
qglUnlockArraysEXT = (void *) qwglGetProcAddress( "glUnlockArraysEXT" );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ri.Con_Printf( PRINT_ALL, "...GL_EXT_compiled_vertex_array not found\n" );
|
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
if ( strstr( gl_config.extensions_string, "GL_EXT_point_parameters" ) )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
if ( gl_ext_pointparameters->value )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
qglPointParameterfEXT = ( void (APIENTRY *) ( GLenum, GLfloat ) )qwglGetProcAddress( "glPointParameterfEXT" );
|
|
|
|
qglPointParameterfvEXT = ( void (APIENTRY *) ( GLenum, const GLfloat * ) )qwglGetProcAddress(
|
|
|
|
"glPointParameterfvEXT" );
|
|
|
|
ri.Con_Printf( PRINT_ALL, "...using GL_EXT_point_parameters\n" );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
ri.Con_Printf( PRINT_ALL, "...ignoring GL_EXT_point_parameters\n" );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
ri.Con_Printf( PRINT_ALL, "...GL_EXT_point_parameters not found\n" );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
|
2010-10-23 07:19:40 +00:00
|
|
|
R_SetDefaultState();
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 09:12:38 +00:00
|
|
|
R_InitImages();
|
2010-10-22 07:49:17 +00:00
|
|
|
Mod_Init();
|
|
|
|
R_InitParticleTexture();
|
|
|
|
Draw_InitLocal();
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
err = qglGetError();
|
2010-10-22 07:49:17 +00:00
|
|
|
|
2009-03-05 09:07:55 +00:00
|
|
|
if ( err != GL_NO_ERROR )
|
2010-10-22 07:49:17 +00:00
|
|
|
{
|
|
|
|
ri.Con_Printf( PRINT_ALL, "glGetError() = 0x%x\n", err );
|
|
|
|
}
|
|
|
|
|
|
|
|
return ( true );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
void
|
|
|
|
R_Shutdown ( void )
|
|
|
|
{
|
|
|
|
ri.Cmd_RemoveCommand( "modellist" );
|
|
|
|
ri.Cmd_RemoveCommand( "screenshot" );
|
|
|
|
ri.Cmd_RemoveCommand( "imagelist" );
|
|
|
|
ri.Cmd_RemoveCommand( "gl_strings" );
|
|
|
|
|
|
|
|
Mod_FreeAll();
|
|
|
|
|
2010-10-22 09:12:38 +00:00
|
|
|
R_ShutdownImages();
|
2010-10-22 07:49:17 +00:00
|
|
|
|
|
|
|
/* shut down OS specific OpenGL stuff like contexts, etc. */
|
2009-03-05 09:07:55 +00:00
|
|
|
GLimp_Shutdown();
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/* shutdown our QGL subsystem */
|
2009-03-05 09:07:55 +00:00
|
|
|
QGL_Shutdown();
|
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
extern void UpdateHardwareGamma ();
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
void
|
|
|
|
R_BeginFrame ( float camera_separation )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
|
|
|
gl_state.camera_separation = camera_separation;
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/* change modes if necessary */
|
2009-03-05 09:07:55 +00:00
|
|
|
if ( gl_mode->modified || vid_fullscreen->modified )
|
2010-10-22 07:49:17 +00:00
|
|
|
{
|
|
|
|
cvar_t *ref;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
ref = ri.Cvar_Get( "vid_ref", "gl", 0 );
|
2009-03-05 09:07:55 +00:00
|
|
|
ref->modified = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( gl_log->modified )
|
|
|
|
{
|
|
|
|
GLimp_EnableLogging( gl_log->value );
|
|
|
|
gl_log->modified = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( gl_log->value )
|
|
|
|
{
|
|
|
|
GLimp_LogNewFrame();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( vid_gamma->modified )
|
|
|
|
{
|
|
|
|
vid_gamma->modified = false;
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
if ( gl_state.hwgamma )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
UpdateHardwareGamma();
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/* go into 2D mode */
|
|
|
|
qglViewport( 0, 0, vid.width, vid.height );
|
|
|
|
qglMatrixMode( GL_PROJECTION );
|
|
|
|
qglLoadIdentity();
|
|
|
|
qglOrtho( 0, vid.width, vid.height, 0, -99999, 99999 );
|
|
|
|
qglMatrixMode( GL_MODELVIEW );
|
|
|
|
qglLoadIdentity();
|
|
|
|
qglDisable( GL_DEPTH_TEST );
|
|
|
|
qglDisable( GL_CULL_FACE );
|
|
|
|
qglDisable( GL_BLEND );
|
|
|
|
qglEnable( GL_ALPHA_TEST );
|
|
|
|
qglColor4f( 1, 1, 1, 1 );
|
|
|
|
|
|
|
|
/* draw buffer stuff */
|
2009-03-05 09:07:55 +00:00
|
|
|
if ( gl_drawbuffer->modified )
|
|
|
|
{
|
|
|
|
gl_drawbuffer->modified = false;
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
if ( ( gl_state.camera_separation == 0 ) || !gl_state.stereo_enabled )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
|
|
|
if ( Q_stricmp( gl_drawbuffer->string, "GL_FRONT" ) == 0 )
|
2010-10-22 07:49:17 +00:00
|
|
|
{
|
2009-03-05 09:07:55 +00:00
|
|
|
qglDrawBuffer( GL_FRONT );
|
2010-10-22 07:49:17 +00:00
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
else
|
2010-10-22 07:49:17 +00:00
|
|
|
{
|
2009-03-05 09:07:55 +00:00
|
|
|
qglDrawBuffer( GL_BACK );
|
2010-10-22 07:49:17 +00:00
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/* texturemode stuff */
|
2009-03-05 09:07:55 +00:00
|
|
|
if ( gl_texturemode->modified )
|
|
|
|
{
|
2010-10-22 09:12:38 +00:00
|
|
|
R_TextureMode( gl_texturemode->string );
|
2009-03-05 09:07:55 +00:00
|
|
|
gl_texturemode->modified = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( gl_texturealphamode->modified )
|
|
|
|
{
|
2010-10-22 09:12:38 +00:00
|
|
|
R_TextureAlphaMode( gl_texturealphamode->string );
|
2009-03-05 09:07:55 +00:00
|
|
|
gl_texturealphamode->modified = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( gl_texturesolidmode->modified )
|
|
|
|
{
|
2010-10-22 09:12:38 +00:00
|
|
|
R_TextureSolidMode( gl_texturesolidmode->string );
|
2009-03-05 09:07:55 +00:00
|
|
|
gl_texturesolidmode->modified = false;
|
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/* swapinterval stuff */
|
2010-10-23 07:19:40 +00:00
|
|
|
R_UpdateSwapInterval();
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/* clear screen if desired */
|
|
|
|
R_Clear();
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
void
|
|
|
|
R_SetPalette ( const unsigned char *palette )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
int i;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
byte *rp = (byte *) r_rawpalette;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
if ( palette )
|
|
|
|
{
|
|
|
|
for ( i = 0; i < 256; i++ )
|
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
rp [ i * 4 + 0 ] = palette [ i * 3 + 0 ];
|
|
|
|
rp [ i * 4 + 1 ] = palette [ i * 3 + 1 ];
|
|
|
|
rp [ i * 4 + 2 ] = palette [ i * 3 + 2 ];
|
|
|
|
rp [ i * 4 + 3 ] = 0xff;
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for ( i = 0; i < 256; i++ )
|
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
rp [ i * 4 + 0 ] = LittleLong( d_8to24table [ i ] ) & 0xff;
|
|
|
|
rp [ i * 4 + 1 ] = ( LittleLong( d_8to24table [ i ] ) >> 8 ) & 0xff;
|
|
|
|
rp [ i * 4 + 2 ] = ( LittleLong( d_8to24table [ i ] ) >> 16 ) & 0xff;
|
|
|
|
rp [ i * 4 + 3 ] = 0xff;
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
qglClearColor( 0, 0, 0, 0 );
|
|
|
|
qglClear( GL_COLOR_BUFFER_BIT );
|
|
|
|
qglClearColor( 1, 0, 0.5, 0.5 );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/* R_DrawBeam */
|
|
|
|
void
|
|
|
|
R_DrawBeam ( entity_t *e )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
int i;
|
2009-03-05 09:07:55 +00:00
|
|
|
float r, g, b;
|
|
|
|
|
|
|
|
vec3_t perpvec;
|
|
|
|
vec3_t direction, normalized_direction;
|
2010-10-22 07:49:17 +00:00
|
|
|
vec3_t start_points [ NUM_BEAM_SEGS ], end_points [ NUM_BEAM_SEGS ];
|
2009-03-05 09:07:55 +00:00
|
|
|
vec3_t oldorigin, origin;
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
oldorigin [ 0 ] = e->oldorigin [ 0 ];
|
|
|
|
oldorigin [ 1 ] = e->oldorigin [ 1 ];
|
|
|
|
oldorigin [ 2 ] = e->oldorigin [ 2 ];
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
origin [ 0 ] = e->origin [ 0 ];
|
|
|
|
origin [ 1 ] = e->origin [ 1 ];
|
|
|
|
origin [ 2 ] = e->origin [ 2 ];
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
normalized_direction [ 0 ] = direction [ 0 ] = oldorigin [ 0 ] - origin [ 0 ];
|
|
|
|
normalized_direction [ 1 ] = direction [ 1 ] = oldorigin [ 1 ] - origin [ 1 ];
|
|
|
|
normalized_direction [ 2 ] = direction [ 2 ] = oldorigin [ 2 ] - origin [ 2 ];
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
if ( VectorNormalize( normalized_direction ) == 0 )
|
2010-10-22 07:49:17 +00:00
|
|
|
{
|
2009-03-05 09:07:55 +00:00
|
|
|
return;
|
2010-10-22 07:49:17 +00:00
|
|
|
}
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
PerpendicularVector( perpvec, normalized_direction );
|
|
|
|
VectorScale( perpvec, e->frame / 2, perpvec );
|
|
|
|
|
|
|
|
for ( i = 0; i < 6; i++ )
|
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
RotatePointAroundVector( start_points [ i ], normalized_direction, perpvec, ( 360.0 / NUM_BEAM_SEGS ) * i );
|
|
|
|
VectorAdd( start_points [ i ], origin, start_points [ i ] );
|
|
|
|
VectorAdd( start_points [ i ], direction, end_points [ i ] );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
qglDisable( GL_TEXTURE_2D );
|
|
|
|
qglEnable( GL_BLEND );
|
|
|
|
qglDepthMask( GL_FALSE );
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
r = ( LittleLong( d_8to24table [ e->skinnum & 0xFF ] ) ) & 0xFF;
|
|
|
|
g = ( LittleLong( d_8to24table [ e->skinnum & 0xFF ] ) >> 8 ) & 0xFF;
|
|
|
|
b = ( LittleLong( d_8to24table [ e->skinnum & 0xFF ] ) >> 16 ) & 0xFF;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
r *= 1 / 255.0F;
|
|
|
|
g *= 1 / 255.0F;
|
|
|
|
b *= 1 / 255.0F;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
qglColor4f( r, g, b, e->alpha );
|
|
|
|
|
|
|
|
qglBegin( GL_TRIANGLE_STRIP );
|
2010-10-22 07:49:17 +00:00
|
|
|
|
2009-03-05 09:07:55 +00:00
|
|
|
for ( i = 0; i < NUM_BEAM_SEGS; i++ )
|
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
qglVertex3fv( start_points [ i ] );
|
|
|
|
qglVertex3fv( end_points [ i ] );
|
|
|
|
qglVertex3fv( start_points [ ( i + 1 ) % NUM_BEAM_SEGS ] );
|
|
|
|
qglVertex3fv( end_points [ ( i + 1 ) % NUM_BEAM_SEGS ] );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
2010-10-22 07:49:17 +00:00
|
|
|
|
2009-03-05 09:07:55 +00:00
|
|
|
qglEnd();
|
|
|
|
|
|
|
|
qglEnable( GL_TEXTURE_2D );
|
|
|
|
qglDisable( GL_BLEND );
|
|
|
|
qglDepthMask( GL_TRUE );
|
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
refexport_t
|
2010-10-23 06:29:01 +00:00
|
|
|
R_GetRefAPI ( refimport_t rimp )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
refexport_t re;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
ri = rimp;
|
|
|
|
|
|
|
|
re.api_version = API_VERSION;
|
|
|
|
|
|
|
|
re.BeginRegistration = R_BeginRegistration;
|
|
|
|
re.RegisterModel = R_RegisterModel;
|
|
|
|
re.RegisterSkin = R_RegisterSkin;
|
|
|
|
re.RegisterPic = Draw_FindPic;
|
|
|
|
re.SetSky = R_SetSky;
|
|
|
|
re.EndRegistration = R_EndRegistration;
|
|
|
|
|
|
|
|
re.RenderFrame = R_RenderFrame;
|
|
|
|
|
|
|
|
re.DrawGetPicSize = Draw_GetPicSize;
|
|
|
|
re.DrawPic = Draw_Pic;
|
|
|
|
re.DrawStretchPic = Draw_StretchPic;
|
|
|
|
re.DrawChar = Draw_Char;
|
|
|
|
re.DrawTileClear = Draw_TileClear;
|
|
|
|
re.DrawFill = Draw_Fill;
|
2010-10-22 07:49:17 +00:00
|
|
|
re.DrawFadeScreen = Draw_FadeScreen;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
|
|
|
re.DrawStretchRaw = Draw_StretchRaw;
|
|
|
|
|
|
|
|
re.Init = R_Init;
|
|
|
|
re.Shutdown = R_Shutdown;
|
|
|
|
|
|
|
|
re.CinematicSetPalette = R_SetPalette;
|
|
|
|
re.BeginFrame = R_BeginFrame;
|
|
|
|
re.EndFrame = GLimp_EndFrame;
|
|
|
|
|
2010-10-19 12:43:11 +00:00
|
|
|
re.AppActivate = NULL;
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
Swap_Init();
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
return ( re );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
/*
|
|
|
|
* this is only here so the functions in
|
|
|
|
* q_shared.c can link
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
Sys_Error ( char *error, ... )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
va_list argptr;
|
|
|
|
char text [ 1024 ];
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
va_start( argptr, error );
|
|
|
|
vsprintf( text, error, argptr );
|
|
|
|
va_end( argptr );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
ri.Sys_Error( ERR_FATAL, "%s", text );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
void
|
|
|
|
Com_Printf ( char *fmt, ... )
|
2009-03-05 09:07:55 +00:00
|
|
|
{
|
2010-10-22 07:49:17 +00:00
|
|
|
va_list argptr;
|
|
|
|
char text [ 1024 ];
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
va_start( argptr, fmt );
|
|
|
|
vsprintf( text, fmt, argptr );
|
|
|
|
va_end( argptr );
|
2009-03-05 09:07:55 +00:00
|
|
|
|
2010-10-22 07:49:17 +00:00
|
|
|
ri.Con_Printf( PRINT_ALL, "%s", text );
|
2009-03-05 09:07:55 +00:00
|
|
|
}
|
2009-03-05 12:42:43 +00:00
|
|
|
|