mirror of
https://github.com/drewcassidy/quicktex.git
synced 2024-09-13 06:37:34 +00:00
fix pfflags and mipmap count
This commit is contained in:
parent
f87226ad50
commit
38d3805add
@ -166,7 +166,7 @@ class DDSFile:
|
||||
|
||||
# WRITE HEADER
|
||||
file.write(struct.pack('<7I44x', DDSFile.header_bytes, int(self.flags), self.size[1], self.size[0], self.pitch, self.depth, self.mipmap_count))
|
||||
file.write(struct.pack('<2I4s5I', 32, int(self.flags), bytes(self.four_cc, 'ascii'), self.pixel_size, *self.pixel_bitmasks))
|
||||
file.write(struct.pack('<2I4s5I', 32, int(self.pfflags), bytes(self.four_cc, 'ascii'), self.pixel_size, *self.pixel_bitmasks))
|
||||
file.write(struct.pack('<4I4x', *self.caps))
|
||||
|
||||
assert file.tell() == 4 + DDSFile.header_bytes, 'error writing file: incorrect header size'
|
||||
|
@ -19,7 +19,7 @@ def mip_sizes(dimensions: Tuple[int, int], mip_count: Optional[int] = None) -> L
|
||||
"""
|
||||
assert all([dim > 0 for dim in dimensions]), "Invalid source dimensions"
|
||||
if not mip_count:
|
||||
mip_count = math.ceil(math.log2(max(dimensions))) # maximum possible number of mips for a given source
|
||||
mip_count = math.ceil(math.log2(max(dimensions)) + 1) # maximum possible number of mips for a given source
|
||||
|
||||
assert mip_count > 0, "mip_count must be greater than 0"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user