Code: Select all
#Construct Model
for i in range(0, meshCount):
print(UVpos[i])
bs.seek(VInfo[i][0] + 32, NOESEEK_ABS) #Seek to vertices info
VData = bs.read(">HHi")
VBsize = VData[0]
VCount = VData[2]
bs.seek(FInfo[i][0] + 32, NOESEEK_ABS) #Seek to faces info
FCount = bs.read(">HH")
bs.seek(VOff[i][0] + hdrSize[0], NOESEEK_ABS) #Seek to Vertices Start
VertBuff = bs.readBytes(VBufferSize[i][0])
rapi.rpgSetName("mesh" + str(i))
rapi.rpgSetOption(noesis.RPGOPT_BIGENDIAN, 1)
rapi.rpgBindPositionBufferOfs(VertBuff, noesis.RPGEODATA_FLOAT, VBsize, 0)
rapi.rpgBindUV1BufferOfs(VertBuff, noesis.RPGEODATA_FLOAT, VBsize, UVpos[i])
bs.seek(FOff[i][0] + hdrSize[0], NOESEEK_ABS) #Seek to Faces Start
FaceBuff = bs.readBytes(FBufferSize[i][0])
rapi.rpgSetMaterial(MatNames[((MatIndexTable[i] - 1) // 3) - 28])
rapi.rpgCommitTriangles(FaceBuff, noesis.RPGEODATA_USHORT, FCount[1], noesis.RPGEO_TRIANGLE, 1)
mdl = rapi.rpgConstructModel()
mdl.setModelMaterials(NoeModelMaterials(TexList, MatList))
mdlList.append(mdl)
rapi.rpgClearBufferBinds()
rapi.rpgReset()