3 self.inline_data = True
5 def export_texture(self, texture):
6 from .datafile import Resource, Statement, Token
7 tex_res = Resource(texture.name+".tex2d")
9 if texture.use_interpolation:
10 if texture.use_mipmap:
11 tex_res.statements.append(Statement("min_filter", Token('LINEAR_MIPMAP_LINEAR')))
12 tex_res.statements.append(Statement("generate_mipmap", True))
14 tex_res.statements.append(Statement("min_filter", Token('LINEAR')))
15 tex_res.statements.append(Statement("max_anisotropy", texture.filter_eccentricity))
17 if texture.use_mipmap:
18 tex_res.statements.append(Statement("min_filter", Token('NEAREST_MIPMAP_NEAREST')))
19 tex_res.statements.append(Statement("generate_mipmap", True))
21 tex_res.statements.append(Statement("min_filter", Token('NEAREST')))
23 if not self.inline_data:
24 from .util import image_name
25 tex_res.statements.append(Statement("image_data", image_name(texture.image)))
30 for p in texture.image.pixels:
31 texdata += "\\x{:02X}".format(int(p*255))
34 for i in range(0, len(texture.image.pixels), 4):
36 texdata += "\\x{:02X}".format(int(texture.image.pixels[i+j]*255))
37 tex_res.statements.append(Statement("storage", Token(fmt), texture.image.size[0], texture.image.size[1]))
38 tex_res.statements.append(Statement("raw_data", texdata))