//----------------------------------------------------------------------------- SLLight::SLLight(SLfloat ambiPower, SLfloat diffPower, SLfloat specPower, SLint id) { // Set parameter of SLLight _id = id; _on = true; _spotCutoff = 180.0f; _spotCosCut = cos(SL_DEG2RAD*_spotCutoff); _spotExponent = 1.0f; // Set parameters of inherited SLMaterial _ambient.set (ambiPower, ambiPower, ambiPower); _diffuse.set (diffPower, diffPower, diffPower); _specular.set(specPower, specPower, specPower); // By default there is no attenuation set. This is physically not correct // Default OpenGL: kc=1, kl=0, kq=0 // Physically correct: kc=0, kl=0, kq=1 // set quadratic attenuation with d = distance to light // 1 // attenuation = ------------------ // kc + kl*d + kq*d*d kc(1.0f); kl(0.0f); kq(0.0f); }
double physics::f_lo_plus (double E) { return kq(E)*(nq+1 )*log(( 1 +sqrt( 1 +(hw/E)))/( 1 -sqrt( 1 -(hw/E)))); }
double physics::f_lo_minus (double E) { return kq(E)*nq * log(( 1 +sqrt( 1 +(hw/E)))/(sqrt( 1 +(hw/E))- 1)); }