level/light_face.c
/*	For each texture aligned grid point, back project onto the plane
	to get the world xyz value of the sample point
*/
For each texture aligned grid point, back project onto the plane
to get the world xyz value of the sample point
For each texture aligned grid point back project onto the plane to get the world xyz value of the sample point
static void CalcPoints( lightinfo_t *l )
{
	int j, s, t, w, h, realw, realh, stepbit;
	vec_t starts, startt, us, ut;
	vec3_t facemid, base;
	lightTrace_t tr;
	lightpoint_t *point;
	VectorMA( l->texorg, (1.0 / 32.0), l->facenormal, base );
	VectorMA( l->facemid, (1.0 / 32.0), l->facenormal, facemid );
	realw =	l->texsize[0];
	realh =	l->texsize[1];
	starts = l->texmins[0]*16;
	startt = l->texmins[1]*16;
	stepbit = 4 - extrasamplesbit;
	w = realw << extrasamplesbit;
	h = realh << extrasamplesbit;
	if( stepbit < 4 )
	{
		starts -= 1 << stepbit;
		startt -= 1 << stepbit;
	}
	point = l->point;
	l->numpoints = w * h;
	for( t = 0; t < h; t++ )
	{
		for( s = 0; s < w; s++, point++ )
		{
			us = starts + (s << stepbit);
			ut = startt + (t << stepbit);
			point->occluded = false;
			point->samplepos = (t >> extrasamplesbit) * realw + (s >> extrasamplesbit);
			for( j = 0; j < 3; j++ )
				point->v[j] = base[j] + l->textoworld[0][j] * us + l->textoworld[1][j] * ut;
			{
				Light_TraceLine( &tr, facemid, point->v, false );
				VectorCopy( tr.impact, point->v );
				if( Light_PointContents( point->v ) == BSP_CONTENTS_SOLID )
				{
					c_occluded++;
					point->occluded = true;
				}
			}
		}
	}
}
static void CalcPoints ( lightinfo_t * l ) { int j , s , t , w , h , realw , realh , stepbit ; vec_t starts , startt , us , ut ; vec3_t facemid , base ; lightTrace_t tr ; lightpoint_t * point ; VectorMA ( l -> texorg , ( 1.0 / 32.0 ) , l -> facenormal , base ) ; VectorMA ( l -> facemid , ( 1.0 / 32.0 ) , l -> facenormal , facemid ) ; realw = l -> texsize [ 0 ] ; realh = l -> texsize [ 1 ] ; starts = l -> texmins [ 0 ] * 16 ; startt = l -> texmins [ 1 ] * 16 ; stepbit = 4 - extrasamplesbit ; w = realw << extrasamplesbit ; h = realh << extrasamplesbit ; if ( stepbit < 4 ) { starts -= 1 << stepbit ; startt -= 1 << stepbit ; } point = l -> point ; l -> numpoints = w * h ; for ( t = 0 ; t < h ; t ++ ) { for ( s = 0 ; s < w ; s ++ , point ++ ) { us = starts + ( s << stepbit ) ; ut = startt + ( t << stepbit ) ; point -> occluded = false ; point -> samplepos = ( t >> extrasamplesbit ) * realw + ( s >> extrasamplesbit ) ; for ( j = 0 ; j < 3 ; j ++ ) point -> v [ j ] = base [ j ] + l -> textoworld [ 0 ] [ j ] * us + l -> textoworld [ 1 ] [ j ] * ut ; { Light_TraceLine ( & tr , facemid , point -> v , false ) ; VectorCopy ( tr . impact , point -> v ) ; if ( Light_PointContents ( point -> v ) == BSP_CONTENTS_SOLID ) { c_occluded ++ ; point -> occluded = true ; } } } } }
For each texture aligned grid point, back project onto the plane
to get the world xyz value of the sample point
For each texture aligned grid point back project onto the plane to get the world xyz value of the sample point
// put the base and facemid a little above the surface // calculate texture point // ok, give it one last chance // note: at this point we already know that // the starting sample point is in solid //VectorSubtract(point->v, facemid, v); //VectorNormalize(v); //VectorMA(point->v, (0.0 / 32.0), v, v); // adjust to impact position // (which is nudged out of the impact surface by 1/32 already)