|
![](/i/fill.gif) |
On 11/01/2010 08:14 AM, nip wrote:
> Hello!
>
> I'm wondering if there's a way to supply variables\values to a union object to
> alter the way it is rendered. I'm not sure if I've worded that correctly, so
> consider the code below. I'm trying to rotate the top box on the second figure,
> but leave the first figure as-is. Is something like this possible or would I
> need completely separate declarations for each "pose".
>
> Thanks for any help you can offer.
> -nip
>
>
>
> Sample code:
>
> #include "colors.inc"
>
> #declare Tilted = 0.0;
>
> #declare Figure = union {
> box {
> <0, 0, 0>, <1, 1, 1>
> pigment { Green }
> }
>
> box {
> <0, 0, 0>, <1, 1, 1>
> pigment { Blue }
>
> #if (Tilted > 0)
> rotate z*15
> #end
>
> translate y*1
> }
> }
>
> object { Figure }
>
> object {
> #declare Tilted = 1; //this does not make the right blue box rotate
> Figure
> translate <2, 0, 0>
> }
>
>
> camera {
> location <5, 1, -5>
> look_at <0, 1, 3>
> }
>
>
> light_source {
> <5, 1, -5>
> color rgb <1, 1, 1>
> }
>
>
>
a macro is what you need:
http://wiki.povray.org/content/Documentation:Reference_Section_2.6#The_.23macro_Directive
you problem is a simple one so I'll get you started, give this a whirl:
#macro Figure (Tilted)
union {
box {
<0, 0, 0>, <1, 1, 1>
pigment { Green }
}
box {
<0, 0, 0>, <1, 1, 1>
pigment { Blue }
#if (Tilted > 0)
rotate z*15
#end
translate y*1
}
}
#end
object { Figure (0) }
object { Figure (1) translate <2,0,0> }
Post a reply to this message
|
![](/i/fill.gif) |