Example #1
0
    def load(self, di):
        BamObject.load(self, di)
        num_transforms = di.get_uint16()
        self.transforms = [VertexTransform(di) for i in range(num_transforms)]
        num_vertex_morphs = di.get_uint16()
        self.vertex_morphs = [
            ComputedVerticesMorph(di, LVecBase3f)
            for i in range(num_vertex_morphs)
        ]
        num_normal_morphs = di.get_uint16()
        self.normal_morphs = [
            ComputedVerticesMorph(di, LVecBase3f)
            for i in range(num_normal_morphs)
        ]
        num_texcoord_morphs = di.get_uint16()
        self.texcoord_morphs = [
            ComputedVerticesMorph(di, LVecBase2f)
            for i in range(num_texcoord_morphs)
        ]
        num_color_morphs = di.get_uint16()
        self.color_morphs = [
            ComputedVerticesMorph(di, LVecBase4f)
            for i in range(num_color_morphs)
        ]

        self.orig_coords = self.bam_file.read_vec3_array(di)
        self.orig_norms = self.bam_file.read_vec3_array(di)
        self.orig_colors = self.bam_file.read_vec4_array(di)
        self.orig_texcoords = self.bam_file.read_vec2_array(di)
    def load(self, di):
        BamObject.load(self, di)

        self.name = di.get_string()
        self.group_id = self.bam_file.read_pointer(di)  # PaletteGroup
        self.texture_properties = self.load_type(TextureProperties, di)

        self.image_ids = self.bam_file.read_pointer_uint32_list(
            di)  # PaletteImage
    def load(self, di):
        BamObject.load(self, di)

        self.margin = di.get_int32()
        self.x = di.get_int32()
        self.y = di.get_int32()
        self.x_size = di.get_int32()
        self.y_size = di.get_int32()
        self.min_uv = LPoint2d(di.get_float64(), di.get_float64())
        self.max_uv = LPoint2d(di.get_float64(), di.get_float64())
        self.wrap_u = di.get_int32()
        self.wrap_v = di.get_int32()
Example #4
0
    def load(self, di):
        BamObject.load(self, di)

        self.properties = self.load_type(TextureProperties, di)
        self.filename = di.get_string()
        self.alpha_filename = di.get_string()  # Always empty on source image

        if PI_VERSION >= 10:
            self.alpha_file_channel = di.get_uint8()
        else:
            self.alpha_file_channel = 0

        self.size_known = di.get_bool()
        self.x_size = di.get_int32()
        self.y_size = di.get_int32()
Example #5
0
    def load(self, di):
        BamObject.load(self, di)

        self.name = di.get_string()
        self.current_directory = di.get_string()
        self.source_filename = di.get_string()
        self.dest_filename = di.get_string()
        self.egg_comment = di.get_string()

        self.texture_ref_ids = self.bam_file.read_pointer_uint32_list(
            di)  # TextureReference

        self.explicitly_assigned_groups = self.load_type(PaletteGroups, di)
        self.default_group_id = self.bam_file.read_pointer(di)  # PaletteGroup

        self.is_surprise = di.get_bool()
        self.is_stale = di.get_bool()
Example #6
0
    def load(self, di):
        BamObject.load(self, di)
        self.coords = self.bam_file.read_vec3_array(di)
        self.norms = self.bam_file.read_vec3_array(di)
        self.colors = self.bam_file.read_vec4_array(di)
        self.texcoords = self.bam_file.read_vec2_array(di)

        self.vindex = self.bam_file.read_ushort_array(di)
        self.nindex = self.bam_file.read_ushort_array(di)
        self.cindex = self.bam_file.read_ushort_array(di)
        self.tindex = self.bam_file.read_ushort_array(di)

        self.num_prims = di.get_uint16()
        self.prim_lengths = self.bam_file.read_int_array(di)

        self.binds = [di.get_uint8()
                      for i in range(num_GeomAttrTypes)]  # GeomBindType`
