[Algorithms] Sh data falloff..
Brought to you by:
vexxed72
From: Andreas T. <at...@cu...> - 2004-01-17 13:19:54
|
// compute luminance for this light and this vertex XVECTOR4 vTmpCol =3D fClusteredPCA[nClusterOffset]; vTmpCol.x +=3D vExitR.x + vExitR.y + vExitR.z + vExitR.w; vTmpCol.y +=3D vExitG.x + vExitG.y + vExitG.z + vExitG.w; vTmpCol.z +=3D vExitB.x + vExitB.y + vExitB.z + vExitB.w; XCOLOR rLuminance(vTmpCol.x, vTmpCol.y, vTmpCol.z, vTmpCol.w); =09 // Calulate distance from vertex to light XVECTOR3 vTmp;=20 XVec3TransformCoord(&vTmp, &pSTDVertices[i].vPosition, &objmat); vTmp =3D lobj->GetPos()-vTmp; float32 fDistVertex =3D XVec3Length(&vTmp); // calculate vertex luminance modulator float32 fLumMod =3D (( (fDistObject * fDistObject) / (fDistVertex * = fDistVertex))); // modulate vertex luminance rLuminance.r =3D 0.5f*fLumMod; rLuminance.g =3D 0.5f*fLumMod; rLuminance.b =3D 0.5f*fLumMod; |