POV-Ray : Newsgroups : povray.general : We need a new 'render' statement : Re: We need a new 'render' statement Server Time
29 Jul 2024 16:31:08 EDT (-0400)
  Re: We need a new 'render' statement  
From: Ron Parker
Date: 20 Nov 1998 11:50:32
Message: <36559dd8.0@news.povray.org>
On Fri, 20 Nov 1998 00:12:41 +0100, Lukee <luk### [at] altavistanet> wrote:
>#declare a_cross = union {
>			cylinder { <-1.5,0,0>, <1.5,0,0>, 0.3}
>			cylinder { <0,1.5,0>, <0,-1.5,0>, 0.3}
>		   }	
>
>#macro DrawCross (rot,trans, colr)
>	object {a_cross
>		texture {pigment {color rgb colr}}
>		rotate rot translate trans 
>	}
>#end
>
>#declare cycles=0;
>
>
>#while (cycles<36)
>	DrawCross(<0,cycles*10,0>,<0,0,0>,<0,.8,.2>)
>	#declare cycles=cycles+1;
>	render <sort of a numbered-filename>//<- THIS IS THE NEW DIRECTIVE!
>#end

Please explain how POV knows to get rid of the old 'cross' object while 
keeping the objects that were created outside the loop, such as the 
camera.  That is, let's assume that you've made this new directive so 
it renders the frame as it exists at the time you told it to render.
The first call will then render the cross in the initial position. The
second call will render TWO crosses, one in the initial position and 
one in the second position. By the 36th call, you'll have 36 crosses
(though it'll look like 9).

I do think it'd be nice if you could dump the entire contents of the 
symbol table (essentially, the 'state' of the script, but not including 
the frame) to a file for later resurrection, though.  Then you could 
do this:

----------------------------------------
#fopen File "filename" read
#ifdef (File)
  #readstate File
  #fclose File
#end

#ifndef (SavedStep)
   /* Initialize all variables to their start values */ 
   #declare MySphere=sphere{0,1 pigment {color red 1}}
   #declare SavedStep=1;
#else
   /* Adjust all variables as necessary */
   #declare MySphere=object{MySphere translate clock_delta*x}
   #declare SavedStep=SavedStep+1;
#end

#fopen File "filename" write
#ifdef (File)
  #writestate File
  #fclose File
#end

camera {location -4*z look_at 0}
light_source { <-4,4,-4> rgb 1 }
object {MySphere}
----------------------------------------

I am of course opposed to the idea of persistent variables on principle, 
due to the way they muck up scalability, but if you're gonna use them, 
it would be nice to have an easy way to just make all variables - 
including the entire state of objects and textures - be persistent.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.