macro Texture_Index(sh, t) { prm = { fn f(c) { def s = Concat(sh,"_",c); return If(Prm_There(s), s^2,0); } return 1 +1/5 (f(c20)+f(c21p)+f(c21m)+f(c22p)+f(c22m)) +1/9 (f(c40)+f(c41p)+f(c41m)+f(c42p)+f(c42m)+f(c43p)+f(c43m)+f(c44p)+f(c44m)) +1/13 (f(c60)+f(c61p)+f(c61m)+f(c62p)+f(c62m)+f(c63p)+f(c63m)+f(c64p)+f(c64m)+f(c65p)+f(c65m)+f(c66p)+f(c66m)) +1/17 (f(c80)+f(c81p)+f(c81m)+f(c82p)+f(c82m)+f(c83p)+f(c83m)+f(c84p)+f(c84m)+f(c85p)+f(c85m)+f(c86p)+f(c86m)+f(c87p)+f(c87m)+f(c88p)+f(c88m)); } : t }
str… PO_Spherical_Harmonics(sh, 8) Texture_Index(sh, 0)
On termination of refinement the second argument of the Texture_Index macro is updated.