public static bool Intersect(SlimDX.Ray ray, ref float dist, out IADTChunk hitChunk) { hitChunk = null; if (VisibleChunks.Count == 0) { return(false); } bool hasHit = false; float nearHit = 9999999; foreach (var file in VisibleChunks) { float curHit = 0; IADTChunk tmpHit; if (file.Intersect(ray, ref curHit, out tmpHit)) { hitChunk = tmpHit; hasHit = true; if (curHit < nearHit) { nearHit = curHit; } } } if (hasHit) { dist = nearHit; } return(hasHit); }
public abstract bool Intersect(SlimDX.Ray ray, ref float dist, out IADTChunk hitChunk);
public static bool Intersect(SlimDX.Ray ray, ref float dist, out IADTChunk hitChunk) { hitChunk = null; if (VisibleChunks.Count == 0) return false; bool hasHit = false; float nearHit = 9999999; foreach (var file in VisibleChunks) { float curHit = 0; IADTChunk tmpHit; if (file.Intersect(ray, ref curHit, out tmpHit)) { hitChunk = tmpHit; hasHit = true; if (curHit < nearHit) nearHit = curHit; } } if (hasHit) dist = nearHit; return hasHit; }