Could you explain the following python code. I have most of it ported but the index part at the bottom confuses me:
def auto_join_frames(self):
print "auto-joining compatible meshes..."
meshes = {}
for mesh in self.meshes:
key = (mesh.texture,mesh.frame_count,mesh.twoSided|mesh.customColour)
if key in meshes:
meshes[key].append(mesh)
else:
meshes[key] = [mesh]
for joinable in meshes.values():
if len(joinable) < 2: continue
base = joinable[0]
print "\tjoining to",base
for mesh in joinable[1:]:
if base.index_count+mesh.index_count > 0xffff:
base = mesh
print "\tjoining to",base
continue
print "\t\t",mesh
for a,b in zip(base.frames,mesh.frames):
a.vertices.extend(b.vertices)
a.normals.extend(b.normals)
if base.texture:
base.textures.extend(mesh.textures)
base.indices.extend(index+base.vertex_count for index in mesh.indices)
base.vertex_count += mesh.vertex_count
base.index_count += mesh.index_count
self.meshes.remove(mesh)
*Update: Think i've got it finally. Code is in svn head. Render performance seems better to me.