mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2025-09-19 03:56:10 +08:00
* Added support for building shaders in your mod
* Added nav mesh support * fixed many warnings and misc bugs * Fixed the create*projects scripts in mp * Added a bunch of stuff to .gitignore
This commit is contained in:
@ -661,8 +661,9 @@ bool BuildFacesamples( lightinfo_t *pLightInfo, facelight_t *pFaceLight )
|
||||
pTex->lightmapVecsLuxelsPerWorldUnits[1] ) ) );
|
||||
|
||||
// allocate a large number of samples for creation -- get copied later!
|
||||
char sampleData[sizeof(sample_t)*SINGLE_BRUSH_MAP*2];
|
||||
sample_t *samples = (sample_t*)sampleData; // use a char array to speed up the debug version.
|
||||
CUtlVector<sample_t> sampleData;
|
||||
sampleData.SetCount( SINGLE_BRUSH_MAP * 2 );
|
||||
sample_t *samples = sampleData.Base();
|
||||
sample_t *pSamples = samples;
|
||||
|
||||
// lightmap space winding
|
||||
|
@ -622,14 +622,23 @@ void AddBrushesForRayTrace( void )
|
||||
|
||||
for ( int j = 0; j < face->numedges; j++ )
|
||||
{
|
||||
if ( j >= MAX_POINTS_ON_WINDING )
|
||||
Error( "***** ERROR! MAX_POINTS_ON_WINDING reached!" );
|
||||
|
||||
if ( face->firstedge + j >= ARRAYSIZE( dsurfedges ) )
|
||||
Error( "***** ERROR! face->firstedge + j >= ARRAYSIZE( dsurfedges )!" );
|
||||
|
||||
int surfEdge = dsurfedges[face->firstedge + j];
|
||||
short v;
|
||||
unsigned short v;
|
||||
|
||||
if (surfEdge < 0)
|
||||
v = dedges[-surfEdge].v[1];
|
||||
else
|
||||
v = dedges[surfEdge].v[0];
|
||||
|
||||
if ( v >= ARRAYSIZE( dvertexes ) )
|
||||
Error( "***** ERROR! v(%u) >= ARRAYSIZE( dvertexes(%d) )!", ( unsigned int )v, ARRAYSIZE( dvertexes ) );
|
||||
|
||||
dvertex_t *dv = &dvertexes[v];
|
||||
points[j] = dv->point;
|
||||
}
|
||||
|
@ -665,8 +665,8 @@ void CVRADDispColl::CreateChildPatchesSub( int iParentPatch )
|
||||
// Split along the longest edge.
|
||||
Vector vecEdges[3];
|
||||
vecEdges[0] = pParentPatch->winding->p[1] - pParentPatch->winding->p[0];
|
||||
vecEdges[1] = pParentPatch->winding->p[2] - pParentPatch->winding->p[0];
|
||||
vecEdges[2] = pParentPatch->winding->p[2] - pParentPatch->winding->p[1];
|
||||
vecEdges[1] = pParentPatch->winding->p[2] - pParentPatch->winding->p[1];
|
||||
vecEdges[2] = pParentPatch->winding->p[0] - pParentPatch->winding->p[2];
|
||||
|
||||
// Find the longest edge.
|
||||
float flEdgeLength = 0.0f;
|
||||
|
@ -1135,7 +1135,7 @@ void AddPatchLightToRadial( Vector const &patchOrigin, Vector const &patchNormal
|
||||
if( bNeighborBump )
|
||||
{
|
||||
float flScale = patchNormal.Dot( normals[0] );
|
||||
flScale = clamp( flScale, 0.0f, flScale );
|
||||
flScale = max( 0.0f, flScale );
|
||||
float flBumpInfluence = influence * flScale;
|
||||
|
||||
for( int ndxBump = 0; ndxBump < ( NUM_BUMP_VECTS+1 ); ndxBump++ )
|
||||
@ -1148,7 +1148,7 @@ void AddPatchLightToRadial( Vector const &patchOrigin, Vector const &patchNormal
|
||||
else
|
||||
{
|
||||
float flScale = patchNormal.Dot( normals[0] );
|
||||
flScale = clamp( flScale, 0.0f, flScale );
|
||||
flScale = max( 0.0f, flScale );
|
||||
float flBumpInfluence = influence * flScale * 0.05f;
|
||||
|
||||
for( int ndxBump = 0; ndxBump < ( NUM_BUMP_VECTS+1 ); ndxBump++ )
|
||||
@ -1162,7 +1162,7 @@ void AddPatchLightToRadial( Vector const &patchOrigin, Vector const &patchNormal
|
||||
else
|
||||
{
|
||||
float flScale = patchNormal.Dot( luxelNormal );
|
||||
flScale = clamp( flScale, 0.0f, flScale );
|
||||
flScale = max( 0.0f, flScale );
|
||||
influence *= flScale;
|
||||
pRadial->light[0][ndxRadial].AddWeighted( pPatchLight[0], influence );
|
||||
|
||||
@ -1580,21 +1580,13 @@ bool CVRadDispMgr::BuildDispSamples( lightinfo_t *pLightInfo, facelight_t *pFace
|
||||
//
|
||||
int ndxU, ndxV;
|
||||
|
||||
// NOTE: These allocations are necessary to avoid stack overflow
|
||||
// FIXME: Solve with storing global per-thread temp buffers if there's
|
||||
// a performance problem with this solution...
|
||||
bool bTempAllocationNecessary = ((height + 1) * (width + 1)) > SINGLE_BRUSH_MAP;
|
||||
CUtlVector<sample_t> samples;
|
||||
samples.SetCount( SINGLEMAP );
|
||||
sample_t *pSamples = samples.Base();
|
||||
|
||||
Vector worldPointBuffer[SINGLE_BRUSH_MAP];
|
||||
sample_t sampleBuffer[SINGLE_BRUSH_MAP*2];
|
||||
|
||||
Vector *pWorldPoints = worldPointBuffer;
|
||||
sample_t *pSamples = sampleBuffer;
|
||||
if (bTempAllocationNecessary)
|
||||
{
|
||||
pWorldPoints = new Vector[ SINGLEMAP ];
|
||||
pSamples = new sample_t[ SINGLEMAP ];
|
||||
}
|
||||
CUtlVector<Vector> worldPoints;
|
||||
worldPoints.SetCount( SINGLEMAP );
|
||||
Vector *pWorldPoints = worldPoints.Base();
|
||||
|
||||
for( ndxV = 0; ndxV < ( height + 1 ); ndxV++ )
|
||||
{
|
||||
@ -1607,7 +1599,6 @@ bool CVRadDispMgr::BuildDispSamples( lightinfo_t *pLightInfo, facelight_t *pFace
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for( ndxV = 0; ndxV < height; ndxV++ )
|
||||
{
|
||||
for( ndxU = 0; ndxU < width; ndxU++ )
|
||||
@ -1660,7 +1651,7 @@ bool CVRadDispMgr::BuildDispSamples( lightinfo_t *pLightInfo, facelight_t *pFace
|
||||
pFaceLight->numsamples = width * height;
|
||||
pFaceLight->sample = ( sample_t* )calloc( pFaceLight->numsamples, sizeof( *pFaceLight->sample ) );
|
||||
if( !pFaceLight->sample )
|
||||
goto buildDispSamplesError;
|
||||
return false;
|
||||
|
||||
memcpy( pFaceLight->sample, pSamples, pFaceLight->numsamples * sizeof( *pFaceLight->sample ) );
|
||||
|
||||
@ -1669,23 +1660,8 @@ bool CVRadDispMgr::BuildDispSamples( lightinfo_t *pLightInfo, facelight_t *pFace
|
||||
{
|
||||
Msg( "BuildDispSamples: WARNING - no samples %d\n", pLightInfo->face - g_pFaces );
|
||||
}
|
||||
|
||||
if (bTempAllocationNecessary)
|
||||
{
|
||||
delete[] pWorldPoints;
|
||||
delete[] pSamples;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
buildDispSamplesError:
|
||||
if (bTempAllocationNecessary)
|
||||
{
|
||||
delete[] pWorldPoints;
|
||||
delete[] pSamples;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user