POV-Ray : Newsgroups : povray.newusers : Random Access inside a file. : Re: Random Access inside a file. Server Time
1 Jul 2024 02:14:46 EDT (-0400)
  Re: Random Access inside a file.  
From: pH
Date: 16 Aug 2011 15:15:01
Message: <web.4e4ac0a1874b3d7d2fab58380@news.povray.org>
Alain <aze### [at] qwertyorg> wrote:

> > Hi all,
> >
> > I am trying to read a frame_data_file which has data of frames to be animated.
> > This file has the following data
> >
> > "Frame",<framenumber>,<number of bytes of data realted to this frame>
> > <framedata>
> > "Frame",<framenumber>,<number of bytes of data related to this frame>
> > <framedata>
> > ..
> > ..
> > ..
> >
> > I am reading this from a scene file(.pov) to generate a each frame. To generate
> > each image in the scene, I use the "clock" to get the frame I am generating.
> > Then I want to jump through my frame_data_file to that particular frame parse
> > the data pertinent to that. I am not able to find a way to randomly jump through
> > the frame_data_file using pov-ray file handling capabilities.
> >
> > Is there some way I can achieve my functionality? The only other way I see is to
> > generate separate file for each frame which would be a lot.
> >
> > Any help with this would be great.
> >
> > Thanks,
> > pH
> >
>
> There is no true random access of files.
>
> You should use the "frame_number" internal variable.
> Using that value, you sequentialy read through your file untill you find
> the coresponding <framenumber> entry, discarting unneeded frame
> informations. This will cause the parsing of your scene to get longer
> for later frames. For that reason, you should probably make some data
> files, maybe one per 100 frames.
>
> Beter yet, reconstruct your data file as an .inc file and use
> #switch(frame_number) #case(Value) <frame_specific_code> #break ...
> #else ... #end
>
> Using one #case(..)... #break statement per frame.
>
> For your animation, if the first frame have less than 3 objects, it's
> advisable to create enough dummy objects to get about 4 objects uniquely
> for that frame. They can be zero radius spheres, of any object placed
> behind the camera, of having no_image no_reflection and no_shadow, or
> pigment{ rgbt 1} to make them invisible.
> This will ensure that the bounding is done for all frames. There is no
> bounding done if there is less than 3 objects in the scene, and, in an
> animation, the flag is only set during the first frame.
>
>
>
> Alain

Thanks Alian. I will look at the .inc option if it helps.


Post a reply to this message

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