POV-Ray : Newsgroups : povray.animations : Clockless_Animation : Re: Clockless_Animation Server Time
28 Apr 2024 19:28:44 EDT (-0400)
  Re: Clockless_Animation  
From: clipka
Date: 6 Jan 2018 00:55:27
Message: <5a5064cf$1@news.povray.org>
Am 06.01.2018 um 02:19 schrieb muyu:

>> In essence, `#persistent` works like `#declare`, but the variable sticks
>> around until UberPOV exits.
>>
>> You'll still need to assemble the contents of such persistent variables
>> into a new scene for each frame; however, you can prepare arbitrarily
>> complex objects in this manner, such as nested CSG unions.
> 
> Thanks a lot for your suggestions. But it still need parsing from frame to
> frame.

Well, yes, of course. The scene needs to be parsed again for each frame,
if only to insert the `#persistent`-declared object into the scene for
that frame in a manner that's unique to that particular frame (after all
you want /some/ difference between the frames of an animation).

Parsing speed is still increased, because UberPOV doesn't actually need
to process the tokens in the `#ifndef FOO #persistent FOO = ... #endif`
blocks again, but can just skip over them instead. For example, in an
image based pigment the most time is spent in loading the actual image
file, not parsing.

In cases where the block is just a long litany of loopless SDL code that
would be easy to parse except for its sheer length (as might be the case
for mesh2 objects), another trick you can use is to pull out that code
into an include file, and place the `#include` statement into the
`#ifndef... #endif` block, e.g.:

    // main file
    #ifndef MyMesh
      #include "mymesh.inc"
    #endif
    object { MyMesh }

    // mymesh.inc
    #persistent MyMesh = mesh2 {
      ...
    }

Or, if your mesh is generated by a 3rd party utility and uses
`#declare`, you might use:

    // main file
    #ifndef MyMesh
      #include "mymesh.inc"
      #persistent MyMesh = object { ExportedMesh }
    #endif

    // mymesh.inc
    #declare ExportedMesh = mesh2 {
      ...
    }


Post a reply to this message

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