mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2025-09-19 03:56:10 +08:00
Sync with latest source-sdk-2013.
This commit is contained in:
@ -91,7 +91,7 @@ void vprint( int depth, const char *fmt, ... )
|
||||
}
|
||||
}
|
||||
|
||||
::printf( string );
|
||||
::printf( "%s", string );
|
||||
OutputDebugString( string );
|
||||
|
||||
if ( fp )
|
||||
|
@ -20,7 +20,6 @@ $Configuration
|
||||
$Linker
|
||||
{
|
||||
$AdditionalDependencies "$BASE glu32.lib opengl32.lib odbc32.lib odbccp32.lib winmm.lib"
|
||||
$AdditionalDependencies "$BASE glaux.lib" [!$VS2010]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,6 +54,8 @@ struct StaticPropBuild_t
|
||||
float m_flForcedFadeScale;
|
||||
unsigned short m_nMinDXLevel;
|
||||
unsigned short m_nMaxDXLevel;
|
||||
int m_LightmapResolutionX;
|
||||
int m_LightmapResolutionY;
|
||||
};
|
||||
|
||||
|
||||
@ -516,6 +518,9 @@ static void AddStaticPropToLump( StaticPropBuild_t const& build )
|
||||
}
|
||||
}
|
||||
|
||||
propLump.m_nLightmapResolutionX = build.m_LightmapResolutionX;
|
||||
propLump.m_nLightmapResolutionY = build.m_LightmapResolutionY;
|
||||
|
||||
// Add the leaves to the leaf lump
|
||||
for (int j = 0; j < leafList.Size(); ++j)
|
||||
{
|
||||
@ -523,6 +528,7 @@ static void AddStaticPropToLump( StaticPropBuild_t const& build )
|
||||
insert.m_Leaf = leafList[j];
|
||||
s_StaticPropLeafLump.AddToTail( insert );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -619,6 +625,18 @@ void EmitStaticProps()
|
||||
build.m_Flags |= STATIC_PROP_SCREEN_SPACE_FADE;
|
||||
}
|
||||
|
||||
if (IntForKey( &entities[i], "generatelightmaps") == 0)
|
||||
{
|
||||
build.m_Flags |= STATIC_PROP_NO_PER_TEXEL_LIGHTING;
|
||||
build.m_LightmapResolutionX = 0;
|
||||
build.m_LightmapResolutionY = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
build.m_LightmapResolutionX = IntForKey( &entities[i], "lightmapresolutionx" );
|
||||
build.m_LightmapResolutionY = IntForKey( &entities[i], "lightmapresolutiony" );
|
||||
}
|
||||
|
||||
const char *pKey = ValueForKey( &entities[i], "fadescale" );
|
||||
if ( pKey && pKey[0] )
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ static void Pause( void )
|
||||
|
||||
static void Exit(const char *msg)
|
||||
{
|
||||
fprintf( stderr, msg );
|
||||
fprintf( stderr, "%s", msg );
|
||||
Pause();
|
||||
exit( -1 );
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ int FindNeighborCornerVert( CCoreDispInfo *pDisp, const Vector &vTest )
|
||||
}
|
||||
|
||||
|
||||
int GetAllNeighbors( const CCoreDispInfo *pDisp, int iNeighbors[512] )
|
||||
int GetAllNeighbors( const CCoreDispInfo *pDisp, int (&iNeighbors)[512] )
|
||||
{
|
||||
int nNeighbors = 0;
|
||||
|
||||
@ -57,7 +57,7 @@ int GetAllNeighbors( const CCoreDispInfo *pDisp, int iNeighbors[512] )
|
||||
|
||||
for ( int i=0; i < pCorner->m_nNeighbors; i++ )
|
||||
{
|
||||
if ( nNeighbors < _ARRAYSIZE( iNeighbors ) )
|
||||
if ( nNeighbors < ARRAYSIZE( iNeighbors ) )
|
||||
iNeighbors[nNeighbors++] = pCorner->m_Neighbors[i];
|
||||
}
|
||||
}
|
||||
|
@ -3548,30 +3548,51 @@ static void LinearToBumpedLightmap(
|
||||
// Convert a RGBExp32 to a RGBA8888
|
||||
// This matches the engine's conversion, so the lighting result is consistent.
|
||||
//-----------------------------------------------------------------------------
|
||||
void ConvertRGBExp32ToRGBA8888( const ColorRGBExp32 *pSrc, unsigned char *pDst )
|
||||
void ConvertRGBExp32ToRGBA8888( const ColorRGBExp32 *pSrc, unsigned char *pDst, Vector* _optOutLinear )
|
||||
{
|
||||
Vector linearColor;
|
||||
Vector vertexColor;
|
||||
|
||||
// convert from ColorRGBExp32 to linear space
|
||||
linearColor[0] = TexLightToLinear( ((ColorRGBExp32 *)pSrc)->r, ((ColorRGBExp32 *)pSrc)->exponent );
|
||||
linearColor[1] = TexLightToLinear( ((ColorRGBExp32 *)pSrc)->g, ((ColorRGBExp32 *)pSrc)->exponent );
|
||||
linearColor[2] = TexLightToLinear( ((ColorRGBExp32 *)pSrc)->b, ((ColorRGBExp32 *)pSrc)->exponent );
|
||||
|
||||
ConvertLinearToRGBA8888( &linearColor, pDst );
|
||||
if ( _optOutLinear )
|
||||
*_optOutLinear = linearColor;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Converts a RGBExp32 to a linear color value.
|
||||
//-----------------------------------------------------------------------------
|
||||
void ConvertRGBExp32ToLinear(const ColorRGBExp32 *pSrc, Vector* pDst)
|
||||
{
|
||||
|
||||
(*pDst)[0] = TexLightToLinear(((ColorRGBExp32 *)pSrc)->r, ((ColorRGBExp32 *)pSrc)->exponent);
|
||||
(*pDst)[1] = TexLightToLinear(((ColorRGBExp32 *)pSrc)->g, ((ColorRGBExp32 *)pSrc)->exponent);
|
||||
(*pDst)[2] = TexLightToLinear(((ColorRGBExp32 *)pSrc)->b, ((ColorRGBExp32 *)pSrc)->exponent);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Converts a linear color value (suitable for combining linearly) to an RBGA8888 value expected by the engine.
|
||||
//-----------------------------------------------------------------------------
|
||||
void ConvertLinearToRGBA8888(const Vector *pSrcLinear, unsigned char *pDst)
|
||||
{
|
||||
Vector vertexColor;
|
||||
|
||||
// convert from linear space to lightmap space
|
||||
// cannot use mathlib routine directly because it doesn't match
|
||||
// the colorspace version found in the engine, which *is* the same sequence here
|
||||
vertexColor[0] = LinearToVertexLight( linearColor[0] );
|
||||
vertexColor[1] = LinearToVertexLight( linearColor[1] );
|
||||
vertexColor[2] = LinearToVertexLight( linearColor[2] );
|
||||
vertexColor[0] = LinearToVertexLight((*pSrcLinear)[0]);
|
||||
vertexColor[1] = LinearToVertexLight((*pSrcLinear)[1]);
|
||||
vertexColor[2] = LinearToVertexLight((*pSrcLinear)[2]);
|
||||
|
||||
// this is really a color normalization with a floor
|
||||
ColorClamp( vertexColor );
|
||||
ColorClamp(vertexColor);
|
||||
|
||||
// final [0..255] scale
|
||||
pDst[0] = RoundFloatToByte( vertexColor[0] * 255.0f );
|
||||
pDst[1] = RoundFloatToByte( vertexColor[1] * 255.0f );
|
||||
pDst[2] = RoundFloatToByte( vertexColor[2] * 255.0f );
|
||||
pDst[0] = RoundFloatToByte(vertexColor[0] * 255.0f);
|
||||
pDst[1] = RoundFloatToByte(vertexColor[1] * 255.0f);
|
||||
pDst[2] = RoundFloatToByte(vertexColor[2] * 255.0f);
|
||||
pDst[3] = 255;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ every surface must be divided into at least two patches each axis
|
||||
*/
|
||||
|
||||
CUtlVector<CPatch> g_Patches;
|
||||
CUtlVector<int> g_FacePatches; // constains all patches, children first
|
||||
CUtlVector<int> g_FacePatches; // contains all patches, children first
|
||||
CUtlVector<int> faceParents; // contains only root patches, use next parent to iterate
|
||||
CUtlVector<int> clusterChildren;
|
||||
CUtlVector<Vector> emitlight;
|
||||
@ -60,6 +60,8 @@ bool g_bDumpRtEnv = false;
|
||||
bool bRed2Black = true;
|
||||
bool g_bFastAmbient = false;
|
||||
bool g_bNoSkyRecurse = false;
|
||||
bool g_bDumpPropLightmaps = false;
|
||||
|
||||
|
||||
int junk;
|
||||
|
||||
@ -2404,16 +2406,21 @@ int ParseCommandLine( int argc, char **argv, bool *onlydetail )
|
||||
{
|
||||
g_bLargeDispSampleRadius = true;
|
||||
}
|
||||
else if (!Q_stricmp( argv[i], "-dumppropmaps"))
|
||||
{
|
||||
g_bDumpPropLightmaps = true;
|
||||
}
|
||||
else if (!Q_stricmp(argv[i],"-bounce"))
|
||||
{
|
||||
if ( ++i < argc )
|
||||
{
|
||||
numbounce = atoi (argv[i]);
|
||||
if ( numbounce < 0 )
|
||||
int bounceParam = atoi (argv[i]);
|
||||
if ( bounceParam < 0 )
|
||||
{
|
||||
Warning("Error: expected non-negative value after '-bounce'\n" );
|
||||
return 1;
|
||||
}
|
||||
numbounce = (unsigned)bounceParam;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -285,6 +285,7 @@ extern qboolean g_bLowPriority;
|
||||
extern qboolean do_fast;
|
||||
extern bool g_bInterrupt; // Was used with background lighting in WC. Tells VRAD to stop lighting.
|
||||
extern IIncremental *g_pIncremental; // null if not doing incremental lighting
|
||||
extern bool g_bDumpPropLightmaps;
|
||||
|
||||
extern float g_flSkySampleScale; // extra sampling factor for indirect light
|
||||
|
||||
@ -367,7 +368,10 @@ void BuildFacelights (int facenum, int threadnum);
|
||||
void PrecompLightmapOffsets();
|
||||
void FinalLightFace (int threadnum, int facenum);
|
||||
void PvsForOrigin (Vector& org, byte *pvs);
|
||||
void ConvertRGBExp32ToRGBA8888( const ColorRGBExp32 *pSrc, unsigned char *pDst );
|
||||
void ConvertRGBExp32ToRGBA8888( const ColorRGBExp32 *pSrc, unsigned char *pDst, Vector* _optOutLinear = NULL );
|
||||
void ConvertRGBExp32ToLinear(const ColorRGBExp32 *pSrc, Vector* pDst);
|
||||
void ConvertLinearToRGBA8888( const Vector *pSrc, unsigned char *pDst );
|
||||
|
||||
|
||||
inline byte PVSCheck( const byte *pvs, int iCluster )
|
||||
{
|
||||
|
@ -738,7 +738,9 @@ void ComputeIndirectLightingAtPoint( Vector &position, Vector &normal, Vector &o
|
||||
ColorRGBExp32ToVector( *pLightmap, lightmapColor );
|
||||
}
|
||||
|
||||
VectorMultiply( lightmapColor, dtexdata[pTex->texdata].reflectivity, lightmapColor );
|
||||
float invLengthSqr = 1.0f / (1.0f + ((vEnd - position) * surfEnum.m_HitFrac / 128.0).LengthSqr());
|
||||
// Include falloff using invsqrlaw.
|
||||
VectorMultiply( lightmapColor, invLengthSqr * dtexdata[pTex->texdata].reflectivity, lightmapColor );
|
||||
VectorAdd( outColor, lightmapColor, outColor );
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -15,7 +15,7 @@ $Configuration
|
||||
$Compiler
|
||||
{
|
||||
$Create/UsePrecompiledHeader "Use Precompiled Header (/Yu)"
|
||||
$PrecompiledHeaderFile "Debug/vrad_launcher.pch"
|
||||
$PrecompiledHeaderFile "$(IntDir)/vrad_launcher.pch"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ static void PFMWrite( float *pFloatImage, const char *pFilename, int width, int
|
||||
|
||||
SpewRetval_t VTF2TGAOutputFunc( SpewType_t spewType, char const *pMsg )
|
||||
{
|
||||
printf( pMsg );
|
||||
printf( "%s", pMsg );
|
||||
fflush( stdout );
|
||||
|
||||
if (spewType == SPEW_ERROR)
|
||||
|
Reference in New Issue
Block a user