Ray traces now continue through any water they hit (unless the water surface is the target)
This commit is contained in:
parent
e6ca952962
commit
b47a7536c4
|
@ -611,6 +611,10 @@ public class LightMapper
|
|||
}
|
||||
|
||||
private bool TraceRay(Vector3 origin, Vector3 target)
|
||||
{
|
||||
var hitDistanceFromTarget = float.MinValue;
|
||||
var hitSurfaceType = SurfaceType.Water;
|
||||
while (hitDistanceFromTarget < -MathUtils.Epsilon && hitSurfaceType == SurfaceType.Water)
|
||||
{
|
||||
var direction = target - origin;
|
||||
var hitResult = _scene.Trace(new Ray
|
||||
|
@ -618,7 +622,13 @@ public class LightMapper
|
|||
Origin = origin,
|
||||
Direction = Vector3.Normalize(direction),
|
||||
});
|
||||
return hitResult && Math.Abs(hitResult.Distance - direction.Length()) < MathUtils.Epsilon;
|
||||
|
||||
hitDistanceFromTarget = hitResult.Distance - direction.Length();
|
||||
hitSurfaceType = _triangleTypeMap[(int)hitResult.PrimId];
|
||||
origin = hitResult.Position += direction * MathUtils.Epsilon;
|
||||
}
|
||||
|
||||
return Math.Abs(hitDistanceFromTarget) < MathUtils.Epsilon;
|
||||
}
|
||||
|
||||
private void SetAnimLightCellMaps()
|
||||
|
|
Loading…
Reference in New Issue