|
|
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "Chris R" <car### [at] comcastnet> wrote:
>
> > There were a few other tweaks due to some parser errors that I still don't quite
> > understand, but I got it to work.
>
> Well post the errors and we'll see what we can do.
>
> Also would be nice to post what you've currently got, so others can use it as a
> texture, but also see if they can fix any problems that you've found.
>
> - BE
I will start with the parsing errors I ran into with my initial transformation.
Here is the tail end of the original DakotaRedGranite macro that declares the
material and returns it:
#declare M_DakotaRed =
material {
interior {ior 1.6}
#if (Pol) //polished
#if (Typ=1)
texture {T1_DakotaRedPol}
#else
texture {T1_DakotaRedPol}
texture {T2_DakotaRedPol}
#end //Typ
#else //frosted
#if (Typ=1)
texture {T1_DakotaRedFro}
Crand(0.25)
#else
texture {T1_DakotaRedFro}
texture {T2_DakotaRedFro}
Crand(0.25)
#end //Typ
#end //Pol
scale M_scale
rotate M_rotat
translate M_trans
} //material
M_DakotaRed
I did a test with Type=1 and Pol=off and calling the macro was successful.
Here was my first attempt at having it return just the texture part:
#local _t_dakota_red_tmp =
#if (Pol) //polished
#if (Typ=1)
texture {T1_DakotaRedPol}
#else
texture {T1_DakotaRedPol}
texture {T2_DakotaRedPol}
#end //Typ
#else //frosted
#if (Typ=1)
texture {T1_DakotaRedFro}
/*Line 658 */ CRand(0.25) //texture { _t_crand }
#else
texture {T1_DakotaRedFro}
texture {T2_DakotaRedFro}
CRand(0.25) //texture { _t_crand }
#end //Typ
#end //Pol
#declare T_DakotaRed = texture {
_t_dakota_red_tmp
scale M_scale
rotate M_rotat
translate M_trans
}
;
T_DakotaRed
}
#macro DakotaRedGranite(CSC, Pol, Typ, Pat1, Pat2, Blend, SS)
#local _m = material {
/*Line 681*/ texture { DakotaRedGranite_texture(CSC, Pol, Typ, Pat1,
Pat2, Blend, SS) }
interior { ior 1.6 }
}
_m
#end
The two step declaration of the final texture is required since there is no
other way to apply the scale/rotate/translate transformation to a layered
texture.
The error I get using the same Typ and Pol parameters is:
Line 681: Possible Parse Error: Unmatched {
Line 658: Parse Error: No matching }, undeclared identifier instead
To fix these errors in my final version, I change the CRand(Intensity) to return
a texture identifier instead of a texture, then right before the #local
_t_dakota_red_tmp line, I do:
#local _t_crand = texture { Crand(0.25) }
and then replace each of the CRand(0.25) invocations in the _t_dakota_red_tmp
declaration to texture { _t_crand } instead.
Once I do that the two parse errors go away and everything works correctly.
I have attached my version of the file as well.
-- Chris R
Post a reply to this message
Attachments:
Download 'dakota_red_granite.inc.txt' (24 KB)
|
|