|
![](/i/fill.gif) |
Dave Matthews wrote:
> I'm trying to recall off the top of my head, since my files like this
> are at home, but it must have been pretty simple, or else I never could
> have managed it.
>
Well, for the record, here's what I did:
First, I opened the raw (txt) file in Microsoft Word (sorry, but I did.)
By using "find" and "replace all" I added commas after each vertex.
(Is there some way of doing this in POV SDL? I couldn't think of any.)
Then, once it was comma-delimited, I could use the following POV
script to create a mesh1 object:
//------------------------------------------------------------------------
//This creates a Mesh1 object include file
#fopen Converted_File "MESHFILE.inc" write
//This should be the comma-delimited RAW format file
#fopen Raw_File "RAWFILE.txt" read
//Here's where you name your mesh object
#write(Converted_File, "#declare MESH_OBJECT = object { \n")
//This stuff creates the mesh
#write(Converted_File, "mesh { \n" )
#read (Raw_File,X_1,Y_1,Z_1)
#while (defined(Raw_File))
#write(Converted_File, "triangle { ")
#write(Converted_File, "<" , X_1, ", "Y_1, ", " Z_1, ">, ")
#read (Raw_File,X_2,Y_2,Z_2)
#write(Converted_File, "<" , X_2, ", "Y_2, ", " Z_2, ">, ")
#read (Raw_File,X_3,Y_3,Z_3)
#write(Converted_File, "<" , X_3, ", "Y_3, ", " Z_3, "> } \n ")
#read (Raw_File,X_1,Y_1,Z_1)
#end
#write(Converted_File, " } \n ")
#write(Converted_File, "}; \n" )
#fclose Converted_File
//Then if you want to use it, you do something like this:
#include "MESHFILE.inc"
#declare NEW_OBJECT = MESH_OBJECT;
object { NEW_OBJECT texture { pigment { color rgb <1, 0, 0> } } }
//
Post a reply to this message
|
![](/i/fill.gif) |