|
![](/i/fill.gif) |
Chris Huff <Chr### [at] compuserve com> wrote:
:>Dynamic memory allocation is not possible in povray.
: Actually, it is, because POV-Ray is written in C, and the scene
: description language is interpreted. I believe it dynamically allocates
: the objects and variables (using pre-allocated memory for speed) as it
: parses them, doesn't it?
I think that we are talking about different things here.
You can't make a list structure with the povray script language. Arrays
are a bad substitute since you can't change their size after creation.
I think that 'new' and 'delete' along with pointers may be a good idea
for the next povray version (perhaps pov4?).
Something like:
#declare MyObject =
sphere
{ 0,1 pigment { rgb 1 }
MyObject* next;
}
#declare ObjectList = null;
#declare Ind=0;
#while(Ind<100)
#declare Obj = new MyObject;
#declare Obj.next = ObjectList;
#declare ObjectList = Obj;
#declare Ind=Ind+1;
#end
#declare Obj = ObjectList;
#while(Obj != null)
object { Obj translate x*Ind }
#declare Obj = Obj.next;
#end
It shouldn't be very difficult to achieve...
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
![](/i/fill.gif) |