Return correct light count from GenerateSourceLightBuffers
The only functional change is fixing the light count calculation in GenerateSourceLightBuffers. It actually returns the end index for the probe portion of the light list, not the count of probes. This doesn't lead to any real bugs because the entries copied into the light data buffers are zero'd out because C# is nice to you. This would likely manifest in bugs in C/C++.
There are also a lot of readability changes made to GenerateSourceLightBuffers.
if(!isCircularSpot)// square spots always have cookie
if(bHasCookie)
Vector3lightDir=lightToWorld.GetColumn(2);// Z axis in world space
varvz=lightDir;// Z axis in world space
Vector3vz=lightToWorld.GetColumn(2);// Z axis in world space
varlightDir=vz;
// transform to camera space (becomes a left hand coordinate frame in Unity since Determinant(worldToView)<0)
vx=worldToView.MultiplyVector(vx);
varcota=si>0.0f?(cs/si):FltMax;
//const float cotasa = l.GetCotanHalfSpotAngle();
bound.center=worldToView.MultiplyPoint(lightPos+((0.5f*range)*lightDir));// use mid point of the spot as the center of the bounding volume for building screen-space AABB for tiled lighting.
bound.center=worldToView.MultiplyPoint(lightPos+((0.5f*range)*lightDir));// use mid point of the spot as the center of the bounding volume for building screen-space AABB for tiled lighting.
light.lightAxisX=vx;
light.lightAxisY=vy;
light.lightAxisZ=vz;
// scale axis to match box or base of pyramid
bound.boxAxisX=(fS*range)*vx;
bound.radius=altDist>(0.5f*range)?altDist:(0.5f*range);// will always pick fAltDist