- r_tvMode - forces 640x480 rendering no matter what res
- r_retroAA - old 2000 console style anti-aliasing (if you can call it that) - XMP uses mixer's sample rate.
This commit is contained in:
@@ -22,6 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
int xmpspeed = 22050; // assume 22050hz unless........
|
||||
#ifdef USE_CODEC_XMP
|
||||
|
||||
// includes for the Q3 sound system
|
||||
@@ -42,6 +43,7 @@ void sound_deinit(void);
|
||||
|
||||
|
||||
|
||||
|
||||
extern int samplingrate; // from snd_dma
|
||||
|
||||
void S_XMP_StartSong ( void ){
|
||||
@@ -131,7 +133,7 @@ snd_stream_t *S_XMP_CodecOpenStream(const char *filename)
|
||||
FS_FCloseFile(file); // unfortunately these do not help with the leak
|
||||
|
||||
if (itsloaded == 0)
|
||||
itsloaded = xmp_start_player(xmpsong, 44100, 0); // TODO: do sample rate of the mixer.
|
||||
itsloaded = xmp_start_player(xmpsong, xmpspeed, 0); // TODO: do sample rate of the mixer.
|
||||
|
||||
if (itsloaded == 0){
|
||||
|
||||
@@ -148,7 +150,7 @@ snd_stream_t *S_XMP_CodecOpenStream(const char *filename)
|
||||
rv->info.size = 1337; // This doesn't matter!
|
||||
rv->pos = 0;
|
||||
|
||||
rv->info.rate = 44100;
|
||||
rv->info.rate = xmpspeed;
|
||||
rv->info.width = 2;
|
||||
rv->info.channels = 2;
|
||||
rv->info.samples = 12;
|
||||
|
@@ -50,6 +50,7 @@ static qboolean enumeration_all_ext = qfalse;
|
||||
#ifdef USE_VOIP
|
||||
static qboolean capture_ext = qfalse;
|
||||
#endif
|
||||
extern int xmpspeed; // leilei
|
||||
|
||||
/*
|
||||
=================
|
||||
@@ -2517,6 +2518,9 @@ qboolean S_AL_Init( soundInterface_t *si )
|
||||
s_alInputDevice = Cvar_Get( "s_alInputDevice", "", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
s_alDevice = Cvar_Get("s_alDevice", "", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
|
||||
|
||||
xmpspeed = 48000; // leilei - force it to 48000 which is the native mixing rate post-ac'97
|
||||
|
||||
// Load QAL
|
||||
if( !QAL_Init( s_alDriver->string ) )
|
||||
{
|
||||
|
@@ -1085,17 +1085,36 @@ RB_SetGL2D
|
||||
|
||||
================
|
||||
*/
|
||||
extern int tvWidth;
|
||||
extern int tvHeight;
|
||||
|
||||
void RB_SetGL2D (void) {
|
||||
backEnd.projection2D = qtrue;
|
||||
|
||||
// set 2D virtual screen size
|
||||
|
||||
if (r_tvMode->integer)
|
||||
{
|
||||
qglViewport( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
|
||||
qglScissor( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
|
||||
|
||||
qglMatrixMode(GL_PROJECTION);
|
||||
qglLoadIdentity ();
|
||||
qglOrtho (0, glConfig.vidWidth, glConfig.vidHeight, 0, 0, 1);
|
||||
qglMatrixMode(GL_MODELVIEW);
|
||||
qglLoadIdentity ();
|
||||
}
|
||||
else
|
||||
{
|
||||
qglViewport( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
|
||||
qglScissor( 0, 0, glConfig.vidWidth, glConfig.vidHeight );
|
||||
|
||||
qglMatrixMode(GL_PROJECTION);
|
||||
qglLoadIdentity ();
|
||||
qglOrtho (0, glConfig.vidWidth, glConfig.vidHeight, 0, 0, 1);
|
||||
qglMatrixMode(GL_MODELVIEW);
|
||||
qglLoadIdentity ();
|
||||
}
|
||||
|
||||
qglGetFloatv(GL_PROJECTION_MATRIX, glState.currentProjectionMatrix);
|
||||
qglGetFloatv(GL_MODELVIEW_MATRIX, glState.currentModelViewMatrix);
|
||||
@@ -1484,6 +1503,9 @@ int mpasses; // how many passes of motion blur we should render.
|
||||
|
||||
float motioner;
|
||||
|
||||
void R_TVScreen( void );
|
||||
void R_RetroAAScreen( void );
|
||||
|
||||
void R_MblurScreen( void );
|
||||
void R_MblurScreenPost( void );
|
||||
void RB_UpdateMotionBlur (void){
|
||||
@@ -1580,6 +1602,8 @@ const void *RB_SwapBuffers( const void *data ) {
|
||||
|
||||
|
||||
R_BrightScreen(); // leilei - alternate brightness - do it here so we hit evereything
|
||||
R_RetroAAScreen(); // leilei - then apply 'anti aliasing'
|
||||
R_TVScreen(); // leilei - tv operation comes last, this is a SCREEN
|
||||
|
||||
|
||||
cmd = (const swapBuffersCommand_t *)data;
|
||||
@@ -1623,6 +1647,8 @@ const void *RB_SwapBuffers( const void *data ) {
|
||||
backEnd.doneSurfaces = qfalse;
|
||||
backEnd.doneSun = qfalse;
|
||||
backEnd.doneSunFlare = qfalse;
|
||||
backEnd.donetv = qfalse;
|
||||
backEnd.doneraa = qfalse;
|
||||
|
||||
|
||||
// leilei - artificial slowness (mapper debug) - this might be windows only
|
||||
|
@@ -43,6 +43,12 @@ cvar_t *r_film;
|
||||
extern int force32upload;
|
||||
int leifxmode;
|
||||
int fakeit = 0;
|
||||
|
||||
int tvinterlace = 1;
|
||||
int tvinter= 1;
|
||||
extern int tvWidth;
|
||||
extern int tvHeight;
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
@@ -170,6 +176,19 @@ static struct {
|
||||
int width, height;
|
||||
float readW, readH;
|
||||
} mpass4;
|
||||
struct {
|
||||
image_t *texture;
|
||||
int width, height;
|
||||
float readW, readH;
|
||||
} tv;
|
||||
struct {
|
||||
int width, height;
|
||||
} tvwork;
|
||||
struct {
|
||||
image_t *texture;
|
||||
int width, height;
|
||||
float readW, readH;
|
||||
} tveffect;
|
||||
|
||||
qboolean started;
|
||||
} postproc;
|
||||
@@ -201,6 +220,51 @@ static void ID_INLINE R_Bloom_Quad( int width, int height, float texX, float tex
|
||||
qglEnd ();
|
||||
}
|
||||
|
||||
static void ID_INLINE R_Bloom_QuadTV( int width, int height, float texX, float texY, float texWidth, float texHeight, int aa ) {
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
float raa = r_retroAA->value;
|
||||
if (raa < 1) raa = 1;
|
||||
|
||||
float xpix = 1.0f / width / (4 / raa);
|
||||
float ypix = 1.0f / height / (4 / raa);
|
||||
float xaa;
|
||||
float yaa;
|
||||
x = 0;
|
||||
y = 0;
|
||||
|
||||
if (aa == 0){ xaa = 0; yaa = 0; }
|
||||
if (aa == 1){ xaa = -xpix; yaa = ypix; }
|
||||
if (aa == 2){ xaa = -xpix; yaa = -ypix; }
|
||||
if (aa == 3){ xaa = xpix; yaa = -ypix; }
|
||||
if (aa == 4){ xaa = xpix; yaa = ypix; }
|
||||
|
||||
//y += tvHeight - height;
|
||||
width += x;
|
||||
height += y;
|
||||
|
||||
texWidth += texX;
|
||||
texHeight += texY;
|
||||
|
||||
if (!aa){
|
||||
qglViewport( 0, 0, tvWidth, tvHeight );
|
||||
qglScissor( 0, 0, tvWidth, tvHeight );
|
||||
}
|
||||
qglBegin( GL_QUADS );
|
||||
//GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE );
|
||||
if (aa)
|
||||
qglColor4f( 0.25, 0.25, 0.25, 1 );
|
||||
qglTexCoord2f( texX + xaa, texHeight + yaa);
|
||||
qglVertex2f( x, y );
|
||||
qglTexCoord2f( texX + xaa, texY + yaa );
|
||||
qglVertex2f( x, height );
|
||||
qglTexCoord2f( texWidth + xaa, texY + yaa );
|
||||
qglVertex2f( width, height );
|
||||
qglTexCoord2f( texWidth + xaa, texHeight + yaa );
|
||||
qglVertex2f( width, y );
|
||||
qglEnd ();
|
||||
}
|
||||
|
||||
// LEILEI - Bloom Reflection
|
||||
|
||||
|
||||
@@ -339,6 +403,34 @@ static void R_Postprocess_InitTextures( void )
|
||||
postproc.screen.texture = R_CreateImage( "***postproc screen texture***", data, postproc.screen.width, postproc.screen.height, qfalse, qfalse, GL_CLAMP_TO_EDGE );
|
||||
ri.Hunk_FreeTempMemory( data );
|
||||
|
||||
// leilei - tv output texture
|
||||
|
||||
if (r_tvMode->integer){
|
||||
// find closer power of 2 to screen size
|
||||
for (postproc.tv.width = 1;postproc.tv.width< tvWidth;postproc.tv.width *= 2);
|
||||
for (postproc.tv.height = 1;postproc.tv.height < tvHeight;postproc.tv.height *= 2);
|
||||
|
||||
postproc.tv.readW = tvWidth / (float)postproc.tv.width;
|
||||
postproc.tv.readH = tvHeight / (float)postproc.tv.height;
|
||||
|
||||
// find closer power of 2 to effect size
|
||||
postproc.tvwork.width = r_bloom_sample_size->integer;
|
||||
postproc.tvwork.height = postproc.tvwork.width * ( tvWidth / tvHeight );
|
||||
|
||||
for (postproc.tveffect.width = 1;postproc.tveffect.width < postproc.tvwork.width;postproc.tveffect.width *= 2);
|
||||
for (postproc.tveffect.height = 1;postproc.tveffect.height < postproc.tvwork.height;postproc.tveffect.height *= 2);
|
||||
|
||||
postproc.tveffect.readW = postproc.tvwork.width / (float)postproc.tveffect.width;
|
||||
postproc.tveffect.readH = postproc.tvwork.height / (float)postproc.tveffect.height;
|
||||
|
||||
|
||||
|
||||
data = ri.Hunk_AllocateTempMemory( tvWidth * tvHeight * 4 );
|
||||
Com_Memset( data, 0, tvWidth * tvHeight * 4 );
|
||||
postproc.tv.texture = R_CreateImage( "***tv output screen texture***", data, tvWidth, tvHeight, qfalse, qfalse, GL_CLAMP_TO_EDGE );
|
||||
ri.Hunk_FreeTempMemory( data );
|
||||
}
|
||||
|
||||
// leilei - motion blur textures!
|
||||
|
||||
if (r_motionblur->integer){
|
||||
@@ -682,6 +774,13 @@ static void R_Postprocess_BackupScreen( void ) {
|
||||
|
||||
}
|
||||
|
||||
static void R_Postprocess_BackupScreenTV( void ) {
|
||||
|
||||
GL_Bind( postproc.screen.texture );
|
||||
qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, tvinter, glConfig.vidWidth, glConfig.vidHeight);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// leilei - motion blur hack
|
||||
void R_MotionBlur_BackupScreen(int which) {
|
||||
@@ -744,6 +843,7 @@ static void R_Bloom_RestoreScreen_Postprocessed( void ) {
|
||||
if (leifxmode == 778){ if (vertexShaders) R_GLSL_UseProgram(tr.motionBlurProgram); program=tr.programs[tr.motionBlurProgram];}
|
||||
if (leifxmode == 779){ if (vertexShaders) R_GLSL_UseProgram(tr.motionBlurPostProgram); program=tr.programs[tr.motionBlurPostProgram];}
|
||||
if (leifxmode == 666){ if (vertexShaders) R_GLSL_UseProgram(tr.BrightnessProgram); program=tr.programs[tr.BrightnessProgram];}
|
||||
if (leifxmode == 1236){ if (vertexShaders) R_GLSL_UseProgram(tr.CRTProgram); program=tr.programs[tr.CRTProgram];}
|
||||
|
||||
}
|
||||
else
|
||||
@@ -760,6 +860,10 @@ static void R_Bloom_RestoreScreen_Postprocessed( void ) {
|
||||
|
||||
if (program->u_ScreenToNextPixelY > -1) R_GLSL_SetUniform_u_ScreenToNextPixelY(program, (float)1.0/(float)glConfig.vidHeight);
|
||||
|
||||
// leilei - for TV shaders
|
||||
// if (program->u_ActualScreenSizeX > -1) R_GLSL_SetUniform_u_ActualScreenSizeX(program, tvWidth);
|
||||
|
||||
// if (program->u_ActualScreenSizeY > -1) R_GLSL_SetUniform_u_ActualScreenSizeY(program, tvHeight);
|
||||
|
||||
|
||||
|
||||
@@ -817,9 +921,33 @@ static void R_Bloom_RestoreScreen_Postprocessed( void ) {
|
||||
|
||||
// if (leifxmode == 778)
|
||||
// return;
|
||||
if (leifxmode == 1234){
|
||||
{
|
||||
R_Bloom_QuadTV( glConfig.vidWidth, glConfig.vidHeight, 0, 0, postproc.screen.readW,postproc.screen.readH, 0 );
|
||||
}
|
||||
}
|
||||
else if (leifxmode == 1236){
|
||||
{
|
||||
R_Bloom_QuadTV( glConfig.vidWidth, glConfig.vidHeight, 0, 0, postproc.screen.readW,postproc.screen.readH, 0 );
|
||||
}
|
||||
}
|
||||
else if (leifxmode == 1233){
|
||||
|
||||
|
||||
R_Bloom_QuadTV( glConfig.vidWidth, glConfig.vidHeight, 0, 0, postproc.screen.readW,postproc.screen.readH, 1 );
|
||||
GL_SelectTexture(0);
|
||||
GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ONE );
|
||||
GL_Bind( postproc.screen.texture );
|
||||
R_Bloom_QuadTV( glConfig.vidWidth, glConfig.vidHeight, 0, 0, postproc.screen.readW,postproc.screen.readH, 2 );
|
||||
R_Bloom_QuadTV( glConfig.vidWidth, glConfig.vidHeight, 0, 0, postproc.screen.readW,postproc.screen.readH, 3 );
|
||||
R_Bloom_QuadTV( glConfig.vidWidth, glConfig.vidHeight, 0, 0, postproc.screen.readW,postproc.screen.readH, 4 );
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
R_Bloom_Quad( glConfig.vidWidth, glConfig.vidHeight, 0, 0,
|
||||
postproc.screen.readW,postproc.screen.readH );
|
||||
|
||||
}
|
||||
if (vertexShaders) R_GLSL_UseProgram(0);
|
||||
GL_SelectTexture(0);
|
||||
|
||||
@@ -1054,8 +1182,8 @@ void R_LeiFXPostprocessDitherScreen( void )
|
||||
return;
|
||||
if ( backEnd.doneleifx)
|
||||
return;
|
||||
if ( !backEnd.doneSurfaces )
|
||||
return;
|
||||
// if ( !backEnd.doneSurfaces )
|
||||
// return;
|
||||
// backEnd.doneleifx = qtrue;
|
||||
if( !postproc.started ) {
|
||||
force32upload = 1;
|
||||
@@ -1092,8 +1220,8 @@ void R_LeiFXPostprocessFilterScreen( void )
|
||||
return;
|
||||
if ( backEnd.doneleifx)
|
||||
return;
|
||||
if ( !backEnd.doneSurfaces )
|
||||
return;
|
||||
// if ( !backEnd.doneSurfaces )
|
||||
// return;
|
||||
if( !postproc.started ) {
|
||||
force32upload = 1;
|
||||
R_Postprocess_InitTextures();
|
||||
@@ -1137,6 +1265,86 @@ void R_LeiFXPostprocessFilterScreen( void )
|
||||
|
||||
}
|
||||
|
||||
// tvmode doesn't do any actual postprocessing yet (ntsc, shadow mask etc)
|
||||
|
||||
float tvtime;
|
||||
|
||||
void R_TVScreen( void )
|
||||
{
|
||||
if( !r_tvMode->integer)
|
||||
return;
|
||||
if ( backEnd.donetv)
|
||||
return;
|
||||
if( !postproc.started ) {
|
||||
force32upload = 1;
|
||||
R_Postprocess_InitTextures();
|
||||
if( !postproc.started )
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !backEnd.projection2D )
|
||||
RB_SetGL2D();
|
||||
force32upload = 1;
|
||||
|
||||
// postprocess = 1;
|
||||
|
||||
if (backEnd.refdef.time > tvtime){
|
||||
tvinterlace *= -1;
|
||||
tvtime = backEnd.refdef.time + (1000.0f / 60); // 60hz
|
||||
}
|
||||
|
||||
tvinter = tvinterlace;
|
||||
if (tvinter < 0) tvinter = 0;
|
||||
if (r_tvMode->integer < 3) tvinter = 0;
|
||||
|
||||
leifxmode = 1234; // just show it through to tvWidth/tvHeight
|
||||
|
||||
if (r_tvMode->integer == 2)
|
||||
leifxmode = 1236; // run it through a shader
|
||||
//R_Postprocess_BackupScreen();
|
||||
R_Postprocess_BackupScreenTV();
|
||||
|
||||
R_Bloom_RestoreScreen_Postprocessed();
|
||||
|
||||
backEnd.donetv = qtrue;
|
||||
|
||||
force32upload = 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// leilei - old 2000 console-style antialiasing/antiflickering
|
||||
void R_RetroAAScreen( void )
|
||||
{
|
||||
if( !r_retroAA->integer)
|
||||
return;
|
||||
if ( backEnd.doneraa)
|
||||
return;
|
||||
if( !postproc.started ) {
|
||||
force32upload = 1;
|
||||
R_Postprocess_InitTextures();
|
||||
if( !postproc.started )
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !backEnd.projection2D )
|
||||
RB_SetGL2D();
|
||||
force32upload = 1;
|
||||
|
||||
leifxmode = 1233; // just show it through to tvWidth/tvHeight
|
||||
//R_Postprocess_BackupScreen();
|
||||
R_Postprocess_BackupScreen();
|
||||
R_Bloom_RestoreScreen_Postprocessed();
|
||||
|
||||
backEnd.doneraa = qtrue;
|
||||
|
||||
force32upload = 0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void R_AnimeScreen( void )
|
||||
|
@@ -196,6 +196,8 @@ cvar_t *r_flaresDlight;
|
||||
cvar_t *r_alternateBrightness; // leilei - linux overbright fix
|
||||
cvar_t *r_mockvr; // Leilei - for debugging PVR only!
|
||||
cvar_t *r_leifx; // Leilei - leifx nostalgia filter
|
||||
//cvar_t *r_tvMode; // Leilei - tv fake mode
|
||||
cvar_t *r_retroAA; // Leilei - old console AA
|
||||
cvar_t *r_anime; // Leilei - anime filter
|
||||
cvar_t *r_leidebug; // Leilei - debug
|
||||
cvar_t *r_leidebugeye; // Leilei - eye debug
|
||||
@@ -212,6 +214,9 @@ cvar_t *r_slowness_gpu; // Leilei
|
||||
|
||||
// leilei - fallback shader hack
|
||||
|
||||
#include "tr_leiglsl.h"
|
||||
|
||||
|
||||
#ifdef USE_FALLBACK_GLSL
|
||||
extern const char *fallbackShader_anime_vp;
|
||||
extern const char *fallbackShader_anime_fp;
|
||||
@@ -1248,6 +1253,9 @@ void R_Register( void )
|
||||
r_mockvr = ri.Cvar_Get( "r_mockvr", "0" , CVAR_ARCHIVE | CVAR_CHEAT);
|
||||
r_leifx = ri.Cvar_Get( "r_leifx", "0" , CVAR_ARCHIVE | CVAR_LATCH);
|
||||
|
||||
//r_tvMode = ri.Cvar_Get( "r_tvMode", "0" , CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_retroAA = ri.Cvar_Get( "r_retroAA", "0" , CVAR_ARCHIVE | CVAR_LATCH);
|
||||
|
||||
r_suggestiveThemes = ri.Cvar_Get( "r_suggestiveThemes", "1" , CVAR_ARCHIVE | CVAR_LATCH);
|
||||
|
||||
r_motionblur = ri.Cvar_Get( "r_motionblur", "0" , CVAR_ARCHIVE | CVAR_LATCH);
|
||||
@@ -1419,6 +1427,10 @@ void R_GLSL_Init(void) {
|
||||
Q_strncpyz(programFragmentObjects[0], "glsl/brightness_fp.glsl", sizeof(programFragmentObjects[0]));
|
||||
tr.BrightnessProgram = RE_GLSL_RegisterProgram("brightness", (const char *)programVertexObjects, 1, (const char *)programFragmentObjects, 1);
|
||||
|
||||
Q_strncpyz(programVertexObjects[0], "glsl/crt_vp.glsl", sizeof(programVertexObjects[0]));
|
||||
Q_strncpyz(programFragmentObjects[0], "glsl/crt_fp.glsl", sizeof(programFragmentObjects[0]));
|
||||
tr.CRTProgram = RE_GLSL_RegisterProgram("crt", (const char *)programVertexObjects, 1, (const char *)programFragmentObjects, 1);
|
||||
|
||||
if (strcmp( (const char *)r_postprocess->string, "none" ))
|
||||
{
|
||||
sprintf(p,"glsl/%s_vp.glsl",r_postprocess->string);
|
||||
|
@@ -842,6 +842,8 @@ typedef struct {
|
||||
GLfloat u_ScreenToNextPixelX;
|
||||
GLfloat u_ScreenToNextPixelY;
|
||||
GLfloat u_zFar;
|
||||
GLint u_ActualScreenSizeX;
|
||||
GLint u_ActualScreenSizeY;
|
||||
|
||||
// leilei - motion blur vars
|
||||
|
||||
@@ -1025,6 +1027,8 @@ typedef struct {
|
||||
qboolean doneSun; // leilei - done drawing a sun
|
||||
qboolean doneSunFlare; // leilei - done drawing a sun flare
|
||||
qboolean donemblur; // leilei - done motionblur this frame
|
||||
qboolean donetv; // leilei - tv this frame
|
||||
qboolean doneraa; // leilei - done aa'ing this frame
|
||||
qboolean doneSurfaces; // done any 3d surfaces already
|
||||
trRefEntity_t entity2D; // currentEntity will point at this when doing 2D rendering
|
||||
} backEndState_t;
|
||||
@@ -1084,6 +1088,7 @@ typedef struct {
|
||||
qhandle_t motionBlurProgram; // leilei
|
||||
qhandle_t motionBlurPostProgram; // leilei
|
||||
qhandle_t BrightnessProgram; // leilei
|
||||
qhandle_t CRTProgram; // leilei
|
||||
|
||||
int numPrograms;
|
||||
glslProgram_t *programs[MAX_PROGRAMS];
|
||||
@@ -1289,6 +1294,10 @@ extern cvar_t *r_alternateBrightness; // leilei - alternate brightness
|
||||
|
||||
extern cvar_t *r_leifx; // Leilei - leifx nostalgia filter
|
||||
|
||||
extern cvar_t *r_tvMode; // Leilei - tv faking mode
|
||||
|
||||
extern cvar_t *r_retroAA; // Leilei - old console anti aliasing
|
||||
|
||||
extern cvar_t *r_suggestiveThemes; // Leilei - mature content
|
||||
|
||||
extern cvar_t *r_motionblur; // Leilei - motionblur
|
||||
@@ -1816,6 +1825,14 @@ static ID_INLINE void R_GLSL_SetUniform_u_mpasses(glslProgram_t *program, GLint
|
||||
qglUniform1iARB(program->u_mpasses, value);
|
||||
}
|
||||
|
||||
static ID_INLINE void R_GLSL_SetUniform_u_ActualScreenSizeX(glslProgram_t *program, GLint value) {
|
||||
qglUniform1iARB(program->u_ActualScreenSizeX, value);
|
||||
}
|
||||
static ID_INLINE void R_GLSL_SetUniform_u_ActualScreenSizeY(glslProgram_t *program, GLint value) {
|
||||
qglUniform1iARB(program->u_ActualScreenSizeY, value);
|
||||
}
|
||||
|
||||
|
||||
static ID_INLINE void R_GLSL_SetUniform_Mpass1(glslProgram_t *program, GLint value) {qglUniform1iARB(program->u_mpass1, value);}
|
||||
static ID_INLINE void R_GLSL_SetUniform_Mpass2(glslProgram_t *program, GLint value) {qglUniform1iARB(program->u_mpass2, value);}
|
||||
static ID_INLINE void R_GLSL_SetUniform_Mpass3(glslProgram_t *program, GLint value) {qglUniform1iARB(program->u_mpass3, value);}
|
||||
|
@@ -136,6 +136,9 @@ static glslProgram_t *R_GLSL_AllocProgram(void) {
|
||||
program->u_CC_Overbright = -1;
|
||||
program->u_CC_Contrast = -1;
|
||||
program->u_CC_Saturation = -1;
|
||||
program->u_ActualScreenSizeX = -1;
|
||||
program->u_ActualScreenSizeY = -1;
|
||||
|
||||
|
||||
tr.programs[tr.numPrograms] = program;
|
||||
tr.numPrograms++;
|
||||
@@ -174,6 +177,10 @@ static void R_GLSL_ParseProgram(glslProgram_t *program, char *_text) {
|
||||
program->u_ScreenSizeX = qglGetUniformLocationARB(program->program, "u_ScreenSizeX");
|
||||
} else if (!Q_stricmp(token, "u_ScreenSizeY;")) {
|
||||
program->u_ScreenSizeY = qglGetUniformLocationARB(program->program, "u_ScreenSizeY");
|
||||
} else if (!Q_stricmp(token, "u_ActualScreenSizeX;")) {
|
||||
program->u_ActualScreenSizeX = qglGetUniformLocationARB(program->program, "u_ActualScreenSizeX");
|
||||
} else if (!Q_stricmp(token, "u_ActualScreenSizeY;")) {
|
||||
program->u_ActualScreenSizeY = qglGetUniformLocationARB(program->program, "u_ActualScreenSizeY");
|
||||
} else if (!Q_stricmp(token, "u_mpasses;")) {
|
||||
program->u_mpasses = qglGetUniformLocationARB(program->program, "u_mpasses");
|
||||
} else {
|
||||
|
@@ -49,6 +49,10 @@ typedef void *QGLContext;
|
||||
|
||||
static QGLContext opengl_context;
|
||||
|
||||
int tvMode; // leilei - tvmode
|
||||
int tvWidth;
|
||||
int tvHeight;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RSERR_OK,
|
||||
@@ -63,6 +67,8 @@ static SDL_Surface *screen = NULL;
|
||||
static const SDL_VideoInfo *videoInfo = NULL;
|
||||
|
||||
cvar_t *r_allowSoftwareGL; // Don't abort out if a hardware visual can't be obtained
|
||||
cvar_t *r_tvMode; // leilei - tv mode - force 480i rendering, which is then stretched and interlaced
|
||||
cvar_t *r_tvModeAspect; // leilei - tv mode - to do widescreen and low res tv etc
|
||||
cvar_t *r_allowResize; // make window resizable
|
||||
cvar_t *r_centerWindow;
|
||||
cvar_t *r_sdlDriver;
|
||||
@@ -377,6 +383,7 @@ static int GLimp_SetMode(int mode, qboolean fullscreen, qboolean noborder)
|
||||
|
||||
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
|
||||
|
||||
|
||||
#if 0 // See http://bugzilla.icculus.org/show_bug.cgi?id=3526
|
||||
// If not allowing software GL, demand accelerated
|
||||
if( !r_allowSoftwareGL->integer )
|
||||
@@ -439,9 +446,36 @@ static int GLimp_SetMode(int mode, qboolean fullscreen, qboolean noborder)
|
||||
ri.Printf( PRINT_ALL, "Couldn't get a visual\n" );
|
||||
return RSERR_INVALID_MODE;
|
||||
}
|
||||
|
||||
//
|
||||
// leilei - TV MODE
|
||||
//
|
||||
tvWidth = glConfig.vidWidth;
|
||||
tvHeight = glConfig.vidHeight;
|
||||
|
||||
if( r_tvMode->integer ){
|
||||
|
||||
// HIJACKED >:)
|
||||
glConfig.vidWidth = 640;
|
||||
glConfig.vidHeight = 480;
|
||||
|
||||
// leilei - make it use an aspect-corrected lower resolution that's always 640 wide for the width, but variable height
|
||||
if( r_tvModeAspect->integer ){
|
||||
float aspe = 640.0f / tvWidth;
|
||||
glConfig.vidWidth = tvWidth * aspe;
|
||||
glConfig.vidHeight = tvHeight * aspe;
|
||||
|
||||
}
|
||||
// then change the gl port..
|
||||
//vidscreen = SDL_SetVideoMode(tvWidth, tvHeight, colorbits, flags);
|
||||
}
|
||||
// leilei - tv mode hack end
|
||||
|
||||
screen = vidscreen;
|
||||
|
||||
|
||||
|
||||
|
||||
glstring = (char *) qglGetString (GL_RENDERER);
|
||||
ri.Printf( PRINT_ALL, "GL_RENDERER: %s\n", glstring );
|
||||
|
||||
@@ -691,7 +725,9 @@ void GLimp_Init( void )
|
||||
r_sdlDriver = ri.Cvar_Get( "r_sdlDriver", "", CVAR_ROM );
|
||||
r_allowResize = ri.Cvar_Get( "r_allowResize", "0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
r_centerWindow = ri.Cvar_Get( "r_centerWindow", "0", CVAR_ARCHIVE | CVAR_LATCH );
|
||||
|
||||
// leilei - tv mode hack
|
||||
r_tvMode = ri.Cvar_Get( "r_tvMode", "0", CVAR_LATCH | CVAR_ARCHIVE );
|
||||
r_tvModeAspect = ri.Cvar_Get( "r_tvModeAspect", "0", CVAR_LATCH | CVAR_ARCHIVE ); // yes
|
||||
if( ri.Cvar_VariableIntegerValue( "com_abnormalExit" ) )
|
||||
{
|
||||
ri.Cvar_Set( "r_mode", va( "%d", R_MODE_FALLBACK ) );
|
||||
|
@@ -44,6 +44,9 @@ cvar_t *s_sdlMixSamps;
|
||||
static int dmapos = 0;
|
||||
static int dmasize = 0;
|
||||
|
||||
// leilei - setting correct speed for xmp
|
||||
extern int xmpspeed;
|
||||
|
||||
/*
|
||||
===============
|
||||
SNDDMA_AudioCallback
|
||||
@@ -181,6 +184,8 @@ qboolean SNDDMA_Init(void)
|
||||
if(!desired.freq) desired.freq = 22050;
|
||||
desired.format = ((tmp == 16) ? AUDIO_S16SYS : AUDIO_U8);
|
||||
|
||||
xmpspeed = desired.freq; // leilei
|
||||
|
||||
// I dunno if this is the best idea, but I'll give it a try...
|
||||
// should probably check a cvar for this...
|
||||
if (s_sdlDevSamps->value)
|
||||
|
Reference in New Issue
Block a user