mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2024-11-10 06:31:48 +00:00
parsing the q3map_sun[Ext] shader directives
This commit is contained in:
parent
c737a2833f
commit
a01c88707d
3 changed files with 43 additions and 0 deletions
|
@ -1499,6 +1499,7 @@ static void R_LoadFogs( const lump_t* l, const lump_t* brushesLump, const lump_t
|
||||||
|
|
||||||
// get information from the shader for fog parameters
|
// get information from the shader for fog parameters
|
||||||
shader_t* shader = R_FindShader( fogs->shader, LIGHTMAP_NONE, FINDSHADER_MIPRAWIMAGE_BIT );
|
shader_t* shader = R_FindShader( fogs->shader, LIGHTMAP_NONE, FINDSHADER_MIPRAWIMAGE_BIT );
|
||||||
|
shader->isFog = qtrue;
|
||||||
|
|
||||||
out->parms = shader->fogParms;
|
out->parms = shader->fogParms;
|
||||||
|
|
||||||
|
|
|
@ -415,6 +415,12 @@ struct shader_t {
|
||||||
float dfInvDist;
|
float dfInvDist;
|
||||||
float dfBias;
|
float dfBias;
|
||||||
|
|
||||||
|
// Radiant sun information from the sky shader
|
||||||
|
qbool isSunDataValid;
|
||||||
|
vec3_t sunColor;
|
||||||
|
float sunAzimuth;
|
||||||
|
float sunInclination;
|
||||||
|
|
||||||
qbool greyscaleCTF;
|
qbool greyscaleCTF;
|
||||||
|
|
||||||
// extra info for /shaderinfo
|
// extra info for /shaderinfo
|
||||||
|
@ -429,6 +435,7 @@ struct shader_t {
|
||||||
qbool isAlphaTestedOpaque; // no alpha blending, first stage is alpha tested
|
qbool isAlphaTestedOpaque; // no alpha blending, first stage is alpha tested
|
||||||
qbool isDynamic; // at least one vertex attribute must be generated on the fly
|
qbool isDynamic; // at least one vertex attribute must be generated on the fly
|
||||||
qbool hasLightmapStage;
|
qbool hasLightmapStage;
|
||||||
|
qbool isFog;
|
||||||
|
|
||||||
pipeline_t pipelines[MAX_SHADER_STAGES];
|
pipeline_t pipelines[MAX_SHADER_STAGES];
|
||||||
int numPipelines;
|
int numPipelines;
|
||||||
|
|
|
@ -1314,6 +1314,37 @@ static void ParseSurfaceParm( const char** text )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static qbool ParseFloat( float* out, const char** text, const char* commandName, int argIndex )
|
||||||
|
{
|
||||||
|
const char* const token = COM_ParseExt( text, qfalse );
|
||||||
|
if ( token[0] == '\0' || sscanf( token, "%f", out ) != 1 ) {
|
||||||
|
ParserWarning( "invalid/missing %s argument #%d", commandName, argIndex );
|
||||||
|
return qfalse;
|
||||||
|
}
|
||||||
|
|
||||||
|
return qtrue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// q3map_sun R G B intensity azimuth elevation
|
||||||
|
// q3map_sunExt R G B intensity azimuth elevation shadow_degrees samples
|
||||||
|
|
||||||
|
static void ParseSun( const char** text )
|
||||||
|
{
|
||||||
|
float v[6];
|
||||||
|
for ( int i = 0; i < ARRAY_LEN( v ); i++ ) {
|
||||||
|
if ( !ParseFloat( &v[i], text, "q3map_sun", i + 1 ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
shader.isSunDataValid = qtrue;
|
||||||
|
VectorSet( shader.sunColor, v[0], v[1], v[2] );
|
||||||
|
shader.sunAzimuth = v[4];
|
||||||
|
shader.sunInclination = 90.0f - v[5];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// q3map_cnq3_depthFade <scale> <bias>
|
// q3map_cnq3_depthFade <scale> <bias>
|
||||||
|
|
||||||
static void ParseDepthFade( const char** text )
|
static void ParseDepthFade( const char** text )
|
||||||
|
@ -1407,6 +1438,10 @@ static qbool ParseShader( const char** text )
|
||||||
ParseDepthFade( text );
|
ParseDepthFade( text );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else if ( !Q_stricmp( token, "q3map_sun" ) || !Q_stricmp( token, "q3map_sunExt" ) ) {
|
||||||
|
ParseSun( text );
|
||||||
|
SkipRestOfLine( text );
|
||||||
|
}
|
||||||
// skip stuff that only the q3map needs
|
// skip stuff that only the q3map needs
|
||||||
else if ( !Q_stricmpn( token, "q3map", 5 ) ) {
|
else if ( !Q_stricmpn( token, "q3map", 5 ) ) {
|
||||||
SkipRestOfLine( text );
|
SkipRestOfLine( text );
|
||||||
|
|
Loading…
Reference in a new issue