Fix instanced shadows

This commit is contained in:
Lubos Lenco 2017-01-14 17:37:18 +01:00
parent 09ce6a999a
commit 910f6906e4
4 changed files with 11 additions and 4 deletions

View file

@ -134,7 +134,7 @@ def parse_shader(sres, c, con, defs, lines, parse_attributes):
found = find_def(defs, s)
if line.startswith('#ifndef'):
found = not found
if found == False or s == '_Instancing': # TODO: Prevent instanced data to go into main vertex structure
if found == False:
stack.append(0)
else:
stack.append(1)

View file

@ -25,6 +25,9 @@ def make(context_id, rpasses):
if mat_state.data.is_elem('bone'):
make_skin.skin_pos(vert)
if mat_state.data.is_elem('off'):
vert.write('spos.xyz += off;')
if mat_utils.disp_linked(mat_state.output_node) and mat_state.material.height_tess_shadows:
tesc = con_shadowmap.make_tesc()
tese = con_shadowmap.make_tese()

View file

@ -41,8 +41,7 @@ class ShaderData:
# TODO: temporary, Sort vertex data
for sd in self.data['shader_datas']:
vs = []
ar = ['pos', 'nor', 'tex', 'tex1', 'col', 'tan', 'bone', 'weight']
# 'off' is discarded and recreated in instanced vertex structure
ar = ['pos', 'nor', 'tex', 'tex1', 'col', 'tan', 'bone', 'weight', 'off']
for ename in ar:
elem = self.get_elem(ename)
if elem != None:

View file

@ -27,6 +27,11 @@ def update_translucency_state(self, context):
return
update_renderpath(self, context)
def invalidate_mesh_cache(self, context):
if context.object == None or context.object.data == None:
return
context.object.data.mesh_cached = False
arm_ver = '17.01.1'
def init_properties():
global arm_ver
@ -99,7 +104,7 @@ def init_properties():
bpy.types.World.arm_loadbar = BoolProperty(name="Load Bar", description="Show asset loading progress on published builds", default=True)
# For object
bpy.types.Object.instanced_children = bpy.props.BoolProperty(name="Instanced Children", description="Use instaced rendering", default=False)
bpy.types.Object.instanced_children = bpy.props.BoolProperty(name="Instanced Children", description="Use instaced rendering", default=False, update=invalidate_mesh_cache)
bpy.types.Object.instanced_children_loc_x = bpy.props.BoolProperty(name="X", default=True)
bpy.types.Object.instanced_children_loc_y = bpy.props.BoolProperty(name="Y", default=True)
bpy.types.Object.instanced_children_loc_z = bpy.props.BoolProperty(name="Z", default=True)