def read(io_stream, chunk_end): result = AnimationChannel(first_frame=read_ushort(io_stream), last_frame=read_ushort(io_stream), vector_len=read_ushort(io_stream), type=read_ushort(io_stream), pivot=read_ushort(io_stream), unknown=read_ushort(io_stream), data=[]) if result.vector_len == 1: result.data = read_array(io_stream, chunk_end, read_float) elif result.vector_len == 4: result.data = read_array(io_stream, chunk_end, read_quaternion) return result
def read(context, io_stream, chunk_end): result = Hierarchy(pivots=[], pivot_fixups=[]) while io_stream.tell() < chunk_end: (chunk_type, chunk_size, subchunk_end) = read_chunk_head(io_stream) if chunk_type == W3D_CHUNK_HIERARCHY_HEADER: result.header = HierarchyHeader.read(io_stream) elif chunk_type == W3D_CHUNK_PIVOTS: result.pivots = read_array(io_stream, subchunk_end, HierarchyPivot.read) elif chunk_type == W3D_CHUNK_PIVOT_FIXUPS: result.pivot_fixups = read_array(io_stream, subchunk_end, read_vector) else: skip_unknown_chunk(context, io_stream, chunk_type, chunk_size) return result
def read(io_stream, chunk_end): result = TextureStage(txIds=[], per_face_tx_coords=[], tx_coords=[]) while io_stream.tell() < chunk_end: (chunk_type, chunk_size, subchunk_end) = read_chunk_head(io_stream) if chunk_type == W3D_CHUNK_TEXTURE_IDS: result.tx_ids = read_array(io_stream, subchunk_end, read_long) elif chunk_type == W3D_CHUNK_STAGE_TEXCOORDS: result.tx_coords = read_array(io_stream, subchunk_end, read_vector2) elif chunk_type == W3D_CHUNK_PER_FACE_TEXCOORD_IDS: result.per_face_tx_coords = read_array(io_stream, subchunk_end, read_vector) else: skip_unknown_chunk(None, io_stream, chunk_type, chunk_size) return result
def read(context, io_stream, chunk_end): result = MeshAABBTree() while io_stream.tell() < chunk_end: (chunk_type, chunk_size, subchunk_end) = read_chunk_head(io_stream) if chunk_type == W3D_CHUNK_AABBTREE_HEADER: result.header = AABBTreeHeader.read(io_stream) elif chunk_type == W3D_CHUNK_AABBTREE_POLYINDICES: result.poly_indices = read_array( io_stream, subchunk_end, read_long) elif chunk_type == W3D_CHUNK_AABBTREE_NODES: result.nodes = read_array( io_stream, subchunk_end, AABBTreeNode.read) else: skip_unknown_chunk(context, io_stream, chunk_type, chunk_size) return result
def read(io_stream, chunk_end): result = MaterialPass(vertex_material_ids=[], shader_ids=[], dcg=[], dig=[], scg=[], shader_material_ids=[], tx_stages=[], tx_coords=[]) while io_stream.tell() < chunk_end: (chunk_type, chunk_size, subchunk_end) = read_chunk_head(io_stream) if chunk_type == W3D_CHUNK_VERTEX_MATERIAL_IDS: result.vertex_material_ids = read_array( io_stream, subchunk_end, read_ulong) elif chunk_type == W3D_CHUNK_SHADER_IDS: result.shader_ids = read_array(io_stream, subchunk_end, read_ulong) elif chunk_type == W3D_CHUNK_DCG: result.dcg = read_array(io_stream, subchunk_end, RGBA.read) elif chunk_type == W3D_CHUNK_DIG: result.dig = read_array(io_stream, subchunk_end, RGBA.read) elif chunk_type == W3D_CHUNK_SCG: result.scg = read_array(io_stream, subchunk_end, RGBA.read) elif chunk_type == W3D_CHUNK_SHADER_MATERIAL_ID: result.shader_material_ids = read_array( io_stream, subchunk_end, read_ulong) elif chunk_type == W3D_CHUNK_TEXTURE_STAGE: result.tx_stages.append( TextureStage.read(io_stream, subchunk_end)) elif chunk_type == W3D_CHUNK_STAGE_TEXCOORDS: result.tx_coords = read_array(io_stream, subchunk_end, read_vector2) else: skip_unknown_chunk(None, io_stream, chunk_type, chunk_size) return result