|
 |
> Possible 4.0 way:
>
> #local A = sphere {
> translate y*1
> rotate z*10
> rotate x*20
> scale <23,44,33>
> }
>
> // an instance of a
> A.transform[0] = <0,1,0>
> object { A }
>
> // another instance of a
> A.transform[0] = <0,2,0>
> object { A }
>
The real OOP way would be:
Sphere A = sphere {
translate y*1
rotate z*10
rotate x*20
scale <23,44,33>
}
// an instance of a
A.transform[0] = <0,1,0>;
scene.addObject(A);
// another instance of a
A.transform[0] = <0,2,0>
scene.addObject(A);
addObject could also apply to CSG objects :) I think it's nicer to do this:
Union all = union{};
/* shinyThings is an array */
foreach(obj in shinyThings) {
all.addObject(obj);
}
Than using POV-Ray's current "power" to put loops anywhere:
union {
#foreach(obj in shinyThings)
object { obj }
#end
}
This is just like allowing macros anywhere: it blocks from doing many
performance improvements. Evil stuff like this is currently possible:
#declare I=0;
#while (I<10)
union {
#declare I=I+1;
#end
whatever
#declare I=0;
#while (I<10)
}
#declare I=I+1;
#end
Just as bad as #macro abuse.
Post a reply to this message
|
 |