st.sub.append(tech_res.create_embed_statement("material", mat_res))
if material.render_mode=='CUSTOM':
st.sub.append(tech_res.create_embed_statement("material", mat_res))
if material.render_mode=='CUSTOM':
- st.sub.append(Statement("shader", material.shader))
+ shader = material.shader
+ if shader.endswith(".glsl"):
+ shader += ".shader"
+ st.sub.append(Statement("shader", shader))
from .datafile import Resource, Statement
mat_res = Resource(material.name+".mat", "material")
from .datafile import Resource, Statement
mat_res = Resource(material.name+".mat", "material")
- for kw, p in material.properties.items():
- ss = self.create_property_statement(mat_res, p, kw, resources)
+ for p in material.properties:
+ ss = self.create_property_statement(mat_res, p, resources)
- first_tex = (p.texture for p in material.properties.values() if p.texture).__next__()
- if first_tex and not first_tex.default_filter:
+ textures = [p.texture for p in material.properties if p.texture]
+ if textures and not textures[0].default_filter:
- def create_property_statement(self, mat_res, prop, keyword, resources):
+ def create_property_statement(self, mat_res, prop, resources):
from .datafile import Statement
if self.use_textures and prop.texture:
tex_res = resources[prop.texture.image.name+".tex2d"]
from .util import basename
fn = basename(prop.texture.image.filepath)
if prop.texture.default_filter and fn:
from .datafile import Statement
if self.use_textures and prop.texture:
tex_res = resources[prop.texture.image.name+".tex2d"]
from .util import basename
fn = basename(prop.texture.image.filepath)
if prop.texture.default_filter and fn:
base_color_res = resources.get(base_color_name)
if not base_color_res:
base_color_res = Resource(base_color_name, "texture2d")
base_color_res = resources.get(base_color_name)
if not base_color_res:
base_color_res = Resource(base_color_name, "texture2d")
- base_color_res.statements.append(Statement("storage", Token('SRGB_ALPHA'), *material_map.size))
- base_color_res.statements.append(Statement("raw_data", material_map.base_color_data))
+ base_color_res.statements.append(Statement("storage", Token('SRGB_ALPHA'), *material_atlas.size))
+ base_color_res.statements.append(Statement("raw_data", material_atlas.base_color_data))
if mat_name not in resources:
mat_res = Resource(mat_name, "material")
st = Statement("pbr")
if mat_name not in resources:
mat_res = Resource(mat_name, "material")
st = Statement("pbr")
- def export_technique(self, material_map, *, resources):
- return create_technique_resource(material_map, resources)
+ def export_technique(self, material_atlas, *, resources):
+ return create_technique_resource(material_atlas, resources)