Merge pull request #2053 from QuantumCoderQC/ParticleFix

Fix normals and wposition in custom particle node
This commit is contained in:
Lubos Lenco 2020-12-12 18:24:05 +01:00 committed by GitHub
commit f69185a765
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -160,7 +160,7 @@ class CustomParticleNode(Node):
vertshdr.write(f' sin({rot}.z) * sin({rot}.x) + cos({rot}.z) * sin({rot}.y) * cos({rot}.x), -cos({rot}.z) * sin({rot}.x) + sin({rot}.z) * sin({rot}.y) * cos({rot}.x), cos({rot}.y) * cos({rot}.x));')
vertshdr.write('spos.xyz = part_rot_mat * spos.xyz;')
if (part_con.data['name'] == 'mesh' or 'translucent') and vertshdr.contains('wnormal'):
if ((part_con.data['name'] == 'mesh' or part_con.data['name'] == 'translucent')):
vertshdr.write('wnormal = transpose(inverse(part_rot_mat)) * wnormal;')
if self.posX or self.posY or self.posZ:
@ -174,9 +174,8 @@ class CustomParticleNode(Node):
if self.posZ:
vertshdr.write(f'spos.z += {pos}.z;')
if vertshdr.contains('vec3 disp'):
vertshdr.write('wposition = vec4(W * spos).xyz;')
vertshdr.write('wposition = vec4(W * spos).xyz;')
add_node(CustomParticleNode, category='Armory')