Testasin nopsaan onnistuuko tuo RealFlow formaatin lukeminen ihmisen vaivalla maxissa.
Tämä lukee verteksit, facet ja uvt. Velocity vektoreita ei lueta, joskin ne filusta löytyy. Periaatteessa tästä voisi pureskella jonkin sortin importterin varsin helposti. Tosin scripti varmaan kellahtaa kyljelleen raskaamman simun kanssa. Anyways, kenties jollekin löytyy joskus jotain käyttöä tuolle.
fn readRFBin strFile =
(
binfile = fopen strFile "rb"
fseek binfile 0 #seek_set
fseek binfile 4 #seek_cur
iVersion = ReadLong binfile #unsiged
if iVersion < 4 do
(
format "Support RealFlow 4 and 5.\n"
fclose binfile
return undefined
)
fseek binfile 4 #seek_cur
iVertCount = ReadLong binfile #signed
for i=1 to iVertCount do
(
fx = ReadFloat binfile
fy = ReadFloat binfile
fz = ReadFloat binfile
format "%, %, %\n" fx fy fz
)
iFaceCount = ReadLong binfile #signed
for i=1 to iFaceCount do
(
ia = ReadLong binfile #signed
ib = ReadLong binfile #signed
ic = ReadLong binfile #signed
format "%, %, %\n" ia ib ic
)
fseek binfile 4 #seek_cur
iFluidCount = ReadLong binfile #signed
for i=1 to iVertCount do
(
fseek binfile ((iFluidCount-1)*4) #seek_cur
fu = ReadFloat binfile
fv = ReadFloat binfile
fw = ReadFloat binfile
format "%, %, %\n" fu fv fw
)
fclose binfile
)
strFile = getOpenFileName "Real Flow Bin File" filter:"*.bin|*.bin"
if strFile != undefined do
readRFBin strFile