Example #7
0
    def load(self, di):
        BamObject.load(self, di)

        self.texture_id = self.bam_file.read_pointer(di)  # TextureImage
        self.group_id = self.bam_file.read_pointer(di)  # PaletteGroup
        self.image_id = self.bam_file.read_pointer(di)  # PaletteImage
        self.dest_image_id = self.bam_file.read_pointer(di)  # DestTextureImage

        self.has_uvs = di.get_bool()
        self.size_known = di.get_bool()
        self.position = self.load_type(TexturePosition, di)

        self.is_filled = di.get_bool()
        self.placed = self.load_type(TexturePosition, di)
        self.omit_reason = di.get_int32()

        self.reference_ids = self.bam_file.read_pointer_int32_list(di)
        self.texture_swap_ids = self.bam_file.read_pointer_int32_list(di)
Example #8
0
    def load(self, di):
        BamObject.load(self, di)

        self.name = di.get_string()
        self.dirname = di.get_string()
        self.palette_groups = self.load_type(PaletteGroups, di)
        self.dependency_level = di.get_int32()
        self.dependency_order = di.get_int32()
        self.dirname_order = di.get_int32()

        self.placement_ids = self.bam_file.read_pointer_uint32_list(di) # TexturePlacement
        self.page_ids = self.bam_file.read_pointer_uint32_list(di) # PalettePage

        if PI_VERSION >= 19:
            self.has_margin_override = di.get_bool()
            self.margin_override = di.get_int16()
        else:
            self.has_margin_override = False
            self.margin_override = 0
Example #9
0
    def load(self, di):
        BamObject.load(self, di)

        self.egg_file_id = self.bam_file.read_pointer(di)

        self.tref_name = di.get_string()

        self.tex_mat = self.load_type(Matrix3F, di)
        self.inv_tex_mat = self.load_type(Matrix3F, di)

        self.source_texture_id = self.bam_file.read_pointer(
            di)  # SourceTextureImage
        self.placement_id = self.bam_file.read_pointer(di)  # TexturePlacement

        self.uses_alpha = di.get_bool()
        self.any_uvs = di.get_bool()
        self.min_uv = [di.get_float64(), di.get_float64()]
        self.max_uv = [di.get_float64(), di.get_float64()]
        self.wrap_u = di.get_int32()
        self.wrap_v = di.get_int32()
        self.properties = self.load_type(TextureProperties, di)
Example #10
0
    def load(self, di):
        BamObject.load(self, di)

        self.name = di.get_string()
        self.filename = di.get_string()
        self.alpha_filename = di.get_string()

        if self.bam_version >= (4, 2):
            self.primary_file_num_channels = di.get_uint8()
        else:
            self.primary_file_num_channels = 0

        if self.bam_version >= (4, 3):
            self.alpha_file_channel = di.get_uint8()
        else:
            self.alpha_file_channel = 0

        # There used to be a proper implementation here, using
        # BAM file versions, but being highly untested, this is more secure.
        # We'll just read everything we need to change, and nothing else.
        self.texture_data = di.extract_bytes(di.get_remaining_size())
Example #11
0
    def load(self, di):
        BamObject.load(self, di)

        self.got_num_channels = di.get_bool()
        self.num_channels = di.get_int32()

        if PI_VERSION >= 9:
            self.effective_channels = di.get_int32()
        else:
            self.effective_channels = self.num_channels

        self.format = di.get_int32()
        self.force_format = di.get_bool()

        if PI_VERSION >= 9:
            self.generic_format = di.get_bool()
        else:
            self.generic_format = False

        if PI_VERSION >= 13:
            self.keep_format = di.get_bool()
        else:
            self.keep_format = False

        self.minfilter = di.get_int32()
        self.magfilter = di.get_int32()

        if PI_VERSION >= 18:
            self.quality_level = di.get_int32()
        else:
            self.quality_level = QL_unspecified

        self.anisotropic_degree = di.get_int32()

        self.color_type_id = self.bam_file.read_pointer(di)
        self.alpha_type_id = self.bam_file.read_pointer(di)
Example #12
0
 def load(self, di):
     BamObject.load(self, di)
     self.name = di.get_string()
     self.alpha_name = di.get_string()
    def load(self, di):
        BamObject.load(self, di)

        self.group_ids = self.bam_file.read_pointer_int32_list(
            di)  # PaletteGroup
Example #14
0
 def load(self, di):
     BamObject.load(self, di)
     self.tangible = di.get_uint8() != 0