POV-Ray : Newsgroups : povray.programming : Persistent Variables : Re: Persistent Variables Server Time
28 Jul 2024 18:19:39 EDT (-0400)
  Re: Persistent Variables  
From: Chris Huff
Date: 23 Nov 1999 09:54:55
Message: <231119990958007458%chrishuff_99@yahoo.com>
In article <383aa335@news.povray.org>, Nieminen Juha
<war### [at] punarastascstutfi> wrote:

>   Wouldn't it be easier to do it with #macros that use file-io?
> 
>   On the other hand, it would only work with floats and vectors (and arrays
> of them with array-specific macros). But is there need for other types of
> identifiers to be persistent?

The patch would be easier to use, once it is written. :-)
There are a lot of times it would be useful to make an object
persistant, say you have a tree that doesn't change through the
animation, but takes 20 minutes to parse. You would be saving 20
minutes per frame after the first frame. Also, particle simulations
would benefit a lot from persistant variables.
Also, it might be difficult to manage a persistant array using file I/O.
And besides that, I think the syntax for declaring variables could be
improved. No reason to drop the old syntax, just provide for the new
one.
The patch shouldn't be too difficult to do, except for the persistant
variables part(which I don't know how to do). I propose something like
this:
#declare MyFloat = float {FLOAT_EXP VARIABLE_FLAGS};
#declare MyVector = vector {VECTOR_EXP VARIABLE_FLAGS};
and so on, with object, texture, and others. Maybe a restricted sort of
pointer, too?(with protection against modifying memory it shouldn't)

where VARIABLE_FLAGS are:
const on/off           Whether or not the variable can be modified, an
attempt to modify it produces an error.
persistant on/off      Whether the value is carried to the next frame
or not.
Any suggestions?

Also, maybe #declare and #local should be required only when creating a
new identifier, so you could use:
#declare k=float{0};
#while(k<5)
    k=k+1;         //short form
    k=float{k+1};  //long form, ideally, both would be allowed
#end
This is just a minor thing I have been thinking about, but it would
make a lot of code easier to read. A variable should not be modified if
it is used in the #if() or #while() expression, though.(if it was, a ==
operator would be required, and some old scenes would break)

-- 
Chris Huff
e-mail: chr### [at] yahoocom
Web page: http://chrishuff.dhs.org/


Post a reply to this message

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