/* compensate for ingame overbrighting/bitshifting */
VectorScale( sample, (1.0f / lightmapCompensate), sample );
+
+ /* sRGB lightmaps */
+ if(lightmapsRGB)
+ {
+ sample[0] = floor(Image_sRGBFloatFromLinearFloat(sample[0] * (1.0 / 255.0)) * 255.0 + 0.5);
+ sample[1] = floor(Image_sRGBFloatFromLinearFloat(sample[1] * (1.0 / 255.0)) * 255.0 + 0.5);
+ sample[2] = floor(Image_sRGBFloatFromLinearFloat(sample[2] * (1.0 / 255.0)) * 255.0 + 0.5);
+ }
/* store it off */
colorBytes[ 0 ] = sample[ 0 ];
vec3_t deluxel[ 3 ];
vec3_t origin[ 4 ], normal[ 4 ];
float biasDirs[ 4 ][ 2 ] = { { -1.0f, -1.0f }, { 1.0f, -1.0f }, { -1.0f, 1.0f }, { 1.0f, 1.0f } };
- vec3_t color, direction, total;
+ vec3_t color, direction = { 0, 0, 0 }, total;
/* limit check */
//% VectorClear( color );
//% samples = 0;
VectorCopy( lightLuxel, color );
- VectorCopy( lightDeluxel, direction );
+ if(lightDeluxel)
+ {
+ VectorCopy( lightDeluxel, direction );
+ }
samples = 1;
for( b = 0; b < 4; b++ )
{
determines opaque brushes in the world and find sky shaders for sunlight calculations
*/
-void SetupBrushes( void )
+void SetupBrushesFlags( int mask_any, int test_any, int mask_all, int test_all )
{
- int i, j, b, compileFlags;
+ int i, j, b;
+ unsigned int compileFlags, allCompileFlags;
qboolean inside;
bspBrush_t *brush;
bspBrushSide_t *side;
/* check all sides */
inside = qtrue;
compileFlags = 0;
+ allCompileFlags = ~(0u);
for( j = 0; j < brush->numSides && inside; j++ )
{
/* do bsp shader calculations */
side = &bspBrushSides[ brush->firstSide + j ];
shader = &bspShaders[ side->shaderNum ];
-
+
/* get shader info */
- si = ShaderInfoForShader( shader->shader );
+ si = ShaderInfoForShaderNull( shader->shader );
if( si == NULL )
continue;
/* or together compile flags */
compileFlags |= si->compileFlags;
+ allCompileFlags &= si->compileFlags;
}
+
+ Sys_FPrintf( SYS_VRB, "flags: %d (all: %d)\n", compileFlags, allCompileFlags );
/* determine if this brush is opaque to light */
- if( !(compileFlags & C_TRANSLUCENT) )
+ if( (compileFlags & mask_any) == test_any && (allCompileFlags & mask_all) == test_all )
{
opaqueBrushes[ b >> 3 ] |= (1 << (b & 7));
numOpaqueBrushes++;
/* emit some statistics */
Sys_FPrintf( SYS_VRB, "%9d opaque brushes\n", numOpaqueBrushes );
}
+void SetupBrushes( void )
+{
+ SetupBrushesFlags(C_TRANSLUCENT, 0, 0, 0);
+}
qboolean ClusterVisible( int a, int b )
{
- int portalClusters, leafBytes;
+ int leafBytes;
byte *pvs;
return qtrue;
/* get pvs data */
- portalClusters = ((int *) bspVisBytes)[ 0 ];
+ /* portalClusters = ((int *) bspVisBytes)[ 0 ]; */
leafBytes = ((int*) bspVisBytes)[ 1 ];
pvs = bspVisBytes + VIS_HEADER_SIZE + (a * leafBytes);
int i, j;
float angle, elevation, angleStep, elevationStep;
const char *value;
- double v1,v2,v3,v4,v5;
+ double v1,v2,v3,v4,v5,v6;
/* note it */
Sys_FPrintf( SYS_VRB, "--- SetupFloodLight ---\n" );
v5=floodlightIntensity;
v6=floodlightDirectionScale;
- sscanf( value, "%lf %lf %lf %lf %lf %lf", &v1, &v2, &v3, &v4, &v5);
+ sscanf( value, "%lf %lf %lf %lf %lf %lf", &v1, &v2, &v3, &v4, &v5, &v6);
floodlightRGB[0]=v1;
floodlightRGB[1]=v2;