static void sh_from_disc(float *n, float area, float *shresult) { /* See formula (3) in: * "An Efficient Representation for Irradiance Environment Maps" */ float sh[9], x, y, z; x = n[0]; y = n[1]; z = n[2]; sh[0] = 0.282095f; sh[1] = 0.488603f * y; sh[2] = 0.488603f * z; sh[3] = 0.488603f * x; sh[4] = 1.092548f * x * y; sh[5] = 1.092548f * y * z; sh[6] = 0.315392f * (3.0f * z * z - 1.0f); sh[7] = 1.092548f * x * z; sh[8] = 0.546274f * (x * x - y * y); sh_mul(sh, area); sh_copy(shresult, sh); }
dake::gl::program::program(std::initializer_list<shader> shaders): program() { for (const shader &sh: shaders) { // Let's just pray to god this works shader sh_copy(sh.t, sh.id); *this << sh_copy; } }