Exemple #1
0
 def parse_chunk_mappinggroups(self, chunk):
     parser = BinaryReader(chunk)
     mappinggroups = {}
     num_mappinggroups = parser.read_unsigned_int32()
     for i in range(num_mappinggroups):
         mgid = parser.read_unsigned_int32()
         angle = parser.read_float32()
         scale = parser.read_vec2_float32()
         offset = parser.read_vec2_float32()
         normal = parser.read_vec3_float32()
         mappinggroups[mgid] = {
             "angle": angle,
             "scale": scale,
             "offset": offset,
             "normal": normal
         }
     return mappinggroups
Exemple #2
0
 def parse_chunk_faces(self, chunk):
     parser = BinaryReader(chunk)
     faces = []
     num_faces = parser.read_unsigned_int32()
     for i in range(num_faces):
         face = {}
         face["angle"] = parser.read_float32()
         face["offset"] = parser.read_vec2_float32()
         face["scale"] = parser.read_vec2_float32()
         face["mapping_group_id"] = parser.read_unsigned_int32()
         face["materialid"] = parser.read_unsigned_int32()
         face["edgeloops"] = []
         num_additional_edgeloops = parser.read_unsigned_int32()
         # border edge loop is always the first edge loop
         face["border_edgeloop"] = self.parse_edgeloop(parser)
         for j in range(num_additional_edgeloops):
             edgeloop = self.parse_edgeloop(parser)
             face["edgeloops"].append(edgeloop)
         faces.append(face)
     return faces