|
|
> // --------- Start of code ----------------------------------------
> #declare Obj = 0;
> #declare Var = 1;
> #declare Tex = 2;
> #declare Total = array[3]
>
> // Make the subarrays
> #declare Objects = array[2]
> #declare Vars = array[4]
> {0,1, -1, +1}
> #declare Textur = array[2]
> {pigment{color rgb <0,1,0>},
> pigment{color rgbt <1,1,1,0.4>} }
>
> // Connect everything
> #declare Total[Obj] = Objects
> #declare Total[Tex] = Textur
> #declare Total[Var] = Vars
>
> // Use it:
> #declare Total[Obj][0] =
> sphere{ Total[Var][0], Total[Var][1]
> texture { Total[Tex][0]}}
> #declare Total[Obj][1] =
> box{ Total[Var][2], Total[Var][3]
> texture { Total[Tex][1]}}
>
> // Show it:
> object {Total[Obj][0]}
> object {Total[Obj][1]}
>
> light_source {
> <-20, 40, -20>
> color rgb <1,1,1> }
> camera {
> location <0,0,-3>
> look_at 0 }
>
> // ------- End of code -----------------------------------------
>
> Why is this useful?
> You can give a macro in one name (Total) a couple
> of objects and all his variables and let it do something
> with it.
> For instance: the macro can reach the textures and
> can change them.
>
> I hope someone can use this.
>
> Jaap Frank
This is a very good explanation of arrays to me and I have been searching the
documentation and the net. It is making things very exciting for me. Thanks
Jaap!
Post a reply to this message
|
|