texturecompress: use a POT size of PVRTC (same for width/height), otherwise the OSX texturecompress will fail.

This commit is contained in:
Mathieu Virbel 2014-04-02 15:28:15 +02:00
parent 4ad0ba8ba1
commit ec299657d5
1 changed files with 6 additions and 1 deletions

View File

@ -204,12 +204,17 @@ class PvrtcTool(Tool):
s2 = max(w2, h2)
print('PVR need a square image, the texture will be {0}x{0}'.format(s2))
ext = self.source_fn.rsplit('.', 1)[-1]
tmpfile = '/tmp/ktexturecompress.{}'.format(ext)
image = image.resize((s2, s2))
image.save(tmpfile)
# 4. invoke texture tool
raw_tex_fn = self.tex_fn + '.raw'
cmd = [self.texturetool]
if self.options.mipmap:
cmd += ['-m']
cmd += ['-e', 'PVRTC', '-o', raw_tex_fn, '-f', 'RAW', self.source_fn]
cmd += ['-e', 'PVRTC', '-o', raw_tex_fn, '-f', 'RAW', tmpfile]
try:
self.runcmd(cmd)
with open(raw_tex_fn, 'rb') as fd: