forked from LeenkxTeam/LNXSDK
Repe [T3DU] Update - 31f26d171bba0355ce2a77031e3aad4c64dbc7e9
This commit is contained in:
@ -23,32 +23,31 @@ def make(con_mesh: ShaderContext):
|
||||
|
||||
# Additional values referenced in cycles
|
||||
# TODO: enable from cycles.py
|
||||
if (frag.contains('dotNV') or frag.contains('n')) and not frag.contains('vec3 n'):
|
||||
vert.add_out('vec3 wnormal')
|
||||
billboard = mat_state.material.lnx_billboard
|
||||
if billboard == 'spherical':
|
||||
vert.add_uniform('mat3 N', '_normalMatrixSphere')
|
||||
elif billboard == 'cylindrical':
|
||||
vert.add_uniform('mat3 N', '_normalMatrixCylinder')
|
||||
else:
|
||||
vert.add_uniform('mat3 N', '_normalMatrix')
|
||||
vert.write_attrib('wnormal = normalize(N * vec3(nor.xy, pos.w));')
|
||||
frag.write_attrib('vec3 n = normalize(wnormal);')
|
||||
|
||||
# If not yet added, add nor vertex data
|
||||
vertex_elems = con_mesh.data['vertex_elements']
|
||||
has_normals = False
|
||||
for elem in vertex_elems:
|
||||
if elem['name'] == 'nor':
|
||||
has_normals = True
|
||||
break
|
||||
if not has_normals:
|
||||
vertex_elems.append({'name': 'nor', 'data': 'short2norm'})
|
||||
|
||||
if frag.contains('dotNV') and not frag.contains('float dotNV'):
|
||||
frag.write_init('float dotNV = max(dot(n, vVec), 0.0);')
|
||||
|
||||
# n is not always defined yet (in some shadowmap shaders e.g.)
|
||||
if not frag.contains('vec3 n'):
|
||||
vert.add_out('vec3 wnormal')
|
||||
billboard = mat_state.material.lnx_billboard
|
||||
if billboard == 'spherical':
|
||||
vert.add_uniform('mat3 N', '_normalMatrixSphere')
|
||||
elif billboard == 'cylindrical':
|
||||
vert.add_uniform('mat3 N', '_normalMatrixCylinder')
|
||||
else:
|
||||
vert.add_uniform('mat3 N', '_normalMatrix')
|
||||
vert.write_attrib('wnormal = normalize(N * vec3(nor.xy, pos.w));')
|
||||
frag.write_attrib('vec3 n = normalize(wnormal);')
|
||||
|
||||
# If not yet added, add nor vertex data
|
||||
vertex_elems = con_mesh.data['vertex_elements']
|
||||
has_normals = False
|
||||
for elem in vertex_elems:
|
||||
if elem['name'] == 'nor':
|
||||
has_normals = True
|
||||
break
|
||||
if not has_normals:
|
||||
vertex_elems.append({'name': 'nor', 'data': 'short2norm'})
|
||||
|
||||
write_wpos = False
|
||||
export_wpos = False
|
||||
if frag.contains('wposition') and not frag.contains('vec3 wposition'):
|
||||
|
||||
Reference in New Issue
Block a user