def create_shadow_method(tech_res, material, resources, detail):
- from .datafile import Statement
+ from .datafile import Statement, Token
color_prop = next((p for p in material.properties if p.keyword and "color" in p.keyword), None)
else:
st.sub.append(Statement("shader", "occluder{}.glsl.shader".format(detail)))
+ if material.face_cull=='BACK':
+ st.sub.append(Statement("face_cull", Token("CULL_BACK")))
+
return st;
def create_technique_resource(material, resources):
ss.sub.append(Statement("uniform", u.name, *u.values[:u.size]))
st.sub.append(ss)
+ if material.face_cull=='BACK':
+ st.sub.append(Statement("face_cull", Token("CULL_BACK")))
+
tech_res.statements.append(st)
else:
base_method = "blended" if material.blend_type!='NONE' else ""
st.sub.append(Statement("receive_shadows", True))
if material.image_based_lighting:
st.sub.append(Statement("image_based_lighting", True))
+ if material.face_cull=='BACK':
+ st.sub.append(Statement("face_cull", Token("CULL_BACK")))
tech_res.statements.append(st)
task = ctx.task("Creating statements", 1.0)
+ statements.append(Statement("winding", Token('COUNTERCLOCKWISE')))
+
st = Statement("vertices", Token("VERTEX3_FLOAT"))
stride = 12
if mesh.vertices[0].color:
st.sub.append(Statement("indices", *(v.index for v in l.vertices)))
statements.append(st)
- if mesh.winding_test:
- statements.append(Statement("winding", Token('COUNTERCLOCKWISE')))
-
task.set_progress(1.0)
return resource
self.technique = material.technique
self.render_methods = material.render_methods[:]
self.uniforms = material.uniforms[:]
+ self.face_cull = 'BACK' if material.use_backface_culling else 'NONE'
self.receive_shadows = material.receive_shadows
self.cast_shadows = (material.shadow_method!='NONE')
self.blend_type = 'ALPHA' if material.blend_method=='BLEND' else 'NONE'
def __init__(self, mesh):
self.name = mesh.name
- self.winding_test = mesh.winding_test
self.smoothing = mesh.smoothing
self.use_uv = mesh.use_uv
self.tangent_uvtex = mesh.tangent_uvtex
bmesh = eval_obj.to_mesh()
# Object.to_mesh does not copy custom properties
- bmesh.winding_test = o.data.winding_test
bmesh.smoothing = o.data.smoothing
bmesh.use_lines = o.data.use_lines
bmesh.vertex_groups = o.data.vertex_groups
def draw(self, context):
mesh = context.active_object.data
- self.layout.prop(mesh, "winding_test")
self.layout.prop(mesh, "smoothing")
self.layout.prop(mesh, "use_strips")
bpy.types.World.use_sky = bpy.props.BoolProperty(name="Realtime sky", description="Use a realtime rendered sky background", default=False)
bpy.types.World.sun_light = bpy.props.PointerProperty(type=bpy.types.Light, name="Sun", description="Light to use as sun for the sky")
- bpy.types.Mesh.winding_test = bpy.props.BoolProperty(name="Winding test", description="Perform winding test to skip back faces")
bpy.types.Mesh.smoothing = bpy.props.EnumProperty(name="Smoothing", description="Smoothing method to use", default="MSPGL",
items=(("NONE", "None", "No smoothing"),
("BLENDER", "Blender", "Use Blender's vertex normals"),
const Material *material = 0;
std::string material_slot;
std::vector<TextureSlot> textures;
- CullMode face_cull = CULL_BACK;
+ CullMode face_cull = NO_CULL;
Blend blend;
bool receive_shadows = false;
bool image_based_lighting = false;