- r_suggestiveThemes cvar - loads _safe (for work) models if set to 0, and if they're available.
- similarly, r_anime looks for _cel prefixed shaders and loads them instead - r_iconmip - resizes 2D icons (that have nopicmip) to save some inches of video memory/texture cache. - Don't allocate motionblur textures if motionblur is off - Motionblur variable passes hack - remove debug lines from the wip shading mode
This commit is contained in:
@@ -124,13 +124,6 @@ void S_CodecInit()
|
||||
{
|
||||
codecs = NULL;
|
||||
|
||||
#ifdef USE_CODEC_XMP
|
||||
S_CodecRegister(&xmp_codec);
|
||||
S_CodecRegister(&xmp_mod_codec);
|
||||
S_CodecRegister(&xmp_s3m_codec);
|
||||
S_CodecRegister(&xmp_xm_codec);
|
||||
S_CodecRegister(&xmp_it_codec);
|
||||
#endif
|
||||
|
||||
#ifdef USE_CODEC_OPUS
|
||||
S_CodecRegister(&opus_codec);
|
||||
@@ -142,6 +135,15 @@ void S_CodecInit()
|
||||
|
||||
// Register wav codec last so that it is always tried first when a file extension was not found
|
||||
S_CodecRegister(&wav_codec);
|
||||
|
||||
#ifdef USE_CODEC_XMP
|
||||
S_CodecRegister(&xmp_codec);
|
||||
S_CodecRegister(&xmp_mod_codec);
|
||||
S_CodecRegister(&xmp_s3m_codec);
|
||||
S_CodecRegister(&xmp_xm_codec);
|
||||
S_CodecRegister(&xmp_it_codec);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -106,6 +106,8 @@ S_StartBackgroundTrack
|
||||
*/
|
||||
void S_StartBackgroundTrack( const char *intro, const char *loop )
|
||||
{
|
||||
// leilei - i used to have extension stripping here, but it crashed on looped tracks
|
||||
|
||||
if( si.StartBackgroundTrack ) {
|
||||
si.StartBackgroundTrack( intro, loop );
|
||||
}
|
||||
@@ -437,6 +439,8 @@ void S_Music_f( void ) {
|
||||
|
||||
c = Cmd_Argc();
|
||||
|
||||
// leilei - strip the extension so we can play other formats if our song's not there.
|
||||
|
||||
if ( c == 2 ) {
|
||||
si.StartBackgroundTrack( Cmd_Argv(1), NULL );
|
||||
} else if ( c == 3 ) {
|
||||
|
@@ -1480,29 +1480,40 @@ int numofmotionpasses;
|
||||
int inmotion;
|
||||
|
||||
int mblurred; // tells the renderer if we are rendering to a motion blur accum buffer instead of our drawing buffer
|
||||
int mpasses; // how many passes of motion blur we should render.
|
||||
|
||||
float motioner;
|
||||
|
||||
void R_MblurScreen( void );
|
||||
void R_MblurScreenPost( void );
|
||||
void RB_UpdateMotionBlur (void){
|
||||
// leilei - motion blur hack
|
||||
int e;
|
||||
numofmotionpasses = 4;
|
||||
motion_finished = (1000.0f / r_motionblur_fps->integer / 5 / numofmotionpasses);
|
||||
numofmotionpasses = backEnd.refdef.time - backEnd.refdef.floatTime / 1000.0f;
|
||||
|
||||
motioner = (backEnd.refdef.time - motiontime);
|
||||
numofmotionpasses = (int)motioner / 3;
|
||||
|
||||
|
||||
|
||||
// unfortunately doing this with some math just causes it to loop
|
||||
if (numofmotionpasses == 4) numofmotionpasses = 0;
|
||||
else if (numofmotionpasses == 3) numofmotionpasses = 1;
|
||||
else if (numofmotionpasses == 2) numofmotionpasses = 2;
|
||||
else if (numofmotionpasses == 1) numofmotionpasses = 3;
|
||||
else if (numofmotionpasses == 0) numofmotionpasses = 4;
|
||||
//else numofmotionpasses = 0;
|
||||
|
||||
//ri.Printf( PRINT_WARNING, "hah %i\n", numofmotionpasses);
|
||||
mpasses = floor(numofmotionpasses);
|
||||
if (mpasses > 4) mpasses = 4;
|
||||
if (mpasses < 1) return; // JUST DONT!!
|
||||
motion_finished = (1000.0f / r_motionblur_fps->integer / 5 / mpasses);
|
||||
|
||||
/*
|
||||
|
||||
if (motionpasses > numofmotionpasses){
|
||||
motionpasses = 0;
|
||||
// inmotion = 0;
|
||||
motionframe = 0;
|
||||
// if (!backEnd.donemblur){
|
||||
// R_MblurScreenPost();
|
||||
// ri.Printf( PRINT_WARNING, "yae\n" );
|
||||
// }
|
||||
// return; // okay!
|
||||
}
|
||||
*/
|
||||
if (motionpasses > numofmotionpasses){
|
||||
motionpasses = 0;
|
||||
}
|
||||
|
||||
if (motionframe > 5){
|
||||
@@ -1546,26 +1557,11 @@ const void *RB_SwapBuffers( const void *data ) {
|
||||
}
|
||||
|
||||
if (r_motionblur->integer){
|
||||
|
||||
|
||||
|
||||
// if (backEnd.refdef.time > mtime && mblurred)
|
||||
{
|
||||
mtime = backEnd.refdef.time + (1000.0f / r_motionblur_fps->integer);
|
||||
mblurred = 0;
|
||||
RB_UpdateMotionBlur();
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// mblurred = 1;
|
||||
//// RB_UpdateMotionBlur();
|
||||
//
|
||||
// }
|
||||
|
||||
// if (mblurred)
|
||||
// R_MblurScreen(); // don't update while in motion blur.
|
||||
// if (!mblurred)
|
||||
// R_MblurScreenPost();
|
||||
}
|
||||
|
||||
// texture swapping test
|
||||
@@ -1632,10 +1628,6 @@ const void *RB_SwapBuffers( const void *data ) {
|
||||
// leilei - artificial slowness (mapper debug) - this might be windows only
|
||||
#ifdef _WIN32
|
||||
|
||||
//if (r_motionblur->integer && !mblurred)
|
||||
// Sleep(1000.0f / r_motionblur_fps->value);
|
||||
|
||||
|
||||
if (r_slowness->integer > 2){
|
||||
// Should be roughly equiv to a P2 300 at value 1.0 (target system)
|
||||
float cpuspeed = r_slowness_cpu->value;
|
||||
|
@@ -341,6 +341,7 @@ static void R_Postprocess_InitTextures( void )
|
||||
|
||||
// leilei - motion blur textures!
|
||||
|
||||
if (r_motionblur->integer){
|
||||
data = ri.Hunk_AllocateTempMemory( postproc.screen.width * postproc.screen.height * 4 );
|
||||
Com_Memset( data, 0, postproc.screen.width * postproc.screen.height * 4 );
|
||||
postproc.motion1.texture = R_CreateImage( "***motionblur1 texture***", data, postproc.screen.width, postproc.screen.height, qfalse, qfalse, GL_CLAMP_TO_EDGE );
|
||||
@@ -353,7 +354,7 @@ static void R_Postprocess_InitTextures( void )
|
||||
postproc.mpass3.texture = R_CreateImage( "***motionaccum1 texture***", data, postproc.screen.width, postproc.screen.height, qfalse, qfalse, GL_CLAMP_TO_EDGE );
|
||||
postproc.mpass4.texture = R_CreateImage( "***motionaccum1 texture***", data, postproc.screen.width, postproc.screen.height, qfalse, qfalse, GL_CLAMP_TO_EDGE );
|
||||
ri.Hunk_FreeTempMemory( data );
|
||||
|
||||
}
|
||||
|
||||
// GLSL Depth Buffer
|
||||
|
||||
@@ -684,7 +685,8 @@ static void R_Postprocess_BackupScreen( void ) {
|
||||
|
||||
// leilei - motion blur hack
|
||||
void R_MotionBlur_BackupScreen(int which) {
|
||||
|
||||
if( !r_motionblur->integer)
|
||||
return;
|
||||
if (which == 1){ GL_Bind( postproc.motion1.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); } // gather thee samples
|
||||
if (which == 2){ GL_Bind( postproc.motion2.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); }
|
||||
if (which == 3){ GL_Bind( postproc.motion3.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); }
|
||||
@@ -696,6 +698,7 @@ void R_MotionBlur_BackupScreen(int which) {
|
||||
if (which == 14){ GL_Bind( postproc.mpass1.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); } // to accum
|
||||
if (which == 18){ GL_Bind( postproc.screen.texture ); qglCopyTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 0, 0, glConfig.vidWidth, glConfig.vidHeight ); } // to accum
|
||||
|
||||
|
||||
}
|
||||
/*
|
||||
=================
|
||||
@@ -727,9 +730,9 @@ R_Bloom_RestoreScreen_Postprocessed
|
||||
Restore the temporary framebuffer section we used with the backup texture
|
||||
=================
|
||||
*/
|
||||
extern int mpasses;
|
||||
static void R_Bloom_RestoreScreen_Postprocessed( void ) {
|
||||
glslProgram_t *program;
|
||||
|
||||
if (leifxmode)
|
||||
{
|
||||
if (leifxmode == 1){ if (vertexShaders) R_GLSL_UseProgram(tr.leiFXDitherProgram); program=tr.programs[tr.leiFXDitherProgram];}
|
||||
@@ -758,6 +761,8 @@ static void R_Bloom_RestoreScreen_Postprocessed( void ) {
|
||||
if (program->u_ScreenToNextPixelY > -1) R_GLSL_SetUniform_u_ScreenToNextPixelY(program, (float)1.0/(float)glConfig.vidHeight);
|
||||
|
||||
|
||||
|
||||
|
||||
// Brightness stuff
|
||||
if (program->u_CC_Brightness > -1) R_GLSL_SetUniform_u_CC_Brightness(program, 1.0);
|
||||
if (program->u_CC_Gamma > -1) R_GLSL_SetUniform_u_CC_Gamma(program, r_gamma->value);
|
||||
@@ -778,6 +783,8 @@ static void R_Bloom_RestoreScreen_Postprocessed( void ) {
|
||||
GL_Bind( postproc.depth.texture );
|
||||
|
||||
// motion blur crap
|
||||
if( r_motionblur->integer){
|
||||
if (program->u_mpasses > -1) R_GLSL_SetUniform_u_mpasses(program, mpasses);
|
||||
GL_SelectTexture(2);
|
||||
GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO );
|
||||
GL_Bind( postproc.motion1.texture );
|
||||
@@ -805,8 +812,9 @@ static void R_Bloom_RestoreScreen_Postprocessed( void ) {
|
||||
GL_SelectTexture(14);
|
||||
GL_State( GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_ONE | GLS_DSTBLEND_ZERO );
|
||||
GL_Bind( postproc.mpass1.texture );
|
||||
|
||||
}
|
||||
qglColor4f( 1, 1, 1, 1 );
|
||||
|
||||
// if (leifxmode == 778)
|
||||
// return;
|
||||
R_Bloom_Quad( glConfig.vidWidth, glConfig.vidHeight, 0, 0,
|
||||
|
@@ -1048,6 +1048,8 @@ Upload32
|
||||
extern qboolean charSet;
|
||||
int hqresample = 0; // leilei - high quality texture resampling
|
||||
// Currently 0 as there is an alignment issue I haven't fixed.
|
||||
|
||||
int isicon; // leilei - for determining if it's an icon.
|
||||
static void Upload32( unsigned *data,
|
||||
int width, int height,
|
||||
qboolean mipmap,
|
||||
@@ -1114,6 +1116,47 @@ static void Upload32( unsigned *data,
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// leilei - icon picmip for certain 2d graphics elements that get wasted in lower resolutions, saving vram
|
||||
//
|
||||
|
||||
if ( isicon ){
|
||||
|
||||
if (r_iconmip->integer){
|
||||
|
||||
|
||||
// Auto-determine from resolution division
|
||||
|
||||
if (r_iconmip->integer == 1){
|
||||
int wadth, haght, dev;
|
||||
|
||||
wadth = floor(1280 / glConfig.vidWidth) - 1;
|
||||
haght = floor(960 / glConfig.vidHeight) - 1;
|
||||
if (wadth > haght) dev = wadth;
|
||||
else if (haght > wadth) dev = haght;
|
||||
if (dev < 0) dev = 0;
|
||||
|
||||
scaled_width >>= dev;
|
||||
scaled_height >>= dev;
|
||||
|
||||
if (scaled_width < 32) scaled_width = 32;
|
||||
if (scaled_height < 32) scaled_height = 32;
|
||||
|
||||
}
|
||||
else
|
||||
// Force it
|
||||
{
|
||||
scaled_width >>= (r_iconmip->integer - 1);
|
||||
scaled_height >>= (r_iconmip->integer - 1);
|
||||
if (scaled_width < 16) scaled_width = 16;
|
||||
if (scaled_height < 16) scaled_height = 16;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// clamp to minimum size
|
||||
@@ -2028,6 +2071,17 @@ image_t *R_FindImageFile( const char *name, imgType_t type, imgFlags_t flags )
|
||||
detailhack = 1; // leilei - attempt to fade detail mips to gray, EXPECTS DST_COLOR/SRC_COLOR for this to work right
|
||||
}
|
||||
|
||||
// leilei - iconmip hack
|
||||
|
||||
if ( !Q_strncmp( name, "icons/", 5 ) ||
|
||||
!Q_strncmp( name, "gfx/2d", 6 ) &&
|
||||
Q_strncmp( name, "gfx/2d/bigchars", 14 )
|
||||
){
|
||||
isicon = 1;
|
||||
}
|
||||
else
|
||||
isicon = 0;
|
||||
|
||||
//
|
||||
// load the pic from disk
|
||||
//
|
||||
|
@@ -126,6 +126,7 @@ cvar_t *r_singleShader;
|
||||
cvar_t *r_roundImagesDown;
|
||||
cvar_t *r_colorMipLevels;
|
||||
cvar_t *r_picmip;
|
||||
cvar_t *r_iconmip;
|
||||
cvar_t *r_showtris;
|
||||
cvar_t *r_showsky;
|
||||
cvar_t *r_shownormals;
|
||||
@@ -199,6 +200,8 @@ cvar_t *r_anime; // Leilei - anime filter
|
||||
cvar_t *r_leidebug; // Leilei - debug
|
||||
cvar_t *r_leidebugeye; // Leilei - eye debug
|
||||
|
||||
cvar_t *r_suggestiveThemes; // leilei - mature content control
|
||||
|
||||
cvar_t *r_motionblur; // Leilei - motionblur
|
||||
cvar_t *r_motionblur_fps; // Leilei - motionblur framerated
|
||||
|
||||
@@ -208,25 +211,27 @@ cvar_t *r_slowness_gpu; // Leilei
|
||||
|
||||
|
||||
// leilei - fallback shader hack
|
||||
//extern const char *fallbackShader_anime_vp;
|
||||
//extern const char *fallbackShader_anime_fp;
|
||||
//extern const char *fallbackShader_anime_film_vp;
|
||||
//extern const char *fallbackShader_anime_film_fp;
|
||||
//extern const char *fallbackShader_brightness_vp;
|
||||
//extern const char *fallbackShader_brightness_fp;
|
||||
|
||||
#ifdef USE_FALLBACK_GLSL
|
||||
extern const char *fallbackShader_anime_vp;
|
||||
extern const char *fallbackShader_anime_fp;
|
||||
extern const char *fallbackShader_anime_film_vp;
|
||||
extern const char *fallbackShader_anime_film_fp;
|
||||
extern const char *fallbackShader_brightness_vp;
|
||||
extern const char *fallbackShader_brightness_fp;
|
||||
extern const char *fallbackShader_leifx_dither_vp;
|
||||
extern const char *fallbackShader_leifx_dither_fp;
|
||||
extern const char *fallbackShader_leifx_filter_vp;
|
||||
extern const char *fallbackShader_leifx_filter_fp;
|
||||
extern const char *fallbackShader_leifx_gamma_vp;
|
||||
extern const char *fallbackShader_leifx_gamma_fp;
|
||||
//extern const char *fallbackShader_leifx_vgasignal_vp;
|
||||
//extern const char *fallbackShader_leifx_vgasignal_fp;
|
||||
//extern const char *fallbackShader_motionblur_accum_vp;
|
||||
//extern const char *fallbackShader_motionblur_accum_fp;
|
||||
//extern const char *fallbackShader_motionblur_post_vp;
|
||||
//extern const char *fallbackShader_motionblur_post_fp;
|
||||
|
||||
extern const char *fallbackShader_leifx_vgasignal_vp;
|
||||
extern const char *fallbackShader_leifx_vgasignal_fp;
|
||||
extern const char *fallbackShader_motionblur_accum_vp;
|
||||
extern const char *fallbackShader_motionblur_accum_fp;
|
||||
extern const char *fallbackShader_motionblur_post_vp;
|
||||
extern const char *fallbackShader_motionblur_post_fp;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -1243,7 +1248,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_motionblur = ri.Cvar_Get( "r_motionblur", "0" , CVAR_ARCHIVE);
|
||||
r_suggestiveThemes = ri.Cvar_Get( "r_suggestiveThemes", "1" , CVAR_ARCHIVE | CVAR_LATCH);
|
||||
|
||||
r_motionblur = ri.Cvar_Get( "r_motionblur", "0" , CVAR_ARCHIVE | CVAR_LATCH);
|
||||
r_motionblur_fps = ri.Cvar_Get( "r_motionblur_fps", "60", 0);
|
||||
|
||||
r_anime = ri.Cvar_Get( "r_anime", "0" , CVAR_ARCHIVE | CVAR_LATCH);
|
||||
@@ -1253,6 +1260,8 @@ void R_Register( void )
|
||||
r_slowness_cpu = ri.Cvar_Get( "r_slowness_cpu", "300" , CVAR_ARCHIVE); // it's 0 because you want it to be the fastest possible by default.
|
||||
r_slowness_gpu = ri.Cvar_Get( "r_slowness_gpu", "96" , CVAR_ARCHIVE); // it's 0 because you want it to be the fastest possible by default.
|
||||
|
||||
r_iconmip = ri.Cvar_Get ("r_iconmip", "1", CVAR_ARCHIVE | CVAR_LATCH ); // leilei - icon mip
|
||||
|
||||
// make sure all the commands added here are also
|
||||
// removed in R_Shutdown
|
||||
ri.Cmd_AddCommand( "imagelist", R_ImageList_f );
|
||||
@@ -1327,6 +1336,7 @@ static glslProgram_t *R_GLSL_AllocProgram(void) {
|
||||
* R_GLSL_Init
|
||||
* Load all default GLSL programs which are not loaded via the q3 shader system
|
||||
*/
|
||||
|
||||
void R_GLSL_Init(void) {
|
||||
glslProgram_t *program;
|
||||
char programVertexObjects[MAX_PROGRAM_OBJECTS][MAX_QPATH];
|
||||
@@ -1385,9 +1395,10 @@ void R_GLSL_Init(void) {
|
||||
Q_strncpyz(programVertexObjects[0], "glsl/leifx_dither_vp.glsl", sizeof(programVertexObjects[0]));
|
||||
Q_strncpyz(programFragmentObjects[0], "glsl/leifx_dither_fp.glsl", sizeof(programFragmentObjects[0]));
|
||||
tr.leiFXDitherProgram = RE_GLSL_RegisterProgram("leifx_dither", (const char *)programVertexObjects, 1, (const char *)programFragmentObjects, 1);
|
||||
#ifdef USE_FALLBACK_GLSL
|
||||
// if (!tr.leiFXDitherProgram) // try fallback shader
|
||||
//tr.leiFXDitherProgram = RE_GLSL_RegisterProgram("leifx_dither", (const char *)fallbackShader_leifx_dither_vp, 1, (const char *)fallbackShader_leifx_dither_fp, 1);
|
||||
|
||||
// tr.leiFXDitherProgram = RE_GLSL_RegisterProgram("leifx_dither", fallbackShader_leifx_dither_vp, 1, fallbackShader_leifx_dither_fp, 1);
|
||||
#endif
|
||||
Q_strncpyz(programVertexObjects[0], "glsl/leifx_gamma_vp.glsl", sizeof(programVertexObjects[0]));
|
||||
Q_strncpyz(programFragmentObjects[0], "glsl/leifx_gamma_fp.glsl", sizeof(programFragmentObjects[0]));
|
||||
tr.leiFXGammaProgram = RE_GLSL_RegisterProgram("leifx_gamma", (const char *)programVertexObjects, 1, (const char *)programFragmentObjects, 1);
|
||||
|
@@ -856,6 +856,8 @@ typedef struct {
|
||||
GLint u_mpass3; // 11-15
|
||||
GLint u_mpass4; // 16-20
|
||||
|
||||
GLint u_mpasses; // How many passes of Motion do we have anyhow?
|
||||
|
||||
|
||||
|
||||
// leilei - Color control
|
||||
@@ -1287,6 +1289,8 @@ extern cvar_t *r_alternateBrightness; // leilei - alternate brightness
|
||||
|
||||
extern cvar_t *r_leifx; // Leilei - leifx nostalgia filter
|
||||
|
||||
extern cvar_t *r_suggestiveThemes; // Leilei - mature content
|
||||
|
||||
extern cvar_t *r_motionblur; // Leilei - motionblur
|
||||
extern cvar_t *r_motionblur_fps; // Leilei - motionblur framerated
|
||||
|
||||
@@ -1294,6 +1298,8 @@ extern cvar_t *r_anime; // Leilei - anime filter
|
||||
extern cvar_t *r_leidebug; // Leilei - debug only!
|
||||
extern cvar_t *r_leidebugeye; // Leilei - debug only!
|
||||
|
||||
extern cvar_t *r_iconmip; // leilei - icon mip - picmip for 2d icons
|
||||
|
||||
//====================================================================
|
||||
|
||||
void R_SwapBuffers( int );
|
||||
@@ -1806,7 +1812,9 @@ static ID_INLINE void R_GLSL_SetUniform_u_CC_Overbright(glslProgram_t *program,
|
||||
}
|
||||
|
||||
|
||||
|
||||
static ID_INLINE void R_GLSL_SetUniform_u_mpasses(glslProgram_t *program, GLint value) {
|
||||
qglUniform1iARB(program->u_mpasses, 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);}
|
||||
|
@@ -249,7 +249,7 @@ optimization to prevent disk rescanning if they are
|
||||
asked for again.
|
||||
====================
|
||||
*/
|
||||
qhandle_t RE_RegisterModel( const char *name ) {
|
||||
qhandle_t RE_RegisterModelReal( const char *name ) {
|
||||
model_t *mod;
|
||||
qhandle_t hModel;
|
||||
qboolean orgNameFailed = qfalse;
|
||||
@@ -259,6 +259,8 @@ qhandle_t RE_RegisterModel( const char *name ) {
|
||||
const char *ext;
|
||||
char altName[ MAX_QPATH ];
|
||||
|
||||
|
||||
|
||||
if ( !name || !name[0] ) {
|
||||
ri.Printf( PRINT_ALL, "RE_RegisterModel: NULL name\n" );
|
||||
return 0;
|
||||
@@ -364,6 +366,30 @@ qhandle_t RE_RegisterModel( const char *name ) {
|
||||
return hModel;
|
||||
}
|
||||
|
||||
|
||||
// leilei - wrapper function to get alternate models loaded
|
||||
|
||||
qhandle_t RE_RegisterModel( const char *name ) {
|
||||
|
||||
|
||||
if (!r_suggestiveThemes->integer){
|
||||
qhandle_t eh;
|
||||
char narm[ MAX_QPATH ];
|
||||
COM_StripExtension( name, narm, MAX_QPATH );
|
||||
|
||||
eh = RE_RegisterModelReal( va("%s_safe", narm) );
|
||||
if (!eh)
|
||||
eh = RE_RegisterModelReal( name );
|
||||
// TODO: Free the previous _safe qhandle
|
||||
return eh;
|
||||
}
|
||||
else
|
||||
{
|
||||
return RE_RegisterModelReal( name );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
R_LoadMD3
|
||||
|
@@ -1520,7 +1520,7 @@ static void RB_CalcDiffuseColor_crazy( unsigned char *colors )
|
||||
|
||||
|
||||
// Actually, in reality, I disabled B, C and D as I figured out a more sane way to do things.
|
||||
/*
|
||||
|
||||
// debug light positions
|
||||
{
|
||||
vec3_t temp;
|
||||
@@ -1541,7 +1541,6 @@ static void RB_CalcDiffuseColor_crazy( unsigned char *colors )
|
||||
qglDepthRange( 0, 1 );
|
||||
}
|
||||
|
||||
*/
|
||||
if (lightDirA[0] == 666){
|
||||
VectorCopy( ent->directedLight, directedLightA );
|
||||
VectorCopy( ent->lightDir, lightDirA );
|
||||
|
@@ -130,6 +130,7 @@ static glslProgram_t *R_GLSL_AllocProgram(void) {
|
||||
program->u_zFar = -1;
|
||||
program->u_MotionBlurX = -1;
|
||||
program->u_MotionBlurY = -1;
|
||||
program->u_mpasses = -1;
|
||||
program->u_CC_Brightness = -1;
|
||||
program->u_CC_Gamma = -1;
|
||||
program->u_CC_Overbright = -1;
|
||||
@@ -173,6 +174,8 @@ 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_mpasses;")) {
|
||||
program->u_mpasses = qglGetUniformLocationARB(program->program, "u_mpasses");
|
||||
} else {
|
||||
ri.Printf(PRINT_WARNING, "WARNING: uniform int %s unrecognized in program %s\n", token, program->name);
|
||||
}
|
||||
@@ -4138,7 +4141,7 @@ most world construction surfaces.
|
||||
|
||||
===============
|
||||
*/
|
||||
shader_t *R_FindShader( const char *name, int lightmapIndex, qboolean mipRawImage ) {
|
||||
shader_t *R_FindShaderReal( const char *name, int lightmapIndex, qboolean mipRawImage ) {
|
||||
char strippedName[MAX_QPATH];
|
||||
int i, hash;
|
||||
char *shaderText;
|
||||
@@ -4293,6 +4296,22 @@ shader_t *R_FindShader( const char *name, int lightmapIndex, qboolean mipRawImag
|
||||
return FinishShader();
|
||||
}
|
||||
|
||||
// leilei - rather stupid way to do a cel wrapper to work for all textures
|
||||
shader_t *R_FindShader( const char *name, int lightmapIndex, qboolean mipRawImage ) {
|
||||
shader_t *sh;
|
||||
|
||||
if (r_anime->integer){
|
||||
sh = R_FindShaderReal(va("%s_cel",name), lightmapIndex, mipRawImage);
|
||||
if ( sh->defaultShader )
|
||||
sh = R_FindShaderReal(name, lightmapIndex, mipRawImage);
|
||||
return sh;
|
||||
}
|
||||
else
|
||||
sh = R_FindShaderReal(name, lightmapIndex, mipRawImage);
|
||||
return sh;
|
||||
|
||||
}
|
||||
|
||||
|
||||
qhandle_t RE_RegisterShaderFromImage(const char *name, int lightmapIndex, image_t *image, qboolean mipRawImage) {
|
||||
int i, hash;
|
||||
@@ -4444,15 +4463,16 @@ way to ask for different implicit lighting modes (vertex, lightmap, etc)
|
||||
qhandle_t RE_RegisterShader( const char *name ) {
|
||||
shader_t *sh;
|
||||
|
||||
|
||||
if ( strlen( name ) >= MAX_QPATH ) {
|
||||
ri.Printf( PRINT_ALL, "Shader name exceeds MAX_QPATH\n" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
sh = R_FindShader( name, LIGHTMAP_2D, qtrue );
|
||||
|
||||
|
||||
// we want to return 0 if the shader failed to
|
||||
// load for some reason, but R_FindShader should
|
||||
// still keep a name allocated for it, so if
|
||||
|
Reference in New Issue
Block a user