rendered paste body
/* lookup the initial hw_reg_a and hw_reg_g, based on exponent: */
lut_value = spotlight_LUT[lut_index_int]*left_factor + spotlight_LUT[lut_index_int+1]*right_factor;
/* hw_reg_g: */
cos_cutoff = lut_value;
tmp = 1/(cos_cutoff-1);
hw_reg_g = tmp + 1; /* hw_reg_g = 1/(cos_cutoff-1) + 1; */
/* hw_reg_d, hw_reg_e, hw_reg_f: */
spotlight_length = sqrtl( dirX*dirX + dirY*dirY + dirZ*dirZ );
tmp /= spotlight_length;
hw_reg_d = tmp * dirX; /* hw_reg_d = 1/(cos_cutoff-1) * dirX/spotlight_length; */
hw_reg_e = tmp * dirY; /* hw_reg_e = 1/(cos_cutoff-1) * dirY/spotlight_length; */
hw_reg_f = tmp * dirZ; /* hw_reg_f = 1/(cos_cutoff-1) * dirZ/spotlight_length; */