import struct
b=open("content/VIDEO/GEO/BLX_COP.BGF",'rb').read()
# (label, off, len)
chunks=[
 ("utorso.main",0x00ba,3920),("utorso.p2",0x146b,280),("utorso.p3",0x15ff,280),
 ("rtorso.main",0x17d2,3920),("rtorso.p2",0x2b81,140),("rtorso.p3",0x2c3f,140),
 ("ltorso.main",0x2d3e,3920),("ltorso.p2",0x40ed,140),("ltorso.p3",0x41ab,140),
]
total=0; totnz=0
for lab,off,ln in chunks:
    n=ln//20; nz=0
    zs=[]; nzlist=[]
    for i in range(n):
        x,y,z,u,v=struct.unpack_from('<5f',b,off+i*20)
        if abs(u)>1e-6 or abs(v)>1e-6:
            nz+=1; nzlist.append((i,x,y,z,u,v))
    total+=n; totnz+=nz
    print("%-12s verts=%3d nonzeroUV=%d"%(lab,n,nz))
    for i,x,y,z,u,v in nzlist[:60]:
        print("     %3d: %7.2f %7.2f %7.2f | u=%7.3f v=%7.3f"%(i,x,y,z,u,v))
print("TOTAL verts=%d nonzeroUV=%d"%(total,totnz))
