This commit is contained in:
Lubos Lenco 2017-11-07 12:01:10 +01:00
parent 6162a4d4a4
commit 45102fb1c7

View file

@ -14,15 +14,17 @@ def interpolate(tese, var, size, normalize=False, declare_out=False):
if declare_out:
tese.add_out('{0} {1}'.format(vec, var))
tese.write('{0} {1}_0 = gl_TessCoord.x * tc_{1}[0];'.format(vec, var))
tese.write('{0} {1}_1 = gl_TessCoord.y * tc_{1}[1];'.format(vec, var))
tese.write('{0} {1}_2 = gl_TessCoord.z * tc_{1}[2];'.format(vec, var))
s = '{0} {1}_0 = gl_TessCoord.x * tc_{1}[0];\n'.format(vec, var)
s += '{0} {1}_1 = gl_TessCoord.y * tc_{1}[1];\n'.format(vec, var)
s += '{0} {1}_2 = gl_TessCoord.z * tc_{1}[2];\n'.format(vec, var)
prep = ''
if not declare_out:
prep = vec + ' '
if normalize:
tese.write('{0}{1} = normalize({1}_0 + {1}_1 + {1}_2);'.format(prep, var))
s += '{0}{1} = normalize({1}_0 + {1}_1 + {1}_2);\n'.format(prep, var)
else:
tese.write('{0}{1} = {1}_0 + {1}_1 + {1}_2;'.format(prep, var))
s += '{0}{1} = {1}_0 + {1}_1 + {1}_2;\n'.format(prep, var)
tese.prepend_header(s)