POV-Ray : Newsgroups : povray.general : Where to put initialisation code? : Re: Where to put initialisation code? Server Time
6 Oct 2024 09:42:37 EDT (-0400)
  Re: Where to put initialisation code?  
From: pbrants
Date: 14 Apr 2014 14:00:01
Message: <web.534c2045e6597704e8159130@news.povray.org>
OK, the #fopen statement should go into the init stuff, and what should I do to
prevent the file being closed after the first frame? Otherwise stated, what is
the sequence of #fopen read write append statements in the #if block? The
documentation of POV mentions something like this: "You may open, read, write,
append, and close plain ASCII text files while parsing POV-Ray scenes. This
feature is primarily intended to help pass information between frames of an
animation. Values such as an object's position can be written while parsing the
current frame and read back during the next frame", but nothing is elaborated.

Paul


Ger <No.### [at] ThankYou> wrote:
> Le_Forgeron wrote:
>
> > Le 14/04/2014 18:46, pbrants nous fit lire :
> >> As the word says, initialisation instructions should be running just ONCE
> >> before the calculation of an animation should start. If I put these
> >> instructions in the POV-file which is to be animated with the INI-file
> >> and clock-variable, then they are executed with each change of the clock.
> >> How can I prevent this happening?
> >>
> >
> > use a condition on clock or frame_number.
> >
> > something like:
> >
> > #if (clock <= 0)
> > ...
> > #else
> > ...
> > #end
>
> All init stuff is lost at the start of the second frame unless it's written to a
file.
> At the start of any frame povray has no knowledge of what happened in the previous
frame unless stored.
> So I would alter the example into
>
> #if (clock <= 0)
>   init your stuff
>   #write stuff to disk
> #else
>   read stuff from disk
> #end
>
>
> --
>
> Ger


Post a reply to this message

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