POV-Ray : Newsgroups : povray.animations : How do you use an external Text file for animation values : Re: How do you use an external Text file for animation values Server Time
28 May 2024 15:38:52 EDT (-0400)
  Re: How do you use an external Text file for animation values  
From: Leroy
Date: 27 Jan 2008 22:50:59
Message: <479D5074.9020503@joplin.com>
audioguytodd wrote:
> Nope that's not it, but I see what you mean.
> 
> Is there any way to read each line in the text file then move on to the next
> frame and read the next line?? Well, I know there is- I just can't remember it.
> 
> I want to read each comma separated variable as in the line. Right now, there
> are three (a vector):
> 
> #fopen MyFile "c:\filename.txt" read
> #while (defined(MyFile))
> #read (MyFile, Var1, Var2, Var3 )
> #end
> 
> I thought that is what I was doing above in line 3. Read File, Variable1, etc...
> 
> But it doesn't seem to work right.
> 
> BTW, I am using the Beta 3.7 (for the SMP which is very nice on my new
> Core2Quad!)
> 
> audioguytodd
> 

First, I'm using pov3.6, I don't know nothing about 3.7.

Your line:
  #read (MyFile, Var1, Var2, Var3 )
should read a LINE of data like you want if Var1,Var2,Var3 has been NOT 
been defined earlier as anything but a float or not defined at all.

To get the frame data you want you need to add a counter and stop 
reading when you got your data.
something like:
  #declare count=0;
  #while (defined(MyFile)&(count<=frame_number))
  #read (MyFile, Var1, Var2, Var3 )
  #declare count=count+1;
  #end
Now Var1,Var2,Var3 should have the frame data!

By the way POV will let you read vectors from a file in the form <0,0,0>.


Post a reply to this message

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