@UberGoober @piinthesky So you’re saying that the .obj file is only one of the submeshes, but Codea is able to somehow read all of the submeshes given the name of the one .obj file.
PS. Where is the yojimbo2000 code you’re talking about.
@UberGoober @piinthesky So you’re saying that the .obj file is only one of the submeshes, but Codea is able to somehow read all of the submeshes given the name of the one .obj file.
PS. Where is the yojimbo2000 code you’re talking about.
i guess the obj files are complete but m.positions only gives the positions of the first mesh.
@piinthesky Thanks for the link. When I dump the watercraft .obj and .mtl files, I’m seeing the positions only for the triangles I show in red with my above program. The rest of the image is shown, but I’m not sure where Codea is getting the information to create the rest of the image since I don’t see anything in the .obj file to point it to that info.
how do you do the dump, using m.positions or some other way? via m.positions you may not see everything.
@piinthesky I thru this together to dump the .obj or .mtl files. It’s not great but it did enough for what I wanted.
PS. If you select to sort the file, blank lines will be removed.
Change the first line in setup to read different files, .obj or .mtl .
viewer.mode=STANDARD
function setup()
str=readText(asset.builtin.Watercraft.watercraftPack_001_obj) -- obj or mtl
print("file length "..#str.." bytes")
parameter.boolean("sort_file",false,sortFile)
textMode(CORNER)
fill(255)
tab={}
cnt=0
for a in string.gmatch(str,".-%\
") do
table.insert(tab,a)
end
print("# of lines",#tab)
pos,dy,yy=1,0,0
font("Courier")
end
function draw()
background(0)
xx=0
st=pos+yy//1
en=math.min(#tab,pos+yy//1+50)
for z=st,en do
xx=xx+1
prt=string.format("%6d %s",z,tab[z])
text(prt,10,HEIGHT-xx*20-20)
end
end
function touched(t)
if t.state==CHANGED then
dy=(dy+t.deltaY)
if dy<1 then
dy=1
end
yy=dy//5
end
end
function sortFile()
table.sort(tab)
for z=#tab,1,-1 do
if string.byte(string.sub(tab[z],1,1))==13 then
table.remove(tab,z)
end
end
print("blank lines removed")
print("# of lines",#tab)
end