|
![](/i/fill.gif) |
> the following lines do not work:
>
> #read (MyFile, MyVect; E)
> #read (MyFile, MyVect, E)
OK, first you need to check your I/O restrictions...
Options, Script I/O restrictions, No Restrictions
Options, Script I/O restrictions,
Make sure permit read/write in current directory is checked
Secondly, POVray expects comma seperated values...
that means you need trailing commas on every line except
the last. Something like:
<0, 0, 0>, 1.0,
<0, 0.1, 0>, 0.5,
<0, 0.2, 0>, 0.0
You can set the color in various ways, selecting one from
a spline color function is a good way, or you can just
have the full color vector in the file instead.
// set colors based on a float
#declare MyColors = function {
spline {
linear_spline
0.0, Red
0.5, Green
1.0, Blue
}
};
// read the file and make spheres
#fopen FileHandle "test_data.txt" read
#while (defined(FileHandle))
#read (FileHandle, Vector, E)
sphere {Vector, 0.1
pigment { color MyColors(E) }
}
#end
#fclose FileHandle
Post a reply to this message
|
![](/i/fill.gif) |