public override bool L(SceneData sceneData, Ray ray, out Color color, out Vector3 normal) { if (m_Geometry == null || m_Geometry.material == null) { color = Color.black; normal = default(Vector3); return false; } RayCastHit hit = default(RayCastHit); hit.distance = double.MaxValue; if (sceneData.Raycast(ray, out hit)) { if (hit.geometry == m_Geometry && hit.material == m_Geometry.material) { double ndl = Vector3.Dot(-1.0 * hit.normal, ray.direction); normal = hit.normal; if (ndl < 0) { color = Color.black; return false; } color = m_Geometry.material.GetEmissive(hit); return true; } } color = Color.black; normal = default(Vector3); return false; }
public override bool L(SceneData sceneData, Ray ray, out Color color, out Vector3 surfaceNormal) { RayCastHit hit = default(RayCastHit); hit.distance = double.MaxValue; if (sceneData.Raycast(ray, out hit)) { color = Color.black; surfaceNormal = default(Vector3); return(false); } Vector3 hitNormal; if (RayCastSun(ray, out hitNormal)) { double ndl = Vector3.Dot(-1.0 * hitNormal, ray.direction); surfaceNormal = hitNormal; if (ndl < 0) { color = Color.black; return(false); } color = sunIntensity * sunColor; return(true); } color = Color.black; surfaceNormal = default(Vector3); return(false); }