|
![](/i/fill.gif) |
eval_pigment returns a color-vector.
the following is an excerpt from my LED macros:
#macro Display(mS, tS, mD, Image)
#declare mI =
pigment {
image_map {
jpeg Image
map_type 0
interpolate 4
once
}
translate <-0.5, -0.5, 0.0>
scale <mS.u, mS.v, 1>
rotate 90.0*x
}
#local a = mS.u / tS.u;
#local b = mS.v / tS.v;
#local bO = cylinder { -0.125*y, 0.015625*y, 1.875*ft }
#local rC = 0.0*b;
#while(rC <= 1.0*b)
#local tC = 0.0*a;
#while(tC <= 1.0*a)
//#if(inside(bO, <(-mS.u/2)+(tS.u*tC), 0.0, (-mS.v/2)+(tS.v*rC)>) != 0.0)
#local Color = eval_pigment(mI, <(-mS.u/2)+(tS.u*tC), 0.0,
(-mS.v/2)+(tS.v*rC)>);
#local Shade = (
Color.red +
Color.green +
Color.blue ) / 3 ;
#local rS = Color.red ;
#local gS = Color.green ;
#local bS = Color.blue ;
ColorBlock(rS, gS, bS, transform { translate <(-mS.u/2)+(tS.u*tC), mD,
(-mS.v/2)+(tS.v*rC)> })
// Diode(0, Red, Shade, transform { translate <(-mS.u/2)+(tS.u*tC), -mD,
(-mS.v/2)+(tS.v*rC)> })
//#end
#local tC = tC + 1;
#end
#local rC = rC + 1;
#end
#end
The macro turns an image into a mosaic of tiles containing three colored LEDs
and sets the Diode shades to the value of the rgb components.
I assume the vector is three values, I haven't seen any indication that
eval_pigment takes an alpha channel into account.
A.D.B.
"Kenneth" <kdw### [at] earthlink net> wrote:
> OK, my curiosity has finally reached the point where I want to start playing
> around with eval_pigment. But a few questions first (perhaps naive ones) so
> that I don't end up guessing at the results:
>
> 1) Does it return specifically a COLOR vector (i.e., does POV-ray treat the
> result as such internally, as another pigment); or just a 'generic' vector, with
> no color information implied? (The manner in which it is returned has
> consequences if I want to pull just one component out of the vector later, using
> dot notation--see 3.2.1.5.5 "common color pitfalls" in the docs.)
> 2) How many components are in the returned vector--3 or 5?
>
> Thanks!
>
> Ken
Post a reply to this message
|
![](/i/fill.gif) |