|
|
"Kenneth" <kdw### [at] earthlinknet> wrote:
> ....
> #declare sample_value = eval_pigment(my_pigment,location) // produces a
> // three-component vector, I think.
> #if(sample_value.red = 0) // or .x? *Any* time the red color drops to zero.
> ....
I just realized that there *might* be a problem with using this particular dot
operator syntax; perhaps changing the #if to
#if((sample_value.red) = 0) // extra parentheses
would solve it? The thing is, I don't know if eval_pigment() returns a COLOR
vector or just a 'generic' vector (or even if it's a five-component vector
rather than three.) Again, I haven't worked with eval_pigment to know anything
about these subtleties.
The documentation under "common color pitfalls" describes this situation (I
think!):
"Finally there is another problem which arises when using color dot operators in
#declare or #local directives. Consider the directive:
#declare MyColor = rgb <0.75, 0.5, 0.75>;
#declare RedAmt = MyColor.red;
Now RedAmt should be a float but unfortunately it is a color. POV-Ray looks at
the first keyword after the equals to try to guess what type of identifier you
want. It sees the color identifier MyColor and assumes you want to declare a
color. It then computes the float value as 0.75 then promotes that into
rgbft<0.75,0.75,0.75,0.75,0.75>. It would take a major rewrite to fix this
problem so we are just warning you about it. Any of the following work-arounds
will work properly.
#declare RedAmt = 0.0+MyColor.red;
#declare RedAmt = 1.0*MyColor.red;
#declare RedAmt = (MyColor.red);
"
Ken
Post a reply to this message
|
|