|
|
"MichaelJF" <mi-### [at] t-onlinede> wrote:
> for the first time I tried to use the read-directive and was heavily
> disappointed as I noticed that you can nearly write everything to a file, but
> are very restricted to read from a text-file.
Is it really necessary to #read from a text file and than to parse?
read and write is very useful for transporting informations from one image to
the next in an animated scenes like the marble machine
http://www.alzinger.de/cms5/robert/raytracing/marble-machine-in-povray.html
see the source below.
But if you have more complex problems like transforming mashes. Use an external
program. It is faster.
#macro read_objects ()
// scene lesen
#fopen rscene "objects.txt" read
#declare anz =0;
#while (defined(rscene))
#read (rscene,obj)
#declare objec[anz] = obj;
#if ( objec[anz] != "end")
#read (rscene,p)
#read (rscene,s)
#read (rscene,sp)
#read (rscene,r)
#read (rscene,ri)
#declare position[anz] = p;
#declare siz[anz] = s;
#declare speed[anz] = sp;
#declare rotat[anz] = r;
#declare rotat_inc[anz] = ri;
#declare anz=anz+1;
#end
#end
#fclose rscene
#end
#macro write_objects()
// scene schreiben
#declare i = 0;
#fopen rscene "objects.txt" write
#while (i<=anz)
#write (rscene,"\"",objec[i],"\"",",\n")
#if ( objec[i] != "end")
#write (rscene,position[i],",\n")
#write (rscene,siz[i],",\n")
#write (rscene,speed[i],",\n")
#write (rscene,rotat[i],",\n")
#write (rscene,rotat_inc[i],",\n")
#else
#declare i=anz+1;
#end
#declare i=i+1;
#end
#fclose rscene
#end
Post a reply to this message
|
|