2004-08-22 22:29:09 +00:00
/*
Copyright ( C ) 1996 - 1997 Id Software , Inc .
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 .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
2009-07-20 02:50:00 +00:00
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE .
2004-08-22 22:29:09 +00:00
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
Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 - 1307 , USA .
*/
// r_main.c
# include "quakedef.h"
2004-12-15 19:53:30 +00:00
2009-11-04 21:16:50 +00:00
# ifdef GLQUAKE
2004-08-22 22:29:09 +00:00
# include "glquake.h"
2006-02-11 14:51:36 +00:00
# include "renderque.h"
2005-08-26 22:56:51 +00:00
# include "shader.h"
2020-05-14 15:50:26 +00:00
# include "vr.h"
2005-08-26 22:56:51 +00:00
2004-08-22 22:29:09 +00:00
void R_RenderBrushPoly ( msurface_t * fa ) ;
# define PROJECTION_DISTANCE 200
# define MAX_STENCIL_ENTS 128
2011-12-05 15:23:40 +00:00
extern int gl_stencilbits ;
2004-08-22 22:29:09 +00:00
2007-05-25 22:16:29 +00:00
//mplane_t frustum[4];
2004-08-22 22:29:09 +00:00
//
// view origin
//
2013-03-12 23:09:25 +00:00
//vec3_t vup;
//vec3_t vpn;
//vec3_t vright;
//vec3_t r_origin;
2004-08-22 22:29:09 +00:00
extern cvar_t gl_part_flame ;
2010-07-11 02:22:39 +00:00
extern cvar_t r_bloom ;
2019-03-01 22:39:30 +00:00
extern cvar_t r_wireframe , r_wireframe_smooth ;
extern cvar_t r_outline ;
2004-08-22 22:29:09 +00:00
2021-04-14 05:21:04 +00:00
cvar_t gl_affinemodels = CVARFD ( " gl_affinemodels " , " 0 " , CVAR_ARCHIVE , " Use affine texture sampling for models. This replicates software rendering's distortions. " ) ;
2016-09-08 19:04:35 +00:00
cvar_t gl_finish = CVAR ( " gl_finish " , " 0 " ) ;
cvar_t gl_dither = CVAR ( " gl_dither " , " 1 " ) ;
2012-09-30 05:52:03 +00:00
extern cvar_t r_stereo_separation ;
2016-02-15 06:01:17 +00:00
extern cvar_t r_stereo_convergence ;
2012-09-30 05:52:03 +00:00
extern cvar_t r_stereo_method ;
2018-08-13 06:27:29 +00:00
extern cvar_t r_postprocshader , r_fxaa , r_graphics ;
2018-03-04 14:41:16 +00:00
extern cvar_t r_hdr_framebuffer ;
2007-08-21 17:16:52 +00:00
2011-02-25 04:22:14 +00:00
extern cvar_t gl_screenangle ;
2007-05-25 22:16:29 +00:00
extern cvar_t gl_mindist ;
2014-03-30 08:55:06 +00:00
extern cvar_t vid_srgb ;
2006-02-11 02:09:43 +00:00
2009-07-19 18:13:03 +00:00
extern cvar_t ffov ;
2005-05-27 08:24:31 +00:00
extern cvar_t gl_motionblur ;
2005-06-04 04:20:20 +00:00
extern cvar_t gl_motionblurscale ;
2004-08-22 22:29:09 +00:00
2017-02-11 16:14:06 +00:00
extern cvar_t r_tessellation ;
2004-08-22 22:29:09 +00:00
extern cvar_t gl_ati_truform_type ;
2017-02-11 16:14:06 +00:00
extern cvar_t r_tessellation_level ;
2004-08-22 22:29:09 +00:00
2005-08-23 23:36:04 +00:00
extern cvar_t gl_blendsprites ;
2014-02-14 09:59:32 +00:00
extern cvar_t r_portaldrawplanes ;
extern cvar_t r_portalonly ;
2004-08-22 22:29:09 +00:00
extern cvar_t scr_fov ;
2020-05-14 15:50:26 +00:00
static shader_t * scenepp_rescaled ;
static shader_t * scenepp_antialias ;
static shader_t * scenepp_waterwarp ;
static shader_t * scenepp_gamma ;
2010-07-11 02:22:39 +00:00
2005-01-12 22:15:50 +00:00
// post processing stuff
2020-05-14 15:50:26 +00:00
static texid_t sceneblur_texture ;
static texid_t scenepp_texture_warp ;
static texid_t scenepp_texture_edge ;
2005-01-12 22:15:50 +00:00
2011-10-27 16:16:29 +00:00
texid_t scenepp_postproc_cube ;
2020-05-14 15:50:26 +00:00
static int scenepp_postproc_cube_size ;
2009-07-19 18:13:03 +00:00
2020-05-14 15:50:26 +00:00
static fbostate_t fbo_vr ;
static fbostate_t fbo_gameview ;
static fbostate_t fbo_postproc ;
static fbostate_t fbo_postproc_cube ;
2014-02-07 08:38:40 +00:00
2005-01-12 22:15:50 +00:00
// KrimZon - init post processing - called in GL_CheckExtensions, when they're called
// I put it here so that only this file need be changed when messing with the post
// processing shaders
2020-05-14 15:50:26 +00:00
static void GL_InitSceneProcessingShaders_WaterWarp ( void )
2005-01-12 22:15:50 +00:00
{
2012-07-05 19:42:36 +00:00
scenepp_waterwarp = NULL ;
2010-07-11 02:22:39 +00:00
if ( gl_config . arb_shader_objects )
{
2013-08-21 07:14:39 +00:00
scenepp_waterwarp = R_RegisterShader ( " waterwarp " , SUF_NONE ,
2010-07-11 02:22:39 +00:00
" { \n "
2011-10-27 16:16:29 +00:00
" program underwaterwarp \n "
" { \n "
2014-08-19 06:08:23 +00:00
" map $sourcecolour \n "
2011-10-27 16:16:29 +00:00
" } \n "
" { \n "
" map $upperoverlay \n "
" } \n "
" { \n "
" map $loweroverlay \n "
" } \n "
2010-07-11 02:22:39 +00:00
" } \n "
) ;
2015-05-03 19:57:46 +00:00
scenepp_waterwarp - > defaulttextures - > upperoverlay = scenepp_texture_warp ;
scenepp_waterwarp - > defaulttextures - > loweroverlay = scenepp_texture_edge ;
2010-07-11 02:22:39 +00:00
}
2006-03-14 09:20:07 +00:00
}
2014-05-30 03:57:30 +00:00
void GL_ShutdownPostProcessing ( void )
{
2020-05-14 15:50:26 +00:00
GLBE_FBO_Destroy ( & fbo_vr ) ;
2014-05-30 03:57:30 +00:00
GLBE_FBO_Destroy ( & fbo_gameview ) ;
2014-08-19 06:08:23 +00:00
GLBE_FBO_Destroy ( & fbo_postproc ) ;
2016-07-28 13:18:22 +00:00
GLBE_FBO_Destroy ( & fbo_postproc_cube ) ;
2014-08-10 00:31:37 +00:00
R_BloomShutdown ( ) ;
2014-05-30 03:57:30 +00:00
}
2005-08-26 22:56:51 +00:00
void GL_InitSceneProcessingShaders ( void )
{
2010-03-25 22:56:11 +00:00
if ( gl_config . arb_shader_objects )
{
GL_InitSceneProcessingShaders_WaterWarp ( ) ;
}
2012-04-24 07:59:11 +00:00
2018-03-04 14:41:16 +00:00
scenepp_gamma = R_RegisterShader ( " fte_scenegamma " , 0 ,
" { \n "
" program defaultgammacb \n "
" affine \n "
" { \n "
" map $sourcecolour \n "
" nodepthtest \n "
" } \n "
" } \n "
) ;
2015-07-14 14:47:00 +00:00
scenepp_rescaled = R_RegisterShader ( " fte_rescaler " , 0 ,
" { \n "
" program default2d \n "
2018-03-04 14:41:16 +00:00
" affine \n "
2015-07-14 14:47:00 +00:00
" { \n "
" map $sourcecolour \n "
2018-03-04 14:41:16 +00:00
" nodepthtest \n "
2015-07-14 14:47:00 +00:00
" } \n "
" } \n "
) ;
scenepp_antialias = R_RegisterShader ( " fte_ppantialias " , 0 ,
" { \n "
" program fxaa \n "
2018-03-04 14:41:16 +00:00
" affine \n "
2015-07-14 14:47:00 +00:00
" { \n "
" map $sourcecolour \n "
2018-03-04 14:41:16 +00:00
" nodepthtest \n "
2015-07-14 14:47:00 +00:00
" } \n "
" } \n "
) ;
2014-09-02 02:44:43 +00:00
r_wireframe_smooth . modified = true ;
2012-04-24 07:59:11 +00:00
gl_dither . modified = true ; //fixme: bad place for this, but hey
2014-03-30 08:55:06 +00:00
vid_srgb . modified = true ;
2005-08-26 22:56:51 +00:00
}
2004-08-22 22:29:09 +00:00
2005-01-17 18:06:45 +00:00
# define PP_WARP_TEX_SIZE 64
# define PP_AMP_TEX_SIZE 64
# define PP_AMP_TEX_BORDER 4
void GL_SetupSceneProcessingTextures ( void )
{
int i , x , y ;
2014-10-05 20:04:11 +00:00
unsigned char pp_warp_tex [ PP_WARP_TEX_SIZE * PP_WARP_TEX_SIZE * 4 ] ;
unsigned char pp_edge_tex [ PP_AMP_TEX_SIZE * PP_AMP_TEX_SIZE * 4 ] ;
2005-01-17 18:06:45 +00:00
2011-10-27 16:16:29 +00:00
scenepp_postproc_cube = r_nulltex ;
2009-07-19 18:13:03 +00:00
2014-10-05 20:04:11 +00:00
TEXASSIGN ( sceneblur_texture , Image_CreateTexture ( " ***postprocess_blur*** " , NULL , 0 ) ) ;
2005-05-27 08:24:31 +00:00
2005-02-12 18:56:04 +00:00
if ( ! gl_config . arb_shader_objects )
return ;
2014-10-05 20:04:11 +00:00
TEXASSIGN ( scenepp_texture_warp , Image_CreateTexture ( " ***postprocess_warp*** " , NULL , IF_NOMIPMAP | IF_NOGAMMA | IF_LINEAR ) ) ;
TEXASSIGN ( scenepp_texture_edge , Image_CreateTexture ( " ***postprocess_edge*** " , NULL , IF_NOMIPMAP | IF_NOGAMMA | IF_LINEAR ) ) ;
2005-01-17 18:06:45 +00:00
2009-07-20 02:50:00 +00:00
// init warp texture - this specifies offset in
2005-01-17 18:06:45 +00:00
for ( y = 0 ; y < PP_WARP_TEX_SIZE ; y + + )
{
for ( x = 0 ; x < PP_WARP_TEX_SIZE ; x + + )
{
float fx , fy ;
2014-10-05 20:04:11 +00:00
i = ( x + y * PP_WARP_TEX_SIZE ) * 4 ;
2005-01-17 18:06:45 +00:00
fx = sin ( ( ( double ) y / PP_WARP_TEX_SIZE ) * M_PI * 2 ) ;
fy = cos ( ( ( double ) x / PP_WARP_TEX_SIZE ) * M_PI * 2 ) ;
pp_warp_tex [ i ] = ( fx + 1.0f ) * 127.0f ;
pp_warp_tex [ i + 1 ] = ( fy + 1.0f ) * 127.0f ;
pp_warp_tex [ i + 2 ] = 0 ;
2014-10-05 20:04:11 +00:00
pp_warp_tex [ i + 3 ] = 0xff ;
2005-01-17 18:06:45 +00:00
}
}
2020-11-04 10:19:30 +00:00
Image_Upload ( scenepp_texture_warp , TF_RGBX32 , pp_warp_tex , NULL , PP_WARP_TEX_SIZE , PP_WARP_TEX_SIZE , 1 , IF_LINEAR | IF_NOMIPMAP | IF_NOGAMMA ) ;
2005-01-17 18:06:45 +00:00
// TODO: init edge texture - this is ampscale * 2, with ampscale calculated
2009-07-20 02:50:00 +00:00
// init warp texture - this specifies offset in
2005-01-17 18:06:45 +00:00
for ( y = 0 ; y < PP_AMP_TEX_SIZE ; y + + )
{
for ( x = 0 ; x < PP_AMP_TEX_SIZE ; x + + )
{
float fx = 1 , fy = 1 ;
2014-10-05 20:04:11 +00:00
i = ( x + y * PP_AMP_TEX_SIZE ) * 4 ;
2005-01-17 18:06:45 +00:00
if ( x < PP_AMP_TEX_BORDER )
{
fx = ( float ) x / PP_AMP_TEX_BORDER ;
}
if ( x > PP_AMP_TEX_SIZE - PP_AMP_TEX_BORDER )
{
fx = ( PP_AMP_TEX_SIZE - ( float ) x ) / PP_AMP_TEX_BORDER ;
}
2013-03-12 23:13:39 +00:00
2005-01-17 18:06:45 +00:00
if ( y < PP_AMP_TEX_BORDER )
{
fy = ( float ) y / PP_AMP_TEX_BORDER ;
}
if ( y > PP_AMP_TEX_SIZE - PP_AMP_TEX_BORDER )
{
fy = ( PP_AMP_TEX_SIZE - ( float ) y ) / PP_AMP_TEX_BORDER ;
}
2013-03-12 23:13:39 +00:00
//avoid any sudden changes.
fx = sin ( fx * M_PI * 0.5 ) ;
fy = sin ( fy * M_PI * 0.5 ) ;
2005-01-17 18:06:45 +00:00
2013-03-12 23:13:39 +00:00
//lame
fx = fy = min ( fx , fy ) ;
pp_edge_tex [ i ] = fx * 255 ;
pp_edge_tex [ i + 1 ] = fy * 255 ;
2005-01-17 18:06:45 +00:00
pp_edge_tex [ i + 2 ] = 0 ;
2014-10-05 20:04:11 +00:00
pp_edge_tex [ i + 3 ] = 0xff ;
2005-01-17 18:06:45 +00:00
}
}
2020-11-04 10:19:30 +00:00
Image_Upload ( scenepp_texture_edge , TF_RGBX32 , pp_edge_tex , NULL , PP_AMP_TEX_SIZE , PP_AMP_TEX_SIZE , 1 , IF_LINEAR | IF_NOMIPMAP | IF_NOGAMMA ) ;
2005-01-17 18:06:45 +00:00
}
2011-10-27 16:16:29 +00:00
void R_RotateForEntity ( float * m , float * modelview , const entity_t * e , const model_t * mod )
2004-08-22 22:29:09 +00:00
{
2020-08-13 08:39:48 +00:00
if ( e - > flags & RF_WEAPONMODEL )
2012-02-27 12:23:15 +00:00
{
float em [ 16 ] ;
float vm [ 16 ] ;
2022-03-08 05:32:03 +00:00
if ( e - > flags & RF_WEAPONMODELNOBOB )
2016-07-12 00:40:13 +00:00
{
2022-03-08 05:32:03 +00:00
vm [ 0 ] = r_refdef . weaponmatrix [ 0 ] [ 0 ] ;
vm [ 1 ] = r_refdef . weaponmatrix [ 0 ] [ 1 ] ;
vm [ 2 ] = r_refdef . weaponmatrix [ 0 ] [ 2 ] ;
2016-07-12 00:40:13 +00:00
vm [ 3 ] = 0 ;
2022-03-08 05:32:03 +00:00
vm [ 4 ] = r_refdef . weaponmatrix [ 1 ] [ 0 ] ;
vm [ 5 ] = r_refdef . weaponmatrix [ 1 ] [ 1 ] ;
vm [ 6 ] = r_refdef . weaponmatrix [ 1 ] [ 2 ] ;
2016-07-12 00:40:13 +00:00
vm [ 7 ] = 0 ;
2022-03-08 05:32:03 +00:00
vm [ 8 ] = r_refdef . weaponmatrix [ 2 ] [ 0 ] ;
vm [ 9 ] = r_refdef . weaponmatrix [ 2 ] [ 1 ] ;
vm [ 10 ] = r_refdef . weaponmatrix [ 2 ] [ 2 ] ;
2016-07-12 00:40:13 +00:00
vm [ 11 ] = 0 ;
2022-03-08 05:32:03 +00:00
vm [ 12 ] = r_refdef . weaponmatrix [ 3 ] [ 0 ] ;
vm [ 13 ] = r_refdef . weaponmatrix [ 3 ] [ 1 ] ;
vm [ 14 ] = r_refdef . weaponmatrix [ 3 ] [ 2 ] ;
2016-07-12 00:40:13 +00:00
vm [ 15 ] = 1 ;
}
else
{
2022-03-08 05:32:03 +00:00
vm [ 0 ] = r_refdef . weaponmatrix_bob [ 0 ] [ 0 ] ;
vm [ 1 ] = r_refdef . weaponmatrix_bob [ 0 ] [ 1 ] ;
vm [ 2 ] = r_refdef . weaponmatrix_bob [ 0 ] [ 2 ] ;
2016-07-12 00:40:13 +00:00
vm [ 3 ] = 0 ;
2022-03-08 05:32:03 +00:00
vm [ 4 ] = r_refdef . weaponmatrix_bob [ 1 ] [ 0 ] ;
vm [ 5 ] = r_refdef . weaponmatrix_bob [ 1 ] [ 1 ] ;
vm [ 6 ] = r_refdef . weaponmatrix_bob [ 1 ] [ 2 ] ;
2016-07-12 00:40:13 +00:00
vm [ 7 ] = 0 ;
2022-03-08 05:32:03 +00:00
vm [ 8 ] = r_refdef . weaponmatrix_bob [ 2 ] [ 0 ] ;
vm [ 9 ] = r_refdef . weaponmatrix_bob [ 2 ] [ 1 ] ;
vm [ 10 ] = r_refdef . weaponmatrix_bob [ 2 ] [ 2 ] ;
2016-07-12 00:40:13 +00:00
vm [ 11 ] = 0 ;
2022-03-08 05:32:03 +00:00
vm [ 12 ] = r_refdef . weaponmatrix_bob [ 3 ] [ 0 ] ;
vm [ 13 ] = r_refdef . weaponmatrix_bob [ 3 ] [ 1 ] ;
vm [ 14 ] = r_refdef . weaponmatrix_bob [ 3 ] [ 2 ] ;
2016-07-12 00:40:13 +00:00
vm [ 15 ] = 1 ;
}
2012-02-27 12:23:15 +00:00
em [ 0 ] = e - > axis [ 0 ] [ 0 ] ;
em [ 1 ] = e - > axis [ 0 ] [ 1 ] ;
em [ 2 ] = e - > axis [ 0 ] [ 2 ] ;
em [ 3 ] = 0 ;
em [ 4 ] = e - > axis [ 1 ] [ 0 ] ;
em [ 5 ] = e - > axis [ 1 ] [ 1 ] ;
em [ 6 ] = e - > axis [ 1 ] [ 2 ] ;
em [ 7 ] = 0 ;
em [ 8 ] = e - > axis [ 2 ] [ 0 ] ;
em [ 9 ] = e - > axis [ 2 ] [ 1 ] ;
em [ 10 ] = e - > axis [ 2 ] [ 2 ] ;
em [ 11 ] = 0 ;
em [ 12 ] = e - > origin [ 0 ] ;
em [ 13 ] = e - > origin [ 1 ] ;
em [ 14 ] = e - > origin [ 2 ] ;
em [ 15 ] = 1 ;
Matrix4_Multiply ( vm , em , m ) ;
}
else
{
m [ 0 ] = e - > axis [ 0 ] [ 0 ] ;
m [ 1 ] = e - > axis [ 0 ] [ 1 ] ;
m [ 2 ] = e - > axis [ 0 ] [ 2 ] ;
m [ 3 ] = 0 ;
m [ 4 ] = e - > axis [ 1 ] [ 0 ] ;
m [ 5 ] = e - > axis [ 1 ] [ 1 ] ;
m [ 6 ] = e - > axis [ 1 ] [ 2 ] ;
m [ 7 ] = 0 ;
m [ 8 ] = e - > axis [ 2 ] [ 0 ] ;
m [ 9 ] = e - > axis [ 2 ] [ 1 ] ;
m [ 10 ] = e - > axis [ 2 ] [ 2 ] ;
m [ 11 ] = 0 ;
m [ 12 ] = e - > origin [ 0 ] ;
m [ 13 ] = e - > origin [ 1 ] ;
m [ 14 ] = e - > origin [ 2 ] ;
m [ 15 ] = 1 ;
}
2004-11-17 18:13:33 +00:00
2010-07-18 08:42:59 +00:00
if ( e - > scale ! = 1 & & e - > scale ! = 0 ) //hexen 2 stuff
{
2014-09-17 03:04:08 +00:00
# ifdef HEXEN2
2010-08-28 17:14:38 +00:00
float z ;
float escale ;
escale = e - > scale ;
2016-07-12 00:40:13 +00:00
switch ( e - > drawflags & SCALE_TYPE_MASK )
2010-07-18 08:42:59 +00:00
{
default :
case SCALE_TYPE_UNIFORM :
2010-08-28 17:14:38 +00:00
VectorScale ( ( m + 0 ) , escale , ( m + 0 ) ) ;
VectorScale ( ( m + 4 ) , escale , ( m + 4 ) ) ;
VectorScale ( ( m + 8 ) , escale , ( m + 8 ) ) ;
2010-07-18 08:42:59 +00:00
break ;
case SCALE_TYPE_XYONLY :
2010-08-28 17:14:38 +00:00
VectorScale ( ( m + 0 ) , escale , ( m + 0 ) ) ;
VectorScale ( ( m + 4 ) , escale , ( m + 4 ) ) ;
2010-07-18 08:42:59 +00:00
break ;
case SCALE_TYPE_ZONLY :
2010-08-28 17:14:38 +00:00
VectorScale ( ( m + 8 ) , escale , ( m + 8 ) ) ;
2010-07-18 08:42:59 +00:00
break ;
}
2016-07-12 00:40:13 +00:00
if ( mod & & ( e - > drawflags & SCALE_TYPE_MASK ) ! = SCALE_TYPE_XYONLY )
2010-07-18 08:42:59 +00:00
{
2016-07-12 00:40:13 +00:00
switch ( e - > drawflags & SCALE_ORIGIN_MASK )
2010-08-28 17:14:38 +00:00
{
case SCALE_ORIGIN_CENTER :
z = ( ( mod - > maxs [ 2 ] + mod - > mins [ 2 ] ) * ( 1 - escale ) ) / 2 ;
VectorMA ( ( m + 12 ) , z , e - > axis [ 2 ] , ( m + 12 ) ) ;
break ;
case SCALE_ORIGIN_BOTTOM :
VectorMA ( ( m + 12 ) , mod - > mins [ 2 ] * ( 1 - escale ) , e - > axis [ 2 ] , ( m + 12 ) ) ;
break ;
case SCALE_ORIGIN_TOP :
VectorMA ( ( m + 12 ) , - mod - > maxs [ 2 ] , e - > axis [ 2 ] , ( m + 12 ) ) ;
break ;
}
2010-07-18 08:42:59 +00:00
}
2014-09-17 03:04:08 +00:00
# else
VectorScale ( ( m + 0 ) , e - > scale , ( m + 0 ) ) ;
VectorScale ( ( m + 4 ) , e - > scale , ( m + 4 ) ) ;
VectorScale ( ( m + 8 ) , e - > scale , ( m + 8 ) ) ;
# endif
2010-07-18 08:42:59 +00:00
}
2010-08-28 17:14:38 +00:00
else if ( mod & & ! strcmp ( mod - > name , " progs/eyes.mdl " ) )
2010-07-18 08:42:59 +00:00
{
2010-08-28 17:14:38 +00:00
/*resize eyes, to make them easier to see*/
m [ 14 ] - = ( 22 + 8 ) ;
VectorScale ( ( m + 0 ) , 2 , ( m + 0 ) ) ;
VectorScale ( ( m + 4 ) , 2 , ( m + 4 ) ) ;
VectorScale ( ( m + 8 ) , 2 , ( m + 8 ) ) ;
2010-07-18 08:42:59 +00:00
}
2011-12-05 15:23:40 +00:00
if ( mod & & ! ruleset_allow_larger_models . ival & & mod - > clampscale ! = 1 & & mod - > type = = mod_alias )
2010-07-18 08:42:59 +00:00
{ //possibly this should be on a per-frame basis, but that's a real pain to do
Con_DPrintf ( " Rescaling %s by %f \n " , mod - > name , mod - > clampscale ) ;
2010-08-28 17:14:38 +00:00
VectorScale ( ( m + 0 ) , mod - > clampscale , ( m + 0 ) ) ;
VectorScale ( ( m + 4 ) , mod - > clampscale , ( m + 4 ) ) ;
VectorScale ( ( m + 8 ) , mod - > clampscale , ( m + 8 ) ) ;
}
2012-02-27 12:23:15 +00:00
Matrix4_Multiply ( r_refdef . m_view , m , modelview ) ;
2004-08-22 22:29:09 +00:00
}
2009-11-04 21:16:50 +00:00
//==================================================================================
2009-07-25 11:05:06 +00:00
2004-08-22 22:29:09 +00:00
/*
= = = = = = = = = = = = =
R_SetupGL
= = = = = = = = = = = = =
*/
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
static void R_SetupGL ( const float eyematrix [ 12 ] /*can be null*/ , const vec4_t fovoverrides /*can be null*/ , const float projmatrix [ 16 ] /*can be null*/ , const pxrect_t * viewport /*can be null*/ , texid_t fbo /*can be null*/ )
2004-08-22 22:29:09 +00:00
{
int x , x2 , y2 , y , w , h ;
2011-02-25 04:22:14 +00:00
vec3_t newa ;
2005-09-29 23:32:22 +00:00
2020-05-14 15:50:26 +00:00
float fov_x , fov_y , fov_l , fov_r , fov_d , fov_u ;
2017-12-15 06:56:40 +00:00
float fovv_x , fovv_y ;
2009-11-07 13:29:15 +00:00
2020-05-14 15:50:26 +00:00
TRACE ( ( " dbg: calling R_SetupGL \n " ) ) ;
2010-07-11 02:22:39 +00:00
if ( ! r_refdef . recurse )
2004-08-22 22:29:09 +00:00
{
2016-02-10 23:23:43 +00:00
newa [ 0 ] = r_refdef . viewangles [ 0 ] ;
newa [ 1 ] = r_refdef . viewangles [ 1 ] ;
newa [ 2 ] = r_refdef . viewangles [ 2 ] + gl_screenangle . value ;
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
if ( eyematrix )
2016-02-10 23:23:43 +00:00
{
2021-05-09 13:02:49 +00:00
extern cvar_t in_vraim ;
matrix3x4 basematrix ;
2021-04-14 05:21:04 +00:00
matrix3x4 viewmatrix ;
2021-05-09 13:02:49 +00:00
if ( r_refdef . base_known )
{ //mod is specifying its own base ang+org.
Matrix3x4_RM_FromAngles ( r_refdef . base_angles , r_refdef . base_origin , basematrix [ 0 ] ) ;
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
Matrix3x4_Multiply ( eyematrix , basematrix [ 0 ] , viewmatrix [ 0 ] ) ;
2021-05-09 13:02:49 +00:00
Matrix3x4_RM_ToVectors ( viewmatrix [ 0 ] , vpn , vright , vup , r_origin ) ;
VectorNegate ( vright , vright ) ;
}
else
{ //mod provides no info.
//client will fiddle with input_angles
newa [ 0 ] = newa [ 2 ] = 0 ; //ignore player pitch+roll. sorry. apply the eye's transform on top.
if ( in_vraim . ival )
newa [ 1 ] - = SHORT2ANGLE ( r_refdef . playerview - > vrdev [ VRDEV_HEAD ] . angles [ YAW ] ) ;
Matrix3x4_RM_FromAngles ( newa , r_refdef . vieworg , basematrix [ 0 ] ) ;
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
Matrix3x4_Multiply ( eyematrix , basematrix [ 0 ] , viewmatrix [ 0 ] ) ;
2021-05-09 13:02:49 +00:00
Matrix3x4_RM_ToVectors ( viewmatrix [ 0 ] , vpn , vright , vup , r_origin ) ;
VectorNegate ( vright , vright ) ;
}
2016-02-10 23:23:43 +00:00
}
else
2020-05-14 15:50:26 +00:00
{
2016-02-10 23:23:43 +00:00
AngleVectors ( newa , vpn , vright , vup ) ;
2020-05-14 15:50:26 +00:00
VectorCopy ( r_refdef . vieworg , r_origin ) ;
}
2005-09-29 23:32:22 +00:00
2020-05-14 15:50:26 +00:00
VectorAdd ( r_origin , r_refdef . eyeoffset , r_origin ) ; //used for vr screenshots
2012-09-30 05:52:03 +00:00
2010-07-11 02:22:39 +00:00
//
// set up viewpoint
//
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
if ( viewport )
{
r_refdef . pxrect = * viewport ;
}
else if ( fbo )
2020-05-14 15:50:26 +00:00
{
//with VR fbo postprocessing, we disable all viewport.
r_refdef . pxrect . x = 0 ;
r_refdef . pxrect . y = 0 ;
r_refdef . pxrect . width = fbo - > width ;
r_refdef . pxrect . height = fbo - > height ;
r_refdef . pxrect . maxheight = fbo - > height ;
}
else if ( r_refdef . flags & ( RDF_ALLPOSTPROC | RDF_RENDERSCALE ) )
2014-08-19 06:08:23 +00:00
{
//with fbo postprocessing, we disable all viewport.
r_refdef . pxrect . x = 0 ;
r_refdef . pxrect . y = 0 ;
r_refdef . pxrect . width = vid . fbpwidth ;
r_refdef . pxrect . height = vid . fbpheight ;
r_refdef . pxrect . maxheight = vid . fbpheight ;
}
else if ( * r_refdef . rt_destcolour [ 0 ] . texname )
2013-03-31 04:21:08 +00:00
{
2014-02-07 08:38:40 +00:00
//with fbo rendering, we disable all virtual scaling.
x = r_refdef . vrect . x ;
x2 = r_refdef . vrect . x + r_refdef . vrect . width ;
y = r_refdef . vrect . y ;
y2 = r_refdef . vrect . y + r_refdef . vrect . height ;
w = x2 - x ;
h = y2 - y ;
r_refdef . pxrect . x = x ;
r_refdef . pxrect . y = y ;
r_refdef . pxrect . width = w ;
r_refdef . pxrect . height = h ;
r_refdef . pxrect . maxheight = vid . fbpheight ;
2013-03-31 04:21:08 +00:00
}
2014-02-07 08:38:40 +00:00
else
{
2015-04-27 06:19:33 +00:00
x = floor ( r_refdef . vrect . x * ( float ) vid . fbpwidth / ( float ) vid . width ) ;
x2 = ceil ( ( r_refdef . vrect . x + r_refdef . vrect . width ) * ( float ) vid . fbpwidth / ( float ) vid . width ) ;
y = floor ( r_refdef . vrect . y * ( float ) vid . fbpheight / ( float ) vid . height ) ;
y2 = ceil ( ( r_refdef . vrect . y + r_refdef . vrect . height ) * ( float ) vid . fbpheight / ( float ) vid . height ) ;
2014-02-07 08:38:40 +00:00
// fudge around because of frac screen scale
2015-04-27 06:19:33 +00:00
/* if (x > 0)
2014-02-07 08:38:40 +00:00
x - - ;
2014-08-19 06:08:23 +00:00
if ( x2 < vid . fbpwidth )
2014-02-07 08:38:40 +00:00
x2 + + ;
2014-08-19 06:08:23 +00:00
if ( y2 < vid . fbpheight )
2014-02-07 08:38:40 +00:00
y2 + + ;
if ( y > 0 )
y - - ;
2015-04-27 06:19:33 +00:00
*/
2014-02-07 08:38:40 +00:00
w = x2 - x ;
h = y2 - y ;
2021-10-22 22:27:28 +00:00
/* if (r_refdef.stereomethod == STEREO_CROSSEYED)
2014-02-07 08:38:40 +00:00
{
w / = 2 ;
2016-12-19 13:31:05 +00:00
if ( i )
2014-08-19 06:08:23 +00:00
x + = vid . fbpwidth / 2 ;
2014-02-07 08:38:40 +00:00
}
2020-05-14 15:50:26 +00:00
*/
2014-02-07 08:38:40 +00:00
r_refdef . pxrect . x = x ;
r_refdef . pxrect . y = y ;
r_refdef . pxrect . width = w ;
r_refdef . pxrect . height = h ;
2014-08-19 06:08:23 +00:00
r_refdef . pxrect . maxheight = vid . fbpheight ;
2014-02-07 08:38:40 +00:00
}
2010-07-11 02:22:39 +00:00
2020-05-16 13:12:58 +00:00
if ( projmatrix )
2014-10-14 16:42:48 +00:00
{
2020-05-16 13:12:58 +00:00
memcpy ( r_refdef . m_projection_std , projmatrix , sizeof ( r_refdef . m_projection_std ) ) ;
memcpy ( r_refdef . m_projection_view , projmatrix , sizeof ( r_refdef . m_projection_view ) ) ;
r_refdef . flipcull = 0 ;
2014-10-14 16:42:48 +00:00
}
2020-05-14 15:50:26 +00:00
else
2005-07-14 01:57:34 +00:00
{
2020-05-16 13:12:58 +00:00
if ( fovoverrides )
2020-05-14 15:50:26 +00:00
{
2020-05-16 13:12:58 +00:00
fov_l = fovoverrides [ 0 ] ;
fov_r = fovoverrides [ 1 ] ;
fov_d = fovoverrides [ 2 ] ;
fov_u = fovoverrides [ 3 ] ;
2020-05-14 15:50:26 +00:00
2020-05-16 13:12:58 +00:00
fov_x = fov_r - fov_l ;
fov_y = fov_u - fov_d ;
2009-11-04 21:16:50 +00:00
2020-05-16 13:12:58 +00:00
fovv_x = fov_x ;
fovv_y = fov_y ;
r_refdef . flipcull = ( ( fov_u < fov_d ) ^ ( fov_r < fov_l ) ) ? SHADER_CULL_FLIP : 0 ;
}
else
{
fov_x = r_refdef . fov_x ;
fov_y = r_refdef . fov_y ;
fovv_x = r_refdef . fovv_x ;
fovv_y = r_refdef . fovv_y ;
2014-10-14 16:42:48 +00:00
2020-05-16 13:12:58 +00:00
if ( ( * r_refdef . rt_destcolour [ 0 ] . texname | | * r_refdef . rt_depth . texname ) & & strcmp ( r_refdef . rt_destcolour [ 0 ] . texname , " megascreeny " ) )
{
r_refdef . pxrect . y = r_refdef . pxrect . maxheight - ( r_refdef . pxrect . height + r_refdef . pxrect . y ) ;
fov_y * = - 1 ;
fovv_y * = - 1 ;
r_refdef . flipcull ^ = SHADER_CULL_FLIP ;
}
else if ( ( r_refdef . flags & RDF_UNDERWATER ) & & ! ( r_refdef . flags & RDF_WATERWARP ) )
{
fov_x * = 1 + ( ( ( sin ( cl . time * 4.7 ) + 1 ) * 0.015 ) * r_waterwarp . value ) ;
fov_y * = 1 + ( ( ( sin ( cl . time * 3.0 ) + 1 ) * 0.015 ) * r_waterwarp . value ) ;
2010-07-11 02:22:39 +00:00
2020-05-16 13:12:58 +00:00
fovv_x * = 1 + ( ( ( sin ( cl . time * 4.7 ) + 1 ) * 0.015 ) * r_waterwarp . value ) ;
fovv_y * = 1 + ( ( ( sin ( cl . time * 3.0 ) + 1 ) * 0.015 ) * r_waterwarp . value ) ;
}
fov_l = - fov_x / 2 ;
fov_r = fov_x / 2 ;
fov_d = - fov_y / 2 ;
fov_u = fov_y / 2 ;
}
2009-07-05 18:45:53 +00:00
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
if ( r_xflip . ival )
{
float t = fov_l ;
fov_l = fov_r ;
fov_r = t ;
r_refdef . flipcull ^ = SHADER_CULL_FLIP ;
fovv_x * = - 1 ;
}
2016-12-19 13:31:05 +00:00
if ( r_refdef . useperspective )
{
2021-12-20 10:05:55 +00:00
float maxdist = r_refdef . maxdist ;
2022-03-08 05:31:34 +00:00
if ( sh_config . stencilbits & & Sh_StencilShadowsActive ( ) )
2021-12-20 10:05:55 +00:00
maxdist = 0 ; //if we're using stencil shadows then force the maxdist to infinite to ensure the shadow volume is sealed.
Matrix4x4_CM_Projection_Offset ( r_refdef . m_projection_std , fov_l , fov_r , fov_d , fov_u , r_refdef . mindist , maxdist , false ) ;
Matrix4x4_CM_Projection_Offset ( r_refdef . m_projection_view , - fovv_x / 2 , fovv_x / 2 , - fovv_y / 2 , fovv_y / 2 , r_refdef . mindist , maxdist , false ) ;
2020-01-13 07:03:28 +00:00
r_refdef . m_projection_std [ 8 ] + = r_refdef . projectionoffset [ 0 ] ;
r_refdef . m_projection_std [ 9 ] + = r_refdef . projectionoffset [ 1 ] ;
r_refdef . m_projection_view [ 8 ] + = r_refdef . projectionoffset [ 0 ] ;
r_refdef . m_projection_view [ 9 ] + = r_refdef . projectionoffset [ 1 ] ;
2010-07-11 02:22:39 +00:00
}
else
{
2017-12-15 06:56:40 +00:00
Matrix4x4_CM_Orthographic ( r_refdef . m_projection_std , - fov_x / 2 , fov_x / 2 , - fov_y / 2 , fov_y / 2 , r_refdef . mindist , r_refdef . maxdist ? r_refdef . maxdist : 9999 ) ;
memcpy ( r_refdef . m_projection_view , r_refdef . m_projection_std , sizeof ( r_refdef . m_projection_view ) ) ;
2010-07-11 02:22:39 +00:00
}
2016-12-19 13:31:05 +00:00
}
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
Matrix4x4_CM_ModelViewMatrixFromAxis ( r_refdef . m_view , vpn , vright , vup , r_origin ) ;
2020-05-16 13:12:58 +00:00
//bias the viewmodel depth range to a third: -1 through -0.333 (instead of -1 to 1)
r_refdef . m_projection_view [ 2 + 4 * 0 ] * = 0.333 ;
r_refdef . m_projection_view [ 2 + 4 * 1 ] * = 0.333 ;
r_refdef . m_projection_view [ 2 + 4 * 2 ] * = 0.333 ;
r_refdef . m_projection_view [ 2 + 4 * 3 ] * = 0.333 ;
r_refdef . m_projection_view [ 14 ] - = 0.666 ;
GL_ViewportUpdate ( ) ;
2010-07-11 02:22:39 +00:00
}
2004-08-22 22:29:09 +00:00
2011-01-23 03:44:49 +00:00
if ( qglLoadMatrixf )
2004-08-22 22:29:09 +00:00
{
2011-01-23 03:44:49 +00:00
qglMatrixMode ( GL_PROJECTION ) ;
2017-12-15 06:56:40 +00:00
qglLoadMatrixf ( r_refdef . m_projection_std ) ;
2011-01-23 03:44:49 +00:00
qglMatrixMode ( GL_MODELVIEW ) ;
qglLoadMatrixf ( r_refdef . m_view ) ;
2004-08-22 22:29:09 +00:00
}
2011-01-23 03:44:49 +00:00
2014-09-02 06:01:03 +00:00
# ifdef GL_LINE_SMOOTH
2014-09-02 02:44:43 +00:00
if ( ! gl_config . gles & & r_wireframe_smooth . modified )
{
r_wireframe_smooth . modified = false ;
2019-03-01 22:39:30 +00:00
if ( r_wireframe_smooth . ival | | ( r_outline . ival & & ! r_wireframe . ival ) )
2014-09-02 02:44:43 +00:00
{
qglEnable ( GL_LINE_SMOOTH ) ;
if ( qglHint )
qglHint ( GL_LINE_SMOOTH_HINT , GL_NICEST ) ;
}
else
{
qglDisable ( GL_LINE_SMOOTH ) ;
if ( qglHint )
qglHint ( GL_LINE_SMOOTH_HINT , GL_FASTEST ) ;
}
}
2014-09-02 06:01:03 +00:00
# endif
2012-04-24 07:59:11 +00:00
if ( ! gl_config . gles & & gl_dither . modified )
2004-08-22 22:29:09 +00:00
{
2012-04-24 07:59:11 +00:00
gl_dither . modified = false ;
2011-01-23 03:44:49 +00:00
if ( gl_dither . ival )
{
qglEnable ( GL_DITHER ) ;
}
else
{
qglDisable ( GL_DITHER ) ;
}
2004-08-22 22:29:09 +00:00
}
}
2014-03-30 08:55:06 +00:00
void Surf_SetupFrame ( void ) ;
2014-08-19 06:08:23 +00:00
2004-08-22 22:29:09 +00:00
/*
= = = = = = = = = = = = = = = =
R_RenderScene
r_refdef must be set before the first call
= = = = = = = = = = = = = = = =
*/
2020-05-14 15:50:26 +00:00
static void R_RenderScene_Internal ( void )
{
2020-12-05 04:08:40 +00:00
extern qboolean depthcleared ;
2020-05-14 15:50:26 +00:00
int tmpvisents = cl_numvisedicts ;
TRACE ( ( " dbg: calling R_SetFrustrum \n " ) ) ;
if ( ! r_refdef . recurse )
R_SetFrustum ( r_refdef . m_projection_std , r_refdef . m_view ) ;
RQ_BeginFrame ( ) ;
TRACE ( ( " dbg: calling Surf_DrawWorld \n " ) ) ;
Surf_DrawWorld ( ) ; // adds static entities to the list
S_ExtraUpdate ( ) ; // don't let sound get messed up if going slow
// R_DrawDecals();
TRACE ( ( " dbg: calling R_RenderDlights \n " ) ) ;
R_RenderDlights ( ) ;
if ( r_refdef . recurse )
RQ_RenderBatch ( ) ;
else
RQ_RenderBatchClear ( ) ;
cl_numvisedicts = tmpvisents ;
2020-12-05 04:08:40 +00:00
depthcleared = false ; //whatever is in the depth buffer is no longer useful.
2021-12-20 10:06:43 +00:00
if ( vrui . enabled )
{
vec3_t uifwd , uiright , uiup ;
vec3_t diff ;
float d ;
vec3_t ctrlang , ctrlorg , aimdir ;
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
extern cvar_t cl_vrui_lock ;
if ( cl_vrui_lock . ival )
VRUI_SnapAngle ( ) ;
2021-12-20 10:06:43 +00:00
// extern usercmd_t cl_pendingcmd[MAX_SPLITS];
AngleVectors ( vrui . angles , uifwd , uiright , uiup ) ;
VectorAngles ( uiright , uifwd , r_worldentity . angles , false ) ;
AngleVectors ( r_worldentity . angles , r_worldentity . axis [ 0 ] , r_worldentity . axis [ 1 ] , r_worldentity . axis [ 2 ] ) ;
VectorNegate ( r_worldentity . axis [ 1 ] , r_worldentity . axis [ 1 ] ) ;
r_worldentity . scale = 1 ; //0.2;
VectorMA ( r_refdef . vieworg , Cvar_Get ( " 2dz " , " 256 " , 0 , " " ) - > value * r_worldentity . scale , r_worldentity . axis [ 2 ] , r_worldentity . origin ) ;
VectorMA ( r_worldentity . origin , - ( int ) ( vid . width / 2 ) * r_worldentity . scale , r_worldentity . axis [ 0 ] , r_worldentity . origin ) ;
VectorMA ( r_worldentity . origin , - ( int ) ( vid . height / 2 ) * r_worldentity . scale , r_worldentity . axis [ 1 ] , r_worldentity . origin ) ;
GL_SetShaderState2D ( true ) ;
VectorCopy ( r_refdef . viewangles , ctrlang ) ;
if ( r_refdef . playerview - > vrdev [ VRDEV_RIGHT ] . status & VRSTATUS_ANG )
{
ctrlang [ 0 ] = SHORT2ANGLE ( r_refdef . playerview - > vrdev [ VRDEV_RIGHT ] . angles [ 0 ] ) ;
ctrlang [ 1 ] = SHORT2ANGLE ( r_refdef . playerview - > vrdev [ VRDEV_RIGHT ] . angles [ 1 ] ) ;
ctrlang [ 2 ] = SHORT2ANGLE ( r_refdef . playerview - > vrdev [ VRDEV_RIGHT ] . angles [ 2 ] ) ;
}
else
VectorCopy ( r_refdef . viewangles , ctrlang ) ;
if ( r_refdef . playerview - > vrdev [ VRDEV_RIGHT ] . status & VRSTATUS_ORG )
VectorCopy ( r_refdef . playerview - > vrdev [ VRDEV_RIGHT ] . origin , ctrlorg ) ;
else
VectorCopy ( r_refdef . vieworg , ctrlorg ) ;
AngleVectors ( ctrlang , aimdir , NULL , NULL ) ;
VectorSubtract ( r_worldentity . origin , ctrlorg , diff ) ;
//d = DotProduct(diff, vpn); //figure out how far we need to move it to get an impact.
d = DotProduct ( diff , r_worldentity . axis [ 2 ] ) ;
d / = DotProduct ( aimdir , r_worldentity . axis [ 2 ] ) ; //compensate for the length.
VectorMA ( ctrlorg , d , aimdir , diff ) ; //calc the impact point...
VectorSubtract ( diff , r_worldentity . origin , diff ) ;
mousecursor_x = DotProduct ( diff , r_worldentity . axis [ 0 ] ) ;
mousecursor_y = DotProduct ( diff , r_worldentity . axis [ 1 ] ) ;
mousecursor_x = bound ( 0 , mousecursor_x , vid . width - 1 ) ;
mousecursor_y = bound ( 0 , mousecursor_y , vid . height - 1 ) ;
# ifdef PLUGINS
Plug_SBar ( r_refdef . playerview ) ;
# else
if ( Sbar_ShouldDraw ( r_refdef . playerview ) )
{
SCR_TileClear ( sb_lines ) ;
Sbar_Draw ( r_refdef . playerview ) ;
Sbar_DrawScoreboard ( r_refdef . playerview ) ;
}
else
SCR_TileClear ( 0 ) ;
# endif
SCR_DrawTwoDimensional ( true ) ;
VectorClear ( r_worldentity . origin ) ;
VectorClear ( r_worldentity . angles ) ;
VectorSet ( r_worldentity . axis [ 0 ] , 1 , 0 , 0 ) ;
VectorSet ( r_worldentity . axis [ 1 ] , 0 , 1 , 0 ) ;
VectorSet ( r_worldentity . axis [ 2 ] , 0 , 0 , 1 ) ;
r_worldentity . scale = 1 ;
GL_SetShaderState2D ( false ) ;
}
2020-05-14 15:50:26 +00:00
}
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
static void R_RenderEyeScene ( texid_t rendertarget , const pxrect_t * viewport , const vec4_t fovoverride , const float projmatrix [ 16 ] , const float eyematrix [ 12 ] )
2020-05-14 15:50:26 +00:00
{
2020-12-05 04:08:40 +00:00
extern qboolean depthcleared ;
2020-05-14 15:50:26 +00:00
refdef_t refdef = r_refdef ;
int pw = vid . fbpwidth ;
int ph = vid . fbpheight ;
int r = 0 ;
2021-05-09 13:02:49 +00:00
extern void CL_ClampPitch ( int pnum , float frametime ) ;
/*the vr code tends to be somewhat laggy with its head angles, leaving it to the last minute, so redo this to reduce latency*/
if ( ( size_t ) ( refdef . playerview - cl . playerview ) < MAX_SPLITS )
CL_ClampPitch ( refdef . playerview - cl . playerview , 0 ) ;
2021-12-20 10:06:43 +00:00
vrui . enabled = true ;
2020-05-14 15:50:26 +00:00
if ( rendertarget )
{
r = GLBE_FBO_Update ( & fbo_vr , FBO_RB_DEPTH , & rendertarget , 1 , r_nulltex , rendertarget - > width , rendertarget - > height , 0 ) ;
GL_ForceDepthWritable ( ) ;
qglClear ( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT ) ;
2020-12-05 04:08:40 +00:00
depthcleared = true ;
2020-05-14 15:50:26 +00:00
vid . fbpwidth = rendertarget - > width ;
vid . fbpheight = rendertarget - > height ;
}
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
R_SetupGL ( eyematrix , fovoverride , projmatrix , viewport , rendertarget ) ;
2020-05-14 15:50:26 +00:00
R_RenderScene_Internal ( ) ;
if ( rendertarget )
{
GLBE_FBO_Pop ( r ) ;
if ( gl_finish . ival )
qglFinish ( ) ;
}
r_refdef = refdef ;
vid . fbpwidth = pw ;
vid . fbpheight = ph ;
}
static void R_RenderScene ( void )
2004-08-22 22:29:09 +00:00
{
2012-09-30 05:52:03 +00:00
float stereooffset [ 2 ] ;
int stereoframes = 1 ;
int stereomode ;
int i ;
2015-02-02 08:01:53 +00:00
int cull = r_refdef . flipcull ;
2020-12-05 04:08:40 +00:00
unsigned int colourmask = r_refdef . colourmask ;
2021-05-09 13:02:49 +00:00
vec3_t eyeangorg [ 2 ] ;
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
float eyematrix [ 12 ] ;
2020-12-05 04:08:40 +00:00
extern qboolean depthcleared ;
2005-06-14 04:52:10 +00:00
2020-12-05 04:08:40 +00:00
r_refdef . colourmask = 0u ;
2016-02-10 23:23:43 +00:00
stereomode = r_refdef . stereomethod ;
if ( stereomode = = STEREO_QUAD )
2012-09-30 05:52:03 +00:00
{
# ifdef GL_STEREO
GLint glb ;
qglGetIntegerv ( GL_STEREO , & glb ) ;
2014-08-27 08:41:31 +00:00
if ( ! glb | | ! qglDrawBuffer )
2012-09-30 05:52:03 +00:00
# endif
2016-02-10 23:23:43 +00:00
stereomode = STEREO_OFF ; //we are not a stereo context, so no stereoscopic rendering (this encourages it to otherwise be left enabled, which means the user is more likely to spot that they asked it to give a slower context.
2012-09-30 05:52:03 +00:00
}
2005-07-01 19:23:00 +00:00
2010-11-10 03:32:47 +00:00
2020-12-05 04:08:40 +00:00
if ( r_refdef . recurse | | ! stereomode ) // || !(r_stereo_separation.value||r_stereo_convergence.value))
2004-08-22 22:29:09 +00:00
{
2012-09-30 05:52:03 +00:00
stereooffset [ 0 ] = 0 ;
stereoframes = 1 ;
2016-02-10 23:23:43 +00:00
stereomode = STEREO_OFF ;
2012-09-30 05:52:03 +00:00
}
else
{
2016-02-10 23:23:43 +00:00
stereooffset [ 0 ] = - 0.5 * r_stereo_separation . value ;
stereooffset [ 1 ] = + 0.5 * r_stereo_separation . value ;
2012-09-30 05:52:03 +00:00
stereoframes = 2 ;
2004-08-22 22:29:09 +00:00
}
2020-05-14 15:50:26 +00:00
if ( vid . vr & & ! r_refdef . recurse & & vid . vr - > Render ( R_RenderEyeScene ) )
; //we drew something VR-ey
else if ( stereomode = = STEREO_OFF )
{
GL_ForceDepthWritable ( ) ;
qglClear ( GL_DEPTH_BUFFER_BIT ) ;
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
R_SetupGL ( NULL , NULL , NULL , NULL , NULL ) ;
2020-05-14 15:50:26 +00:00
R_RenderScene_Internal ( ) ;
}
else for ( i = 0 ; i < stereoframes ; i + + )
2012-09-30 05:52:03 +00:00
{
2020-12-05 04:08:40 +00:00
r_refdef . colourmask = 0u ;
2012-09-30 05:52:03 +00:00
switch ( stereomode )
{
default :
2016-02-10 23:23:43 +00:00
case STEREO_OFF : //off
2012-09-30 05:52:03 +00:00
if ( i )
return ;
break ;
# ifdef GL_STEREO
2016-02-10 23:23:43 +00:00
case STEREO_QUAD : //proper gl stereo rendering
2012-09-30 05:52:03 +00:00
if ( stereooffset [ i ] < 0 )
qglDrawBuffer ( GL_BACK_LEFT ) ;
else
qglDrawBuffer ( GL_BACK_RIGHT ) ;
break ;
# endif
2016-02-10 23:23:43 +00:00
case STEREO_RED_CYAN : //red/cyan(green+blue)
2012-09-30 05:52:03 +00:00
if ( stereooffset [ i ] < 0 )
2020-12-05 04:08:40 +00:00
r_refdef . colourmask = ( SBITS_MASK_GREEN | SBITS_MASK_BLUE ) ;
2012-09-30 05:52:03 +00:00
else
2020-12-05 04:08:40 +00:00
r_refdef . colourmask = SBITS_MASK_RED ;
2012-09-30 05:52:03 +00:00
break ;
2016-02-10 23:23:43 +00:00
case STEREO_RED_BLUE : //red/blue
2012-09-30 05:52:03 +00:00
if ( stereooffset [ i ] < 0 )
2020-12-05 04:08:40 +00:00
r_refdef . colourmask = ( SBITS_MASK_GREEN | SBITS_MASK_BLUE ) ;
2012-09-30 05:52:03 +00:00
else
2020-12-05 04:08:40 +00:00
r_refdef . colourmask = ( SBITS_MASK_RED | SBITS_MASK_GREEN ) ;
2012-09-30 05:52:03 +00:00
break ;
2016-02-10 23:23:43 +00:00
case STEREO_RED_GREEN : //red/green
2012-09-30 05:52:03 +00:00
if ( stereooffset [ i ] < 0 )
2020-12-05 04:08:40 +00:00
r_refdef . colourmask = ( SBITS_MASK_GREEN | SBITS_MASK_BLUE ) ;
2012-09-30 05:52:03 +00:00
else
2020-12-05 04:08:40 +00:00
r_refdef . colourmask = ( SBITS_MASK_RED | SBITS_MASK_BLUE ) ;
2012-09-30 05:52:03 +00:00
break ;
2016-02-10 23:23:43 +00:00
case STEREO_CROSSEYED : //eyestrain
break ;
case STEREO_LEFTONLY :
if ( i ! = 0 )
continue ;
break ;
case STEREO_RIGHTONLY :
if ( i ! = 1 )
continue ;
//fixme: depth buffer doesn't need clearing
2013-03-31 04:21:08 +00:00
break ;
2012-09-30 05:52:03 +00:00
}
2020-12-05 04:08:40 +00:00
if ( ! depthcleared )
2015-02-02 08:01:53 +00:00
{
GL_ForceDepthWritable ( ) ;
2012-09-30 05:52:03 +00:00
qglClear ( GL_DEPTH_BUFFER_BIT ) ;
2020-12-05 04:08:40 +00:00
depthcleared = true ;
2015-02-02 08:01:53 +00:00
}
2012-09-30 05:52:03 +00:00
2021-05-09 13:02:49 +00:00
eyeangorg [ 0 ] [ 0 ] = 0 ;
eyeangorg [ 0 ] [ 1 ] = r_stereo_convergence . value * ( i ? 0.5 : - 0.5 ) ;
eyeangorg [ 0 ] [ 2 ] = 0 ;
VectorSet ( eyeangorg [ 1 ] , 0 , stereooffset [ i ] , 0 ) ;
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
Matrix3x4_RM_FromAngles ( eyeangorg [ 0 ] , eyeangorg [ 1 ] , eyematrix ) ;
R_SetupGL ( eyematrix , NULL , NULL , NULL , NULL ) ;
2020-05-14 15:50:26 +00:00
R_RenderScene_Internal ( ) ;
2012-09-30 05:52:03 +00:00
}
switch ( stereomode )
{
default :
2016-02-10 23:23:43 +00:00
case STEREO_OFF :
case STEREO_LEFTONLY :
case STEREO_RIGHTONLY :
2012-09-30 05:52:03 +00:00
break ;
2016-02-10 23:23:43 +00:00
case STEREO_QUAD :
2012-09-30 05:52:03 +00:00
qglDrawBuffer ( GL_BACK ) ;
break ;
2016-02-10 23:23:43 +00:00
case STEREO_RED_BLUE : //green should have already been cleared.
case STEREO_RED_GREEN : //blue should have already been cleared.
case STEREO_RED_CYAN :
2012-09-30 05:52:03 +00:00
break ;
2013-03-31 04:21:08 +00:00
case 5 :
break ;
2012-09-30 05:52:03 +00:00
}
2015-02-02 08:01:53 +00:00
r_refdef . flipcull = cull ;
2020-12-05 04:08:40 +00:00
r_refdef . colourmask = colourmask ;
2004-08-22 22:29:09 +00:00
}
2010-07-11 02:22:39 +00:00
/*generates a new modelview matrix, as well as vpn vectors*/
static void R_MirrorMatrix ( plane_t * plane )
{
float mirror [ 16 ] ;
float view [ 16 ] ;
float result [ 16 ] ;
vec3_t pnorm ;
VectorNegate ( plane - > normal , pnorm ) ;
mirror [ 0 ] = 1 - 2 * pnorm [ 0 ] * pnorm [ 0 ] ;
mirror [ 1 ] = - 2 * pnorm [ 0 ] * pnorm [ 1 ] ;
mirror [ 2 ] = - 2 * pnorm [ 0 ] * pnorm [ 2 ] ;
mirror [ 3 ] = 0 ;
mirror [ 4 ] = - 2 * pnorm [ 1 ] * pnorm [ 0 ] ;
mirror [ 5 ] = 1 - 2 * pnorm [ 1 ] * pnorm [ 1 ] ;
mirror [ 6 ] = - 2 * pnorm [ 1 ] * pnorm [ 2 ] ;
mirror [ 7 ] = 0 ;
mirror [ 8 ] = - 2 * pnorm [ 2 ] * pnorm [ 0 ] ;
mirror [ 9 ] = - 2 * pnorm [ 2 ] * pnorm [ 1 ] ;
mirror [ 10 ] = 1 - 2 * pnorm [ 2 ] * pnorm [ 2 ] ;
mirror [ 11 ] = 0 ;
mirror [ 12 ] = - 2 * pnorm [ 0 ] * plane - > dist ;
mirror [ 13 ] = - 2 * pnorm [ 1 ] * plane - > dist ;
mirror [ 14 ] = - 2 * pnorm [ 2 ] * plane - > dist ;
mirror [ 15 ] = 1 ;
view [ 0 ] = vpn [ 0 ] ;
view [ 1 ] = vpn [ 1 ] ;
view [ 2 ] = vpn [ 2 ] ;
view [ 3 ] = 0 ;
view [ 4 ] = - vright [ 0 ] ;
view [ 5 ] = - vright [ 1 ] ;
view [ 6 ] = - vright [ 2 ] ;
view [ 7 ] = 0 ;
view [ 8 ] = vup [ 0 ] ;
view [ 9 ] = vup [ 1 ] ;
view [ 10 ] = vup [ 2 ] ;
view [ 11 ] = 0 ;
view [ 12 ] = r_refdef . vieworg [ 0 ] ;
view [ 13 ] = r_refdef . vieworg [ 1 ] ;
view [ 14 ] = r_refdef . vieworg [ 2 ] ;
view [ 15 ] = 1 ;
VectorMA ( r_refdef . vieworg , 0.25 , plane - > normal , r_refdef . pvsorigin ) ;
Matrix4_Multiply ( mirror , view , result ) ;
vpn [ 0 ] = result [ 0 ] ;
vpn [ 1 ] = result [ 1 ] ;
vpn [ 2 ] = result [ 2 ] ;
vright [ 0 ] = - result [ 4 ] ;
vright [ 1 ] = - result [ 5 ] ;
vright [ 2 ] = - result [ 6 ] ;
vup [ 0 ] = result [ 8 ] ;
vup [ 1 ] = result [ 9 ] ;
vup [ 2 ] = result [ 10 ] ;
r_refdef . vieworg [ 0 ] = result [ 12 ] ;
r_refdef . vieworg [ 1 ] = result [ 13 ] ;
r_refdef . vieworg [ 2 ] = result [ 14 ] ;
}
2017-06-21 01:24:25 +00:00
static entity_t * R_FindPortalCamera ( entity_t * rent )
{
int i ;
for ( i = 0 ; i < cl_numvisedicts ; i + + )
{
if ( cl_visedicts [ i ] . rtype = = RT_PORTALCAMERA )
{
if ( cl_visedicts [ i ] . keynum = = rent - > keynum )
return & cl_visedicts [ i ] ;
}
}
return NULL ;
}
2010-07-11 02:22:39 +00:00
static entity_t * R_NearestPortal ( plane_t * plane )
{
int i ;
entity_t * best = NULL ;
float dist , bestd = 0 ;
2017-06-21 01:24:25 +00:00
2012-11-27 03:23:19 +00:00
//for q3-compat, portals on world scan for a visedict to use for their view.
2010-07-11 02:22:39 +00:00
for ( i = 0 ; i < cl_numvisedicts ; i + + )
{
if ( cl_visedicts [ i ] . rtype = = RT_PORTALSURFACE )
{
dist = DotProduct ( cl_visedicts [ i ] . origin , plane - > normal ) - plane - > dist ;
dist = fabs ( dist ) ;
if ( dist < 64 & & ( ! best | | dist < bestd ) )
best = & cl_visedicts [ i ] ;
}
}
return best ;
}
2004-08-22 22:29:09 +00:00
2010-07-11 02:22:39 +00:00
static void TransformCoord ( vec3_t in , vec3_t planea [ 3 ] , vec3_t planeo , vec3_t viewa [ 3 ] , vec3_t viewo , vec3_t result )
{
int i ;
vec3_t local ;
vec3_t transformed ;
float d ;
local [ 0 ] = in [ 0 ] - planeo [ 0 ] ;
local [ 1 ] = in [ 1 ] - planeo [ 1 ] ;
local [ 2 ] = in [ 2 ] - planeo [ 2 ] ;
2004-08-22 22:29:09 +00:00
2010-07-11 02:22:39 +00:00
VectorClear ( transformed ) ;
for ( i = 0 ; i < 3 ; i + + )
{
d = DotProduct ( local , planea [ i ] ) ;
VectorMA ( transformed , d , viewa [ i ] , transformed ) ;
}
result [ 0 ] = transformed [ 0 ] + viewo [ 0 ] ;
result [ 1 ] = transformed [ 1 ] + viewo [ 1 ] ;
result [ 2 ] = transformed [ 2 ] + viewo [ 2 ] ;
}
static void TransformDir ( vec3_t in , vec3_t planea [ 3 ] , vec3_t viewa [ 3 ] , vec3_t result )
{
int i ;
float d ;
vec3_t tmp ;
VectorCopy ( in , tmp ) ;
VectorClear ( result ) ;
for ( i = 0 ; i < 3 ; i + + )
{
d = DotProduct ( tmp , planea [ i ] ) ;
VectorMA ( result , d , viewa [ i ] , result ) ;
}
}
2014-02-14 09:59:32 +00:00
2016-07-12 00:40:13 +00:00
void R_ObliqueNearClip ( float * viewmat , mplane_t * wplane ) ;
2014-02-14 13:29:41 +00:00
void CL_DrawDebugPlane ( float * normal , float dist , float r , float g , float b , qboolean enqueue ) ;
2013-12-29 22:48:28 +00:00
void GLR_DrawPortal ( batch_t * batch , batch_t * * blist , batch_t * depthmasklist [ 2 ] , int portaltype )
2010-07-11 02:22:39 +00:00
{
2017-06-21 01:24:25 +00:00
entity_t * view , * surfent ;
2012-11-29 13:37:48 +00:00
// GLdouble glplane[4];
2014-06-16 16:21:28 +00:00
plane_t plane , oplane ;
2013-12-29 22:48:28 +00:00
float vmat [ 16 ] ;
2010-07-11 02:22:39 +00:00
refdef_t oldrefdef ;
2014-01-13 02:42:25 +00:00
vec3_t r ;
int i ;
2010-07-11 02:22:39 +00:00
mesh_t * mesh = batch - > mesh [ batch - > firstmesh ] ;
2017-06-21 01:24:25 +00:00
pvsbuffer_t newvis ;
2014-02-14 09:59:32 +00:00
float ivmat [ 16 ] , trmat [ 16 ] ;
2010-07-11 02:22:39 +00:00
2021-06-25 18:50:53 +00:00
if ( mesh - > xyz_array )
2012-07-20 01:46:05 +00:00
{
2021-06-25 18:50:53 +00:00
if ( ! mesh - > normals_array )
{
VectorSet ( plane . normal , 0 , 0 , 1 ) ;
}
else
{
VectorCopy ( mesh - > normals_array [ 0 ] , plane . normal ) ;
}
2014-06-16 16:21:28 +00:00
2021-06-25 18:50:53 +00:00
if ( batch - > ent = = & r_worldentity )
{
plane . dist = DotProduct ( mesh - > xyz_array [ 0 ] , plane . normal ) ;
}
else
{
vec3_t point ;
VectorCopy ( plane . normal , oplane . normal ) ;
//rotate the surface normal around its entity's matrix
plane . normal [ 0 ] = oplane . normal [ 0 ] * batch - > ent - > axis [ 0 ] [ 0 ] + oplane . normal [ 1 ] * batch - > ent - > axis [ 1 ] [ 0 ] + oplane . normal [ 2 ] * batch - > ent - > axis [ 2 ] [ 0 ] ;
plane . normal [ 1 ] = oplane . normal [ 0 ] * batch - > ent - > axis [ 0 ] [ 1 ] + oplane . normal [ 1 ] * batch - > ent - > axis [ 1 ] [ 1 ] + oplane . normal [ 2 ] * batch - > ent - > axis [ 2 ] [ 1 ] ;
plane . normal [ 2 ] = oplane . normal [ 0 ] * batch - > ent - > axis [ 0 ] [ 2 ] + oplane . normal [ 1 ] * batch - > ent - > axis [ 1 ] [ 2 ] + oplane . normal [ 2 ] * batch - > ent - > axis [ 2 ] [ 2 ] ;
//rotate some point on the mesh around its entity's matrix
point [ 0 ] = mesh - > xyz_array [ 0 ] [ 0 ] * batch - > ent - > axis [ 0 ] [ 0 ] + mesh - > xyz_array [ 0 ] [ 1 ] * batch - > ent - > axis [ 1 ] [ 0 ] + mesh - > xyz_array [ 0 ] [ 2 ] * batch - > ent - > axis [ 2 ] [ 0 ] + batch - > ent - > origin [ 0 ] ;
point [ 1 ] = mesh - > xyz_array [ 0 ] [ 0 ] * batch - > ent - > axis [ 0 ] [ 1 ] + mesh - > xyz_array [ 0 ] [ 1 ] * batch - > ent - > axis [ 1 ] [ 1 ] + mesh - > xyz_array [ 0 ] [ 2 ] * batch - > ent - > axis [ 2 ] [ 1 ] + batch - > ent - > origin [ 1 ] ;
point [ 2 ] = mesh - > xyz_array [ 0 ] [ 0 ] * batch - > ent - > axis [ 0 ] [ 2 ] + mesh - > xyz_array [ 0 ] [ 1 ] * batch - > ent - > axis [ 1 ] [ 2 ] + mesh - > xyz_array [ 0 ] [ 2 ] * batch - > ent - > axis [ 2 ] [ 2 ] + batch - > ent - > origin [ 2 ] ;
//now we can figure out the plane dist
plane . dist = DotProduct ( point , plane . normal ) ;
}
2014-06-16 16:21:28 +00:00
}
else
2021-06-25 18:50:53 +00:00
return ;
2010-07-11 02:22:39 +00:00
//if we're too far away from the surface, don't draw anything
if ( batch - > shader - > flags & SHADER_AGEN_PORTAL )
{
/*there's a portal alpha blend on that surface, that fades out after this distance*/
if ( DotProduct ( r_refdef . vieworg , plane . normal ) - plane . dist > batch - > shader - > portaldist )
return ;
}
2013-12-29 22:48:28 +00:00
//if we're behind it, then also don't draw anything. for our purposes, behind is when the entire near clipplane is behind.
2016-10-22 07:06:51 +00:00
if ( DotProduct ( r_refdef . vieworg , plane . normal ) - plane . dist < - r_refdef . mindist )
2010-07-11 02:22:39 +00:00
return ;
2016-12-07 18:45:25 +00:00
if ( r_refdef . recurse > = R_MAX_RECURSE - 1 )
{
GLBE_SelectMode ( BEM_DEPTHDARK ) ;
GLBE_SubmitBatch ( batch ) ;
GLBE_SelectMode ( BEM_STANDARD ) ;
return ;
}
Android: fat presses, vibrator, onscreen keyboard, keep-screen-on, console scaling, touch-based console scrolling, additional bindables.
Some memory leaks fixed.
latency with the nq protocol over loopback is much reduced.
Terrain: now mostly a property of a (q1 for now) bsp map, file format changed, glsl now built in, terrain editor builtin improved/changed, holes supported.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4067 fc73d0e0-1445-4013-8a0c-d673dee63da5
2012-07-14 16:25:18 +00:00
TRACE ( ( " GLR_DrawPortal: portal type %i \n " , portaltype ) ) ;
2010-07-11 02:22:39 +00:00
oldrefdef = r_refdef ;
2013-12-29 22:48:28 +00:00
r_refdef . recurse + = 1 ;
2010-07-11 02:22:39 +00:00
r_refdef . externalview = true ;
2013-03-12 23:09:25 +00:00
switch ( portaltype )
2012-05-14 01:41:08 +00:00
{
2013-03-12 23:09:25 +00:00
case 1 : /*fbo explicit mirror (fucked depth, working clip plane)*/
2013-09-06 22:57:44 +00:00
//fixme: pvs is surely wrong?
2014-01-13 02:42:25 +00:00
// r_refdef.flipcull ^= SHADER_CULL_FLIP;
2012-05-14 01:41:08 +00:00
R_MirrorMatrix ( & plane ) ;
2013-12-29 22:48:28 +00:00
Matrix4x4_CM_ModelViewMatrixFromAxis ( vmat , vpn , vright , vup , r_refdef . vieworg ) ;
2014-01-13 02:42:25 +00:00
VectorCopy ( mesh - > xyz_array [ 0 ] , r_refdef . pvsorigin ) ;
for ( i = 1 ; i < mesh - > numvertexes ; i + + )
VectorAdd ( r_refdef . pvsorigin , mesh - > xyz_array [ i ] , r_refdef . pvsorigin ) ;
VectorScale ( r_refdef . pvsorigin , 1.0 / mesh - > numvertexes , r_refdef . pvsorigin ) ;
2013-03-12 23:09:25 +00:00
break ;
case 2 : /*fbo refraction (fucked depth, working clip plane)*/
case 3 : /*screen copy refraction (screen depth, fucked clip planes)*/
2012-05-14 01:41:08 +00:00
/*refraction image (same view, just with things culled*/
2012-07-05 19:42:36 +00:00
r_refdef . externalview = oldrefdef . externalview ;
2012-05-14 01:41:08 +00:00
VectorNegate ( plane . normal , plane . normal ) ;
plane . dist = - plane . dist ;
2012-07-05 19:42:36 +00:00
//use the player's origin for r_viewleaf, because there's not much we can do anyway*/
VectorCopy ( r_origin , r_refdef . pvsorigin ) ;
2014-05-23 02:02:51 +00:00
if ( cl . worldmodel & & cl . worldmodel - > funcs . ClusterPVS & & ! r_novis . ival )
2012-07-05 19:42:36 +00:00
{
2014-05-23 02:02:51 +00:00
int clust , i , j ;
2012-07-05 19:42:36 +00:00
float d ;
vec3_t point ;
2021-06-25 18:50:53 +00:00
r_refdef . forcevis = false ;
2012-07-05 19:42:36 +00:00
r_refdef . forcedvis = NULL ;
2017-06-21 01:24:25 +00:00
newvis . buffer = alloca ( newvis . buffersize = cl . worldmodel - > pvsbytes ) ;
2012-07-05 19:42:36 +00:00
for ( i = batch - > firstmesh ; i < batch - > meshes ; i + + )
{
mesh = batch - > mesh [ i ] ;
2021-06-25 18:50:53 +00:00
if ( ! mesh - > xyz_array )
continue ;
r_refdef . forcevis = true ;
2012-07-05 19:42:36 +00:00
VectorClear ( point ) ;
for ( j = 0 ; j < mesh - > numvertexes ; j + + )
VectorAdd ( point , mesh - > xyz_array [ j ] , point ) ;
VectorScale ( point , 1.0f / mesh - > numvertexes , point ) ;
d = DotProduct ( point , plane . normal ) - plane . dist ;
d + = 0.1 ; //an epsilon on the far side
VectorMA ( point , d , plane . normal , point ) ;
2019-07-02 04:12:20 +00:00
clust = cl . worldmodel - > funcs . ClusterForPoint ( cl . worldmodel , point , NULL ) ;
2012-07-05 19:42:36 +00:00
if ( i = = batch - > firstmesh )
2017-06-21 01:24:25 +00:00
r_refdef . forcedvis = cl . worldmodel - > funcs . ClusterPVS ( cl . worldmodel , clust , & newvis , PVM_REPLACE ) ;
2012-07-05 19:42:36 +00:00
else
2017-06-21 01:24:25 +00:00
r_refdef . forcedvis = cl . worldmodel - > funcs . ClusterPVS ( cl . worldmodel , clust , & newvis , PVM_MERGE ) ;
2012-07-05 19:42:36 +00:00
}
2012-07-07 05:17:43 +00:00
// memset(newvis, 0xff, pvsbytes);
2012-07-05 19:42:36 +00:00
}
2013-12-29 22:48:28 +00:00
Matrix4x4_CM_ModelViewMatrixFromAxis ( vmat , vpn , vright , vup , r_refdef . vieworg ) ;
2013-03-12 23:09:25 +00:00
break ;
2013-12-29 22:48:28 +00:00
case 0 : /*q3 portal*/
default :
2014-01-15 02:58:07 +00:00
# ifdef CSQC_DAT
2013-12-29 22:48:28 +00:00
if ( CSQC_SetupToRenderPortal ( batch - > ent - > keynum ) )
{
2014-02-14 09:59:32 +00:00
oplane = plane ;
2013-12-29 22:48:28 +00:00
//transform the old surface plane into the new view matrix
Matrix4_Invert ( r_refdef . m_view , ivmat ) ;
Matrix4x4_CM_ModelViewMatrixFromAxis ( vmat , vpn , vright , vup , r_refdef . vieworg ) ;
Matrix4_Multiply ( ivmat , vmat , trmat ) ;
2014-02-14 09:59:32 +00:00
plane . normal [ 0 ] = - ( oplane . normal [ 0 ] * trmat [ 0 ] + oplane . normal [ 1 ] * trmat [ 1 ] + oplane . normal [ 2 ] * trmat [ 2 ] ) ;
plane . normal [ 1 ] = - ( oplane . normal [ 0 ] * trmat [ 4 ] + oplane . normal [ 1 ] * trmat [ 5 ] + oplane . normal [ 2 ] * trmat [ 6 ] ) ;
plane . normal [ 2 ] = - ( oplane . normal [ 0 ] * trmat [ 8 ] + oplane . normal [ 1 ] * trmat [ 9 ] + oplane . normal [ 2 ] * trmat [ 10 ] ) ;
2013-12-29 22:48:28 +00:00
plane . dist = - oplane . dist + trmat [ 12 ] * oplane . normal [ 0 ] + trmat [ 13 ] * oplane . normal [ 1 ] + trmat [ 14 ] * oplane . normal [ 2 ] ;
if ( Cvar_Get ( " temp_useplaneclip " , " 1 " , 0 , " temp " ) - > ival )
portaltype = 1 ; //make sure the near clipplane is used.
2017-06-21 01:24:25 +00:00
break ;
2013-12-29 22:48:28 +00:00
}
2014-01-15 02:58:07 +00:00
# endif
2017-06-21 01:24:25 +00:00
surfent = batch - > ent ;
if ( batch - > ent - > keynum )
view = R_FindPortalCamera ( batch - > ent ) ;
else
2013-03-12 23:09:25 +00:00
{
2017-06-21 01:24:25 +00:00
view = R_NearestPortal ( & plane ) ;
if ( view )
{ //for q3bsps where the portal surface is embedded in the bsp itself, we need an extra leyer of indirection.
entity_t * oc = R_FindPortalCamera ( view ) ;
if ( oc )
{
surfent = view ;
view = oc ;
}
}
}
if ( view & & view - > rtype = = RT_PORTALCAMERA )
{ //q1-style portal, where the portal is defined via attachments
//the portal plane itself is assumed to be facing directly forwards from the entity that we're drawing, and with the same origin.
oplane = plane ;
TransformCoord ( r_refdef . vieworg , surfent - > axis , surfent - > origin , view - > axis , view - > origin , r_refdef . vieworg ) ;
TransformDir ( vpn , surfent - > axis , view - > axis , vpn ) ;
TransformDir ( vright , surfent - > axis , view - > axis , vright ) ;
TransformDir ( vup , surfent - > axis , view - > axis , vup ) ;
2014-01-13 02:42:25 +00:00
2017-06-21 01:24:25 +00:00
//transform the old surface plane into the new view matrix
Matrix4_Invert ( r_refdef . m_view , ivmat ) ;
Matrix4x4_CM_ModelViewMatrixFromAxis ( vmat , vpn , vright , vup , r_refdef . vieworg ) ;
Matrix4_Multiply ( ivmat , vmat , trmat ) ;
plane . normal [ 0 ] = - ( oplane . normal [ 0 ] * trmat [ 0 ] + oplane . normal [ 1 ] * trmat [ 1 ] + oplane . normal [ 2 ] * trmat [ 2 ] ) ;
plane . normal [ 1 ] = - ( oplane . normal [ 0 ] * trmat [ 4 ] + oplane . normal [ 1 ] * trmat [ 5 ] + oplane . normal [ 2 ] * trmat [ 6 ] ) ;
plane . normal [ 2 ] = - ( oplane . normal [ 0 ] * trmat [ 8 ] + oplane . normal [ 1 ] * trmat [ 9 ] + oplane . normal [ 2 ] * trmat [ 10 ] ) ;
plane . dist = - oplane . dist + trmat [ 12 ] * oplane . normal [ 0 ] + trmat [ 13 ] * oplane . normal [ 1 ] + trmat [ 14 ] * oplane . normal [ 2 ] ;
2014-02-14 09:59:32 +00:00
2017-06-21 01:24:25 +00:00
portaltype = 1 ; //make sure the near clipplane is used.
break ;
2013-03-12 23:09:25 +00:00
}
2017-06-21 01:24:25 +00:00
//portal surfaces with the same origin+oldorigin are explicit mirrors, and skipped in this case.
if ( view & & view - > rtype = = RT_PORTALSURFACE & & ! VectorCompare ( view - > origin , view - > oldorigin ) )
{ //q3-style portal, where a single entity provides orientation+two origins
2013-03-12 23:09:25 +00:00
float d ;
vec3_t paxis [ 3 ] , porigin , vaxis [ 3 ] , vorg ;
2014-02-14 09:59:32 +00:00
oplane = plane ;
2013-03-12 23:09:25 +00:00
/*calculate where the surface is meant to be*/
VectorCopy ( mesh - > normals_array [ 0 ] , paxis [ 0 ] ) ;
PerpendicularVector ( paxis [ 1 ] , paxis [ 0 ] ) ;
CrossProduct ( paxis [ 0 ] , paxis [ 1 ] , paxis [ 2 ] ) ;
d = DotProduct ( view - > origin , plane . normal ) - plane . dist ;
VectorMA ( view - > origin , - d , paxis [ 0 ] , porigin ) ;
/*grab the camera origin*/
VectorNegate ( view - > axis [ 0 ] , vaxis [ 0 ] ) ;
VectorNegate ( view - > axis [ 1 ] , vaxis [ 1 ] ) ;
VectorCopy ( view - > axis [ 2 ] , vaxis [ 2 ] ) ;
VectorCopy ( view - > oldorigin , vorg ) ;
VectorCopy ( vorg , r_refdef . pvsorigin ) ;
/*rotate it a bit*/
2014-02-14 09:59:32 +00:00
if ( view - > framestate . g [ FS_REG ] . frame [ 1 ] ) //oldframe
{
if ( view - > framestate . g [ FS_REG ] . frame [ 0 ] ) //newframe
d = realtime * view - > framestate . g [ FS_REG ] . frame [ 0 ] ; //newframe
else
d = view - > skinnum + sin ( realtime ) * 4 ;
}
else
d = view - > skinnum ;
if ( d )
{
vec3_t rdir ;
VectorCopy ( vaxis [ 1 ] , rdir ) ;
RotatePointAroundVector ( vaxis [ 1 ] , vaxis [ 0 ] , rdir , d ) ;
CrossProduct ( vaxis [ 0 ] , vaxis [ 1 ] , vaxis [ 2 ] ) ;
}
2013-03-12 23:09:25 +00:00
TransformCoord ( oldrefdef . vieworg , paxis , porigin , vaxis , vorg , r_refdef . vieworg ) ;
TransformDir ( vpn , paxis , vaxis , vpn ) ;
TransformDir ( vright , paxis , vaxis , vright ) ;
TransformDir ( vup , paxis , vaxis , vup ) ;
2013-12-29 22:48:28 +00:00
Matrix4x4_CM_ModelViewMatrixFromAxis ( vmat , vpn , vright , vup , r_refdef . vieworg ) ;
2014-02-14 09:59:32 +00:00
//transform the old surface plane into the new view matrix
if ( Matrix4_Invert ( r_refdef . m_view , ivmat ) )
{
Matrix4_Multiply ( ivmat , vmat , trmat ) ;
plane . normal [ 0 ] = - ( oplane . normal [ 0 ] * trmat [ 0 ] + oplane . normal [ 1 ] * trmat [ 1 ] + oplane . normal [ 2 ] * trmat [ 2 ] ) ;
plane . normal [ 1 ] = - ( oplane . normal [ 0 ] * trmat [ 4 ] + oplane . normal [ 1 ] * trmat [ 5 ] + oplane . normal [ 2 ] * trmat [ 6 ] ) ;
plane . normal [ 2 ] = - ( oplane . normal [ 0 ] * trmat [ 8 ] + oplane . normal [ 1 ] * trmat [ 9 ] + oplane . normal [ 2 ] * trmat [ 10 ] ) ;
plane . dist = - oplane . dist + trmat [ 12 ] * oplane . normal [ 0 ] + trmat [ 13 ] * oplane . normal [ 1 ] + trmat [ 14 ] * oplane . normal [ 2 ] ;
portaltype = 1 ;
}
2017-06-21 01:24:25 +00:00
break ;
2013-03-12 23:09:25 +00:00
}
2017-06-21 01:24:25 +00:00
//fixme: q3 gamecode has explicit mirrors. we 'should' just ignore the surface if we've not seen it yet.
//a portal with no portal entity, or a portal rentity with an origin equal to its oldorigin, is a mirror.
R_MirrorMatrix ( & plane ) ;
Matrix4x4_CM_ModelViewMatrixFromAxis ( vmat , vpn , vright , vup , r_refdef . vieworg ) ;
VectorCopy ( mesh - > xyz_array [ 0 ] , r_refdef . pvsorigin ) ;
for ( i = 1 ; i < mesh - > numvertexes ; i + + )
VectorAdd ( r_refdef . pvsorigin , mesh - > xyz_array [ i ] , r_refdef . pvsorigin ) ;
VectorScale ( r_refdef . pvsorigin , 1.0 / mesh - > numvertexes , r_refdef . pvsorigin ) ;
portaltype = 1 ;
2013-03-12 23:09:25 +00:00
break ;
2010-07-11 02:22:39 +00:00
}
/*FIXME: can we get away with stenciling the screen?*/
/*Add to frustum culling instead of clip planes?*/
2014-02-14 09:59:32 +00:00
/* if (qglClipPlane && portaltype)
2013-12-29 22:48:28 +00:00
{
GLdouble glplane [ 4 ] ;
2014-02-14 09:59:32 +00:00
glplane [ 0 ] = plane . normal [ 0 ] ;
glplane [ 1 ] = plane . normal [ 1 ] ;
glplane [ 2 ] = plane . normal [ 2 ] ;
2013-12-29 22:48:28 +00:00
glplane [ 3 ] = plane . dist ;
qglClipPlane ( GL_CLIP_PLANE0 , glplane ) ;
qglEnable ( GL_CLIP_PLANE0 ) ;
2014-02-14 09:59:32 +00:00
}
*/ //fixme: we can probably scissor a smaller frusum
2017-12-15 06:56:40 +00:00
R_SetFrustum ( r_refdef . m_projection_std , vmat ) ;
2013-10-29 17:38:22 +00:00
if ( r_refdef . frustum_numplanes < MAXFRUSTUMPLANES )
{
2014-01-13 02:42:25 +00:00
extern int SignbitsForPlane ( mplane_t * out ) ;
mplane_t fp ;
VectorCopy ( plane . normal , fp . normal ) ;
fp . dist = plane . dist ;
2014-02-07 14:57:07 +00:00
// if (DotProduct(fp.normal, vpn) < 0)
// {
// VectorNegate(fp.normal, fp.normal);
// fp.dist *= -1;
// }
2014-01-13 02:42:25 +00:00
fp . type = PLANE_ANYZ ;
fp . signbits = SignbitsForPlane ( & fp ) ;
2013-10-29 17:38:22 +00:00
if ( portaltype = = 1 | | portaltype = = 2 )
2014-01-13 02:42:25 +00:00
R_ObliqueNearClip ( vmat , & fp ) ;
//our own culling should be an epsilon forwards so we don't still draw things behind the line due to precision issues.
fp . dist + = 0.01 ;
r_refdef . frustum [ r_refdef . frustum_numplanes + + ] = fp ;
2013-10-29 17:38:22 +00:00
}
2016-12-07 18:45:25 +00:00
# if 1
2013-12-29 22:48:28 +00:00
if ( depthmasklist )
{
/*draw already-drawn portals as depth-only, to ensure that their contents are not harmed*/
/*we can only do this AFTER the oblique perspective matrix is calculated, to avoid depth inconsistancies, while we still have the old view matrix*/
int i ;
batch_t * dmask = NULL ;
if ( qglLoadMatrixf )
{
qglMatrixMode ( GL_PROJECTION ) ;
2017-12-15 06:56:40 +00:00
qglLoadMatrixf ( r_refdef . m_projection_std ) ;
2015-09-01 04:45:15 +00:00
qglMatrixMode ( GL_MODELVIEW ) ;
2013-12-29 22:48:28 +00:00
}
2015-08-28 03:13:45 +00:00
//portals to mask are relative to the old view still.
2013-12-29 22:48:28 +00:00
currententity = NULL ;
if ( gl_config . arb_depth_clamp )
2014-01-13 02:42:25 +00:00
qglEnable ( GL_DEPTH_CLAMP_ARB ) ; //ignore the near clip plane(ish), this means nearer portals can still mask further ones.
2013-12-29 22:48:28 +00:00
GL_ForceDepthWritable ( ) ;
GLBE_SelectMode ( BEM_DEPTHONLY ) ;
for ( i = 0 ; i < 2 ; i + + )
{
for ( dmask = depthmasklist [ i ] ; dmask ; dmask = dmask - > next )
{
if ( dmask = = batch )
continue ;
2016-12-07 18:45:25 +00:00
// if (dmask->meshes == dmask->firstmesh)
// continue;
2013-12-29 22:48:28 +00:00
GLBE_SubmitBatch ( dmask ) ;
}
}
GLBE_SelectMode ( BEM_STANDARD ) ;
if ( gl_config . arb_depth_clamp )
qglDisable ( GL_DEPTH_CLAMP_ARB ) ;
currententity = NULL ;
}
2016-12-07 18:45:25 +00:00
# endif
// r_refdef = oldrefdef;
// return;
2013-12-29 22:48:28 +00:00
//now determine the stuff the backend will use.
memcpy ( r_refdef . m_view , vmat , sizeof ( float ) * 16 ) ;
added r_meshpitch cvar that allows for fixing the unfixable mesh pitch bug from vanilla... needs a better name... do note that this will break pretty much any mod, so this is really only for TCs designed to use it. Its likely that I missed places.
nqsv: added support for spectators with nq clients. the angles are a bit rough, but hey. need to do something about frags so nq clients know who's a spectator. use 'cmd observe' to get an nq client to spectate on an fte server (then attack/jump behave the same as in qw clients).
nqsv: rewrote EF_MUZZLEFLASH handling, so svc_muzzleflash is now translated properly to EF_MUZZLEFLASH, and vice versa. No more missing muzzleflashes!
added screenshot_cubemap, so you can actually pre-generate cubemaps with fte (which can be used for reflections or whatever).
misc fixes (server crash, a couple of other less important ones).
external files based on a model's name will now obey r_replacemodels properly, instead of needing to use foo.mdl_0.skin for foo.md3.
identify <playernum> should now use the correct masked ip, instead of abrubtly failing (reported by kt)
vid_toggle console command should now obey vid_width and vid_height when switching to fullscreen, but only if vid_fullscreen is actually set, which should make it seem better behaved (reported by kt).
qcc: cleaned up sym->symboldata[sym->ofs] to be more consistent at all stages.
qcc: typedef float vec4[4]; now works to define a float array with 4 elements (however, it will be passed by-value rather than by-reference).
qcc: cleaned up optional vs __out ordering issues.
qccgui: shift+f3 searches backwards
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5064 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-02-27 09:34:35 +00:00
VectorAngles ( vpn , vup , r_refdef . viewangles , false ) ;
2013-12-29 22:48:28 +00:00
VectorCopy ( r_refdef . vieworg , r_origin ) ;
2014-01-13 02:42:25 +00:00
//determine r_refdef.flipcull & SHADER_CULL_FLIP based upon whether right is right or not.
CrossProduct ( vpn , vup , r ) ;
if ( DotProduct ( r , vright ) < 0 )
r_refdef . flipcull | = SHADER_CULL_FLIP ;
else
r_refdef . flipcull & = ~ SHADER_CULL_FLIP ;
2017-12-15 06:56:40 +00:00
if ( r_refdef . m_projection_std [ 5 ] < 0 )
2014-10-14 16:42:48 +00:00
r_refdef . flipcull ^ = SHADER_CULL_FLIP ;
2014-01-13 02:42:25 +00:00
2015-09-01 04:45:15 +00:00
Surf_SetupFrame ( ) ;
2014-01-13 02:42:25 +00:00
//FIXME: just call Surf_DrawWorld instead?
2010-07-11 02:22:39 +00:00
R_RenderScene ( ) ;
2012-11-29 13:37:48 +00:00
// if (qglClipPlane)
// qglDisable(GL_CLIP_PLANE0);
2010-07-11 02:22:39 +00:00
2014-02-14 09:59:32 +00:00
if ( r_portaldrawplanes . ival )
{
//the front of the plane should generally point away from the camera, and will be drawn in bright green. woo
2014-02-14 13:29:41 +00:00
CL_DrawDebugPlane ( plane . normal , plane . dist + 0.01 , 0.0 , 0.5 , 0.0 , false ) ;
CL_DrawDebugPlane ( plane . normal , plane . dist - 0.01 , 0.0 , 0.5 , 0.0 , false ) ;
2014-02-14 09:59:32 +00:00
//the back of the plane points towards the camera, and will be drawn in blue, for the luls
VectorNegate ( plane . normal , plane . normal ) ;
plane . dist * = - 1 ;
2014-02-14 13:29:41 +00:00
CL_DrawDebugPlane ( plane . normal , plane . dist + 0.01 , 0.0 , 0.0 , 0.2 , false ) ;
CL_DrawDebugPlane ( plane . normal , plane . dist - 0.01 , 0.0 , 0.0 , 0.2 , false ) ;
2014-02-14 09:59:32 +00:00
}
2014-01-13 02:42:25 +00:00
2010-07-11 02:22:39 +00:00
r_refdef = oldrefdef ;
/*broken stuff*/
AngleVectors ( r_refdef . viewangles , vpn , vright , vup ) ;
VectorCopy ( r_refdef . vieworg , r_origin ) ;
2015-08-28 03:13:45 +00:00
GLBE_SelectEntity ( & r_worldentity ) ;
2010-07-11 02:22:39 +00:00
2014-01-13 02:42:25 +00:00
GL_CullFace ( 0 ) ; //make sure flipcull reversion takes effect
2010-07-11 02:22:39 +00:00
Android: fat presses, vibrator, onscreen keyboard, keep-screen-on, console scaling, touch-based console scrolling, additional bindables.
Some memory leaks fixed.
latency with the nq protocol over loopback is much reduced.
Terrain: now mostly a property of a (q1 for now) bsp map, file format changed, glsl now built in, terrain editor builtin improved/changed, holes supported.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4067 fc73d0e0-1445-4013-8a0c-d673dee63da5
2012-07-14 16:25:18 +00:00
TRACE ( ( " GLR_DrawPortal: portal drawn \n " ) ) ;
2011-10-27 16:16:29 +00:00
# ifdef warningmsg
# pragma warningmsg("warning: there's a bug with rtlights in portals, culling is broken or something. May also be loading the wrong matrix")
2011-05-29 04:26:29 +00:00
# endif
2013-12-29 22:48:28 +00:00
currententity = NULL ;
2004-08-22 22:29:09 +00:00
}
/*
= = = = = = = = = = = = =
R_Clear
= = = = = = = = = = = = =
*/
2005-04-26 16:04:12 +00:00
int gldepthfunc = GL_LEQUAL ;
2015-01-07 13:34:05 +00:00
qboolean depthcleared ;
void R_Clear ( qboolean fbo )
2004-08-22 22:29:09 +00:00
{
2010-03-14 14:35:56 +00:00
/*tbh, this entire function should be in the backend*/
2004-08-22 22:29:09 +00:00
{
2015-01-07 13:34:05 +00:00
if ( ! depthcleared | | fbo )
2012-07-05 19:42:36 +00:00
{
2015-01-07 13:34:05 +00:00
GL_ForceDepthWritable ( ) ;
//we no longer clear colour here. we only ever (need to) do that at the start of the frame, and this point can be called multiple times per frame.
//for performance, we clear the depth at the same time we clear colour, so we can skip clearing depth here the first time around each frame.
//but for multiple scenes, we do need to clear depth still.
//fbos always get cleared depth, just in case (colour fbos may contain junk, but hey).
2019-02-16 19:09:07 +00:00
if ( ( fbo & & r_clear . ival ) | | r_refdef . stereomethod = = STEREO_RED_BLUE | | r_refdef . stereomethod = = STEREO_RED_GREEN )
2020-12-05 04:08:40 +00:00
{
qglClearColor ( 0 , 0 , 0 , 1 ) ;
2017-10-31 22:52:58 +00:00
qglClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) ;
2020-12-05 04:08:40 +00:00
}
2017-10-31 22:52:58 +00:00
else
qglClear ( GL_DEPTH_BUFFER_BIT ) ;
2015-01-07 13:34:05 +00:00
}
if ( ! fbo )
depthcleared = false ;
2004-08-22 22:29:09 +00:00
gldepthmin = 0 ;
gldepthmax = 1 ;
2005-04-26 16:04:12 +00:00
gldepthfunc = GL_LEQUAL ;
2004-08-22 22:29:09 +00:00
}
}
2006-06-02 17:42:36 +00:00
#if 0
void GLR_SetupFog ( void )
{
2012-02-12 05:18:31 +00:00
if ( r_viewleaf ) // && r_viewcontents != FTECONTENTS_EMPTY)
2006-06-02 17:42:36 +00:00
{
// static fogcolour;
float fogcol [ 4 ] = { 0 } ;
float fogperc ;
float fogdist ;
fogperc = 0 ;
fogdist = 512 ;
2012-02-12 05:18:31 +00:00
switch ( r_viewcontents )
2006-06-02 17:42:36 +00:00
{
case FTECONTENTS_WATER :
fogcol [ 0 ] = 64 / 255.0 ;
fogcol [ 1 ] = 128 / 255.0 ;
fogcol [ 2 ] = 192 / 255.0 ;
fogperc = 0.2 ;
fogdist = 512 ;
break ;
case FTECONTENTS_SLIME :
fogcol [ 0 ] = 32 / 255.0 ;
fogcol [ 1 ] = 192 / 255.0 ;
fogcol [ 2 ] = 92 / 255.0 ;
fogperc = 1 ;
fogdist = 256 ;
break ;
case FTECONTENTS_LAVA :
fogcol [ 0 ] = 192 / 255.0 ;
fogcol [ 1 ] = 32 / 255.0 ;
fogcol [ 2 ] = 64 / 255.0 ;
fogperc = 1 ;
fogdist = 128 ;
break ;
default :
fogcol [ 0 ] = 192 / 255.0 ;
fogcol [ 1 ] = 192 / 255.0 ;
fogcol [ 2 ] = 192 / 255.0 ;
fogperc = 1 ;
fogdist = 1024 ;
break ;
}
if ( fogperc )
{
qglFogi ( GL_FOG_MODE , GL_LINEAR ) ;
qglFogfv ( GL_FOG_COLOR , fogcol ) ;
qglFogf ( GL_FOG_DENSITY , fogperc ) ;
qglFogf ( GL_FOG_START , 1 ) ;
qglFogf ( GL_FOG_END , fogdist ) ;
qglEnable ( GL_FOG ) ;
}
}
}
# endif
2009-07-19 18:13:03 +00:00
static void R_RenderMotionBlur ( void )
{
2023-07-01 22:20:13 +00:00
# if !defined(ANDROID)
2009-07-19 18:13:03 +00:00
int vwidth = 1 , vheight = 1 ;
float vs , vt , cs , ct ;
2012-11-27 03:23:19 +00:00
shader_t * shader ;
//figure out the size of our texture.
2014-10-11 19:39:45 +00:00
if ( sh_config . texture_non_power_of_two_pic )
2009-07-19 18:13:03 +00:00
{ //we can use any size, supposedly
2009-11-04 21:16:50 +00:00
vwidth = vid . pixelwidth ;
vheight = vid . pixelheight ;
2009-07-19 18:13:03 +00:00
}
else
{ //limit the texture size to square and use padding.
2009-11-04 21:16:50 +00:00
while ( vwidth < vid . pixelwidth )
2009-07-19 18:13:03 +00:00
vwidth * = 2 ;
2009-11-04 21:16:50 +00:00
while ( vheight < vid . pixelheight )
2009-07-19 18:13:03 +00:00
vheight * = 2 ;
}
//blend the last frame onto the scene
//the maths is because our texture is over-sized (must be power of two)
2009-11-04 21:16:50 +00:00
cs = vs = ( float ) vid . pixelwidth / vwidth * 0.5 ;
ct = vt = ( float ) vid . pixelheight / vheight * 0.5 ;
2009-07-19 18:13:03 +00:00
vs * = gl_motionblurscale . value ;
vt * = gl_motionblurscale . value ;
2012-11-27 03:23:19 +00:00
//render using our texture
2013-08-21 07:14:39 +00:00
shader = R_RegisterShader ( " postproc_motionblur " , SUF_NONE ,
2012-11-27 03:23:19 +00:00
" { \n "
" program default2d \n "
" { \n "
" map $sourcecolour \n "
" blendfunc blend \n "
" } \n "
" } \n "
) ;
2015-05-14 03:06:58 +00:00
GLBE_FBO_Sources ( sceneblur_texture , r_nulltex ) ;
2012-11-27 03:23:19 +00:00
R2D_ImageColours ( 1 , 1 , 1 , gl_motionblur . value ) ;
R2D_Image ( 0 , 0 , vid . width , vid . height , cs - vs , ct + vt , cs + vs , ct - vt , shader ) ;
2015-05-14 03:06:58 +00:00
GLBE_RenderToTextureUpdate2d ( false ) ;
2012-11-27 03:23:19 +00:00
//grab the current image so we can feed that back into the next frame.
GL_MTBind ( 0 , GL_TEXTURE_2D , sceneblur_texture ) ;
2009-07-19 18:13:03 +00:00
//copy the image into the texture so that we can play with it next frame too!
2009-11-04 21:16:50 +00:00
qglCopyTexImage2D ( GL_TEXTURE_2D , 0 , GL_RGB , 0 , 0 , vwidth , vheight , 0 ) ;
qglTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_MIN_FILTER , GL_LINEAR ) ;
qglTexParameteri ( GL_TEXTURE_2D , GL_TEXTURE_MAG_FILTER , GL_LINEAR ) ;
2011-09-05 01:48:23 +00:00
# endif
2009-07-19 18:13:03 +00:00
}
2014-12-08 21:18:32 +00:00
# if 1
# include "shader.h"
2010-05-01 22:47:47 +00:00
/*FIXME: we could use geometry shaders to draw to all 6 faces at once*/
2011-10-27 16:16:29 +00:00
qboolean R_RenderScene_Cubemap ( void )
2009-07-19 18:13:03 +00:00
{
int cmapsize = 512 ;
int i ;
static vec3_t ang [ 6 ] =
{ { 0 , - 90 , 0 } , { 0 , 90 , 0 } ,
{ 90 , 0 , 0 } , { - 90 , 0 , 0 } ,
{ 0 , 0 , 0 } , { 0 , - 180 , 0 } } ;
vec3_t saveang ;
2016-02-10 23:23:43 +00:00
vec3_t saveorg ;
2009-07-19 18:13:03 +00:00
2010-08-16 02:03:02 +00:00
vrect_t vrect ;
2013-11-21 23:02:28 +00:00
pxrect_t prect ;
2010-08-16 02:03:02 +00:00
2011-10-27 16:16:29 +00:00
shader_t * shader ;
int facemask ;
2015-07-03 02:07:41 +00:00
extern cvar_t r_projection ;
2015-07-06 14:47:46 +00:00
int oldfbo = - 1 ;
qboolean usefbo = true ; //this appears to be a 20% speedup in my tests.
2016-01-18 05:22:07 +00:00
qboolean fboreset = false ;
2016-02-10 23:23:43 +00:00
int osm = r_refdef . stereomethod ;
2011-10-27 16:16:29 +00:00
/*needs glsl*/
if ( ! gl_config . arb_shader_objects )
return false ;
2015-07-03 02:07:41 +00:00
if ( ! * ffov . string | | ! strcmp ( ffov . string , " 0 " ) )
ffov . value = scr_fov . value ;
2011-10-27 16:16:29 +00:00
facemask = 0 ;
2015-07-03 02:07:41 +00:00
switch ( r_projection . ival )
2011-10-27 16:16:29 +00:00
{
2015-07-03 02:07:41 +00:00
default : //invalid.
return false ;
2016-02-10 23:23:43 +00:00
case PROJ_STEREOGRAPHIC :
2015-07-03 02:07:41 +00:00
shader = R_RegisterShader ( " postproc_stereographic " , SUF_NONE ,
2011-10-27 16:16:29 +00:00
" { \n "
2015-07-03 02:07:41 +00:00
" program postproc_stereographic \n "
2011-10-27 16:16:29 +00:00
" { \n "
" map $sourcecube \n "
" } \n "
" } \n "
) ;
facemask | = 1 < < 4 ; /*front view*/
2015-07-03 02:07:41 +00:00
if ( ffov . value > 70 )
2011-10-27 16:16:29 +00:00
{
2015-07-03 02:07:41 +00:00
facemask | = ( 1 < < 0 ) | ( 1 < < 1 ) ; /*side/top*/
if ( ffov . value > 85 )
facemask | = ( 1 < < 2 ) | ( 1 < < 3 ) ; /*bottom views*/
if ( ffov . value > 300 )
2011-10-27 16:16:29 +00:00
facemask | = 1 < < 5 ; /*back view*/
}
2015-07-03 02:07:41 +00:00
break ;
2016-02-10 23:23:43 +00:00
case PROJ_FISHEYE :
2013-08-21 07:14:39 +00:00
shader = R_RegisterShader ( " postproc_fisheye " , SUF_NONE ,
2011-10-27 16:16:29 +00:00
" { \n "
" program postproc_fisheye \n "
" { \n "
" map $sourcecube \n "
" } \n "
" } \n "
) ;
//fisheye view sees up to a full sphere
facemask | = 1 < < 4 ; /*front view*/
if ( ffov . value > 77 )
facemask | = ( 1 < < 0 ) | ( 1 < < 1 ) | ( 1 < < 2 ) | ( 1 < < 3 ) ; /*side/top/bottom views*/
if ( ffov . value > 270 )
facemask | = 1 < < 5 ; /*back view*/
2015-07-03 02:07:41 +00:00
break ;
2016-02-10 23:23:43 +00:00
case PROJ_PANORAMA :
2015-07-03 02:07:41 +00:00
shader = R_RegisterShader ( " postproc_panorama " , SUF_NONE ,
" { \n "
" program postproc_panorama \n "
" { \n "
" map $sourcecube \n "
" } \n "
" } \n "
) ;
//panoramic view needs at most the four sides
facemask | = 1 < < 4 ; /*front view*/
if ( ffov . value > 90 )
{
facemask | = ( 1 < < 0 ) | ( 1 < < 1 ) ; /*side views*/
if ( ffov . value > 270 )
facemask | = 1 < < 5 ; /*back view*/
}
2016-01-18 05:22:07 +00:00
facemask = 0x3f ;
2015-07-03 02:07:41 +00:00
break ;
2016-02-10 23:23:43 +00:00
case PROJ_LAEA :
2015-07-03 02:07:41 +00:00
shader = R_RegisterShader ( " postproc_laea " , SUF_NONE ,
" { \n "
" program postproc_laea \n "
" { \n "
" map $sourcecube \n "
" } \n "
" } \n "
) ;
facemask | = 1 < < 4 ; /*front view*/
if ( ffov . value > 90 )
{
facemask | = ( 1 < < 0 ) | ( 1 < < 1 ) | ( 1 < < 2 ) | ( 1 < < 3 ) ; /*side/top/bottom views*/
if ( ffov . value > 270 )
facemask | = 1 < < 5 ; /*back view*/
}
break ;
2016-02-10 23:23:43 +00:00
case PROJ_EQUIRECTANGULAR :
shader = R_RegisterShader ( " postproc_equirectangular " , SUF_NONE ,
" { \n "
" program postproc_equirectangular \n "
" { \n "
" map $sourcecube \n "
" } \n "
" } \n "
) ;
facemask = 0x3f ;
#if 0
facemask | = 1 < < 4 ; /*front view*/
if ( ffov . value > 90 )
{
facemask | = ( 1 < < 0 ) | ( 1 < < 1 ) | ( 1 < < 2 ) | ( 1 < < 3 ) ; /*side/top/bottom views*/
if ( ffov . value > 270 )
facemask | = 1 < < 5 ; /*back view*/
}
# endif
break ;
2011-10-27 16:16:29 +00:00
}
2015-07-03 02:07:41 +00:00
//FIXME: we should be able to rotate the view
2013-06-23 02:17:02 +00:00
vrect = r_refdef . vrect ;
prect = r_refdef . pxrect ;
// prect.x = (vrect.x * vid.pixelwidth)/vid.width;
// prect.width = (vrect.width * vid.pixelwidth)/vid.width;
// prect.y = (vrect.y * vid.pixelheight)/vid.height;
// prect.height = (vrect.height * vid.pixelheight)/vid.height;
2010-03-14 14:35:56 +00:00
2014-12-08 21:18:32 +00:00
if ( sh_config . texture_non_power_of_two_pic )
2009-07-19 18:13:03 +00:00
{
2016-01-18 05:22:07 +00:00
if ( usefbo )
{
cmapsize = prect . width > prect . height ? prect . width : prect . height ;
if ( cmapsize > 4096 ) //sh_config.texture_maxsize)
cmapsize = 4096 ; //sh_config.texture_maxsize;
}
2009-07-19 18:13:03 +00:00
else
2016-01-18 05:22:07 +00:00
cmapsize = prect . width < prect . height ? prect . width : prect . height ;
2009-07-19 18:13:03 +00:00
}
2015-07-06 14:47:46 +00:00
else if ( ! usefbo )
2009-07-19 18:13:03 +00:00
{
2010-08-16 02:03:02 +00:00
while ( cmapsize > prect . width | | cmapsize > prect . height )
2009-07-19 18:13:03 +00:00
{
cmapsize / = 2 ;
}
}
2015-07-06 14:47:46 +00:00
if ( usefbo )
{
r_refdef . flags | = RDF_FISHEYE ;
vid . fbpwidth = vid . fbpheight = cmapsize ;
}
//FIXME: gl_max_size
2016-02-10 23:23:43 +00:00
VectorCopy ( r_refdef . vieworg , saveorg ) ;
2009-07-19 18:13:03 +00:00
VectorCopy ( r_refdef . viewangles , saveang ) ;
saveang [ 2 ] = 0 ;
2016-02-10 23:23:43 +00:00
r_refdef . stereomethod = STEREO_OFF ;
2012-11-27 03:23:19 +00:00
if ( ! TEXVALID ( scenepp_postproc_cube ) | | cmapsize ! = scenepp_postproc_cube_size )
2009-07-19 18:13:03 +00:00
{
2014-10-05 20:04:11 +00:00
if ( ! TEXVALID ( scenepp_postproc_cube ) )
{
2019-10-18 08:37:38 +00:00
scenepp_postproc_cube = Image_CreateTexture ( " ***fish*** " , NULL , IF_TEXTYPE_CUBE | IF_RENDERTARGET | IF_CLAMP | IF_LINEAR ) ;
2014-10-05 20:04:11 +00:00
qglGenTextures ( 1 , & scenepp_postproc_cube - > num ) ;
}
2016-01-18 05:22:07 +00:00
else
{
qglDeleteTextures ( 1 , & scenepp_postproc_cube - > num ) ;
scenepp_postproc_cube - > num = 0 ;
GL_MTBind ( 0 , GL_TEXTURE_CUBE_MAP_ARB , scenepp_postproc_cube ) ;
qglGenTextures ( 1 , & scenepp_postproc_cube - > num ) ;
}
2009-07-19 18:13:03 +00:00
2011-10-27 16:16:29 +00:00
GL_MTBind ( 0 , GL_TEXTURE_CUBE_MAP_ARB , scenepp_postproc_cube ) ;
2009-07-19 18:13:03 +00:00
for ( i = 0 ; i < 6 ; i + + )
qglCopyTexImage2D ( GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB + i , 0 , GL_RGB , 0 , 0 , cmapsize , cmapsize , 0 ) ;
qglTexParameteri ( GL_TEXTURE_CUBE_MAP_ARB , GL_TEXTURE_WRAP_S , GL_CLAMP_TO_EDGE ) ;
qglTexParameteri ( GL_TEXTURE_CUBE_MAP_ARB , GL_TEXTURE_WRAP_T , GL_CLAMP_TO_EDGE ) ;
qglTexParameteri ( GL_TEXTURE_CUBE_MAP_ARB , GL_TEXTURE_MAG_FILTER , GL_LINEAR ) ;
qglTexParameteri ( GL_TEXTURE_CUBE_MAP_ARB , GL_TEXTURE_MIN_FILTER , GL_LINEAR ) ;
2012-11-27 03:23:19 +00:00
scenepp_postproc_cube_size = cmapsize ;
2016-01-18 05:22:07 +00:00
fboreset = true ;
2009-07-19 18:13:03 +00:00
}
2012-11-27 03:23:19 +00:00
vrect = r_refdef . vrect ; //save off the old vrect
2016-01-18 05:22:07 +00:00
r_refdef . vrect . width = ( cmapsize * vid . fbvwidth ) / vid . fbpwidth ;
r_refdef . vrect . height = ( cmapsize * vid . fbvheight ) / vid . fbpheight ;
2009-07-19 18:13:03 +00:00
r_refdef . vrect . x = 0 ;
2010-08-16 02:03:02 +00:00
r_refdef . vrect . y = prect . y ;
2009-07-19 18:13:03 +00:00
ang [ 0 ] [ 0 ] = - saveang [ 0 ] ;
ang [ 0 ] [ 1 ] = - 90 ;
ang [ 0 ] [ 2 ] = - saveang [ 0 ] ;
ang [ 1 ] [ 0 ] = - saveang [ 0 ] ;
ang [ 1 ] [ 1 ] = 90 ;
ang [ 1 ] [ 2 ] = saveang [ 0 ] ;
ang [ 5 ] [ 0 ] = - saveang [ 0 ] * 2 ;
2015-07-06 14:47:46 +00:00
2015-07-03 02:07:41 +00:00
//in theory, we could use a geometry shader to duplicate the polygons to each face.
//that would of course require that every bit of glsl had such a geometry shader.
//it would at least reduce cpu load quite a bit.
2011-10-27 16:16:29 +00:00
for ( i = 0 ; i < 6 ; i + + )
2009-07-19 18:13:03 +00:00
{
2011-10-27 16:16:29 +00:00
if ( ! ( facemask & ( 1 < < i ) ) )
continue ;
2015-07-06 14:47:46 +00:00
if ( usefbo )
{
2016-07-28 13:18:22 +00:00
int r = GLBE_FBO_Update ( & fbo_postproc_cube , FBO_RB_DEPTH | ( fboreset ? FBO_RESET : 0 ) , & scenepp_postproc_cube , 1 , r_nulltex , cmapsize , cmapsize , i ) ;
2016-01-18 05:22:07 +00:00
fboreset = false ;
2015-07-06 14:47:46 +00:00
if ( oldfbo < 0 )
oldfbo = r ;
}
2009-07-19 18:13:03 +00:00
r_refdef . fov_x = 90 ;
r_refdef . fov_y = 90 ;
2011-10-27 16:16:29 +00:00
r_refdef . viewangles [ 0 ] = saveang [ 0 ] + ang [ i ] [ 0 ] ;
r_refdef . viewangles [ 1 ] = saveang [ 1 ] + ang [ i ] [ 1 ] ;
r_refdef . viewangles [ 2 ] = saveang [ 2 ] + ang [ i ] [ 2 ] ;
2009-07-19 18:13:03 +00:00
2015-07-06 14:47:46 +00:00
R_Clear ( usefbo ) ;
2009-07-19 18:13:03 +00:00
GL_SetShaderState2D ( false ) ;
// render normal view
2009-07-20 02:50:00 +00:00
R_RenderScene ( ) ;
2009-07-19 18:13:03 +00:00
2015-07-06 14:47:46 +00:00
if ( ! usefbo )
{
GL_MTBind ( 0 , GL_TEXTURE_CUBE_MAP_ARB , scenepp_postproc_cube ) ;
2016-01-18 05:22:07 +00:00
qglCopyTexSubImage2D ( GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB + i , 0 , 0 , 0 , 0 , vid . fbpheight - ( prect . y + cmapsize ) , cmapsize , cmapsize ) ;
2015-07-06 14:47:46 +00:00
}
2009-07-19 18:13:03 +00:00
}
2015-07-06 14:47:46 +00:00
if ( usefbo )
GLBE_FBO_Pop ( oldfbo ) ;
2012-11-27 03:23:19 +00:00
r_refdef . vrect = vrect ;
2013-11-21 23:02:28 +00:00
r_refdef . pxrect = prect ;
2016-02-10 23:23:43 +00:00
VectorCopy ( saveorg , r_refdef . vieworg ) ;
r_refdef . stereomethod = osm ;
2012-11-27 03:23:19 +00:00
2013-11-21 23:02:28 +00:00
//GL_ViewportUpdate();
GL_Set2D ( false ) ;
2009-07-19 18:13:03 +00:00
// go 2d
2013-11-21 23:02:28 +00:00
/* qglMatrixMode(GL_PROJECTION);
2009-07-19 18:13:03 +00:00
qglPushMatrix ( ) ;
qglLoadIdentity ( ) ;
2010-08-16 02:03:02 +00:00
qglOrtho ( 0 , vid . width , vid . height , 0 , - 99999 , 99999 ) ;
2009-07-19 18:13:03 +00:00
qglMatrixMode ( GL_MODELVIEW ) ;
qglPushMatrix ( ) ;
qglLoadIdentity ( ) ;
2013-11-21 23:02:28 +00:00
*/
2011-10-27 16:16:29 +00:00
// draw it through the shader
2016-02-10 23:23:43 +00:00
if ( r_projection . ival = = PROJ_EQUIRECTANGULAR )
{
//note vr screenshots have requirements here
R2D_Image ( vrect . x , vrect . y , vrect . width , vrect . height , 0 , 1 , 1 , 0 , shader ) ;
}
else if ( r_projection . ival = = PROJ_PANORAMA )
2016-01-18 05:22:07 +00:00
{
float saspect = .5 ;
float taspect = vrect . height / vrect . width * ffov . value / 90 ; //(0.5 * vrect.width) / vrect.height;
R2D_Image ( vrect . x , vrect . y , vrect . width , vrect . height , - saspect , taspect , saspect , - taspect , shader ) ;
}
else if ( vrect . width > vrect . height )
2015-07-03 02:07:41 +00:00
{
float aspect = ( 0.5 * vrect . height ) / vrect . width ;
2016-01-18 05:22:07 +00:00
R2D_Image ( vrect . x , vrect . y , vrect . width , vrect . height , - 0.5 , aspect , 0.5 , - aspect , shader ) ;
2015-07-03 02:07:41 +00:00
}
else
{
float aspect = ( 0.5 * vrect . width ) / vrect . height ;
2016-01-18 05:22:07 +00:00
R2D_Image ( vrect . x , vrect . y , vrect . width , vrect . height , - aspect , 0.5 , aspect , - 0.5 , shader ) ;
2015-07-03 02:07:41 +00:00
}
2009-07-19 18:13:03 +00:00
2016-07-12 00:40:13 +00:00
if ( R2D_Flush )
R2D_Flush ( ) ;
2011-10-27 16:16:29 +00:00
//revert the matricies
2013-11-21 23:02:28 +00:00
/* qglMatrixMode(GL_PROJECTION);
2009-07-19 18:13:03 +00:00
qglPopMatrix ( ) ;
qglMatrixMode ( GL_MODELVIEW ) ;
qglPopMatrix ( ) ;
2013-11-21 23:02:28 +00:00
*/
2009-07-19 18:13:03 +00:00
return true ;
}
2014-08-19 06:08:23 +00:00
# endif
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
texid_t R_RenderPostProcess ( texid_t sourcetex , texid_t sourcedepth , int type , shader_t * shader , char * restexname )
2014-08-19 06:08:23 +00:00
{
if ( r_refdef . flags & type )
{
r_refdef . flags & = ~ type ;
if ( r_refdef . flags & RDF_ALLPOSTPROC )
{ //there's other post-processing passes that still need to be applied.
//thus we need to write this output to a texture.
int w = ( r_refdef . vrect . width * vid . pixelwidth ) / vid . width ;
int h = ( r_refdef . vrect . height * vid . pixelheight ) / vid . height ;
2015-08-07 17:49:49 +00:00
if ( R2D_Flush )
R2D_Flush ( ) ;
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
GLBE_FBO_Sources ( sourcetex , sourcedepth ) ;
2016-10-22 07:06:51 +00:00
sourcetex = R2D_RT_Configure ( restexname , w , h , TF_RGBA32 , RT_IMAGEFLAGS ) ;
2015-07-06 14:47:46 +00:00
GLBE_FBO_Update ( & fbo_postproc , 0 , & sourcetex , 1 , r_nulltex , w , h , 0 ) ;
2015-08-07 17:49:49 +00:00
R2D_ScalePic ( 0 , 0 , r_refdef . vrect . width , r_refdef . vrect . height , shader ) ;
if ( R2D_Flush )
R2D_Flush ( ) ;
2014-08-19 06:08:23 +00:00
GLBE_RenderToTextureUpdate2d ( true ) ;
}
else
{ //yay, dump it to the screen
//update stuff now that we're not rendering the 3d scene
2015-08-07 17:49:49 +00:00
if ( R2D_Flush )
R2D_Flush ( ) ;
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
GLBE_FBO_Sources ( sourcetex , sourcedepth ) ;
2015-07-14 14:47:00 +00:00
R2D_ScalePic ( r_refdef . vrect . x , r_refdef . vrect . y , r_refdef . vrect . width , r_refdef . vrect . height , shader ) ;
2015-08-07 17:49:49 +00:00
if ( R2D_Flush )
R2D_Flush ( ) ;
2014-08-19 06:08:23 +00:00
}
}
return sourcetex ;
}
2009-07-20 07:45:05 +00:00
2004-08-22 22:29:09 +00:00
/*
= = = = = = = = = = = = = = = =
R_RenderView
r_refdef must be set before the first call
= = = = = = = = = = = = = = = =
*/
void GLR_RenderView ( void )
{
2014-08-03 14:47:47 +00:00
int dofbo = * r_refdef . rt_destcolour [ 0 ] . texname | | * r_refdef . rt_depth . texname ;
2004-08-22 22:29:09 +00:00
double time1 = 0 , time2 ;
2014-08-19 06:08:23 +00:00
texid_t sourcetex = r_nulltex ;
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
texid_t sourcedepth = r_nulltex ;
2014-08-19 06:08:23 +00:00
shader_t * custompostproc = NULL ;
2016-11-25 08:14:54 +00:00
float renderscale ; //extreme, but whatever
2015-08-11 09:14:33 +00:00
int oldfbo = 0 ;
2018-03-04 14:41:16 +00:00
qboolean forcedfb = false ;
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
qboolean fbdepth = false ;
2004-08-22 22:29:09 +00:00
2012-04-24 07:59:11 +00:00
checkglerror ( ) ;
2005-04-26 16:04:12 +00:00
2015-08-11 09:14:33 +00:00
if ( r_norefresh . value | | ! vid . fbpwidth | | ! vid . fbpwidth )
2004-08-22 22:29:09 +00:00
return ;
2014-08-19 06:08:23 +00:00
//when loading/bugged, its possible that the world is still loading.
//in this case, don't act as a wallhack (unless the world is meant to be hidden anyway)
2014-03-31 17:06:41 +00:00
if ( ! ( r_refdef . flags & RDF_NOWORLDMODEL ) )
2014-02-07 08:38:40 +00:00
{
//FIXME: fbo stuff
2021-12-20 10:06:43 +00:00
if ( ! r_worldentity . model | | ! cl . worldmodel )
r_refdef . flags | = RDF_NOWORLDMODEL ;
else if ( r_worldentity . model - > loadstate ! = MLS_LOADED | | ! cl . worldmodel )
2005-01-17 17:44:54 +00:00
{
2013-10-08 14:28:11 +00:00
GL_Set2D ( false ) ;
R2D_ImageColours ( 0 , 0 , 0 , 1 ) ;
R2D_FillBlock ( r_refdef . vrect . x , r_refdef . vrect . y , r_refdef . vrect . width , r_refdef . vrect . height ) ;
R2D_ImageColours ( 1 , 1 , 1 , 1 ) ;
2004-08-22 22:29:09 +00:00
return ;
2005-01-17 17:44:54 +00:00
}
2004-08-22 22:29:09 +00:00
// Sys_Error ("R_RenderView: NULL worldmodel");
2014-02-07 08:38:40 +00:00
}
2004-08-22 22:29:09 +00:00
2014-08-19 06:08:23 +00:00
//check if we're underwater (this also limits damage from stereo wallhacks).
Surf_SetupFrame ( ) ;
2016-01-18 05:22:07 +00:00
r_refdef . flags & = ~ ( RDF_ALLPOSTPROC | RDF_RENDERSCALE ) ;
2014-08-19 06:08:23 +00:00
2016-11-25 08:14:54 +00:00
if ( dofbo | | ( r_refdef . flags & RDF_NOWORLDMODEL ) )
renderscale = 1 ;
else
{
renderscale = r_renderscale . value ;
2014-08-25 07:35:41 +00:00
if ( R_CanBloom ( ) )
r_refdef . flags | = RDF_BLOOM ;
2016-11-25 08:14:54 +00:00
}
2014-08-19 06:08:23 +00:00
//check if we can do underwater warp
if ( cls . protocol ! = CP_QUAKE2 ) //quake2 tells us directly
{
if ( r_viewcontents & FTECONTENTS_FLUID )
r_refdef . flags | = RDF_UNDERWATER ;
else
r_refdef . flags & = ~ RDF_UNDERWATER ;
}
if ( r_refdef . flags & RDF_UNDERWATER )
{
2015-07-03 02:07:41 +00:00
extern cvar_t r_projection ;
if ( ! r_waterwarp . value | | r_projection . ival )
2014-08-19 06:08:23 +00:00
r_refdef . flags & = ~ RDF_UNDERWATER ; //no warp at all
else if ( r_waterwarp . value > 0 & & scenepp_waterwarp )
r_refdef . flags | = RDF_WATERWARP ; //try fullscreen warp instead if we can
}
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
if ( ! r_refdef . globalfog . density )
{
2019-10-18 08:37:38 +00:00
int fogtype = ( ( r_refdef . flags & RDF_UNDERWATER ) & & cl . fog [ FOGTYPE_WATER ] . density ) ? FOGTYPE_WATER : FOGTYPE_AIR ;
Reworked client support for DPP5+. less code now, its much more graceful.
added waterfog command. waterfog overrides regular fog only when the view is in water.
fixed 64bit printf format specifiers. should work better on winxp64.
fixed some spec angle weirdness.
fixed viewsize 99.99 weirdness with ezhud.
fixed extra offset on the console (exhibited in 64bit builds, but not limited to).
fixed .avi playback, can now actually display frames again.
reimplemented line sparks.
fixed r_editlights_save flipping the light's pitch.
fixed issue with oggs failing to load.
fixed condump to cope with unicode properly.
made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision.
fixed nq server to not stall weirdly on map changes.
fixed qwprogs svc_cdtrack not bugging out with nq clients on the server.
fixed restart command to load the last map run by the server, instead of start.bsp (when idle)
optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now.
fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised).
fixed a couple of bugs from font change. also now supports utf-8 in a few more places.
r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little).
fixed so corona-only lights won't generate shadowmaps and waste lots of time.
removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet.
fixed nested calls with variant-vectors. this fixes csaddon's light editor.
fixed qcc hc calling conventions using redundant stores.
disabled keywords can still be used by using __keyword instead.
fixed ftegccgui grep feature.
fixed motionless-dog qcc bug.
tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings.
fixed qw svc_intermission + dpp5+ clients bug.
fixed annoying spam about disconnecting in hexen2.
rewrote status command a little to cope with ipv6 addresses more gracefully
fixed significant stall when hibernating/debugging a server with a player sitting on it.
fixed truelightning.
fixed rocketlight overriding pflags.
fixed torches vanishing on vid_restart.
fixed issue with decal scaling.
fixed findentityfield builtin.
fixed fteqcc issue with ptr+1
fixed use of arrays inside class functions.
fixed/implemented fteqcc emulation of pointer opcodes.
added __inout keyword to fteqcc, so that it doesn't feel so horrendous.
fixed sizeof(*foo)
fixed *struct = struct;
fixed recursive structs.
fixed fteqcc warning report.
fixed sdl2 controller support, hopefully.
attempted to implement xinput, including per-player audio playback.
slightly fixed relaxed attitude to mouse focus when running fullscreen.
fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors.
implemented bindmaps (for csqc).
fixed crashing bug with eprint builtin.
implemented subset of music_playlist_* functionality. significant changes to music playback.
fixed some more dpcsqc compat.
fixed binds menu. now displays and accepts modifiers.
fixed issues with huge lightmaps.
fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests.
implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh.
implemented sv_saveentfile command.
fixed resume after breaking inside a stepped-over function.
fixed erroneous footer after debugging.
(I wonder just how many things I broke with these fixes)
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-07-26 10:56:18 +00:00
CL_BlendFog ( & r_refdef . globalfog , & cl . oldfog [ fogtype ] , realtime , & cl . fog [ fogtype ] ) ;
r_refdef . globalfog . density / = 64 ; //FIXME
}
2018-08-13 06:27:29 +00:00
if ( ! ( r_refdef . flags & RDF_NOWORLDMODEL ) )
2014-08-19 06:08:23 +00:00
{
2018-08-13 06:27:29 +00:00
if ( r_fxaa . ival )
r_refdef . flags | = RDF_ANTIALIAS ;
if ( * r_postprocshader . string )
2021-06-22 14:40:53 +00:00
custompostproc = R_RegisterCustom ( NULL , r_postprocshader . string , SUF_NONE , NULL , NULL ) ;
2018-08-13 06:27:29 +00:00
else if ( ! r_graphics . ival )
custompostproc = R_RegisterShader ( " postproc_ascii " , 0 ,
" { \n "
" program postproc_ascii \n "
" affine \n "
" { \n "
" map $sourcecolour \n "
" nodepthtest \n "
" } \n "
" } \n "
) ;
2014-08-19 06:08:23 +00:00
if ( custompostproc )
r_refdef . flags | = RDF_CUSTOMPOSTPROC ;
2018-08-13 06:27:29 +00:00
if ( r_hdr_framebuffer . ival & & ! ( vid . flags & VID_FP16 ) ) //primary use of this cvar is to fix q3shader overbrights (so bright lightmaps can oversaturate then drop below 1 by modulation with the lightmap
forcedfb = true ;
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
if ( custompostproc )
{
int i ;
for ( i = 0 ; i < custompostproc - > numpasses ; i + + )
if ( custompostproc - > passes [ i ] . texgen = = T_GEN_SOURCEDEPTH )
{
fbdepth = true ;
break ;
}
}
2019-04-07 16:41:09 +00:00
if ( vid_hardwaregamma . ival = = 4 & & ( v_gamma . value ! = 1 | | v_contrast . value ! = 1 | | v_contrastboost . value ! = 1 | | v_brightness . value ! = 0 ) )
2018-08-13 06:27:29 +00:00
r_refdef . flags | = RDF_SCENEGAMMA ;
}
2018-03-04 14:41:16 +00:00
2014-08-19 06:08:23 +00:00
//disable stuff if its simply not supported.
2014-10-11 19:39:45 +00:00
if ( dofbo | | ! gl_config . arb_shader_objects | | ! gl_config . ext_framebuffer_objects | | ! sh_config . texture_non_power_of_two_pic )
2018-03-04 14:41:16 +00:00
{
forcedfb & = ! dofbo & & gl_config . ext_framebuffer_objects & & sh_config . texture_non_power_of_two_pic ;
2014-08-19 06:08:23 +00:00
r_refdef . flags & = ~ ( RDF_ALLPOSTPROC ) ; //block all of this stuff
2018-03-04 14:41:16 +00:00
}
if ( dofbo )
forcedfb = false ;
2018-06-02 08:55:57 +00:00
else if ( renderscale ! = 1 )
2018-11-19 06:37:25 +00:00
forcedfb = gl_config . ext_framebuffer_objects & & sh_config . texture_non_power_of_two_pic ;
2014-08-19 06:08:23 +00:00
2014-02-07 08:38:40 +00:00
BE_Scissor ( NULL ) ;
if ( dofbo )
{
unsigned int flags = 0 ;
2014-08-03 14:47:47 +00:00
texid_t col [ R_MAX_RENDERTARGETS ] , depth = r_nulltex ;
2014-02-07 08:38:40 +00:00
unsigned int cw = 0 , ch = 0 , dw = 0 , dh = 0 ;
2014-08-03 14:47:47 +00:00
int mrt ;
2018-11-19 06:37:25 +00:00
if ( ! gl_config . ext_framebuffer_objects & & sh_config . texture_non_power_of_two_pic )
{
Con_DPrintf ( CON_WARNING " Render targets are not supported on this gpu. \n " ) ;
return ; //not supported on this gpu. you'll just get black textures or something.
}
2014-02-07 08:38:40 +00:00
//3d views generally ignore source colour+depth.
//FIXME: support depth with no colour
2014-08-03 14:47:47 +00:00
for ( mrt = 0 ; mrt < R_MAX_RENDERTARGETS ; mrt + + )
{
if ( * r_refdef . rt_destcolour [ mrt ] . texname )
2014-08-15 02:20:41 +00:00
{
2014-08-03 14:47:47 +00:00
col [ mrt ] = R2D_RT_GetTexture ( r_refdef . rt_destcolour [ mrt ] . texname , & cw , & ch ) ;
2014-08-15 02:20:41 +00:00
if ( ! TEXVALID ( col [ mrt ] ) )
break ;
}
2014-08-03 14:47:47 +00:00
else
{
col [ mrt ] = r_nulltex ;
break ;
}
}
if ( * r_refdef . rt_depth . texname )
depth = R2D_RT_GetTexture ( r_refdef . rt_depth . texname , & dw , & dh ) ;
2014-02-07 08:38:40 +00:00
2014-08-03 14:47:47 +00:00
if ( mrt )
2014-02-07 08:38:40 +00:00
{ //colour (with or without depth)
2014-09-20 04:11:39 +00:00
if ( * r_refdef . rt_depth . texname & & ( dw ! = cw | | dh ! = ch ) )
2014-02-07 08:38:40 +00:00
{
Con_Printf ( " RT: destcolour and depth render targets are of different sizes \n " ) ; //should check rgb/depth modes too I guess.
depth = r_nulltex ;
}
vid . fbvwidth = vid . fbpwidth = cw ;
vid . fbvheight = vid . fbpheight = ch ;
}
else
{ //depth, with no colour
vid . fbvwidth = vid . fbpwidth = dw ;
vid . fbvheight = vid . fbpheight = dh ;
}
if ( TEXVALID ( depth ) )
flags | = FBO_TEX_DEPTH ;
else
flags | = FBO_RB_DEPTH ;
2015-08-11 09:14:33 +00:00
oldfbo = GLBE_FBO_Update ( & fbo_gameview , flags , col , mrt , depth , vid . fbpwidth , vid . fbpheight , 0 ) ;
2014-02-07 08:38:40 +00:00
}
2018-03-04 14:41:16 +00:00
else if ( ( r_refdef . flags & ( RDF_ALLPOSTPROC ) ) | | forcedfb )
2014-08-19 06:08:23 +00:00
{
2018-07-05 16:21:44 +00:00
unsigned int rtflags = IF_NOMIPMAP | IF_CLAMP | IF_RENDERTARGET | IF_NOSRGB ;
2018-03-04 14:41:16 +00:00
enum uploadfmt fmt ;
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
unsigned int fboflags = 0 ;
2016-11-20 20:52:41 +00:00
2015-08-28 03:13:45 +00:00
r_refdef . flags | = RDF_RENDERSCALE ;
2014-08-19 06:08:23 +00:00
//the game needs to be drawn to a texture for post processing
2015-08-11 09:14:33 +00:00
if ( 1 ) //vid.framebuffer)
{
vid . fbpwidth = ( r_refdef . vrect . width * r_refdef . pxrect . width ) / vid . width ;
2015-08-28 03:13:45 +00:00
vid . fbpheight = ( r_refdef . vrect . height * r_refdef . pxrect . height ) / vid . height ;
2015-08-11 09:14:33 +00:00
}
else
{
vid . fbpwidth = ( r_refdef . vrect . width * vid . pixelwidth ) / vid . width ;
vid . fbpheight = ( r_refdef . vrect . height * vid . pixelheight ) / vid . height ;
}
2015-07-14 14:47:00 +00:00
2016-11-20 20:52:41 +00:00
if ( renderscale < 0 )
{
renderscale = - renderscale ;
rtflags | = IF_NEAREST ;
vid . fbpwidth * = renderscale ;
vid . fbpheight * = renderscale ;
}
else
{
rtflags | = IF_LINEAR ;
vid . fbpwidth * = renderscale ;
vid . fbpheight * = renderscale ;
}
2015-07-14 14:47:00 +00:00
//well... err... meh.
2017-12-28 16:24:50 +00:00
vid . fbpwidth = bound ( 1 , vid . fbpwidth , sh_config . texture2d_maxsize ) ;
vid . fbpheight = bound ( 1 , vid . fbpheight , sh_config . texture2d_maxsize ) ;
2015-07-14 14:47:00 +00:00
vid . fbvwidth = vid . fbpwidth ;
vid . fbvheight = vid . fbpheight ;
2014-08-19 06:08:23 +00:00
2018-03-04 14:41:16 +00:00
fmt = PTI_RGBA8 ;
2019-03-01 22:39:30 +00:00
if ( r_hdr_framebuffer . ival < 0 )
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
{ //cvar change handler will set ival negative if it matches a known format name, doesn't mean its supported.
2019-03-01 22:39:30 +00:00
fmt = - r_hdr_framebuffer . ival ;
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
if ( fmt > = PTI_FIRSTCOMPRESSED | | ! sh_config . texfmt [ fmt ] )
2019-03-01 22:39:30 +00:00
fmt = PTI_RGB565 ;
}
else if ( ( r_refdef . flags & RDF_SCENEGAMMA ) | | ( vid . flags & ( VID_SRGBAWARE | VID_FP16 ) ) | | r_hdr_framebuffer . ival )
2018-03-04 14:41:16 +00:00
{ //gamma ramps really need higher colour precision, otherwise the entire thing looks terrible.
Too many changes, sorry.
Change revision displays, use the SVN commit date instead of using __DATE__ (when there's no local changes). This should allow reproducible builds.
Added s_al_disable cvar, to block openal and all the various problems people have had with it, without having to name an explicit fallback (which would vary by system).
Add mastervolume cvar (for ss).
Add r_shadows 2 (aka fake shadows - for ss).
Add scr_loadingscreen_aspect -1 setting, to disable levelshots entirely, also disables the progress bar (for ss).
Better support for some effectinfo hacks (for ss).
Added dpcompat_nocsqcwarnings (because of lazy+buggy mods like ss).
Rework the dpcsqc versions of project+unproject builtins for better compat (for ss).
Added dpcompat_csqcinputeventtypes to block unexpected csqc input events (for ss).
Better compat with DP's loadfont console command (for ss).
Added dpcompat_smallerfonts cvar to replicate a DP bug (for ss).
Detect dp's m_draw extension, to work around it (for ss).
Cvar dpcompat_ignoremodificationtimes added. A value of 0 favour the most recently modified file, 1 will use DP-like alphabetically sorted preferences (for ss).
loadfont builtin can now accept outline=1 in the sizes arg for slightly more readable fonts.
Fix bbox calcs for rotated entities, fix needed for r_ignorenetpvs 0.
Hackily parse emoji.json to provide :poop: etc suggestions.
Skip prediction entirely when there's no local entity info. This fixes stair-smoothing in xonotic.
screenshot_cubemap will now capture half-float images when saving to ktx or dds files.
Fix support for xcf files larger than 4gb, mostly to avoid compiler warnings.
Fixed size of gfx/loading.lmp when replacement textures are used.
Added mipmap support for rg8 and l8a8 textures.
r_hdr_framebuffer cvar updated to support format names instead of random negative numbers. Description updated to name some interesting ones.
Perform autoupdate _checks_ ONLY with explicit user confirmation (actual updating already needed user confirmation, but this extra step should reduce the chances of us getting wrongly accused of exfiltrating user data if we're run in a sandbox - we ONLY ever included the updating engine's version in the checks, though there's nothing we can do to avoid sending the user's router's IP).
Removed the 'summon satan all over your harddrive' quit message, in case paranoid security researchers are idiots and don't bother doing actual research.
Removed the triptohell.info and fte.triptohell.info certificates, they really need to stop being self-signed. The updates domain is still self-signed for autoupdates.
Video drivers are now able to report supported video resolutions, visible to menuqc. Currently only works with SDL2 builds.
Added setmousepos builtin. Should work with glx+win32 build.
VF_SKYROOM_CAMERA can now accept an extra two args, setviewprop(VF_SKYROOM_CAMERA, org, axis, degrees).
Removed v_skyroom_origin+v_skyroom_orientation cvars in favour just v_skyroom, which should make it behave more like the 'fog' command (used when csqc isn't overriding).
Added R_EndPolygonRibbon builtin to make it faster+easier to generate textured ribbon/cable/etc wide lines (for TW).
sdl: Fix up sys_sdl.c's file enumeration to support wildcards in directories.
edit command now displays end1.bin/end2.bin correctly, because we can.
Finally add support for f_modified - though ruleset_allow_larger_models and ruleset_allow_overlong_sounds generally make it redundant.
Fix threading race condition in sha1 lookups.
Updated f_ruleset to include the same extra flags reported by ezquake.
A mod's default.fmf file can now contain an eg 'mainconfig config.cfg' line (to explicitly set the main config saved with cfg_save_auto 1 etc).
fmf: basegame steam:GameName/GameDir can be used to try to load a mod directory from an installed steam game. The resulting gamedir will be read-only.
HOMEDIR CHANGE: use homedirs only if the basedir cannot be written or a homedir already exists, which should further reduce the probability of microsoft randomly uploading our data to their cloud (but mostly because its annoying to never know where your data is written).
Fixed buf_cvarlist, should work in xonotic now, and without segfaults.
Added an extra arg to URI_Get_Callback calls - the response size, also changed the tempstring to contain all bytes of the response, you need to be careful about nulls though.
Try to work around nvidia's forced-panning bug on x11 when changing video modes. This might screw with other programs.
sdl: support custom icons.
sdl: support choosing a specific display.
Added some documentation to menuqc builtins.
menusys: use outlines for slightly more readable fonts.
menusys: switch vid_width and vid_height combos into a single video mode combo to set both according to reported video modes.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5581 fc73d0e0-1445-4013-8a0c-d673dee63da5
2019-11-20 03:09:50 +00:00
if ( sh_config . texfmt [ PTI_B10G11R11F ] )
fmt = PTI_B10G11R11F ;
else if ( sh_config . texfmt [ PTI_RGBA16F ] )
2018-03-04 14:41:16 +00:00
fmt = PTI_RGBA16F ;
else if ( sh_config . texfmt [ PTI_A2BGR10 ] )
fmt = PTI_A2BGR10 ;
}
sourcetex = R2D_RT_Configure ( " rt/$lastgameview " , vid . fbpwidth , vid . fbpheight , fmt , rtflags ) ;
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
if ( fbdepth )
{
if ( sh_config . texfmt [ PTI_DEPTH24_8 ] & & ! r_shadow_shadowmapping . ival )
fmt = PTI_DEPTH24_8 ;
else if ( sh_config . texfmt [ PTI_DEPTH32 ] )
fmt = PTI_DEPTH32 ;
else
fmt = PTI_DEPTH16 ;
}
else
fmt = PTI_INVALID ;
sourcedepth = ( fmt ! = PTI_INVALID ) ? R2D_RT_Configure ( " rt/$lastgameviewdepth " , vid . fbpwidth , vid . fbpheight , fmt , rtflags ) : r_nulltex ;
if ( sourcedepth )
fboflags = FBO_TEX_DEPTH ;
else
fboflags = FBO_RB_DEPTH ;
2014-08-19 06:08:23 +00:00
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
oldfbo = GLBE_FBO_Update ( & fbo_gameview , fboflags , & sourcetex , 1 , sourcedepth , vid . fbpwidth , vid . fbpheight , 0 ) ;
2014-08-19 06:08:23 +00:00
dofbo = true ;
}
2015-08-11 09:14:33 +00:00
else if ( vid . framebuffer )
{
vid . fbvwidth = vid . width ;
vid . fbvheight = vid . height ;
vid . fbpwidth = vid . framebuffer - > width ;
vid . fbpheight = vid . framebuffer - > height ;
}
2014-08-19 06:08:23 +00:00
else
2014-02-07 08:38:40 +00:00
{
vid . fbvwidth = vid . width ;
vid . fbvheight = vid . height ;
vid . fbpwidth = vid . pixelwidth ;
vid . fbpheight = vid . pixelheight ;
}
2014-10-14 16:42:48 +00:00
r_refdef . flipcull = 0 ;
2004-08-22 22:29:09 +00:00
if ( qglPNTrianglesiATI )
{
2010-02-06 01:25:04 +00:00
if ( gl_ati_truform_type . ival )
2004-08-22 22:29:09 +00:00
{ //linear
qglPNTrianglesiATI ( GL_PN_TRIANGLES_NORMAL_MODE_ATI , GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI ) ;
qglPNTrianglesiATI ( GL_PN_TRIANGLES_POINT_MODE_ATI , GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI ) ;
}
else
{ //quadric
qglPNTrianglesiATI ( GL_PN_TRIANGLES_NORMAL_MODE_ATI , GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI ) ;
qglPNTrianglesiATI ( GL_PN_TRIANGLES_POINT_MODE_ATI , GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI ) ;
}
2017-02-11 16:14:06 +00:00
qglPNTrianglesfATI ( GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI , r_tessellation_level . value ) ;
2004-08-22 22:29:09 +00:00
}
2009-11-04 21:16:50 +00:00
if ( gl_finish . ival )
2004-08-22 22:29:09 +00:00
{
2004-12-15 19:53:30 +00:00
RSpeedMark ( ) ;
2005-01-07 03:03:56 +00:00
qglFinish ( ) ;
2016-07-12 00:40:13 +00:00
RSpeedEnd ( RSPEED_SUBMIT ) ;
2004-12-15 19:53:30 +00:00
}
2009-11-04 21:16:50 +00:00
if ( r_speeds . ival )
2004-12-15 19:53:30 +00:00
{
2004-08-22 22:29:09 +00:00
time1 = Sys_DoubleTime ( ) ;
}
2016-01-18 05:22:07 +00:00
if ( ! ( r_refdef . flags & RDF_NOWORLDMODEL ) & & R_RenderScene_Cubemap ( ) )
2014-12-08 21:18:32 +00:00
{
}
else
2009-07-20 07:45:05 +00:00
{
2009-11-04 21:16:50 +00:00
GL_SetShaderState2D ( false ) ;
2015-01-07 13:34:05 +00:00
R_Clear ( dofbo ) ;
2004-08-22 22:29:09 +00:00
2009-07-19 18:13:03 +00:00
// GLR_SetupFog ();
2006-06-02 17:42:36 +00:00
2009-07-19 18:13:03 +00:00
// render normal view
2009-07-20 02:50:00 +00:00
R_RenderScene ( ) ;
2009-07-19 18:13:03 +00:00
}
2004-08-22 22:29:09 +00:00
2006-06-02 17:42:36 +00:00
// qglDisable(GL_FOG);
2004-08-22 22:29:09 +00:00
2009-11-04 21:16:50 +00:00
if ( r_speeds . ival )
2004-08-22 22:29:09 +00:00
{
// glFinish ();
time2 = Sys_DoubleTime ( ) ;
2004-12-15 19:53:30 +00:00
RQuantAdd ( RQUANT_MSECS , ( int ) ( ( time2 - time1 ) * 1000000 ) ) ;
2009-07-20 02:50:00 +00:00
// Con_Printf ("%3i ms %4i wpoly %4i epoly\n", (int)((time2-time1)*1000), c_brush_polys, c_alias_polys);
2004-08-22 22:29:09 +00:00
}
2005-01-12 22:15:50 +00:00
2012-04-24 07:59:11 +00:00
checkglerror ( ) ;
2005-04-26 16:04:12 +00:00
2014-02-07 08:38:40 +00:00
//update stuff now that we're not rendering the 3d scene
if ( dofbo )
2015-08-11 09:14:33 +00:00
GLBE_FBO_Pop ( oldfbo ) ;
GLBE_RenderToTextureUpdate2d ( false ) ;
GL_Set2D ( false ) ;
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
2005-01-12 22:15:50 +00:00
// SCENE POST PROCESSING
2005-05-27 08:24:31 +00:00
2018-03-04 14:41:16 +00:00
if ( forcedfb & & ! ( r_refdef . flags & RDF_ALLPOSTPROC ) )
2015-07-14 14:47:00 +00:00
{
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
GLBE_FBO_Sources ( sourcetex , sourcedepth ) ;
2015-07-14 14:47:00 +00:00
R2D_Image ( r_refdef . vrect . x , r_refdef . vrect . y , r_refdef . vrect . width , r_refdef . vrect . height , 0 , 1 , 1 , 0 , scenepp_rescaled ) ;
}
else
{
2018-03-04 14:41:16 +00:00
if ( r_refdef . flags & RDF_SCENEGAMMA )
{
2019-04-07 16:41:09 +00:00
R2D_ImageColours ( v_gammainverted . ival ? v_gamma . value : ( 1 / v_gamma . value ) , v_contrast . value , v_brightness . value , v_contrastboost . value ) ;
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
sourcetex = R_RenderPostProcess ( sourcetex , sourcedepth , RDF_SCENEGAMMA , scenepp_gamma , " rt/$gammaed " ) ;
2018-03-04 14:41:16 +00:00
R2D_ImageColours ( 1 , 1 , 1 , 1 ) ;
}
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
sourcetex = R_RenderPostProcess ( sourcetex , sourcedepth , RDF_WATERWARP , scenepp_waterwarp , " rt/$waterwarped " ) ;
sourcetex = R_RenderPostProcess ( sourcetex , sourcedepth , RDF_CUSTOMPOSTPROC , custompostproc , " rt/$postproced " ) ;
sourcetex = R_RenderPostProcess ( sourcetex , sourcedepth , RDF_ANTIALIAS , scenepp_antialias , " rt/$antialiased " ) ;
2015-07-14 14:47:00 +00:00
if ( r_refdef . flags & RDF_BLOOM )
R_BloomBlend ( sourcetex , r_refdef . vrect . x , r_refdef . vrect . y , r_refdef . vrect . width , r_refdef . vrect . height ) ;
}
2005-05-27 08:24:31 +00:00
2015-08-07 17:49:49 +00:00
if ( R2D_Flush )
R2D_Flush ( ) ;
2014-08-19 06:08:23 +00:00
GLBE_FBO_Sources ( r_nulltex , r_nulltex ) ;
2010-08-29 13:49:43 +00:00
2015-05-14 03:06:58 +00:00
if ( gl_motionblur . value > 0 & & gl_motionblur . value < 1 & & qglCopyTexImage2D )
R_RenderMotionBlur ( ) ;
2011-12-23 03:12:29 +00:00
2012-04-24 07:59:11 +00:00
checkglerror ( ) ;
2004-08-22 22:29:09 +00:00
}
2004-12-15 19:53:30 +00:00
# endif