MCPcopy Create free account
hub / github.com/TheRealMJP/BakingLab / AreaLightIntersection

Function AreaLightIntersection

BakingLab/PathTracer.cpp:177–188  ·  view source on GitHub ↗

Checks to see if a ray intersects with the area light

Source from the content-addressed store, hash-verified

175
176// Checks to see if a ray intersects with the area light
177static float AreaLightIntersection(const Float3& rayStart, const Float3& rayDir, float tStart, float tEnd)
178{
179
180 DirectX::BoundingSphere areaLightSphere;
181 areaLightSphere.Center = XMFLOAT3(AppSettings::AreaLightX, AppSettings::AreaLightY, AppSettings::AreaLightZ);
182 areaLightSphere.Radius = AppSettings::AreaLightSize;
183
184 float intersectDist = FLT_MAX;
185 bool intersects = areaLightSphere.Intersects(rayStart.ToSIMD(), rayDir.ToSIMD(), intersectDist);
186 intersects = intersects && (intersectDist >= tStart && intersectDist <= tEnd);
187 return intersects ? intersectDist : FLT_MAX;
188}
189
190// Computes the difuse and specular contribution from the sun, given a 2D random sample point
191// representing a location on the surface of the light

Callers 1

PathTraceFunction · 0.85

Calls 1

ToSIMDMethod · 0.45

Tested by

no test coverage detected