forked from LeenkxTeam/LNXSDK
Update leenkx/blender/lnx/material/make_cluster.py
This commit is contained in:
@ -19,6 +19,7 @@ def write(vert: shader.Shader, frag: shader.Shader):
|
|||||||
parse_opacity = blend or mat_utils.is_transluc(mat_state.material)
|
parse_opacity = blend or mat_utils.is_transluc(mat_state.material)
|
||||||
is_mobile = rpdat.lnx_material_model == 'Mobile'
|
is_mobile = rpdat.lnx_material_model == 'Mobile'
|
||||||
is_shadows = '_ShadowMap' in wrd.world_defs
|
is_shadows = '_ShadowMap' in wrd.world_defs
|
||||||
|
is_transparent_shadows = '_ShadowMapTransparent' in wrd.world_defs
|
||||||
is_shadows_atlas = '_ShadowMapAtlas' in wrd.world_defs
|
is_shadows_atlas = '_ShadowMapAtlas' in wrd.world_defs
|
||||||
is_single_atlas = '_SingleAtlas' in wrd.world_defs
|
is_single_atlas = '_SingleAtlas' in wrd.world_defs
|
||||||
|
|
||||||
@ -33,13 +34,16 @@ def write(vert: shader.Shader, frag: shader.Shader):
|
|||||||
if is_shadows_atlas:
|
if is_shadows_atlas:
|
||||||
if not is_single_atlas:
|
if not is_single_atlas:
|
||||||
frag.add_uniform('sampler2DShadow shadowMapAtlasPoint', included=True)
|
frag.add_uniform('sampler2DShadow shadowMapAtlasPoint', included=True)
|
||||||
|
if is_transparent_shadows:
|
||||||
frag.add_uniform('sampler2D shadowMapAtlasPointTransparent', included=True)
|
frag.add_uniform('sampler2D shadowMapAtlasPointTransparent', included=True)
|
||||||
else:
|
else:
|
||||||
frag.add_uniform('sampler2DShadow shadowMapAtlas', top=True)
|
frag.add_uniform('sampler2DShadow shadowMapAtlas', top=True)
|
||||||
|
if is_transparent_shadows:
|
||||||
frag.add_uniform('sampler2D shadowMapAtlasTransparent', top=True)
|
frag.add_uniform('sampler2D shadowMapAtlasTransparent', top=True)
|
||||||
frag.add_uniform('vec4 pointLightDataArray[maxLightsCluster]', link='_pointLightsAtlasArray', included=True)
|
frag.add_uniform('vec4 pointLightDataArray[maxLightsCluster]', link='_pointLightsAtlasArray', included=True)
|
||||||
else:
|
else:
|
||||||
frag.add_uniform('samplerCubeShadow shadowMapPoint[4]', included=True)
|
frag.add_uniform('samplerCubeShadow shadowMapPoint[4]', included=True)
|
||||||
|
if is_transparent_shadows:
|
||||||
frag.add_uniform('samplerCube shadowMapPointTransparent[4]', included=True)
|
frag.add_uniform('samplerCube shadowMapPointTransparent[4]', included=True)
|
||||||
|
|
||||||
if not '_VoxelAOvar' in wrd.world_defs and not '_VoxelGI' in wrd.world_defs or ((parse_opacity or '_VoxelShadow' in wrd.world_defs) and ('_VoxelAOvar' in wrd.world_defs or '_VoxelGI' in wrd.world_defs)):
|
if not '_VoxelAOvar' in wrd.world_defs and not '_VoxelGI' in wrd.world_defs or ((parse_opacity or '_VoxelShadow' in wrd.world_defs) and ('_VoxelAOvar' in wrd.world_defs or '_VoxelGI' in wrd.world_defs)):
|
||||||
@ -62,12 +66,15 @@ def write(vert: shader.Shader, frag: shader.Shader):
|
|||||||
if is_shadows_atlas:
|
if is_shadows_atlas:
|
||||||
if not is_single_atlas:
|
if not is_single_atlas:
|
||||||
frag.add_uniform('sampler2DShadow shadowMapAtlasSpot', included=True)
|
frag.add_uniform('sampler2DShadow shadowMapAtlasSpot', included=True)
|
||||||
|
if is_transparent_shadows:
|
||||||
frag.add_uniform('sampler2D shadowMapAtlasSpotTransparent', included=True)
|
frag.add_uniform('sampler2D shadowMapAtlasSpotTransparent', included=True)
|
||||||
else:
|
else:
|
||||||
frag.add_uniform('sampler2DShadow shadowMapAtlas', top=True)
|
frag.add_uniform('sampler2DShadow shadowMapAtlas', top=True)
|
||||||
|
if is_transparent_shadows:
|
||||||
frag.add_uniform('sampler2D shadowMapAtlasTransparent', top=True)
|
frag.add_uniform('sampler2D shadowMapAtlasTransparent', top=True)
|
||||||
else:
|
else:
|
||||||
frag.add_uniform('sampler2DShadow shadowMapSpot[4]', included=True)
|
frag.add_uniform('sampler2DShadow shadowMapSpot[4]', included=True)
|
||||||
|
if is_transparent_shadows:
|
||||||
frag.add_uniform('sampler2D shadowMapSpotTransparent[4]', included=True)
|
frag.add_uniform('sampler2D shadowMapSpotTransparent[4]', included=True)
|
||||||
frag.add_uniform('mat4 LWVPSpotArray[maxLightsCluster]', link='_biasLightWorldViewProjectionMatrixSpotArray', included=True)
|
frag.add_uniform('mat4 LWVPSpotArray[maxLightsCluster]', link='_biasLightWorldViewProjectionMatrixSpotArray', included=True)
|
||||||
|
|
||||||
@ -85,11 +92,9 @@ def write(vert: shader.Shader, frag: shader.Shader):
|
|||||||
frag.write(' specular,')
|
frag.write(' specular,')
|
||||||
frag.write(' f0')
|
frag.write(' f0')
|
||||||
if is_shadows:
|
if is_shadows:
|
||||||
frag.write('\t, li, lightsArray[li * 3 + 2].x, lightsArray[li * 3 + 2].z != 0.0')
|
frag.write('\t, li, lightsArray[li * 3 + 2].x, lightsArray[li * 3 + 2].z != 0.0') # bias
|
||||||
if '_ShadowMapTransparent' in wrd.world_defs and parse_opacity:
|
if is_transparent_shadows:
|
||||||
frag.write(', opacity != 1.0')
|
frag.write('\t, opacity != 1.0')
|
||||||
else:
|
|
||||||
frag.write(', false')
|
|
||||||
if '_Spot' in wrd.world_defs:
|
if '_Spot' in wrd.world_defs:
|
||||||
frag.write('\t, lightsArray[li * 3 + 2].y != 0.0')
|
frag.write('\t, lightsArray[li * 3 + 2].y != 0.0')
|
||||||
frag.write('\t, lightsArray[li * 3 + 2].y') # spot size (cutoff)
|
frag.write('\t, lightsArray[li * 3 + 2].y') # spot size (cutoff)
|
||||||
@ -102,9 +107,10 @@ def write(vert: shader.Shader, frag: shader.Shader):
|
|||||||
if '_MicroShadowing' in wrd.world_defs and not is_mobile:
|
if '_MicroShadowing' in wrd.world_defs and not is_mobile:
|
||||||
frag.write('\t, occlusion')
|
frag.write('\t, occlusion')
|
||||||
if '_SSRS' in wrd.world_defs:
|
if '_SSRS' in wrd.world_defs:
|
||||||
|
frag.add_uniform('sampler2D gbufferD')
|
||||||
frag.add_uniform('mat4 invVP', '_inverseViewProjectionMatrix')
|
frag.add_uniform('mat4 invVP', '_inverseViewProjectionMatrix')
|
||||||
frag.add_uniform('vec3 eye', '_cameraPosition')
|
frag.add_uniform('vec3 eye', '_cameraPosition')
|
||||||
frag.write(', wposition.z, invVP, eye')
|
frag.write(', gbufferD, invVP, eye')
|
||||||
frag.write(');')
|
frag.write(');')
|
||||||
|
|
||||||
frag.write('}') # for numLights
|
frag.write('}') # for numLights
|
||||||
|
Reference in New Issue
Block a user