filename$=peek$("argument")
if filename$="" then
input "File To Convert?" filename$
end if
filename$=lower$(filename$)
open 1,filename$+".pov","r"
dim words$(1)
dim variables$(100)
currentvariable=1
while(!eof(1))
line input #1 l$
if upper$(left$(l$,14)) = "// WRITE JOINT" then
redim words$(1)
num=split(l$,words$()," ")
variables$(currentvariable)=words$(5)
currentvariable=currentvariable+1
end if
wend
close #1
open 1,filename$+".pov","r"
open 2,filename$+".inc","w"
dim words$(1)
print #2 "#declare default_options=0;"
print #2
print #2 "#declare QUAL=2;"
print #2 "#macro quality(temp_value)"
print #2 "#declare QUAL=temp_value;"
print #2 "#end"
print #2
for i = 1 to currentvariable-1
duplicate=0
for j = 1 to i
if variables$(i)=variables$(j) then
duplicate=duplicate+1
end if
next j
if duplicate < 2 then
print #2 "#declare "+filename$+"_"+variables$(i)+"_rotate = 0;"
print #2 "#macro "+filename$+"_"+variables$(i)+"(temp_value)"
print #2 "#declare "+filename$+"_"+variables$(i)+"_rotate = temp_value; 0"
print #2 "#end"
print #2
end if
next i
print #2 "#macro "+filename$+"(temp_value)";
print #2
done = 0
while(!eof(1) and done=0 )
line input #1 l$
if l$="// Background:" then
print #2 "#end"
done=1
elseif left$(l$,13) = "#declare QUAL" then
print #2 "//"+l$
elseif instr(upper$(l$),"JOINT") then
redim words$(1)
num=split(l$,words$()," ")
rotation$=words$(4)
name$=words$(5)
print #2 l$
line input #1 l$
while (left$(l$,2)="//")
print #2 l$
line input #1 l$
wend
location=instr(l$,"matrix")
if rotation$="X" then
print #2 mid$(l$,1,location-1)+" rotate <-"+filename$+"_"+name$+"_rotate,0,0> "+mid$(l$,location)
elseif rotation$="Y" then
print #2 mid$(l$,1,location-1)+" rotate <0,"+filename$+"_"+name$+"_rotate,0> "+mid$(l$,location)
elseif rotation$="Z" then
print #2 mid$(l$,1,location-1)+" rotate <0,0,"+filename$+"_"+name$+"_rotate> "+mid$(l$,location)
end if
else
print #2 l$
end if
wend
close #1
close #2
|
|