POV-Ray : Newsgroups : povray.animations : How to run initialization code only once for all frames : Re: How to run initialization code only once for all frames Server Time
26 Apr 2024 01:30:06 EDT (-0400)
  Re: How to run initialization code only once for all frames  
From: clipka
Date: 19 Jan 2011 06:34:47
Message: <4d36cc57$1@news.povray.org>
Am 19.01.2011 12:28, schrieb Tomohiro:
> Hello,
>
> I would like to generate an animation. The scene file contains
> a lot of preparatory calculations (initializations). The following
> is a reduced example.
>
>
> // Initialization
> #local R=seed(10);
> #local J=0;
> #while(J<10000)
>    #local POS[J]=<rand(R)*100, rand(R)*100, rand(R)*100>
>    #local J=J+1;
> #end
>
> // Drawing
> #local J=0;
> #while(J<10000)
>    sphere{ POS[J] +<clock*100,0,0>  ,1}
>    #local J=J+1;
> #end
>
> For a 1000-frame animation, the whole scene file will need to
> be run 1000 times, including the initialization part.
> However, I think it is not needed and just a waste of time.
> How can I omit the 999-time calculations and let my PC do the
> calculation only once?

You can use "#fopen" / "#write" / "#fclose" to auto-generate an .inc 
file (and do this only on the very first frame), and then #include it 
for all frames.


Post a reply to this message

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