2009-11-07 13:29:15 +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
2011-05-15 13:23:13 +00:00
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE .
2009-11-07 13:29:15 +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_surf.c: surface-related refresh code
# include "quakedef.h"
# if defined(GLQUAKE) || defined(D3DQUAKE)
# include "glquake.h"
# include "shader.h"
# include "renderque.h"
2012-07-05 19:42:36 +00:00
# include "com_mesh.h"
2009-11-07 13:29:15 +00:00
# include <math.h>
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
extern cvar_t r_ambient ;
2009-11-07 13:29:15 +00:00
static vec3_t modelorg ; /*set before recursively entering the visible surface finder*/
static qbyte areabits [ MAX_Q2MAP_AREAS / 8 ] ;
model_t * currentmodel ;
int lightmap_bytes ; // 1, 3 or 4
2010-05-01 22:47:47 +00:00
qboolean lightmap_bgra ;
2009-11-07 13:29:15 +00:00
# define MAX_LIGHTMAP_SIZE LMBLOCK_WIDTH
vec3_t blocknormals [ MAX_LIGHTMAP_SIZE * MAX_LIGHTMAP_SIZE ] ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
unsigned blocklights [ 3 * MAX_LIGHTMAP_SIZE * MAX_LIGHTMAP_SIZE ] ;
2009-11-07 13:29:15 +00:00
lightmapinfo_t * * lightmap ;
int numlightmaps ;
2013-03-12 23:09:25 +00:00
extern mleaf_t * r_vischain ; // linked list of visible leafs
2009-11-07 13:29:15 +00:00
extern cvar_t r_stains ;
extern cvar_t r_loadlits ;
extern cvar_t r_stainfadetime ;
extern cvar_t r_stainfadeammount ;
2011-04-30 17:21:10 +00:00
static int lightmap_shift ;
2009-11-07 13:29:15 +00:00
int Surf_LightmapShift ( model_t * model )
{
2011-05-30 21:48:32 +00:00
extern cvar_t gl_overbright_all , gl_overbright ;
2009-11-07 13:29:15 +00:00
if ( gl_overbright_all . ival | | ( model - > engineflags & MDLF_NEEDOVERBRIGHT ) )
2011-05-30 21:48:32 +00:00
lightmap_shift = bound ( 0 , gl_overbright . ival , 2 ) ;
2011-04-30 17:21:10 +00:00
else
lightmap_shift = 0 ;
return lightmap_shift ;
2009-11-07 13:29:15 +00:00
}
2011-03-03 17:09:15 +00:00
void Surf_RebuildLightmap_Callback ( struct cvar_s * var , char * oldvalue )
{
2011-05-27 17:59:31 +00:00
Mod_RebuildLightmaps ( ) ;
2011-03-03 17:09:15 +00:00
}
2009-11-07 13:29:15 +00:00
//radius, x y z, r g b
void Surf_StainSurf ( msurface_t * surf , float * parms )
2011-05-15 13:23:13 +00:00
{
2009-11-07 13:29:15 +00:00
int sd , td ;
float dist , rad , minlight ;
float change ;
vec3_t impact , local ;
int s , t ;
int i ;
int smax , tmax ;
float amm ;
int lim ;
mtexinfo_t * tex ;
stmap * stainbase ;
2012-07-05 19:42:36 +00:00
lightmapinfo_t * lm ;
2009-11-07 13:29:15 +00:00
lim = 255 - ( r_stains . value * 255 ) ;
# define stain(x) \
change = stainbase [ ( s ) * 3 + x ] + amm * parms [ 4 + x ] ; \
stainbase [ ( s ) * 3 + x ] = bound ( lim , change , 255 ) ;
2012-07-05 19:42:36 +00:00
if ( surf - > lightmaptexturenums [ 0 ] < 0 )
2009-11-07 13:29:15 +00:00
return ;
2012-07-05 19:42:36 +00:00
lm = lightmap [ surf - > lightmaptexturenums [ 0 ] ] ;
2009-11-07 13:29:15 +00:00
smax = ( surf - > extents [ 0 ] > > 4 ) + 1 ;
tmax = ( surf - > extents [ 1 ] > > 4 ) + 1 ;
tex = surf - > texinfo ;
2012-07-05 19:42:36 +00:00
stainbase = lm - > stainmaps ;
stainbase + = ( surf - > light_t [ 0 ] * lm - > width + surf - > light_s [ 0 ] ) * 3 ;
2009-11-07 13:29:15 +00:00
rad = * parms ;
dist = DotProduct ( ( parms + 1 ) , surf - > plane - > normal ) - surf - > plane - > dist ;
rad - = fabs ( dist ) ;
minlight = 0 ;
if ( rad < minlight ) //not hit
return ;
minlight = rad - minlight ;
for ( i = 0 ; i < 3 ; i + + )
{
impact [ i ] = ( parms + 1 ) [ i ] - surf - > plane - > normal [ i ] * dist ;
}
local [ 0 ] = DotProduct ( impact , tex - > vecs [ 0 ] ) + tex - > vecs [ 0 ] [ 3 ] ;
local [ 1 ] = DotProduct ( impact , tex - > vecs [ 1 ] ) + tex - > vecs [ 1 ] [ 3 ] ;
local [ 0 ] - = surf - > texturemins [ 0 ] ;
2011-05-15 13:23:13 +00:00
local [ 1 ] - = surf - > texturemins [ 1 ] ;
2009-11-07 13:29:15 +00:00
for ( t = 0 ; t < tmax ; t + + )
{
td = local [ 1 ] - t * 16 ;
if ( td < 0 )
td = - td ;
for ( s = 0 ; s < smax ; s + + )
{
sd = local [ 0 ] - s * 16 ;
if ( sd < 0 )
sd = - sd ;
if ( sd > td )
dist = sd + ( td > > 1 ) ;
else
dist = td + ( sd > > 1 ) ;
if ( dist < minlight )
{
amm = ( rad - dist ) ;
stain ( 0 ) ;
stain ( 1 ) ;
stain ( 2 ) ;
surf - > stained = true ;
}
}
2012-07-05 19:42:36 +00:00
stainbase + = 3 * lm - > width ;
2009-11-07 13:29:15 +00:00
}
if ( surf - > stained )
surf - > cached_dlight = - 1 ;
}
//combination of R_AddDynamicLights and R_MarkLights
/*
static void Surf_StainNode ( mnode_t * node , float * parms )
{
mplane_t * splitplane ;
float dist ;
msurface_t * surf ;
int i ;
2011-05-15 13:23:13 +00:00
2009-11-07 13:29:15 +00:00
if ( node - > contents < 0 )
2011-05-15 13:23:13 +00:00
return ;
2009-11-07 13:29:15 +00:00
splitplane = node - > plane ;
dist = DotProduct ( ( parms + 1 ) , splitplane - > normal ) - splitplane - > dist ;
2011-05-15 13:23:13 +00:00
2009-11-07 13:29:15 +00:00
if ( dist > ( * parms ) )
{
Surf_StainNode ( node - > children [ 0 ] , parms ) ;
return ;
}
if ( dist < ( - * parms ) )
{
Surf_StainNode ( node - > children [ 1 ] , parms ) ;
return ;
}
// mark the polygons
surf = cl . worldmodel - > surfaces + node - > firstsurface ;
for ( i = 0 ; i < node - > numsurfaces ; i + + , surf + + )
{
if ( surf - > flags & ~ ( SURF_DONTWARP | SURF_PLANEBACK ) )
continue ;
Surf_StainSurf ( surf , parms ) ;
}
Surf_StainNode ( node - > children [ 0 ] , parms ) ;
Surf_StainNode ( node - > children [ 1 ] , parms ) ;
}
*/
void Surf_AddStain ( vec3_t org , float red , float green , float blue , float radius )
{
physent_t * pe ;
int i ;
float parms [ 7 ] ;
if ( ! cl . worldmodel | | cl . worldmodel - > needload | | r_stains . value < = 0 )
return ;
parms [ 0 ] = radius ;
parms [ 1 ] = org [ 0 ] ;
parms [ 2 ] = org [ 1 ] ;
parms [ 3 ] = org [ 2 ] ;
parms [ 4 ] = red ;
parms [ 5 ] = green ;
parms [ 6 ] = blue ;
cl . worldmodel - > funcs . StainNode ( cl . worldmodel - > nodes + cl . worldmodel - > hulls [ 0 ] . firstclipnode , parms ) ;
//now stain bsp models other than world.
for ( i = 1 ; i < pmove . numphysent ; i + + ) //0 is world...
{
2011-05-15 13:23:13 +00:00
pe = & pmove . physents [ i ] ;
2009-11-07 13:29:15 +00:00
if ( pe - > model & & pe - > model - > surfaces = = cl . worldmodel - > surfaces )
{
parms [ 1 ] = org [ 0 ] - pe - > origin [ 0 ] ;
parms [ 2 ] = org [ 1 ] - pe - > origin [ 1 ] ;
parms [ 3 ] = org [ 2 ] - pe - > origin [ 2 ] ;
if ( pe - > angles [ 0 ] | | pe - > angles [ 1 ] | | pe - > angles [ 2 ] )
{
vec3_t f , r , u , temp ;
AngleVectors ( pe - > angles , f , r , u ) ;
VectorCopy ( ( parms + 1 ) , temp ) ;
parms [ 1 ] = DotProduct ( temp , f ) ;
parms [ 2 ] = - DotProduct ( temp , r ) ;
parms [ 3 ] = DotProduct ( temp , u ) ;
}
pe - > model - > funcs . StainNode ( pe - > model - > nodes + pe - > model - > hulls [ 0 ] . firstclipnode , parms ) ;
}
}
}
void Surf_WipeStains ( void )
{
int i ;
for ( i = 0 ; i < numlightmaps ; i + + )
{
if ( ! lightmap [ i ] )
break ;
2012-07-05 19:42:36 +00:00
memset ( lightmap [ i ] - > stainmaps , 255 , LMBLOCK_WIDTH * LMBLOCK_HEIGHT * 3 * sizeof ( stmap ) ) ;
2009-11-07 13:29:15 +00:00
}
}
void Surf_LessenStains ( void )
{
int i ;
msurface_t * surf ;
int smax , tmax ;
int s , t ;
stmap * stain ;
int stride ;
int ammount ;
int limit ;
2012-07-05 19:42:36 +00:00
lightmapinfo_t * lm ;
2009-11-07 13:29:15 +00:00
static float time ;
if ( ! r_stains . value )
return ;
time + = host_frametime ;
if ( time < r_stainfadetime . value )
return ;
time - = r_stainfadetime . value ;
ammount = r_stainfadeammount . value ;
limit = 255 - ammount ;
surf = cl . worldmodel - > surfaces ;
for ( i = 0 ; i < cl . worldmodel - > numsurfaces ; i + + , surf + + )
{
if ( surf - > stained )
{
2012-07-05 19:42:36 +00:00
lm = lightmap [ surf - > lightmaptexturenums [ 0 ] ] ;
2009-11-07 13:29:15 +00:00
surf - > cached_dlight = - 1 ; //nice hack here...
smax = ( surf - > extents [ 0 ] > > 4 ) + 1 ;
2011-05-15 13:23:13 +00:00
tmax = ( surf - > extents [ 1 ] > > 4 ) + 1 ;
2009-11-07 13:29:15 +00:00
2012-07-05 19:42:36 +00:00
stain = lm - > stainmaps ;
stain + = ( surf - > light_t [ 0 ] * lm - > width + surf - > light_s [ 0 ] ) * 3 ;
2009-11-07 13:29:15 +00:00
2012-07-05 19:42:36 +00:00
stride = ( lm - > width - smax ) * 3 ;
2009-11-07 13:29:15 +00:00
surf - > stained = false ;
smax * = 3 ;
for ( t = 0 ; t < tmax ; t + + , stain + = stride )
{
for ( s = 0 ; s < smax ; s + + )
{
if ( * stain < limit ) //eventually decay to 255
{
* stain + = ammount ;
surf - > stained = true ;
}
else //reset to 255
* stain = 255 ;
stain + + ;
2011-05-15 13:23:13 +00:00
}
2009-11-07 13:29:15 +00:00
}
}
}
}
/*
= = = = = = = = = = = = = = =
R_AddDynamicLights
= = = = = = = = = = = = = = =
*/
static void Surf_AddDynamicLights ( msurface_t * surf )
{
int lnum ;
int sd , td ;
float dist , rad , minlight ;
vec3_t impact , local ;
int s , t ;
int i ;
int smax , tmax ;
mtexinfo_t * tex ;
float a ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
unsigned * bl ;
2009-11-07 13:29:15 +00:00
smax = ( surf - > extents [ 0 ] > > 4 ) + 1 ;
tmax = ( surf - > extents [ 1 ] > > 4 ) + 1 ;
tex = surf - > texinfo ;
for ( lnum = rtlights_first ; lnum < RTL_FIRST ; lnum + + )
{
if ( ! ( surf - > dlightbits & ( 1 < < lnum ) ) )
continue ; // not lit by this light
2011-07-30 14:14:56 +00:00
if ( ! ( cl_dlights [ lnum ] . flags & LFLAG_LIGHTMAP ) )
2009-11-07 13:29:15 +00:00
continue ;
rad = cl_dlights [ lnum ] . radius ;
dist = DotProduct ( cl_dlights [ lnum ] . origin , surf - > plane - > normal ) -
surf - > plane - > dist ;
rad - = fabs ( dist ) ;
minlight = cl_dlights [ lnum ] . minlight ;
if ( rad < minlight )
continue ;
minlight = rad - minlight ;
for ( i = 0 ; i < 3 ; i + + )
{
impact [ i ] = cl_dlights [ lnum ] . origin [ i ] -
surf - > plane - > normal [ i ] * dist ;
}
local [ 0 ] = DotProduct ( impact , tex - > vecs [ 0 ] ) + tex - > vecs [ 0 ] [ 3 ] ;
local [ 1 ] = DotProduct ( impact , tex - > vecs [ 1 ] ) + tex - > vecs [ 1 ] [ 3 ] ;
local [ 0 ] - = surf - > texturemins [ 0 ] ;
local [ 1 ] - = surf - > texturemins [ 1 ] ;
2011-12-27 08:35:19 +00:00
a = 256 * ( cl_dlights [ lnum ] . color [ 0 ] * NTSC_RED + cl_dlights [ lnum ] . color [ 1 ] * NTSC_GREEN + cl_dlights [ lnum ] . color [ 2 ] * NTSC_BLUE ) ;
2009-11-07 13:29:15 +00:00
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
bl = blocklights ;
2009-11-07 13:29:15 +00:00
for ( t = 0 ; t < tmax ; t + + )
{
td = local [ 1 ] - t * 16 ;
if ( td < 0 )
td = - td ;
for ( s = 0 ; s < smax ; s + + )
{
sd = local [ 0 ] - s * 16 ;
if ( sd < 0 )
sd = - sd ;
if ( sd > td )
dist = sd + ( td > > 1 ) ;
else
dist = td + ( sd > > 1 ) ;
if ( dist < minlight )
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
bl [ 0 ] + = ( rad - dist ) * a ;
bl + + ;
2009-11-07 13:29:15 +00:00
}
}
}
}
2011-05-15 13:23:13 +00:00
// warning: <20> Surf_AddDynamicLightNorms<6D> defined but not used
/*
2009-11-07 13:29:15 +00:00
static void Surf_AddDynamicLightNorms ( msurface_t * surf )
{
int lnum ;
int sd , td ;
float dist , rad , minlight ;
vec3_t impact , local ;
int s , t ;
int i ;
int smax , tmax ;
mtexinfo_t * tex ;
float a ;
smax = ( surf - > extents [ 0 ] > > 4 ) + 1 ;
tmax = ( surf - > extents [ 1 ] > > 4 ) + 1 ;
tex = surf - > texinfo ;
for ( lnum = rtlights_first ; lnum < RTL_FIRST ; lnum + + )
{
if ( ! ( surf - > dlightbits & ( 1 < < lnum ) ) )
continue ; // not lit by this light
if ( ! ( cl_dlights [ lnum ] . flags & LFLAG_ALLOW_LMHACK ) )
continue ;
rad = cl_dlights [ lnum ] . radius ;
dist = DotProduct ( cl_dlights [ lnum ] . origin , surf - > plane - > normal ) -
surf - > plane - > dist ;
rad - = fabs ( dist ) ;
minlight = cl_dlights [ lnum ] . minlight ;
if ( rad < minlight )
continue ;
minlight = rad - minlight ;
for ( i = 0 ; i < 3 ; i + + )
{
impact [ i ] = cl_dlights [ lnum ] . origin [ i ] -
surf - > plane - > normal [ i ] * dist ;
}
local [ 0 ] = DotProduct ( impact , tex - > vecs [ 0 ] ) + tex - > vecs [ 0 ] [ 3 ] ;
local [ 1 ] = DotProduct ( impact , tex - > vecs [ 1 ] ) + tex - > vecs [ 1 ] [ 3 ] ;
local [ 0 ] - = surf - > texturemins [ 0 ] ;
local [ 1 ] - = surf - > texturemins [ 1 ] ;
2011-12-26 15:19:13 +00:00
a = 256 * ( cl_dlights [ lnum ] . color [ 0 ] * NTSC_RED + cl_dlights [ lnum ] . color [ 1 ] * NTSC_GREEN + cl_dlights [ lnum ] . color [ 2 ] * NTSC_BLUE ) ;
2009-11-07 13:29:15 +00:00
for ( t = 0 ; t < tmax ; t + + )
{
td = local [ 1 ] - t * 16 ;
if ( td < 0 )
td = - td ;
for ( s = 0 ; s < smax ; s + + )
{
sd = local [ 0 ] - s * 16 ;
if ( sd < 0 )
sd = - sd ;
if ( sd > td )
dist = sd + ( td > > 1 ) ;
else
dist = td + ( sd > > 1 ) ;
if ( dist < minlight )
{
// blocknormals[t*smax + s][0] -= (rad - dist)*(impact[0]-local[0])/8192.0;
// blocknormals[t*smax + s][1] -= (rad - dist)*(impact[1]-local[1])/8192.0;
blocknormals [ t * smax + s ] [ 2 ] + = 0.5 * blocknormals [ t * smax + s ] [ 2 ] * ( rad - dist ) / 256 ;
}
}
}
}
}
2011-05-15 13:23:13 +00:00
*/
2009-11-07 13:29:15 +00:00
# ifdef PEXT_LIGHTSTYLECOL
static void Surf_AddDynamicLightsColours ( msurface_t * surf )
{
int lnum ;
int sd , td ;
float dist , rad , minlight ;
vec3_t impact , local ;
int s , t ;
int i ;
int smax , tmax ;
mtexinfo_t * tex ;
// float temp;
float r , g , b ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
unsigned * bl ;
2010-08-28 17:14:38 +00:00
vec3_t lightofs ;
2009-11-07 13:29:15 +00:00
smax = ( surf - > extents [ 0 ] > > 4 ) + 1 ;
tmax = ( surf - > extents [ 1 ] > > 4 ) + 1 ;
tex = surf - > texinfo ;
for ( lnum = rtlights_first ; lnum < RTL_FIRST ; lnum + + )
{
if ( ! ( surf - > dlightbits & ( 1 < < lnum ) ) )
continue ; // not lit by this light
rad = cl_dlights [ lnum ] . radius ;
2010-08-28 17:14:38 +00:00
VectorSubtract ( cl_dlights [ lnum ] . origin , currententity - > origin , lightofs ) ;
dist = DotProduct ( lightofs , surf - > plane - > normal ) -
2009-11-07 13:29:15 +00:00
surf - > plane - > dist ;
rad - = fabs ( dist ) ;
minlight = cl_dlights [ lnum ] . minlight ;
if ( rad < minlight )
continue ;
minlight = rad - minlight ;
for ( i = 0 ; i < 3 ; i + + )
{
2010-08-28 17:14:38 +00:00
impact [ i ] = lightofs [ i ] -
2009-11-07 13:29:15 +00:00
surf - > plane - > normal [ i ] * dist ;
}
local [ 0 ] = DotProduct ( impact , tex - > vecs [ 0 ] ) + tex - > vecs [ 0 ] [ 3 ] ;
local [ 1 ] = DotProduct ( impact , tex - > vecs [ 1 ] ) + tex - > vecs [ 1 ] [ 3 ] ;
local [ 0 ] - = surf - > texturemins [ 0 ] ;
local [ 1 ] - = surf - > texturemins [ 1 ] ;
2011-12-27 08:35:19 +00:00
r = cl_dlights [ lnum ] . color [ 0 ] * 128 ;
g = cl_dlights [ lnum ] . color [ 1 ] * 128 ;
b = cl_dlights [ lnum ] . color [ 2 ] * 128 ;
2009-11-07 13:29:15 +00:00
/* if (cl_dlights[lnum].type == 1) //a wierd effect.
{
for ( t = 0 ; t < tmax ; t + + )
{
td = local [ 1 ] - t * 16 ;
if ( td < 0 )
td = - td ;
for ( s = 0 ; s < smax ; s + + )
{
sd = local [ 0 ] - s * 16 ;
if ( sd < 0 )
sd = - sd ;
if ( sd > td )
dist = sd + ( td > > 1 ) ;
else
dist = td + ( sd > > 1 ) ;
if ( dist < minlight )
2011-05-15 13:23:13 +00:00
{
blocklights [ t * smax + s ] + = 2 * sin ( dist / 10 + cl . time * 20 ) * ( rad - dist ) * 256 * cl_dlights [ lnum ] . colour [ 0 ] * 3 ;
2009-11-07 13:29:15 +00:00
greenblklights [ t * smax + s ] + = 2 * sin ( M_PI / 3 + dist / 10 + cl . time * 20 ) * ( rad - dist ) * 256 * cl_dlights [ lnum ] . colour [ 1 ] * 3 ;
blueblklights [ t * smax + s ] + = 2 * sin ( 2 * M_PI / 3 + dist / 10 + cl . time * 20 ) * ( rad - dist ) * 256 * cl_dlights [ lnum ] . colour [ 2 ] * 3 ;
}
}
}
}
else
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
*/ {
bl = blocklights ;
for ( t = 0 ; t < tmax ; t + + )
2009-11-07 13:29:15 +00:00
{
td = local [ 1 ] - t * 16 ;
if ( td < 0 )
td = - td ;
for ( s = 0 ; s < smax ; s + + )
{
sd = local [ 0 ] - s * 16 ;
if ( sd < 0 )
sd = - sd ;
if ( sd > td )
dist = sd + ( td > > 1 ) ;
else
dist = td + ( sd > > 1 ) ;
if ( dist < minlight )
2011-05-15 13:23:13 +00:00
{
bl [ 0 ] + = ( rad - dist ) * r ;
2011-04-21 12:11:15 +00:00
bl [ 1 ] + = ( rad - dist ) * g ;
bl [ 2 ] + = ( rad - dist ) * b ;
2009-11-07 13:29:15 +00:00
}
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
bl + = 3 ;
2009-11-07 13:29:15 +00:00
}
}
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
}
2009-11-07 13:29:15 +00:00
}
}
# endif
static void Surf_BuildDeluxMap ( msurface_t * surf , qbyte * dest )
{
int smax , tmax ;
int i , j , size ;
qbyte * lightmap ;
qbyte * deluxmap ;
unsigned scale ;
int maps ;
float intensity ;
vec_t * bnorm ;
vec3_t temp ;
2012-09-30 05:52:03 +00:00
int stride = LMBLOCK_WIDTH * lightmap_bytes ;
if ( ! dest )
return ;
2009-11-07 13:29:15 +00:00
smax = ( surf - > extents [ 0 ] > > 4 ) + 1 ;
tmax = ( surf - > extents [ 1 ] > > 4 ) + 1 ;
size = smax * tmax ;
lightmap = surf - > samples ;
// set to full bright if no light data
if ( ! currentmodel - > deluxdata )
{
for ( i = 0 ; i < size ; i + + )
{
blocknormals [ i ] [ 0 ] = 0.9 ; //surf->orientation[2][0];
blocknormals [ i ] [ 1 ] = 0.8 ; //surf->orientation[2][1];
blocknormals [ i ] [ 2 ] = 1 ; //surf->orientation[2][2];
}
goto store ;
}
if ( currentmodel - > engineflags & MDLF_RGBLIGHTING )
deluxmap = surf - > samples - currentmodel - > lightdata + currentmodel - > deluxdata ;
else
deluxmap = ( surf - > samples - currentmodel - > lightdata ) * 3 + currentmodel - > deluxdata ;
// clear to no light
for ( i = 0 ; i < size ; i + + )
{
blocknormals [ i ] [ 0 ] = 0 ;
blocknormals [ i ] [ 1 ] = 0 ;
blocknormals [ i ] [ 2 ] = 0 ;
}
// add all the lightmaps
if ( lightmap )
{
if ( currentmodel - > engineflags & MDLF_RGBLIGHTING )
{
deluxmap = surf - > samples - currentmodel - > lightdata + currentmodel - > deluxdata ;
2013-10-08 14:28:11 +00:00
for ( maps = 0 ; maps < MAXQ1LIGHTMAPS & & surf - > styles [ maps ] ! = 255 ;
2009-11-07 13:29:15 +00:00
maps + + )
{
scale = d_lightstylevalue [ surf - > styles [ maps ] ] ;
for ( i = 0 ; i < size ; i + + )
{
intensity = ( lightmap [ i * 3 ] + lightmap [ i * 3 + 1 ] + lightmap [ i * 3 + 2 ] ) * scale ;
blocknormals [ i ] [ 0 ] + = intensity * ( deluxmap [ i * 3 + 0 ] - 127 ) ;
blocknormals [ i ] [ 1 ] + = intensity * ( deluxmap [ i * 3 + 1 ] - 127 ) ;
blocknormals [ i ] [ 2 ] + = intensity * ( deluxmap [ i * 3 + 2 ] - 127 ) ;
}
lightmap + = size * 3 ; // skip to next lightmap
deluxmap + = size * 3 ;
}
}
else
{
deluxmap = ( surf - > samples - currentmodel - > lightdata ) * 3 + currentmodel - > deluxdata ;
2013-10-08 14:28:11 +00:00
for ( maps = 0 ; maps < MAXQ1LIGHTMAPS & & surf - > styles [ maps ] ! = 255 ;
2009-11-07 13:29:15 +00:00
maps + + )
{
scale = d_lightstylevalue [ surf - > styles [ maps ] ] ;
for ( i = 0 ; i < size ; i + + )
{
intensity = ( lightmap [ i ] ) * scale ;
blocknormals [ i ] [ 0 ] + = intensity * ( deluxmap [ i * 3 + 0 ] - 127 ) ;
blocknormals [ i ] [ 1 ] + = intensity * ( deluxmap [ i * 3 + 1 ] - 127 ) ;
blocknormals [ i ] [ 2 ] + = intensity * ( deluxmap [ i * 3 + 2 ] - 127 ) ;
}
lightmap + = size ; // skip to next lightmap
deluxmap + = size * 3 ;
}
}
}
store :
// add all the dynamic lights
// if (surf->dlightframe == r_framecount)
// GLR_AddDynamicLightNorms (surf);
// bound, invert, and shift
2012-09-30 05:52:03 +00:00
stride - = smax * lightmap_bytes ;
2009-11-07 13:29:15 +00:00
bnorm = blocknormals [ 0 ] ;
for ( i = 0 ; i < tmax ; i + + , dest + = stride )
{
for ( j = 0 ; j < smax ; j + + )
{
temp [ 0 ] = bnorm [ 0 ] ;
temp [ 1 ] = bnorm [ 1 ] ;
temp [ 2 ] = bnorm [ 2 ] ; //half the effect? so we emulate light's scalecos of 0.5
VectorNormalize ( temp ) ;
2012-09-30 05:52:03 +00:00
dest [ 2 ] = ( temp [ 0 ] + 1 ) / 2 * 255 ;
2009-11-07 13:29:15 +00:00
dest [ 1 ] = ( temp [ 1 ] + 1 ) / 2 * 255 ;
2012-09-30 05:52:03 +00:00
dest [ 0 ] = ( temp [ 2 ] + 1 ) / 2 * 255 ;
2009-11-07 13:29:15 +00:00
2012-09-30 05:52:03 +00:00
dest + = lightmap_bytes ;
2009-11-07 13:29:15 +00:00
bnorm + = 3 ;
}
2011-05-15 13:23:13 +00:00
}
2009-11-07 13:29:15 +00:00
}
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
enum lm_mode
{
bgra4_os ,
bgra4 ,
rgb3_os ,
lum
} ;
/*any sane compiler will inline and split this, removing the stainsrc stuff
just unpacks the internal lightmap block into texture info ready for upload
merges stains and oversaturates overbrights .
2009-11-07 13:29:15 +00:00
*/
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
static void Surf_StoreLightmap ( qbyte * dest , int smax , int tmax , unsigned int shift , enum lm_mode lm_mode , stmap * stainsrc )
2009-11-07 13:29:15 +00:00
{
2011-04-20 23:05:45 +00:00
int r , g , b , t , m ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
unsigned int i , j ;
unsigned int * bl ;
int stride ;
2011-04-20 23:05:45 +00:00
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
switch ( lm_mode )
2009-11-07 13:29:15 +00:00
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
case bgra4_os :
stride = LMBLOCK_WIDTH * 4 - ( smax < < 2 ) ;
2009-11-07 13:29:15 +00:00
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
bl = blocklights ;
2009-11-07 13:29:15 +00:00
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
for ( i = 0 ; i < tmax ; i + + , dest + = stride )
2009-11-07 13:29:15 +00:00
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
for ( j = 0 ; j < smax ; j + + )
2009-11-07 13:29:15 +00:00
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
r = * bl + + > > shift ;
g = * bl + + > > shift ;
b = * bl + + > > shift ;
2009-11-07 13:29:15 +00:00
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
if ( stainsrc ) // merge in stain
2009-11-07 13:29:15 +00:00
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
r = ( 127 + r * ( * stainsrc + + ) ) > > 8 ;
g = ( 127 + g * ( * stainsrc + + ) ) > > 8 ;
b = ( 127 + b * ( * stainsrc + + ) ) > > 8 ;
2009-11-07 13:29:15 +00:00
}
2011-04-20 23:05:45 +00:00
// quake 2 method, scale highest down to
// maintain hue
m = max ( max ( r , g ) , b ) ;
if ( m > 255 )
2009-11-07 13:29:15 +00:00
{
2011-04-20 23:05:45 +00:00
r * = 255.0 / m ;
g * = 255.0 / m ;
b * = 255.0 / m ;
2009-11-07 13:29:15 +00:00
}
2011-04-21 12:11:15 +00:00
dest [ 0 ] = b ;
dest [ 1 ] = g ;
dest [ 2 ] = r ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
dest [ 3 ] = 255 ;
2011-04-20 23:05:45 +00:00
2011-05-15 13:23:13 +00:00
dest + = 4 ;
2009-11-07 13:29:15 +00:00
}
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
if ( stainsrc )
stainsrc + = ( LMBLOCK_WIDTH - smax ) * 3 ;
2011-05-15 13:23:13 +00:00
}
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
break ;
2011-04-20 23:05:45 +00:00
/*
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
case bgra4 :
stride = LMBLOCK_WIDTH * 4 - ( smax < < 2 ) ;
2009-11-07 13:29:15 +00:00
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
bl = blocklights ;
2009-11-07 13:29:15 +00:00
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
for ( i = 0 ; i < tmax ; i + + , dest + = stride )
{
for ( j = 0 ; j < smax ; j + + )
{
r = * bl + + > > shift ;
g = * bl + + > > shift ;
b = * bl + + > > shift ;
2009-11-07 13:29:15 +00:00
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
if ( stainsrc ) // merge in stain
{
r = ( 127 + r * ( * stainsrc + + ) ) > > 8 ;
g = ( 127 + g * ( * stainsrc + + ) ) > > 8 ;
b = ( 127 + b * ( * stainsrc + + ) ) > > 8 ;
}
2009-11-07 13:29:15 +00:00
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
if ( r > 255 )
dest [ 2 ] = 255 ;
else if ( r < 0 )
dest [ 2 ] = 0 ;
else
dest [ 2 ] = r ;
2009-11-07 13:29:15 +00:00
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
if ( g > 255 )
dest [ 1 ] = 255 ;
else if ( g < 0 )
dest [ 1 ] = 0 ;
else
dest [ 1 ] = g ;
2009-11-07 13:29:15 +00:00
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
if ( b > 255 )
dest [ 0 ] = 255 ;
else if ( b < 0 )
dest [ 0 ] = 0 ;
else
dest [ 0 ] = b ;
2009-11-07 13:29:15 +00:00
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
dest [ 3 ] = 255 ;
2011-05-15 13:23:13 +00:00
dest + = 4 ;
2009-11-07 13:29:15 +00:00
}
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
if ( stainsrc )
stainsrc + = ( LMBLOCK_WIDTH - smax ) * 3 ;
2011-05-15 13:23:13 +00:00
}
2009-11-07 13:29:15 +00:00
break ;
2011-04-20 23:05:45 +00:00
*/
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
case rgb3_os :
stride = LMBLOCK_WIDTH * 3 - ( smax * 3 ) ;
2009-11-07 13:29:15 +00:00
bl = blocklights ;
2011-05-15 13:23:13 +00:00
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
for ( i = 0 ; i < tmax ; i + + , dest + = stride )
2009-11-07 13:29:15 +00:00
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
for ( j = 0 ; j < smax ; j + + )
2009-11-07 13:29:15 +00:00
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
r = * bl + + > > shift ;
g = * bl + + > > shift ;
2011-05-15 13:23:13 +00:00
b = * bl + + > > shift ;
2009-11-07 13:29:15 +00:00
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
if ( stainsrc ) // merge in stain
2009-11-07 13:29:15 +00:00
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
r = ( 127 + r * ( * stainsrc + + ) ) > > 8 ;
g = ( 127 + g * ( * stainsrc + + ) ) > > 8 ;
b = ( 127 + b * ( * stainsrc + + ) ) > > 8 ;
}
2009-11-07 13:29:15 +00:00
2011-04-20 23:05:45 +00:00
// quake 2 method, scale highest down to
// maintain hue
m = max ( max ( r , g ) , b ) ;
if ( m > 255 )
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
{
2011-04-20 23:05:45 +00:00
r * = 255.0 / m ;
g * = 255.0 / m ;
b * = 255.0 / m ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
}
2009-11-07 13:29:15 +00:00
2011-04-21 12:11:15 +00:00
dest [ 0 ] = r ;
dest [ 1 ] = g ;
dest [ 2 ] = b ;
2011-05-15 13:23:13 +00:00
dest + = 3 ;
2009-11-07 13:29:15 +00:00
}
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
if ( stainsrc )
stainsrc + = ( LMBLOCK_WIDTH - smax ) * 3 ;
2011-05-15 13:23:13 +00:00
}
2009-11-07 13:29:15 +00:00
break ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
case lum :
stride = LMBLOCK_WIDTH ;
2009-11-07 13:29:15 +00:00
bl = blocklights ;
for ( i = 0 ; i < tmax ; i + + , dest + = stride )
{
for ( j = 0 ; j < smax ; j + + )
{
t = * bl + + ;
t > > = shift ;
if ( t > 255 )
t = 255 ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
dest [ j ] = t ;
2009-11-07 13:29:15 +00:00
}
}
break ;
default :
Sys_Error ( " Bad lightmap format " ) ;
}
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
}
2009-11-07 13:29:15 +00:00
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
/*
= = = = = = = = = = = = = = =
R_BuildLightMap
2009-11-07 13:29:15 +00:00
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
Combine and scale multiple lightmaps into the 8.8 format in blocklights
= = = = = = = = = = = = = = =
*/
static void Surf_BuildLightMap ( msurface_t * surf , qbyte * dest , qbyte * deluxdest , stmap * stainsrc , int shift , int ambient )
{
int smax , tmax ;
int t ;
int i , j , size ;
qbyte * lightmap ;
unsigned scale ;
int maps ;
unsigned * bl ;
2009-11-07 13:29:15 +00:00
2011-05-15 13:23:13 +00:00
//int stride = LMBLOCK_WIDTH*lightmap_bytes; //warning: unused variable <20> stride<64>
2009-11-07 13:29:15 +00:00
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
shift + = 7 ; // increase to base value
surf - > cached_dlight = ( surf - > dlightframe = = r_framecount ) ;
2009-11-07 13:29:15 +00:00
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
smax = ( surf - > extents [ 0 ] > > 4 ) + 1 ;
tmax = ( surf - > extents [ 1 ] > > 4 ) + 1 ;
size = smax * tmax ;
lightmap = surf - > samples ;
2009-11-07 13:29:15 +00:00
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
if ( size > MAX_LIGHTMAP_SIZE * MAX_LIGHTMAP_SIZE )
{ //fixme: fill in?
Con_Printf ( " Lightmap too large \n " ) ;
return ;
}
2011-05-15 13:23:13 +00:00
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
if ( currentmodel - > deluxdata )
Surf_BuildDeluxMap ( surf , deluxdest ) ;
2009-11-07 13:29:15 +00:00
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
# ifdef PEXT_LIGHTSTYLECOL
if ( lightmap_bytes = = 4 | | lightmap_bytes = = 3 )
{
// set to full bright if no light data
if ( ambient < 0 )
{
t = ( - 1 - ambient ) * 255 ;
for ( i = 0 ; i < size * 3 ; i + + )
{
blocklights [ i ] = t ;
2009-11-07 13:29:15 +00:00
}
2013-10-08 14:28:11 +00:00
for ( maps = 0 ; maps < MAXQ1LIGHTMAPS ; maps + + )
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
{
surf - > cached_light [ maps ] = - 1 - ambient ;
surf - > cached_colour [ maps ] = 0xff ;
}
}
else if ( r_fullbright . value > 0 ) //not qw
2009-11-07 13:29:15 +00:00
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
for ( i = 0 ; i < size * 3 ; i + + )
2009-11-07 13:29:15 +00:00
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
blocklights [ i ] = r_fullbright . value * 255 * 256 ;
}
}
else if ( ! currentmodel - > lightdata )
{
2010-08-14 00:15:07 +00:00
/*fullbright if map is not lit*/
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
for ( i = 0 ; i < size * 3 ; i + + )
{
blocklights [ i ] = 255 * 256 ;
2009-11-07 13:29:15 +00:00
}
}
2010-08-14 00:15:07 +00:00
else if ( ! surf - > samples )
{
/*no samples, but map is otherwise lit = pure black*/
for ( i = 0 ; i < size * 3 ; i + + )
{
blocklights [ i ] = 0 ;
}
surf - > cached_light [ 0 ] = 0 ;
surf - > cached_colour [ 0 ] = 0 ;
}
2009-11-07 13:29:15 +00:00
else
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
{
// clear to no light
t = ambient ;
if ( t = = 0 )
memset ( blocklights , 0 , size * 3 * sizeof ( * bl ) ) ;
else
2009-11-07 13:29:15 +00:00
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
for ( i = 0 ; i < size * 3 ; i + + )
2009-11-07 13:29:15 +00:00
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
blocklights [ i ] = t ;
}
}
2009-11-07 13:29:15 +00:00
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
// add all the lightmaps
if ( lightmap )
{
if ( currentmodel - > fromgame = = fg_quake3 ) //rgb
{
/*q3 lightmaps are meant to be pre-built
this code is misguided , and ought never be executed anyway .
*/
bl = blocklights ;
for ( i = 0 ; i < tmax ; i + + )
2009-11-07 13:29:15 +00:00
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
for ( j = 0 ; j < smax ; j + + )
{
bl [ 0 ] = 255 * lightmap [ ( i * LMBLOCK_WIDTH + j ) * 3 ] ;
bl [ 1 ] = 255 * lightmap [ ( i * LMBLOCK_WIDTH + j ) * 3 + 1 ] ;
bl [ 2 ] = 255 * lightmap [ ( i * LMBLOCK_WIDTH + j ) * 3 + 2 ] ;
bl + = 3 ;
}
2009-11-07 13:29:15 +00:00
}
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
}
else if ( currentmodel - > engineflags & MDLF_RGBLIGHTING ) //rgb
2011-05-15 13:23:13 +00:00
{
2013-10-08 14:28:11 +00:00
for ( maps = 0 ; maps < MAXQ1LIGHTMAPS & & surf - > styles [ maps ] ! = 255 ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
maps + + )
2009-11-07 13:29:15 +00:00
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
scale = d_lightstylevalue [ surf - > styles [ maps ] ] ;
surf - > cached_light [ maps ] = scale ; // 8.8 fraction
surf - > cached_colour [ maps ] = cl_lightstyle [ surf - > styles [ maps ] ] . colour ;
2009-11-07 13:29:15 +00:00
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
if ( scale )
{
if ( cl_lightstyle [ surf - > styles [ maps ] ] . colour = = 7 ) //hopefully a faster alternative.
{
bl = blocklights ;
for ( i = 0 ; i < size * 3 ; i + + )
{
* bl + + + = * lightmap + + * scale ;
}
}
else
{
if ( cl_lightstyle [ surf - > styles [ maps ] ] . colour & 1 )
for ( i = 0 ; i < size ; i + + )
blocklights [ i + 0 ] + = lightmap [ i * 3 + 0 ] * scale ;
if ( cl_lightstyle [ surf - > styles [ maps ] ] . colour & 2 )
for ( i = 0 ; i < size ; i + + )
blocklights [ i + 1 ] + = lightmap [ i * 3 + 1 ] * scale ;
if ( cl_lightstyle [ surf - > styles [ maps ] ] . colour & 4 )
for ( i = 0 ; i < size ; i + + )
blocklights [ i + 2 ] + = lightmap [ i * 3 + 2 ] * scale ;
lightmap + = size * 3 ; // skip to next lightmap
}
}
else
lightmap + = size * 3 ; // skip to next lightmap
2009-11-07 13:29:15 +00:00
}
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
}
else
2013-10-08 14:28:11 +00:00
for ( maps = 0 ; maps < MAXQ1LIGHTMAPS & & surf - > styles [ maps ] ! = 255 ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
maps + + )
{
scale = d_lightstylevalue [ surf - > styles [ maps ] ] ;
surf - > cached_light [ maps ] = scale ; // 8.8 fraction
surf - > cached_colour [ maps ] = cl_lightstyle [ surf - > styles [ maps ] ] . colour ;
2009-11-07 13:29:15 +00:00
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
if ( cl_lightstyle [ surf - > styles [ maps ] ] . colour = = 7 ) //hopefully a faster alternative.
{
bl = blocklights ;
for ( i = 0 ; i < size ; i + + )
{
* bl + + + = * lightmap * scale ;
* bl + + + = * lightmap * scale ;
* bl + + + = * lightmap * scale ;
lightmap + + ;
}
}
else
{
if ( cl_lightstyle [ surf - > styles [ maps ] ] . colour & 1 )
for ( i = 0 , bl = blocklights ; i < size ; i + + , bl + = 3 )
* bl + = lightmap [ i ] * scale ;
if ( cl_lightstyle [ surf - > styles [ maps ] ] . colour & 2 )
for ( i = 0 , bl = blocklights + 1 ; i < size ; i + + , bl + = 3 )
* bl + = lightmap [ i ] * scale ;
if ( cl_lightstyle [ surf - > styles [ maps ] ] . colour & 4 )
for ( i = 0 , bl = blocklights + 2 ; i < size ; i + + , bl + = 3 )
* bl + = lightmap [ i ] * scale ;
lightmap + = size ; // skip to next lightmap
}
}
}
}
2009-11-07 13:29:15 +00:00
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
// add all the dynamic lights
if ( surf - > dlightframe = = r_framecount )
Surf_AddDynamicLightsColours ( surf ) ;
2009-11-07 13:29:15 +00:00
2011-04-20 23:05:45 +00:00
if ( ! r_stains . value | | ! surf - > stained )
stainsrc = NULL ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
if ( lightmap_bytes = = 4 )
{
if ( lightmap_bgra )
{
2011-04-20 23:05:45 +00:00
Surf_StoreLightmap ( dest , smax , tmax , shift , bgra4_os , stainsrc ) ;
2009-11-07 13:29:15 +00:00
}
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
else
{
/*if (!r_stains.value || !surf->stained)
Surf_StoreLightmap ( dest , smax , tmax , shift , rgba4 , NULL ) ;
else
Surf_StoreLightmap ( dest , smax , tmax , shift , rgba4 , stainsrc ) ;
*/
}
}
else if ( lightmap_bytes = = 3 )
2009-11-07 13:29:15 +00:00
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
if ( lightmap_bgra )
2009-11-07 13:29:15 +00:00
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
/*
if ( ! r_stains . value | | ! surf - > stained )
Surf_StoreLightmap ( dest , smax , tmax , shift , bgr3 , NULL ) ;
else
Surf_StoreLightmap ( dest , smax , tmax , shift , bgr3 , stainsrc ) ;
*/
}
2011-05-15 13:23:13 +00:00
else
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
{
2011-04-20 23:05:45 +00:00
Surf_StoreLightmap ( dest , smax , tmax , shift , rgb3_os , stainsrc ) ;
2009-11-07 13:29:15 +00:00
}
}
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
}
else
2009-11-07 13:29:15 +00:00
# endif
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
{
// set to full bright if no light data
2010-08-14 00:15:07 +00:00
if ( ! surf - > samples | | ! currentmodel - > lightdata )
{
for ( i = 0 ; i < size * 3 ; i + + )
{
blocklights [ i ] = 255 * 256 ;
}
surf - > cached_light [ 0 ] = d_lightstylevalue [ 0 ] ;
surf - > cached_colour [ 0 ] = cl_lightstyle [ 0 ] . colour ;
}
else if ( r_fullbright . ival )
2009-11-07 13:29:15 +00:00
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
for ( i = 0 ; i < size ; i + + )
blocklights [ i ] = 255 * 256 ;
}
else
{
// clear to no light
for ( i = 0 ; i < size ; i + + )
blocklights [ i ] = 0 ;
// add all the lightmaps
if ( lightmap )
2009-11-07 13:29:15 +00:00
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
if ( currentmodel - > engineflags & MDLF_RGBLIGHTING ) //rgb
2013-10-08 14:28:11 +00:00
for ( maps = 0 ; maps < MAXQ1LIGHTMAPS & & surf - > styles [ maps ] ! = 255 ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
maps + + )
{
scale = d_lightstylevalue [ surf - > styles [ maps ] ] / 3 ;
surf - > cached_light [ maps ] = scale ; // 8.8 fraction
surf - > cached_colour [ maps ] = cl_lightstyle [ surf - > styles [ maps ] ] . colour ;
for ( i = 0 ; i < size ; i + + )
blocklights [ i ] + = ( lightmap [ i * 3 ] + lightmap [ i * 3 + 1 ] + lightmap [ i * 3 + 2 ] ) * scale ;
lightmap + = size * 3 ; // skip to next lightmap
}
else
2013-10-08 14:28:11 +00:00
for ( maps = 0 ; maps < MAXQ1LIGHTMAPS & & surf - > styles [ maps ] ! = 255 ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
maps + + )
{
scale = d_lightstylevalue [ surf - > styles [ maps ] ] ;
surf - > cached_light [ maps ] = scale ; // 8.8 fraction
surf - > cached_colour [ maps ] = cl_lightstyle [ surf - > styles [ maps ] ] . colour ;
for ( i = 0 ; i < size ; i + + )
blocklights [ i ] + = lightmap [ i ] * scale ;
lightmap + = size ; // skip to next lightmap
}
2009-11-07 13:29:15 +00:00
}
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
// add all the dynamic lights
if ( surf - > dlightframe = = r_framecount )
Surf_AddDynamicLights ( surf ) ;
2009-11-07 13:29:15 +00:00
}
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
2011-04-20 23:05:45 +00:00
Surf_StoreLightmap ( dest , smax , tmax , shift , lum , stainsrc ) ;
2009-11-07 13:29:15 +00:00
}
}
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
BRUSH MODELS
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
/*
= = = = = = = = = = = = = = = =
R_RenderDynamicLightmaps
Multitexture
= = = = = = = = = = = = = = = =
*/
2011-04-30 17:21:10 +00:00
void Surf_RenderDynamicLightmaps ( msurface_t * fa )
2009-11-07 13:29:15 +00:00
{
qbyte * base , * luxbase ;
stmap * stainbase ;
int maps ;
glRect_t * theRect ;
int smax , tmax ;
2012-09-30 05:52:03 +00:00
lightmapinfo_t * lm , * dlm ;
2009-11-07 13:29:15 +00:00
2009-11-15 03:22:07 +00:00
//surfaces without lightmaps
2012-07-05 19:42:36 +00:00
if ( fa - > lightmaptexturenums [ 0 ] < 0 )
2009-11-07 13:29:15 +00:00
return ;
// check for lightmap modification
2010-08-14 00:15:07 +00:00
if ( ! fa - > samples )
{
2010-08-28 17:14:38 +00:00
if ( fa - > cached_light [ 0 ] ! = 0
| | fa - > cached_colour [ 0 ] ! = 0 )
2010-08-14 00:15:07 +00:00
goto dynamic ;
}
else
2009-11-07 13:29:15 +00:00
{
2013-10-08 14:28:11 +00:00
for ( maps = 0 ; maps < MAXQ1LIGHTMAPS & & fa - > styles [ maps ] ! = 255 ;
2009-11-07 13:29:15 +00:00
maps + + )
if ( d_lightstylevalue [ fa - > styles [ maps ] ] ! = fa - > cached_light [ maps ]
2010-08-14 00:15:07 +00:00
| | cl_lightstyle [ fa - > styles [ maps ] ] . colour ! = fa - > cached_colour [ maps ] )
2009-11-07 13:29:15 +00:00
goto dynamic ;
}
if ( fa - > dlightframe = = r_framecount // dynamic this frame
| | fa - > cached_dlight ) // dynamic previously
{
RSpeedLocals ( ) ;
dynamic :
RSpeedRemark ( ) ;
2012-07-05 19:42:36 +00:00
lm = lightmap [ fa - > lightmaptexturenums [ 0 ] ] ;
lm - > modified = true ;
2009-11-07 13:29:15 +00:00
smax = ( fa - > extents [ 0 ] > > 4 ) + 1 ;
tmax = ( fa - > extents [ 1 ] > > 4 ) + 1 ;
2012-07-05 19:42:36 +00:00
theRect = & lm - > rectchange ;
if ( fa - > light_t [ 0 ] < theRect - > t ) {
2009-11-07 13:29:15 +00:00
if ( theRect - > h )
2012-07-05 19:42:36 +00:00
theRect - > h + = theRect - > t - fa - > light_t [ 0 ] ;
theRect - > t = fa - > light_t [ 0 ] ;
2009-11-07 13:29:15 +00:00
}
2012-07-05 19:42:36 +00:00
if ( fa - > light_s [ 0 ] < theRect - > l ) {
2009-11-07 13:29:15 +00:00
if ( theRect - > w )
2012-07-05 19:42:36 +00:00
theRect - > w + = theRect - > l - fa - > light_s [ 0 ] ;
theRect - > l = fa - > light_s [ 0 ] ;
2009-11-07 13:29:15 +00:00
}
2012-07-05 19:42:36 +00:00
if ( ( theRect - > w + theRect - > l ) < ( fa - > light_s [ 0 ] + smax ) )
theRect - > w = ( fa - > light_s [ 0 ] - theRect - > l ) + smax ;
if ( ( theRect - > h + theRect - > t ) < ( fa - > light_t [ 0 ] + tmax ) )
theRect - > h = ( fa - > light_t [ 0 ] - theRect - > t ) + tmax ;
2009-11-07 13:29:15 +00:00
2012-09-30 05:52:03 +00:00
if ( lm - > hasdeluxe )
2009-11-07 13:29:15 +00:00
{
2012-09-30 05:52:03 +00:00
dlm = lightmap [ fa - > lightmaptexturenums [ 0 ] + 1 ] ;
dlm - > modified = true ;
theRect = & dlm - > rectchange ;
2012-07-05 19:42:36 +00:00
if ( fa - > light_t [ 0 ] < theRect - > t ) {
2009-11-07 13:29:15 +00:00
if ( theRect - > h )
2012-07-05 19:42:36 +00:00
theRect - > h + = theRect - > t - fa - > light_t [ 0 ] ;
theRect - > t = fa - > light_t [ 0 ] ;
2009-11-07 13:29:15 +00:00
}
2012-07-05 19:42:36 +00:00
if ( fa - > light_s [ 0 ] < theRect - > l ) {
2009-11-07 13:29:15 +00:00
if ( theRect - > w )
2012-07-05 19:42:36 +00:00
theRect - > w + = theRect - > l - fa - > light_s [ 0 ] ;
theRect - > l = fa - > light_s [ 0 ] ;
2009-11-07 13:29:15 +00:00
}
2012-07-05 19:42:36 +00:00
if ( ( theRect - > w + theRect - > l ) < ( fa - > light_s [ 0 ] + smax ) )
theRect - > w = ( fa - > light_s [ 0 ] - theRect - > l ) + smax ;
if ( ( theRect - > h + theRect - > t ) < ( fa - > light_t [ 0 ] + tmax ) )
theRect - > h = ( fa - > light_t [ 0 ] - theRect - > t ) + tmax ;
2009-11-07 13:29:15 +00:00
2012-09-30 05:52:03 +00:00
luxbase = dlm - > lightmaps ;
luxbase + = fa - > light_t [ 0 ] * dlm - > width * lightmap_bytes + fa - > light_s [ 0 ] * lightmap_bytes ;
2009-11-07 13:29:15 +00:00
}
else
luxbase = NULL ;
2012-07-05 19:42:36 +00:00
base = lm - > lightmaps ;
base + = fa - > light_t [ 0 ] * lm - > width * lightmap_bytes + fa - > light_s [ 0 ] * lightmap_bytes ;
stainbase = lm - > stainmaps ;
stainbase + = ( fa - > light_t [ 0 ] * lm - > width + fa - > light_s [ 0 ] ) * 3 ;
2011-04-30 17:21:10 +00:00
Surf_BuildLightMap ( fa , base , luxbase , stainbase , lightmap_shift , r_ambient . value * 255 ) ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
RSpeedEnd ( RSPEED_DYNAMIC ) ;
}
}
2011-04-30 17:21:10 +00:00
void Surf_RenderAmbientLightmaps ( msurface_t * fa , int ambient )
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
{
qbyte * base , * luxbase ;
stmap * stainbase ;
glRect_t * theRect ;
int smax , tmax ;
2012-09-30 05:52:03 +00:00
lightmapinfo_t * lm , * dlm ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
if ( ! fa - > mesh )
return ;
//surfaces without lightmaps
2012-07-05 19:42:36 +00:00
if ( fa - > lightmaptexturenums [ 0 ] < 0 )
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
return ;
if ( fa - > cached_light [ 0 ] ! = ambient | | fa - > cached_colour [ 0 ] ! = 0xff )
goto dynamic ;
if ( fa - > dlightframe = = r_framecount // dynamic this frame
| | fa - > cached_dlight ) // dynamic previously
{
RSpeedLocals ( ) ;
dynamic :
RSpeedRemark ( ) ;
2012-07-05 19:42:36 +00:00
lm = lightmap [ fa - > lightmaptexturenums [ 0 ] ] ;
lm - > modified = true ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
smax = ( fa - > extents [ 0 ] > > 4 ) + 1 ;
tmax = ( fa - > extents [ 1 ] > > 4 ) + 1 ;
2012-07-05 19:42:36 +00:00
theRect = & lm - > rectchange ;
if ( fa - > light_t [ 0 ] < theRect - > t )
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
if ( theRect - > h )
2012-07-05 19:42:36 +00:00
theRect - > h + = theRect - > t - fa - > light_t [ 0 ] ;
theRect - > t = fa - > light_t [ 0 ] ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
}
2012-07-05 19:42:36 +00:00
if ( fa - > light_s [ 0 ] < theRect - > l )
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
if ( theRect - > w )
2012-07-05 19:42:36 +00:00
theRect - > w + = theRect - > l - fa - > light_s [ 0 ] ;
theRect - > l = fa - > light_s [ 0 ] ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
}
2012-07-05 19:42:36 +00:00
if ( ( theRect - > w + theRect - > l ) < ( fa - > light_s [ 0 ] + smax ) )
theRect - > w = ( fa - > light_s [ 0 ] - theRect - > l ) + smax ;
if ( ( theRect - > h + theRect - > t ) < ( fa - > light_t [ 0 ] + tmax ) )
theRect - > h = ( fa - > light_t [ 0 ] - theRect - > t ) + tmax ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
2012-09-30 05:52:03 +00:00
if ( lm - > hasdeluxe )
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
{
2012-09-30 05:52:03 +00:00
dlm = lightmap [ fa - > lightmaptexturenums [ 0 ] + 1 ] ;
lm - > modified = true ;
theRect = & lm - > rectchange ;
2012-07-05 19:42:36 +00:00
if ( fa - > light_t [ 0 ] < theRect - > t )
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
if ( theRect - > h )
2012-07-05 19:42:36 +00:00
theRect - > h + = theRect - > t - fa - > light_t [ 0 ] ;
theRect - > t = fa - > light_t [ 0 ] ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
}
2012-07-05 19:42:36 +00:00
if ( fa - > light_s [ 0 ] < theRect - > l )
{
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
if ( theRect - > w )
2012-07-05 19:42:36 +00:00
theRect - > w + = theRect - > l - fa - > light_s [ 0 ] ;
theRect - > l = fa - > light_s [ 0 ] ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
}
2012-07-05 19:42:36 +00:00
if ( ( theRect - > w + theRect - > l ) < ( fa - > light_s [ 0 ] + smax ) )
theRect - > w = ( fa - > light_s [ 0 ] - theRect - > l ) + smax ;
if ( ( theRect - > h + theRect - > t ) < ( fa - > light_t [ 0 ] + tmax ) )
theRect - > h = ( fa - > light_t [ 0 ] - theRect - > t ) + tmax ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
2012-09-30 05:52:03 +00:00
luxbase = dlm - > lightmaps ;
luxbase + = fa - > light_t [ 0 ] * dlm - > width * lightmap_bytes + fa - > light_s [ 0 ] * lightmap_bytes ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
}
else
luxbase = NULL ;
2012-07-05 19:42:36 +00:00
base = lm - > lightmaps ;
base + = fa - > light_t [ 0 ] * lm - > width * lightmap_bytes + fa - > light_s [ 0 ] * lightmap_bytes ;
stainbase = lm - > stainmaps ;
stainbase + = ( fa - > light_t [ 0 ] * lm - > width + fa - > light_s [ 0 ] ) * 3 ;
2011-04-30 17:21:10 +00:00
Surf_BuildLightMap ( fa , base , luxbase , stainbase , lightmap_shift , - 1 - ambient ) ;
2009-11-07 13:29:15 +00:00
RSpeedEnd ( RSPEED_DYNAMIC ) ;
}
}
/*
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
WORLD MODEL
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
*/
2012-05-09 15:30:53 +00:00
#if 0
2009-11-07 13:29:15 +00:00
static qbyte * R_MarkLeafSurfaces_Q1 ( void )
{
qbyte * vis ;
mleaf_t * leaf ;
int i , j ;
msurface_t * surf ;
int shift ;
vis = R_CalcVis_Q1 ( ) ;
2011-05-15 13:23:13 +00:00
2009-11-07 13:29:15 +00:00
for ( i = 0 ; i < cl . worldmodel - > numleafs ; i + + )
{
if ( vis [ i > > 3 ] & ( 1 < < ( i & 7 ) ) )
{
leaf = ( mleaf_t * ) & cl . worldmodel - > leafs [ i + 1 ] ;
if ( R_CullBox ( leaf - > minmaxs , leaf - > minmaxs + 3 ) )
continue ;
leaf - > visframe = r_visframecount ;
for ( j = 0 ; j < leaf - > nummarksurfaces ; j + + )
{
surf = leaf - > firstmarksurface [ j ] ;
if ( surf - > visframe = = r_visframecount )
continue ;
surf - > visframe = r_visframecount ;
* surf - > mark = surf ;
}
}
}
{
texture_t * tex ;
shift = Surf_LightmapShift ( cl . worldmodel ) ;
for ( i = 0 ; i < cl . worldmodel - > numtextures ; i + + )
{
tex = cl . worldmodel - > textures [ i ] ;
if ( ! tex )
continue ;
for ( j = 0 ; j < tex - > vbo . meshcount ; j + + )
{
surf = tex - > vbo . meshlist [ j ] ;
if ( surf )
{
2011-04-30 17:21:10 +00:00
Surf_RenderDynamicLightmaps ( surf ) ;
2009-11-07 13:29:15 +00:00
tex - > vbo . meshlist [ j ] = NULL ;
2010-07-11 02:22:39 +00:00
surf - > sbatch - > mesh [ surf - > sbatch - > meshes + + ] = surf - > mesh ;
2009-11-07 13:29:15 +00:00
}
}
}
}
return vis ;
}
2012-05-09 15:30:53 +00:00
# endif
2009-11-07 13:29:15 +00:00
2012-11-27 03:23:19 +00:00
/*
static qbyte * Surf_MaskVis ( qbyte * src , qbyte * dest )
{
int i ;
if ( cl . worldmodel - > leafs [ i ] . ma
}
*/
qbyte * frustumvis ;
2009-11-07 13:29:15 +00:00
/*
= = = = = = = = = = = = = = = =
R_RecursiveWorldNode
= = = = = = = = = = = = = = = =
*/
static void Surf_RecursiveWorldNode ( mnode_t * node , unsigned int clipflags )
{
int c , side , clipped ;
mplane_t * plane , * clipplane ;
msurface_t * surf , * * mark ;
mleaf_t * pleaf ;
double dot ;
start :
if ( node - > contents = = Q1CONTENTS_SOLID )
return ; // solid
if ( node - > visframe ! = r_visframecount )
return ;
2013-10-29 17:38:22 +00:00
for ( c = 0 , clipplane = r_refdef . frustum ; c < r_refdef . frustum_numplanes ; c + + , clipplane + + )
2009-11-07 13:29:15 +00:00
{
if ( ! ( clipflags & ( 1 < < c ) ) )
continue ; // don't need to clip against it
clipped = BOX_ON_PLANE_SIDE ( node - > minmaxs , node - > minmaxs + 3 , clipplane ) ;
if ( clipped = = 2 )
return ;
else if ( clipped = = 1 )
clipflags - = ( 1 < < c ) ; // node is entirely on screen
}
// if a leaf node, draw stuff
if ( node - > contents < 0 )
{
pleaf = ( mleaf_t * ) node ;
2012-11-27 03:23:19 +00:00
c = pleaf - cl . worldmodel - > leafs ;
frustumvis [ c > > 3 ] | = 1 < < ( c & 7 ) ;
2009-11-07 13:29:15 +00:00
mark = pleaf - > firstmarksurface ;
c = pleaf - > nummarksurfaces ;
if ( c )
{
do
{
( * mark + + ) - > visframe = r_framecount ;
} while ( - - c ) ;
}
return ;
}
// node is just a decision point, so go down the apropriate sides
// find which side of the node we are on
plane = node - > plane ;
switch ( plane - > type )
{
case PLANE_X :
dot = modelorg [ 0 ] - plane - > dist ;
break ;
case PLANE_Y :
dot = modelorg [ 1 ] - plane - > dist ;
break ;
case PLANE_Z :
dot = modelorg [ 2 ] - plane - > dist ;
break ;
default :
dot = DotProduct ( modelorg , plane - > normal ) - plane - > dist ;
break ;
}
if ( dot > = 0 )
side = 0 ;
else
side = 1 ;
// recurse down the children, front side first
Surf_RecursiveWorldNode ( node - > children [ side ] , clipflags ) ;
// draw stuff
c = node - > numsurfaces ;
if ( c )
{
surf = cl . worldmodel - > surfaces + node - > firstsurface ;
if ( dot < 0 - BACKFACE_EPSILON )
side = SURF_PLANEBACK ;
else if ( dot > BACKFACE_EPSILON )
side = 0 ;
{
for ( ; c ; c - - , surf + + )
{
if ( surf - > visframe ! = r_framecount )
continue ;
if ( ( ( dot < 0 ) ^ ! ! ( surf - > flags & SURF_PLANEBACK ) ) )
continue ; // wrong side
2011-04-30 17:21:10 +00:00
Surf_RenderDynamicLightmaps ( surf ) ;
2010-07-11 02:22:39 +00:00
surf - > sbatch - > mesh [ surf - > sbatch - > meshes + + ] = surf - > mesh ;
2009-11-07 13:29:15 +00:00
}
}
}
// recurse down the back side
//GLR_RecursiveWorldNode (node->children[!side], clipflags);
node = node - > children [ ! side ] ;
goto start ;
}
2012-05-14 01:41:08 +00:00
static void Surf_OrthoRecursiveWorldNode ( mnode_t * node , unsigned int clipflags )
{
//when rendering as ortho the front and back sides are technically equal. the only culling comes from frustum culling.
2012-07-05 19:42:36 +00:00
int c , clipped ;
mplane_t * clipplane ;
2012-05-14 01:41:08 +00:00
msurface_t * surf , * * mark ;
mleaf_t * pleaf ;
if ( node - > contents = = Q1CONTENTS_SOLID )
return ; // solid
if ( node - > visframe ! = r_visframecount )
return ;
2013-10-29 17:38:22 +00:00
for ( c = 0 , clipplane = r_refdef . frustum ; c < r_refdef . frustum_numplanes ; c + + , clipplane + + )
2012-05-14 01:41:08 +00:00
{
if ( ! ( clipflags & ( 1 < < c ) ) )
continue ; // don't need to clip against it
clipped = BOX_ON_PLANE_SIDE ( node - > minmaxs , node - > minmaxs + 3 , clipplane ) ;
if ( clipped = = 2 )
return ;
else if ( clipped = = 1 )
clipflags - = ( 1 < < c ) ; // node is entirely on screen
}
// if a leaf node, draw stuff
if ( node - > contents < 0 )
{
pleaf = ( mleaf_t * ) node ;
mark = pleaf - > firstmarksurface ;
c = pleaf - > nummarksurfaces ;
if ( c )
{
do
{
( * mark + + ) - > visframe = r_framecount ;
} while ( - - c ) ;
}
return ;
}
// recurse down the children
Surf_OrthoRecursiveWorldNode ( node - > children [ 0 ] , clipflags ) ;
Surf_OrthoRecursiveWorldNode ( node - > children [ 1 ] , clipflags ) ;
// draw stuff
c = node - > numsurfaces ;
if ( c )
{
surf = cl . worldmodel - > surfaces + node - > firstsurface ;
for ( ; c ; c - - , surf + + )
{
if ( surf - > visframe ! = r_framecount )
continue ;
Surf_RenderDynamicLightmaps ( surf ) ;
surf - > sbatch - > mesh [ surf - > sbatch - > meshes + + ] = surf - > mesh ;
}
}
return ;
}
2009-11-07 13:29:15 +00:00
# ifdef Q2BSPS
static void Surf_RecursiveQ2WorldNode ( mnode_t * node )
{
int c , side ;
mplane_t * plane ;
msurface_t * surf , * * mark ;
mleaf_t * pleaf ;
double dot ;
int sidebit ;
if ( node - > contents = = Q2CONTENTS_SOLID )
return ; // solid
if ( node - > visframe ! = r_visframecount )
return ;
if ( R_CullBox ( node - > minmaxs , node - > minmaxs + 3 ) )
return ;
2011-05-15 13:23:13 +00:00
2009-11-07 13:29:15 +00:00
// if a leaf node, draw stuff
if ( node - > contents ! = - 1 )
{
pleaf = ( mleaf_t * ) node ;
// check for door connected areas
// if (areabits)
{
if ( ! ( areabits [ pleaf - > area > > 3 ] & ( 1 < < ( pleaf - > area & 7 ) ) ) )
return ; // not visible
}
mark = pleaf - > firstmarksurface ;
c = pleaf - > nummarksurfaces ;
if ( c )
{
do
{
( * mark ) - > visframe = r_framecount ;
mark + + ;
} while ( - - c ) ;
}
return ;
}
// node is just a decision point, so go down the apropriate sides
// find which side of the node we are on
plane = node - > plane ;
switch ( plane - > type )
{
case PLANE_X :
dot = modelorg [ 0 ] - plane - > dist ;
break ;
case PLANE_Y :
dot = modelorg [ 1 ] - plane - > dist ;
break ;
case PLANE_Z :
dot = modelorg [ 2 ] - plane - > dist ;
break ;
default :
dot = DotProduct ( modelorg , plane - > normal ) - plane - > dist ;
break ;
}
if ( dot > = 0 )
{
side = 0 ;
sidebit = 0 ;
}
else
{
side = 1 ;
sidebit = SURF_PLANEBACK ;
}
// recurse down the children, front side first
Surf_RecursiveQ2WorldNode ( node - > children [ side ] ) ;
// draw stuff
for ( c = node - > numsurfaces , surf = currentmodel - > surfaces + node - > firstsurface ; c ; c - - , surf + + )
{
if ( surf - > visframe ! = r_framecount )
continue ;
if ( ( surf - > flags & SURF_PLANEBACK ) ! = sidebit )
continue ; // wrong side
surf - > visframe = r_framecount + 1 ; //-1;
2011-04-30 17:21:10 +00:00
Surf_RenderDynamicLightmaps ( surf ) ;
2009-11-07 13:29:15 +00:00
2010-07-11 02:22:39 +00:00
surf - > sbatch - > mesh [ surf - > sbatch - > meshes + + ] = surf - > mesh ;
2009-11-07 13:29:15 +00:00
}
// recurse down the back side
Surf_RecursiveQ2WorldNode ( node - > children [ ! side ] ) ;
}
# endif
# ifdef Q3BSPS
2012-05-09 15:30:53 +00:00
#if 0
2009-11-07 13:29:15 +00:00
static void Surf_LeafWorldNode ( void )
{
int i ;
int clipflags ;
msurface_t * * mark , * surf ;
mleaf_t * pleaf ;
int clipped ;
mplane_t * clipplane ;
for ( pleaf = r_vischain ; pleaf ; pleaf = pleaf - > vischain )
{
// check for door connected areas
// if (areabits)
{
// if (!(areabits[pleaf->area>>3] & (1<<(pleaf->area&7))))
// {
// continue; // not visible
// }
}
clipflags = 15 ; // 1 | 2 | 4 | 8
// if (!r_nocull->value)
{
2012-04-24 07:59:11 +00:00
for ( i = 0 , clipplane = frustum ; i < FRUSTUMPLANES ; i + + , clipplane + + )
2009-11-07 13:29:15 +00:00
{
clipped = BoxOnPlaneSide ( pleaf - > minmaxs , pleaf - > minmaxs + 3 , clipplane ) ;
if ( clipped = = 2 )
{
break ;
}
else if ( clipped = = 1 )
{
clipflags & = ~ ( 1 < < i ) ; // node is entirely on screen
}
}
2012-04-24 07:59:11 +00:00
if ( i ! = FRUSTUMPLANES )
2009-11-07 13:29:15 +00:00
{
continue ;
}
}
i = pleaf - > nummarksurfaces ;
mark = pleaf - > firstmarksurface ;
do
{
surf = * mark + + ;
if ( surf - > visframe ! = r_framecount ) //sufraces exist in multiple leafs.
{
surf - > visframe = r_framecount ;
if ( surf - > mark )
* surf - > mark = surf ;
}
} while ( - - i ) ;
// c_world_leafs++;
}
{
int j ;
texture_t * tex ;
for ( i = 0 ; i < cl . worldmodel - > numtextures ; i + + )
{
tex = cl . worldmodel - > textures [ i ] ;
if ( ! tex )
continue ;
for ( j = 0 ; j < tex - > vbo . meshcount ; j + + )
{
surf = tex - > vbo . meshlist [ j ] ;
if ( surf )
{
tex - > vbo . meshlist [ j ] = NULL ;
2010-07-11 02:22:39 +00:00
surf - > sbatch - > mesh [ surf - > sbatch - > meshes + + ] = surf - > mesh ;
2009-11-07 13:29:15 +00:00
}
}
}
}
}
2012-05-09 15:30:53 +00:00
# endif
2012-04-24 07:59:11 +00:00
static void Surf_RecursiveQ3WorldNode ( mnode_t * node , unsigned int clipflags )
{
int c , side , clipped ;
mplane_t * plane , * clipplane ;
msurface_t * surf , * * mark ;
mleaf_t * pleaf ;
double dot ;
start :
if ( node - > visframe ! = r_visframecount )
return ;
2013-10-29 17:38:22 +00:00
for ( c = 0 , clipplane = r_refdef . frustum ; c < r_refdef . frustum_numplanes ; c + + , clipplane + + )
2012-04-24 07:59:11 +00:00
{
if ( ! ( clipflags & ( 1 < < c ) ) )
continue ; // don't need to clip against it
clipped = BOX_ON_PLANE_SIDE ( node - > minmaxs , node - > minmaxs + 3 , clipplane ) ;
if ( clipped = = 2 )
return ;
else if ( clipped = = 1 )
clipflags - = ( 1 < < c ) ; // node is entirely on screen
}
// if a leaf node, draw stuff
if ( node - > contents ! = - 1 )
{
pleaf = ( mleaf_t * ) node ;
if ( ! ( areabits [ pleaf - > area > > 3 ] & ( 1 < < ( pleaf - > area & 7 ) ) ) )
return ; // not visible
mark = pleaf - > firstmarksurface ;
for ( c = pleaf - > nummarksurfaces ; c ; c - - )
{
surf = * mark + + ;
if ( surf - > visframe = = r_framecount )
continue ;
surf - > visframe = r_framecount ;
// if (((dot < 0) ^ !!(surf->flags & SURF_PLANEBACK)))
// continue; // wrong side
surf - > sbatch - > mesh [ surf - > sbatch - > meshes + + ] = surf - > mesh ;
}
return ;
}
// node is just a decision point, so go down the apropriate sides
// find which side of the node we are on
plane = node - > plane ;
switch ( plane - > type )
{
case PLANE_X :
dot = modelorg [ 0 ] - plane - > dist ;
break ;
case PLANE_Y :
dot = modelorg [ 1 ] - plane - > dist ;
break ;
case PLANE_Z :
dot = modelorg [ 2 ] - plane - > dist ;
break ;
default :
dot = DotProduct ( modelorg , plane - > normal ) - plane - > dist ;
break ;
}
if ( dot > = 0 )
side = 0 ;
else
side = 1 ;
// recurse down the children, front side first
Surf_RecursiveQ3WorldNode ( node - > children [ side ] , clipflags ) ;
// q3 nodes contain no drawables
// recurse down the back side
//GLR_RecursiveWorldNode (node->children[!side], clipflags);
node = node - > children [ ! side ] ;
goto start ;
}
2009-11-07 13:29:15 +00:00
# endif
static void Surf_CleanChains ( void )
{
model_t * model = cl . worldmodel ;
2010-07-11 02:22:39 +00:00
batch_t * batch ;
2010-08-28 17:14:38 +00:00
int i ;
2009-11-07 13:29:15 +00:00
2010-07-11 02:22:39 +00:00
if ( r_refdef . recurse )
2009-11-07 13:29:15 +00:00
{
2010-08-28 17:14:38 +00:00
for ( i = 0 ; i < SHADER_SORT_COUNT ; i + + )
for ( batch = model - > batches [ i ] ; batch ; batch = batch - > next )
2010-07-11 02:22:39 +00:00
{
batch - > meshes = batch - > firstmesh ;
}
}
else
{
2010-08-28 17:14:38 +00:00
for ( i = 0 ; i < SHADER_SORT_COUNT ; i + + )
for ( batch = model - > batches [ i ] ; batch ; batch = batch - > next )
2010-07-11 02:22:39 +00:00
{
batch - > meshes = batch - > firstmesh ;
}
2009-11-07 13:29:15 +00:00
}
}
//most of this is a direct copy from gl
void Surf_SetupFrame ( void )
{
mleaf_t * leaf ;
2012-07-05 19:42:36 +00:00
vec3_t temp , pvsorg ;
2009-11-07 13:29:15 +00:00
R_AnimateLight ( ) ;
r_framecount + + ;
2012-02-12 05:18:31 +00:00
r_viewcontents = 0 ;
2009-11-07 13:29:15 +00:00
if ( r_refdef . flags & Q2RDF_NOWORLDMODEL )
{
}
# ifdef Q2BSPS
else if ( cl . worldmodel & & ( cl . worldmodel - > fromgame = = fg_quake2 | | cl . worldmodel - > fromgame = = fg_quake3 ) )
{
static mleaf_t fakeleaf ;
mleaf_t * leaf ;
2013-10-08 14:28:11 +00:00
//FIXME: do we still need this fakeleaf stuff?
r_viewleaf = & fakeleaf ;
2009-11-07 13:29:15 +00:00
r_viewleaf - > contents = Q1CONTENTS_EMPTY ;
r_viewleaf2 = NULL ;
r_oldviewcluster = r_viewcluster ;
r_oldviewcluster2 = r_viewcluster2 ;
2010-08-29 13:49:43 +00:00
if ( r_refdef . recurse )
2013-10-08 14:28:11 +00:00
{
2013-07-14 12:22:51 +00:00
leaf = Mod_PointInLeaf ( cl . worldmodel , r_refdef . pvsorigin ) ;
2013-10-08 14:28:11 +00:00
r_viewcontents = cl . worldmodel - > funcs . PointContents ( cl . worldmodel , NULL , r_refdef . pvsorigin ) ;
}
2010-08-29 13:49:43 +00:00
else
2013-10-08 14:28:11 +00:00
{
2013-07-14 12:22:51 +00:00
leaf = Mod_PointInLeaf ( cl . worldmodel , r_origin ) ;
2013-10-08 14:28:11 +00:00
r_viewcontents = cl . worldmodel - > funcs . PointContents ( cl . worldmodel , NULL , r_origin ) ;
}
2009-11-07 13:29:15 +00:00
r_viewcluster = r_viewcluster2 = leaf - > cluster ;
// check above and below so crossing solid water doesn't draw wrong
if ( ! leaf - > contents )
{ // look down a bit
vec3_t temp ;
VectorCopy ( r_origin , temp ) ;
temp [ 2 ] - = 16 ;
2013-07-14 12:22:51 +00:00
leaf = Mod_PointInLeaf ( cl . worldmodel , temp ) ;
2009-11-07 13:29:15 +00:00
if ( ! ( leaf - > contents & Q2CONTENTS_SOLID ) & &
( leaf - > cluster ! = r_viewcluster2 ) )
r_viewcluster2 = leaf - > cluster ;
}
else
{ // look up a bit
vec3_t temp ;
VectorCopy ( r_origin , temp ) ;
temp [ 2 ] + = 16 ;
2013-07-14 12:22:51 +00:00
leaf = Mod_PointInLeaf ( cl . worldmodel , temp ) ;
2009-11-07 13:29:15 +00:00
if ( ! ( leaf - > contents & Q2CONTENTS_SOLID ) & &
( leaf - > cluster ! = r_viewcluster2 ) )
r_viewcluster2 = leaf - > cluster ;
}
}
# endif
2011-02-25 04:22:14 +00:00
else if ( cl . worldmodel & & cl . worldmodel - > fromgame = = fg_doom3 )
{
r_viewleaf = NULL ;
r_viewleaf2 = NULL ;
}
2009-11-07 13:29:15 +00:00
else
{
2010-07-11 02:22:39 +00:00
if ( r_refdef . recurse )
2012-07-05 19:42:36 +00:00
{
VectorCopy ( r_refdef . pvsorigin , pvsorg ) ;
}
2010-07-11 02:22:39 +00:00
else
2012-07-05 19:42:36 +00:00
{
VectorCopy ( r_origin , pvsorg ) ;
}
2013-07-14 12:22:51 +00:00
r_viewleaf = Mod_PointInLeaf ( cl . worldmodel , pvsorg ) ;
2009-11-07 13:29:15 +00:00
if ( ! r_viewleaf )
{
}
else if ( r_viewleaf - > contents = = Q1CONTENTS_EMPTY )
2011-05-15 13:23:13 +00:00
{ //look down a bit
2012-07-05 19:42:36 +00:00
VectorCopy ( pvsorg , temp ) ;
2009-11-07 13:29:15 +00:00
temp [ 2 ] - = 16 ;
2013-07-14 12:22:51 +00:00
leaf = Mod_PointInLeaf ( cl . worldmodel , temp ) ;
2009-11-07 13:29:15 +00:00
if ( leaf - > contents < = Q1CONTENTS_WATER & & leaf - > contents > = Q1CONTENTS_LAVA )
r_viewleaf2 = leaf ;
else
r_viewleaf2 = NULL ;
}
else if ( r_viewleaf - > contents < = Q1CONTENTS_WATER & & r_viewleaf - > contents > = Q1CONTENTS_LAVA )
{ //in water, look up a bit.
2011-05-15 13:23:13 +00:00
2012-07-05 19:42:36 +00:00
VectorCopy ( pvsorg , temp ) ;
2009-11-07 13:29:15 +00:00
temp [ 2 ] + = 16 ;
2013-07-14 12:22:51 +00:00
leaf = Mod_PointInLeaf ( cl . worldmodel , temp ) ;
2009-11-07 13:29:15 +00:00
if ( leaf - > contents = = Q1CONTENTS_EMPTY )
r_viewleaf2 = leaf ;
else
r_viewleaf2 = NULL ;
}
else
r_viewleaf2 = NULL ;
2011-05-15 13:23:13 +00:00
2009-11-07 13:29:15 +00:00
if ( r_viewleaf )
2012-02-12 05:18:31 +00:00
{
switch ( r_viewleaf - > contents )
{
case Q1CONTENTS_WATER :
r_viewcontents | = FTECONTENTS_WATER ;
break ;
case Q1CONTENTS_LAVA :
r_viewcontents | = FTECONTENTS_LAVA ;
break ;
case Q1CONTENTS_SLIME :
r_viewcontents | = FTECONTENTS_SLIME ;
break ;
case Q1CONTENTS_SKY :
r_viewcontents | = FTECONTENTS_SKY ;
break ;
2012-11-27 03:23:19 +00:00
case Q1CONTENTS_SOLID :
r_viewcontents | = FTECONTENTS_SOLID ;
break ;
2013-09-06 22:57:44 +00:00
case Q1CONTENTS_LADDER :
r_viewcontents | = FTECONTENTS_LADDER ;
break ;
2012-02-12 05:18:31 +00:00
}
}
2009-11-07 13:29:15 +00:00
}
2012-02-12 05:18:31 +00:00
2012-07-20 01:46:05 +00:00
# ifdef TERRAIN
if ( ! ( r_refdef . flags & Q2RDF_NOWORLDMODEL ) & & cl . worldmodel & & cl . worldmodel - > terrain )
{
r_viewcontents | = Heightmap_PointContents ( cl . worldmodel , NULL , r_origin ) ;
}
# endif
2012-02-12 05:18:31 +00:00
/*pick up any extra water entities*/
{
extern vec3_t player_maxs , player_mins ;
vec3_t t1 , t2 ;
VectorCopy ( player_mins , t1 ) ;
VectorCopy ( player_maxs , t2 ) ;
VectorClear ( player_maxs ) ;
VectorClear ( player_mins ) ;
r_viewcontents | = PM_ExtraBoxContents ( r_origin ) ;
VectorCopy ( t1 , player_mins ) ;
VectorCopy ( t2 , player_maxs ) ;
}
V_SetContentsColor ( r_viewcontents ) ;
2013-10-29 17:38:22 +00:00
if ( r_refdef . audio . defaulted )
{
//first scene is the 'main' scene and audio defaults to that (unless overridden later in the frame)
r_refdef . audio . defaulted = false ;
VectorCopy ( r_origin , r_refdef . audio . origin ) ;
VectorCopy ( vpn , r_refdef . audio . forward ) ;
VectorCopy ( vright , r_refdef . audio . right ) ;
VectorCopy ( vup , r_refdef . audio . up ) ;
if ( r_viewcontents & FTECONTENTS_FLUID )
r_refdef . audio . inwater = true ;
else
r_refdef . audio . inwater = false ;
}
2009-11-07 13:29:15 +00:00
}
2012-05-09 15:30:53 +00:00
/*
2010-11-06 23:05:29 +00:00
static mesh_t * surfbatchmeshes [ 256 ] ;
2010-11-02 23:17:25 +00:00
static void Surf_BuildBrushBatch ( batch_t * batch )
{
model_t * model = batch - > ent - > model ;
unsigned int i ;
batch - > mesh = surfbatchmeshes ;
batch - > meshes = batch - > surf_count ;
for ( i = 0 ; i < batch - > surf_count ; i + + )
{
surfbatchmeshes [ i ] = model - > surfaces [ batch - > surf_first + i ] . mesh ;
}
}
2012-05-09 15:30:53 +00:00
*/
2010-11-02 23:17:25 +00:00
void Surf_GenBrushBatches ( batch_t * * batches , entity_t * ent )
{
int i ;
msurface_t * s ;
2012-05-09 15:30:53 +00:00
batch_t * ob ;
2010-11-02 23:17:25 +00:00
model_t * model ;
batch_t * b ;
unsigned int bef ;
model = ent - > model ;
if ( R_CullEntityBox ( ent , model - > mins , model - > maxs ) )
return ;
# ifdef RTLIGHTS
if ( BE_LightCullModel ( ent - > origin , model ) )
return ;
# endif
// calculate dynamic lighting for bmodel if it's not an
// instanced model
2011-02-25 04:22:14 +00:00
if ( model - > fromgame ! = fg_quake3 & & model - > fromgame ! = fg_doom3 )
2010-11-02 23:17:25 +00:00
{
int k ;
currententity = ent ;
currentmodel = ent - > model ;
2010-11-10 03:32:47 +00:00
if ( model - > nummodelsurfaces ! = 0 & & r_dynamic . ival )
2010-11-02 23:17:25 +00:00
{
for ( k = rtlights_first ; k < RTL_FIRST ; k + + )
{
if ( ! cl_dlights [ k ] . radius )
continue ;
2011-07-30 14:14:56 +00:00
if ( ! ( cl_dlights [ k ] . flags & LFLAG_LIGHTMAP ) )
2010-11-02 23:17:25 +00:00
continue ;
model - > funcs . MarkLights ( & cl_dlights [ k ] , 1 < < k ,
model - > nodes + model - > hulls [ 0 ] . firstclipnode ) ;
}
}
2011-04-30 17:21:10 +00:00
Surf_LightmapShift ( model ) ;
2010-11-02 23:17:25 +00:00
if ( ( ent - > drawflags & MLS_MASKIN ) = = MLS_ABSLIGHT )
{
//update lightmaps.
for ( s = model - > surfaces + model - > firstmodelsurface , i = 0 ; i < model - > nummodelsurfaces ; i + + , s + + )
2011-04-30 17:21:10 +00:00
Surf_RenderAmbientLightmaps ( s , ent - > abslight ) ;
2010-11-02 23:17:25 +00:00
}
else if ( ent - > drawflags & DRF_TRANSLUCENT )
{
//update lightmaps.
for ( s = model - > surfaces + model - > firstmodelsurface , i = 0 ; i < model - > nummodelsurfaces ; i + + , s + + )
2011-04-30 17:21:10 +00:00
Surf_RenderAmbientLightmaps ( s , 255 ) ;
2010-11-02 23:17:25 +00:00
}
else
{
//update lightmaps.
for ( s = model - > surfaces + model - > firstmodelsurface , i = 0 ; i < model - > nummodelsurfaces ; i + + , s + + )
2011-04-30 17:21:10 +00:00
Surf_RenderDynamicLightmaps ( s ) ;
2010-11-02 23:17:25 +00:00
}
currententity = NULL ;
}
bef = BEF_PUSHDEPTH ;
if ( ent - > flags & Q2RF_ADDITIVE )
bef | = BEF_FORCEADDITIVE ;
else if ( ent - > drawflags & DRF_TRANSLUCENT & & r_wateralpha . value ! = 1 )
{
bef | = BEF_FORCETRANSPARENT ;
ent - > shaderRGBAf [ 3 ] = r_wateralpha . value ;
}
2011-04-23 20:37:20 +00:00
else if ( ent - > flags & Q2RF_TRANSLUCENT & & cls . protocol ! = CP_QUAKE3 )
2010-11-02 23:17:25 +00:00
bef | = BEF_FORCETRANSPARENT ;
if ( ent - > flags & RF_NODEPTHTEST )
bef | = BEF_FORCENODEPTH ;
2011-04-25 03:25:22 +00:00
if ( ent - > flags & RF_NOSHADOW )
bef | = BEF_NOSHADOWS ;
2010-11-02 23:17:25 +00:00
2012-05-09 15:30:53 +00:00
for ( i = 0 ; i < SHADER_SORT_COUNT ; i + + )
for ( ob = model - > batches [ i ] ; ob ; ob = ob - > next )
2011-02-25 04:22:14 +00:00
{
2012-05-09 15:30:53 +00:00
b = BE_GetTempBatch ( ) ;
if ( ! b )
continue ;
* b = * ob ;
2013-12-02 14:30:30 +00:00
// if (b->texture)
// b->shader = R_TextureAnimation(ent->framestate.g[FS_REG].frame[0], b->texture)->shader;
2012-05-09 15:30:53 +00:00
b - > meshes = b - > maxmeshes ;
b - > ent = ent ;
2012-05-11 00:51:54 +00:00
b - > flags = bef ;
2011-02-25 04:22:14 +00:00
2013-12-02 14:30:30 +00:00
if ( b - > buildmeshes )
b - > buildmeshes ( b ) ;
2012-05-09 15:30:53 +00:00
if ( bef & BEF_FORCEADDITIVE )
{
b - > next = batches [ SHADER_SORT_ADDITIVE ] ;
batches [ SHADER_SORT_ADDITIVE ] = b ;
2011-02-25 04:22:14 +00:00
}
2012-05-09 15:30:53 +00:00
else if ( bef & BEF_FORCETRANSPARENT )
2010-11-02 23:17:25 +00:00
{
2012-05-09 15:30:53 +00:00
b - > next = batches [ SHADER_SORT_BLEND ] ;
batches [ SHADER_SORT_BLEND ] = b ;
}
else
{
b - > next = batches [ b - > shader - > sort ] ;
batches [ b - > shader - > sort ] = b ;
2010-11-02 23:17:25 +00:00
}
}
}
2009-11-07 13:29:15 +00:00
/*
= = = = = = = = = = = = =
R_DrawWorld
= = = = = = = = = = = = =
*/
void Surf_DrawWorld ( void )
{
2012-11-27 03:23:19 +00:00
//surfvis vs entvis - the key difference is that surfvis is surfaces while entvis is volume. though surfvis should be frustum culled also for lighting. entvis doesn't care.
qbyte * surfvis , * entvis ;
qbyte frustumvis_ [ MAX_MAP_LEAFS / 8 ] ;
2009-11-07 13:29:15 +00:00
RSpeedLocals ( ) ;
2010-11-13 17:22:46 +00:00
if ( r_refdef . flags & Q2RDF_NOWORLDMODEL )
2010-11-10 03:32:47 +00:00
{
r_refdef . flags | = Q2RDF_NOWORLDMODEL ;
2012-07-07 05:17:43 +00:00
BE_DrawWorld ( false , NULL ) ;
2010-11-10 03:32:47 +00:00
return ;
}
2010-11-13 17:22:46 +00:00
if ( ! cl . worldmodel | | cl . worldmodel - > needload )
{
/*Don't act as a wallhack*/
return ;
}
2010-11-10 03:32:47 +00:00
2009-11-07 13:29:15 +00:00
Surf_SetupFrame ( ) ;
currentmodel = cl . worldmodel ;
2010-07-11 02:22:39 +00:00
currententity = & r_worldentity ;
2009-11-07 13:29:15 +00:00
{
RSpeedRemark ( ) ;
2011-04-30 17:21:10 +00:00
Surf_LightmapShift ( cl . worldmodel ) ;
2009-11-07 13:29:15 +00:00
# ifdef Q2BSPS
2010-11-11 18:22:49 +00:00
if ( cl . worldmodel - > fromgame = = fg_quake2 | | cl . worldmodel - > fromgame = = fg_quake3 )
2009-11-07 13:29:15 +00:00
{
int leafnum ;
int clientarea ;
2012-10-10 22:58:51 +00:00
# ifdef Q2CLIENT
2009-11-07 13:29:15 +00:00
if ( cls . protocol = = CP_QUAKE2 ) //we can get server sent info
2012-10-10 22:58:51 +00:00
{
2009-11-07 13:29:15 +00:00
memcpy ( areabits , cl . q2frame . areabits , sizeof ( areabits ) ) ;
2012-10-10 22:58:51 +00:00
}
2009-11-07 13:29:15 +00:00
else
# endif
{ //generate the info each frame.
leafnum = CM_PointLeafnum ( cl . worldmodel , r_refdef . vieworg ) ;
clientarea = CM_LeafArea ( cl . worldmodel , leafnum ) ;
CM_WriteAreaBits ( cl . worldmodel , areabits , clientarea ) ;
}
# ifdef Q3BSPS
2010-07-11 02:22:39 +00:00
if ( currententity - > model - > fromgame = = fg_quake3 )
2009-11-07 13:29:15 +00:00
{
2012-11-27 03:23:19 +00:00
entvis = surfvis = R_MarkLeaves_Q3 ( ) ;
2013-10-29 17:38:22 +00:00
Surf_RecursiveQ3WorldNode ( cl . worldmodel - > nodes , ( 1 < < r_refdef . frustum_numplanes ) - 1 ) ;
2012-04-24 07:59:11 +00:00
//Surf_LeafWorldNode ();
2009-11-07 13:29:15 +00:00
}
else
# endif
{
2012-11-27 03:23:19 +00:00
entvis = surfvis = R_MarkLeaves_Q2 ( ) ;
2009-11-07 13:29:15 +00:00
VectorCopy ( r_refdef . vieworg , modelorg ) ;
Surf_RecursiveQ2WorldNode ( cl . worldmodel - > nodes ) ;
}
}
else
# endif
2011-03-03 13:32:27 +00:00
# ifdef MAP_PROC
2011-02-25 04:22:14 +00:00
if ( cl . worldmodel - > fromgame = = fg_doom3 )
{
2012-11-27 03:23:19 +00:00
entvis = surfvis = D3_CalcVis ( cl . worldmodel , r_origin ) ;
2011-02-25 04:22:14 +00:00
}
else
2011-05-20 04:10:46 +00:00
# endif
2012-02-12 05:33:16 +00:00
# ifdef MAP_DOOM
2012-02-12 05:18:31 +00:00
if ( currentmodel - > fromgame = = fg_doom )
{
2012-11-27 03:23:19 +00:00
entvis = surfvis = NULL ;
2012-02-12 05:18:31 +00:00
GLR_DoomWorld ( ) ;
}
else
2012-02-12 05:33:16 +00:00
# endif
2011-05-20 04:10:46 +00:00
# ifdef TERRAIN
if ( currentmodel - > type = = mod_heightmap )
{
2012-11-27 03:23:19 +00:00
entvis = surfvis = NULL ;
2011-05-20 04:10:46 +00:00
}
else
2011-03-03 13:32:27 +00:00
# endif
2009-11-07 13:29:15 +00:00
{
2010-07-11 10:53:13 +00:00
//extern cvar_t temp1;
2012-05-09 15:30:53 +00:00
// if (0)//temp1.value)
2012-11-27 03:23:19 +00:00
// entvis = surfvis = R_MarkLeafSurfaces_Q1();
2012-05-09 15:30:53 +00:00
// else
2009-11-07 13:29:15 +00:00
{
2012-11-27 03:23:19 +00:00
entvis = R_MarkLeaves_Q1 ( ) ;
2011-12-05 15:23:40 +00:00
if ( ! ( r_novis . ival & 2 ) )
2012-09-30 05:52:03 +00:00
VectorCopy ( r_origin , modelorg ) ;
2011-04-30 17:21:10 +00:00
2012-11-27 03:23:19 +00:00
frustumvis = frustumvis_ ;
memset ( frustumvis , 0 , ( cl . worldmodel - > numleafs + 7 ) > > 3 ) ;
2012-05-14 01:41:08 +00:00
if ( r_refdef . useperspective )
Surf_RecursiveWorldNode ( cl . worldmodel - > nodes , 0x1f ) ;
else
Surf_OrthoRecursiveWorldNode ( cl . worldmodel - > nodes , 0x1f ) ;
2012-11-27 03:23:19 +00:00
surfvis = frustumvis ;
2009-11-07 13:29:15 +00:00
}
}
2012-01-21 07:53:49 +00:00
if ( ! ( r_refdef . flags & Q2RDF_NOWORLDMODEL ) )
{
2012-11-29 13:37:48 +00:00
CL_LinkStaticEntities ( entvis ) ;
2012-01-21 07:53:49 +00:00
TRACE ( ( " dbg: calling R_DrawParticles \n " ) ) ;
2012-11-27 03:23:19 +00:00
if ( ! r_refdef . recurse )
P_DrawParticles ( ) ;
2012-01-21 07:53:49 +00:00
}
2010-07-11 02:22:39 +00:00
2009-11-07 13:29:15 +00:00
RSpeedEnd ( RSPEED_WORLDNODE ) ;
TRACE ( ( " dbg: calling BE_DrawWorld \n " ) ) ;
2012-11-27 03:23:19 +00:00
BE_DrawWorld ( true , surfvis ) ;
2009-11-07 13:29:15 +00:00
2010-07-11 02:22:39 +00:00
/*FIXME: move this away*/
2010-11-11 18:22:49 +00:00
if ( cl . worldmodel - > fromgame = = fg_quake | | cl . worldmodel - > fromgame = = fg_halflife )
Surf_LessenStains ( ) ;
2010-07-11 02:22:39 +00:00
Surf_CleanChains ( ) ;
2009-11-07 13:29:15 +00:00
}
}
2012-05-09 15:30:53 +00:00
unsigned int Surf_CalcMemSize ( msurface_t * surf )
{
if ( surf - > mesh )
return 0 ;
if ( ! surf - > numedges )
return 0 ;
//figure out how much space this surface needs
return sizeof ( mesh_t ) +
sizeof ( index_t ) * ( surf - > numedges - 2 ) * 3 +
( sizeof ( vecV_t ) + sizeof ( vec2_t ) * 2 + sizeof ( vec3_t ) * 3 + sizeof ( vec4_t ) ) * surf - > numedges ;
}
2009-11-07 13:29:15 +00:00
void Surf_DeInit ( void )
{
int i ;
2010-05-01 22:47:47 +00:00
2009-11-07 13:29:15 +00:00
for ( i = 0 ; i < numlightmaps ; i + + )
{
if ( ! lightmap [ i ] )
break ;
2012-09-30 05:52:03 +00:00
if ( ! lightmap [ i ] - > external )
2012-07-05 19:42:36 +00:00
{
R_DestroyTexture ( lightmap [ i ] - > lightmap_texture ) ;
}
2009-11-07 13:29:15 +00:00
BZ_Free ( lightmap [ i ] ) ;
lightmap [ i ] = NULL ;
}
if ( lightmap )
BZ_Free ( lightmap ) ;
lightmap = NULL ;
numlightmaps = 0 ;
2012-07-05 19:42:36 +00:00
Alias_Shutdown ( ) ;
2009-11-07 13:29:15 +00:00
}
2010-07-12 22:46:37 +00:00
void Surf_Clear ( model_t * mod )
{
2012-05-09 15:30:53 +00:00
vbo_t * vbo ;
2011-02-25 04:22:14 +00:00
if ( mod - > fromgame = = fg_doom3 )
return ; /*they're on the hunk*/
2012-05-09 15:30:53 +00:00
while ( mod - > vbos )
2009-11-07 13:29:15 +00:00
{
2012-05-09 15:30:53 +00:00
vbo = mod - > vbos ;
mod - > vbos = vbo - > next ;
BE_ClearVBO ( vbo ) ;
2009-11-07 13:29:15 +00:00
}
2012-05-09 15:30:53 +00:00
BZ_Free ( mod - > shadowbatches ) ;
mod - > numshadowbatches = 0 ;
mod - > shadowbatches = NULL ;
2012-05-10 19:14:25 +00:00
# ifdef RTLIGHTS
2012-05-09 15:30:53 +00:00
Sh_PurgeShadowMeshes ( ) ;
2012-05-10 19:14:25 +00:00
# endif
2012-05-09 15:30:53 +00:00
}
2009-11-07 13:29:15 +00:00
2012-05-09 15:30:53 +00:00
//pick fastest mode for lightmap data
void Surf_LightmapMode ( void )
{
2010-11-22 02:03:28 +00:00
lightmap_bgra = true ;
2010-05-01 22:47:47 +00:00
2010-11-22 02:03:28 +00:00
switch ( qrenderer )
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
{
------------------------------------------------------------------------
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
case QR_SOFTWARE :
lightmap_bytes = 4 ;
lightmap_bgra = true ;
break ;
2011-05-15 13:23:13 +00:00
# ifdef D3DQUAKE
2012-09-30 05:52:03 +00:00
case QR_DIRECT3D9 :
case QR_DIRECT3D11 :
2010-11-22 02:03:28 +00:00
/*always bgra, hope your card supports it*/
2010-05-01 22:47:47 +00:00
lightmap_bytes = 4 ;
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
lightmap_bgra = true ;
2011-05-15 13:23:13 +00:00
break ;
2012-09-30 05:52:03 +00:00
# endif
2010-11-22 02:03:28 +00:00
case QR_OPENGL :
2011-05-19 13:34:07 +00:00
# ifdef GLQUAKE
2010-11-22 02:03:28 +00:00
/*favour bgra if the gpu supports it, otherwise use rgb only if it'll be used*/
2010-11-15 02:40:31 +00:00
lightmap_bgra = false ;
2011-01-23 03:44:49 +00:00
if ( gl_config . gles )
{
lightmap_bytes = 3 ;
lightmap_bgra = false ;
}
else if ( gl_config . glversion > = 1.2 )
2010-11-22 02:03:28 +00:00
{
/*the more common case*/
lightmap_bytes = 4 ;
lightmap_bgra = true ;
}
else if ( cl . worldmodel - > fromgame = = fg_quake3 | | ( cl . worldmodel - > engineflags & MDLF_RGBLIGHTING ) | | cl . worldmodel - > deluxdata | | r_loadlits . value )
{
lightmap_bgra = false ;
lightmap_bytes = 3 ;
}
else
lightmap_bytes = 1 ;
break ;
# endif
2012-09-30 05:52:03 +00:00
default :
2011-05-15 13:23:13 +00:00
break ;
2010-11-15 02:40:31 +00:00
}
2012-05-09 15:30:53 +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
//needs to be followed by a BE_UploadAllLightmaps at some point
2012-09-30 05:52:03 +00:00
int Surf_NewLightmaps ( int count , int width , int height , qboolean deluxe )
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
{
int first = numlightmaps ;
2012-09-30 05:52:03 +00:00
int i ;
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
if ( ! count )
return - 1 ;
2013-03-12 23:09:25 +00:00
if ( deluxe & & ( count & 1 ) )
{
deluxe = false ;
Con_Print ( " WARNING: Deluxemapping with odd number of lightmaps \n " ) ;
}
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
i = numlightmaps + count ;
lightmap = BZ_Realloc ( lightmap , sizeof ( * lightmap ) * ( i ) ) ;
while ( i > first )
{
i - - ;
2012-09-30 05:52:03 +00:00
if ( deluxe & & ( ( i - numlightmaps ) & 1 ) )
{
2013-10-29 17:38:22 +00:00
lightmap [ i ] = Z_Malloc ( sizeof ( * lightmap [ i ] ) + ( sizeof ( qbyte ) * 4 ) * width * height ) ;
2012-09-30 05:52:03 +00:00
lightmap [ i ] - > width = width ;
lightmap [ i ] - > height = height ;
lightmap [ i ] - > lightmaps = ( qbyte * ) ( lightmap [ i ] + 1 ) ;
lightmap [ i ] - > stainmaps = NULL ;
lightmap [ i ] - > hasdeluxe = false ;
}
else
{
2013-10-29 17:38:22 +00:00
lightmap [ i ] = Z_Malloc ( sizeof ( * lightmap [ i ] ) + ( sizeof ( qbyte ) * 4 + sizeof ( stmap ) * 3 ) * width * height ) ;
2012-09-30 05:52:03 +00:00
lightmap [ i ] - > width = width ;
lightmap [ i ] - > height = height ;
lightmap [ i ] - > lightmaps = ( qbyte * ) ( lightmap [ i ] + 1 ) ;
lightmap [ i ] - > stainmaps = ( stmap * ) ( lightmap [ i ] - > lightmaps + 4 * width * height ) ;
lightmap [ i ] - > hasdeluxe = deluxe ;
}
lightmap [ i ] - > rectchange . l = 0 ;
lightmap [ i ] - > rectchange . t = 0 ;
lightmap [ i ] - > rectchange . h = LMBLOCK_WIDTH ;
lightmap [ i ] - > rectchange . w = LMBLOCK_WIDTH ;
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
2012-09-30 05:52:03 +00:00
lightmap [ i ] - > lightmap_texture = r_nulltex ;
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
lightmap [ i ] - > modified = true ;
// lightmap[i]->shader = NULL;
lightmap [ i ] - > external = false ;
// reset stainmap since it now starts at 255
2012-09-30 05:52:03 +00:00
if ( lightmap [ i ] - > stainmaps )
memset ( lightmap [ i ] - > stainmaps , 255 , width * height * 3 * sizeof ( stmap ) ) ;
}
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
2012-09-30 05:52:03 +00:00
numlightmaps + = count ;
return first ;
}
int Surf_NewExternalLightmaps ( int count , char * filepattern , qboolean deluxe )
{
int first = numlightmaps ;
int i ;
char nname [ MAX_QPATH ] ;
2013-10-08 14:28:11 +00:00
qboolean odd = ( count & 1 ) & & deluxe ;
2012-09-30 05:52:03 +00:00
if ( ! count )
return - 1 ;
2013-10-08 14:28:11 +00:00
if ( odd )
count + + ;
2012-09-30 05:52:03 +00:00
i = numlightmaps + count ;
lightmap = BZ_Realloc ( lightmap , sizeof ( * lightmap ) * ( i ) ) ;
while ( i > first )
{
i - - ;
lightmap [ i ] = Z_Malloc ( sizeof ( * lightmap [ i ] ) ) ;
lightmap [ i ] - > width = 0 ;
lightmap [ i ] - > height = 0 ;
lightmap [ i ] - > lightmaps = NULL ;
lightmap [ i ] - > stainmaps = NULL ;
lightmap [ i ] - > modified = false ;
lightmap [ i ] - > external = true ;
lightmap [ i ] - > hasdeluxe = ( deluxe & & ( ( i - numlightmaps ) & 1 ) ) ;
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
2012-09-30 05:52:03 +00:00
Q_snprintfz ( nname , sizeof ( nname ) , filepattern , i - numlightmaps ) ;
TEXASSIGN ( lightmap [ i ] - > lightmap_texture , R_LoadHiResTexture ( nname , NULL , 0 ) ) ;
lightmap [ i ] - > width = image_width ;
lightmap [ i ] - > height = image_height ;
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
}
2013-10-08 14:28:11 +00:00
if ( odd )
{
i = numlightmaps + count - 1 ;
if ( ! TEXVALID ( lightmap [ i ] - > lightmap_texture ) )
{ //FIXME: no deluxemaps after all...
Z_Free ( lightmap [ i ] ) ;
lightmap [ i ] = NULL ;
count - - ;
}
}
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
numlightmaps + = count ;
return first ;
}
2012-11-27 03:23:19 +00:00
void Surf_BuildModelLightmaps ( model_t * m )
2012-05-09 15:30:53 +00:00
{
2012-11-27 03:23:19 +00:00
int i , t ;
2012-05-09 15:30:53 +00:00
int shift ;
msurface_t * surf ;
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
batch_t * batch ;
2012-05-09 15:30:53 +00:00
int sortid ;
int ptype ;
2012-07-07 05:17:43 +00:00
int newfirst ;
2012-05-09 15:30:53 +00:00
2012-11-27 03:23:19 +00:00
if ( ! lightmap_bytes )
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
# ifdef TERRAIN
2012-11-27 03:23:19 +00:00
if ( m - > terrain )
Terr_PurgeTerrainModel ( m , true , false ) ;
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
# endif
2012-11-27 03:23:19 +00:00
if ( m - > type ! = mod_brush )
return ;
2012-07-05 19:42:36 +00:00
2012-11-27 03:23:19 +00:00
if ( ! m - > lightmaps . count )
return ;
if ( m - > needload )
return ;
2012-07-05 19:42:36 +00:00
2012-11-27 03:23:19 +00:00
currentmodel = m ;
shift = Surf_LightmapShift ( currentmodel ) ;
2012-07-05 19:42:36 +00:00
2012-11-27 03:23:19 +00:00
if ( * m - > name = = ' * ' & & m - > fromgame = = fg_quake3 ) //FIXME: should be all bsp formats
newfirst = cl . model_precache [ 1 ] - > lightmaps . first ;
else
{
if ( ! m - > lightdata & & m - > lightmaps . count & & m - > fromgame = = fg_quake3 )
2012-09-30 05:52:03 +00:00
{
2012-11-27 03:23:19 +00:00
char pattern [ MAX_QPATH ] ;
COM_StripAllExtensions ( m - > name , pattern , sizeof ( pattern ) ) ;
Q_strncatz ( pattern , " /lm_%04u.tga " , sizeof ( pattern ) ) ;
newfirst = Surf_NewExternalLightmaps ( m - > lightmaps . count , pattern , m - > lightmaps . deluxemapping ) ;
2013-10-08 14:28:11 +00:00
m - > lightmaps . count = numlightmaps - newfirst ;
2012-09-30 05:52:03 +00:00
}
2012-11-27 03:23:19 +00:00
else
newfirst = Surf_NewLightmaps ( m - > lightmaps . count , m - > lightmaps . width , m - > lightmaps . height , m - > lightmaps . deluxemapping ) ;
}
2012-07-05 19:42:36 +00:00
2012-11-27 03:23:19 +00:00
//fixup batch lightmaps
for ( sortid = 0 ; sortid < SHADER_SORT_COUNT ; sortid + + )
for ( batch = m - > batches [ sortid ] ; batch ! = NULL ; batch = batch - > next )
{
2013-10-08 14:28:11 +00:00
for ( i = 0 ; i < MAXRLIGHTMAPS ; i + + )
2012-07-05 19:42:36 +00:00
{
2012-11-27 03:23:19 +00:00
if ( batch - > lightmap [ i ] < 0 )
continue ;
batch - > lightmap [ i ] = batch - > lightmap [ i ] - m - > lightmaps . first + newfirst ;
2012-07-05 19:42:36 +00:00
}
2012-11-27 03:23:19 +00:00
}
2012-07-05 19:42:36 +00:00
2012-11-27 03:23:19 +00:00
/*particle emision based upon texture. this is lazy code*/
if ( m = = cl . worldmodel )
{
for ( t = m - > numtextures - 1 ; t > = 0 ; t - - )
2012-07-05 19:42:36 +00:00
{
2013-06-23 02:17:02 +00:00
char * pn = va ( " tex_%s " , m - > textures [ t ] - > name ) ;
char * h = strchr ( pn , ' # ' ) ;
if ( h )
* h = 0 ;
ptype = P_FindParticleType ( pn ) ;
2012-11-27 03:23:19 +00:00
if ( ptype ! = P_INVALID )
2012-07-05 19:42:36 +00:00
{
2012-11-27 03:23:19 +00:00
for ( i = 0 ; i < m - > nummodelsurfaces ; i + + )
2012-07-05 19:42:36 +00:00
{
2012-11-27 03:23:19 +00:00
surf = m - > surfaces + i + m - > firstmodelsurface ;
if ( surf - > texinfo - > texture = = m - > textures [ t ] )
P_EmitSkyEffectTris ( m , surf , ptype ) ;
2012-07-05 19:42:36 +00:00
}
}
}
2012-11-27 03:23:19 +00:00
}
2012-07-05 19:42:36 +00:00
2012-11-27 03:23:19 +00:00
if ( m - > fromgame = = fg_quake3 )
{
int j ;
unsigned char * src ;
unsigned char * dst ;
for ( i = 0 ; i < m - > lightmaps . count ; i + + )
2012-07-05 19:42:36 +00:00
{
2012-11-27 03:23:19 +00:00
if ( lightmap [ newfirst + i ] - > external )
continue ;
2012-09-30 05:52:03 +00:00
2012-11-27 03:23:19 +00:00
dst = lightmap [ newfirst + i ] - > lightmaps ;
src = m - > lightdata + i * m - > lightmaps . width * m - > lightmaps . height * 3 ;
if ( lightmap_bytes = = 4 & & m - > lightdata )
{
if ( lightmap_bgra )
2012-07-05 19:42:36 +00:00
{
2012-11-27 03:23:19 +00:00
for ( j = 0 ; j < m - > lightmaps . width * m - > lightmaps . height ; j + + , dst + = 4 , src + = 3 )
2012-07-05 19:42:36 +00:00
{
2012-11-27 03:23:19 +00:00
dst [ 0 ] = src [ 2 ] ;
dst [ 1 ] = src [ 1 ] ;
dst [ 2 ] = src [ 0 ] ;
dst [ 3 ] = 255 ;
2012-07-05 19:42:36 +00:00
}
2012-11-27 03:23:19 +00:00
}
else
{
for ( j = 0 ; j < m - > lightmaps . width * m - > lightmaps . height ; j + + , dst + = 4 , src + = 3 )
2012-07-05 19:42:36 +00:00
{
2012-11-27 03:23:19 +00:00
dst [ 0 ] = src [ 0 ] ;
dst [ 1 ] = src [ 1 ] ;
dst [ 2 ] = src [ 2 ] ;
dst [ 3 ] = 255 ;
2012-07-05 19:42:36 +00:00
}
}
}
}
2012-11-27 03:23:19 +00:00
}
else
{
int j ;
lightmapinfo_t * lm , * dlm ;
qbyte * deluxemap ;
//fixup surface lightmaps, and paint
for ( i = 0 ; i < m - > nummodelsurfaces ; i + + )
2012-07-05 19:42:36 +00:00
{
2012-11-27 03:23:19 +00:00
surf = m - > surfaces + i + m - > firstmodelsurface ;
2013-10-08 14:28:11 +00:00
for ( j = 0 ; j < MAXRLIGHTMAPS ; j + + )
2012-07-05 19:42:36 +00:00
{
2012-11-27 03:23:19 +00:00
if ( surf - > lightmaptexturenums [ j ] < m - > lightmaps . first )
2012-07-05 19:42:36 +00:00
{
2012-11-27 03:23:19 +00:00
surf - > lightmaptexturenums [ j ] = - 1 ;
continue ;
}
surf - > lightmaptexturenums [ j ] = surf - > lightmaptexturenums [ 0 ] - m - > lightmaps . first + newfirst ;
2012-07-05 19:42:36 +00:00
2012-11-27 03:23:19 +00:00
lm = lightmap [ surf - > lightmaptexturenums [ j ] ] ;
if ( lm - > hasdeluxe )
{
dlm = lightmap [ surf - > lightmaptexturenums [ j ] + 1 ] ;
deluxemap = dlm - > lightmaps + ( surf - > light_t [ j ] * dlm - > width + surf - > light_s [ j ] ) * lightmap_bytes ;
2012-07-05 19:42:36 +00:00
}
2012-11-27 03:23:19 +00:00
else
deluxemap = NULL ;
Surf_BuildLightMap ( surf ,
lm - > lightmaps + ( surf - > light_t [ j ] * lm - > width + surf - > light_s [ j ] ) * lightmap_bytes ,
deluxemap ,
lm - > stainmaps + ( surf - > light_t [ j ] * lm - > width + surf - > light_s [ j ] ) * 3 ,
shift , r_ambient . value * 255 ) ;
2012-07-05 19:42:36 +00:00
}
}
2012-11-27 03:23:19 +00:00
}
m - > lightmaps . first = newfirst ;
}
void Surf_ClearLightmaps ( void )
{
lightmap_bytes = 0 ;
}
/*
= = = = = = = = = = = = = = = = = =
GL_BuildLightmaps
Builds the lightmap texture
with all the surfaces from all brush models
Groups surfaces into their respective batches ( based on the lightmap number ) .
= = = = = = = = = = = = = = = = = =
*/
void Surf_BuildLightmaps ( void )
{
int i , j ;
model_t * m ;
r_framecount = 1 ; // no dlightcache
for ( i = 0 ; i < numlightmaps ; i + + )
{
if ( ! lightmap [ i ] )
break ;
BZ_Free ( lightmap [ i ] ) ;
lightmap [ i ] = NULL ;
}
Surf_LightmapMode ( ) ;
r_oldviewleaf = NULL ;
r_oldviewleaf2 = NULL ;
r_oldviewcluster = - 1 ;
r_oldviewcluster2 = - 1 ;
numlightmaps = 0 ;
for ( j = 1 ; j < MAX_MODELS ; j + + )
{
m = cl . model_precache [ j ] ;
if ( ! m )
break ;
Surf_BuildModelLightmaps ( m ) ;
}
2013-03-12 22:44:00 +00:00
for ( j = 1 ; j < MAX_CSMODELS ; j + + )
2012-11-27 03:23:19 +00:00
{
m = cl . model_csqcprecache [ j ] ;
if ( ! m )
break ;
Surf_BuildModelLightmaps ( m ) ;
2012-07-05 19:42:36 +00:00
}
2009-11-07 13:29:15 +00:00
BE_UploadAllLightmaps ( ) ;
}
# endif