don't set sun parameters if we didn't have SH
The parameters would turn out as NaN. We might need a better API for this, but it's never okay to set NaN values.
This commit is contained in:
committed by
Mathias Agopian
parent
9914eb84a4
commit
d589634968
@@ -384,10 +384,12 @@ void SimpleViewer::setIndirectLight(filament::IndirectLight* ibl,
|
||||
if (ibl) {
|
||||
float3 d = filament::IndirectLight::getDirectionEstimate(sh3);
|
||||
float4 c = filament::IndirectLight::getColorEstimate(sh3, d);
|
||||
mSettings.lighting.sunlightDirection = d;
|
||||
mSettings.lighting.sunlightColor = c.rgb;
|
||||
mSettings.lighting.sunlightIntensity = c[3] * ibl->getIntensity();
|
||||
updateIndirectLight();
|
||||
if (!std::isnan(d.x * d.y * d.z)) {
|
||||
mSettings.lighting.sunlightDirection = d;
|
||||
mSettings.lighting.sunlightColor = c.rgb;
|
||||
mSettings.lighting.sunlightIntensity = c[3] * ibl->getIntensity();
|
||||
updateIndirectLight();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user