|
 |
A few more breadcrumbs from the source code.
- BE
https://github.com/POV-Ray/povray/blob/master/source/parser/parser_expressions.cpp
Starting at Line 1340:
/* Promote_Express promotes Express to the requested number of terms. If
*Old_Terms==1, then it sets all terms to Express[0]. Otherwise, it pads
extra terms with 0.0.
To maximize the consistency of results, DO NOT promote until it is actually
required. This is to ensure, as much as possible, that the same expression
will produce the same results regardless of the context.
*/
void Parser::Promote_Express(EXPRESS& Express,int *Old_Terms,int New_Terms)
{
int i;
if (*Old_Terms >= New_Terms)
return;
if (*Old_Terms==1)
{
for(i=1;i<New_Terms;i++)
{
Express[i]=Express[0];
}
}
else
{
for(i=(*Old_Terms);i<New_Terms;i++)
{
Express[i]=0.0;
}
}
*Old_Terms=New_Terms;
}
Then, if I'm correctly inferring the meaning at Line 1581:
void Parser::Parse_Rel_Term (EXPRESS& Express,int *Terms)
this must involve the "relational operator" which I'm assuming is whatever is in
between the parentheses of a comparison)
and further down starting at line 1623:
CASE (EQUALS_TOKEN)
Parse_Rel_Factor(Local_Express,&Local_Terms);
Promote_Express(Express,Terms,Local_Terms);
for(i=0;i<*Terms;i++)
Express[i] = (DBL)(!FTRUE(Express[i]-Local_Express[i]));
END_CASE
Further down in the file there is the code with the light source warning
(It's actually a large block of vector code starting at line 2028)
CASE_VECTOR_UNGET
if (startedParsing)
{
EXIT
}
else
{
// Note: Setting up for potential warning on single value float
promote to
// five value color vector. Any single float will be promoted to
the full
// 'tgtTerms' value. This usually results in filter and transmit
values >0,
// which caused shadow artifacts back to at least version
v3.6.1.
if ((CurrentCategorizedTokenId() == FLOAT_TOKEN_CATEGORY) ||
(CurrentTrueTokenId() == FUNCT_ID_TOKEN))
sawFloatOrFloatFnct = true;
else
sawFloatOrFloatFnct = false;
if (expectFT)
tgtTerms = 5;
else
tgtTerms = 3;
Parse_Express(Express,&Terms);
Promote_Express(Express,&Terms,tgtTerms);
if (expectFT && (Terms != 5))
Error("Color expression expected but float or vector
expression found.");
else if (!expectFT && ((Terms < 3) || Terms > 5))
Error("RGB color expression expected but float or vector
expression found.");
colour.Set(Express, Terms);
if (((sawFloatOrFloatFnct) && (Terms==5)) && ((colour.filter()
!= 0) && (colour.transm() != 0)))
Warning("Float value promoted to full color vector where
both filter and transmit >0.0.");
if (!expectFT && ((colour.filter() != 0) || (colour.transm() !=
0)))
Warning("Expected pure RGB color expression, unexpected
filter and transmit components will have no effect.");
startedParsing = true;
}
END_CASE
Post a reply to this message
|
 |