POV-Ray : Newsgroups : povray.programming : Persistent Variables : Re: Persistent Variables Server Time
29 Jul 2024 00:28:48 EDT (-0400)
  Re: Persistent Variables  
From: Nathan Kopp
Date: 24 Nov 1999 13:10:52
Message: <383c2a2c@news.povray.org>
Nieminen Juha <war### [at] punarastascstutfi> wrote...
>
> #static Position = <1,2,3>; // like #local, but persistent
> #const Radius = 5; // same as #static, but makes it also unchangeable

Persistent things (objects or variables) should not have limited scope.  It
would be very difficult (if not impossible) for POV to know when the
object/variable should be brought back into scope in the next frame, since
#while and #if statements could drasitcally change the flow of the
scripting.  All persistent objects should have global scope.

My thoughts on the subject are as follows:

An INI or command-line option specifies if the animation is persistent or
not.  If the scene is persistent, ALL global (#declare) variables are
persistent.  All non-global variables (#local) are not persistent.  If you
want to re-declare the globals for the next frame, that's OK.  Remember, you
can #undef objects if you like.

If you want to put an object in the scene and give it a name so you can
change it later, you could use something like this:

#create mySphere=sphere{0,1 texture{mytex}}

You could #delete objects that were created (or maybe #undef them?).

Then, you could have by default all objects are persistent, and if you don't
want them to be persistent you have to name them (with #create) and then
#delete them.  Or, you could have all objects be not-persistent by default
and only those that are created and named using #create would be persistent.
I personally lean towards fully persistent scenes.  If you say
"Persistent_Animation=on" in the INI file, then all global variables and all
elements in the scene are persistent and you must #undef or #delete them if
you don't want them at the end of the frame.

-Nathan


Post a reply to this message

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