Adding editor point light support

This commit is contained in:
Michael Riegger
2021-04-27 15:14:59 -07:00
parent 2eed8684b5
commit 805eb1ba34
3 changed files with 65 additions and 1 deletions
@@ -112,7 +112,7 @@ namespace AZ
bool AreaLightComponentConfig::SupportsShadows() const
{
return m_shapeType == AZ_CRC_CE("DiskShape");
return m_lightType == LightType::SpotDisk || m_lightType == LightType::Sphere;
}
bool AreaLightComponentConfig::ShadowsDisabled() const
@@ -63,5 +63,60 @@ namespace AZ
debugDisplay.DrawWireSphere(transform.GetTranslation(), CalculateAttenuationRadius(AreaLightComponentConfig::CutoffIntensity));
}
}
void SphereLightDelegate::SetEnableShadow(bool enabled)
{
Base::SetEnableShadow(enabled);
GetFeatureProcessor()->SetShadowsEnabled(GetLightHandle(), enabled);
}
void SphereLightDelegate::SetShadowmapMaxSize(ShadowmapSize size)
{
if (GetShadowsEnabled())
{
GetFeatureProcessor()->SetShadowmapMaxResolution(GetLightHandle(), size);
}
}
void SphereLightDelegate::SetShadowFilterMethod(ShadowFilterMethod method)
{
if (GetShadowsEnabled())
{
GetFeatureProcessor()->SetShadowFilterMethod(GetLightHandle(), method);
}
}
void SphereLightDelegate::SetSofteningBoundaryWidthAngle(float widthInDegrees)
{
if (GetShadowsEnabled())
{
GetFeatureProcessor()->SetSofteningBoundaryWidthAngle(GetLightHandle(), DegToRad(widthInDegrees));
}
}
void SphereLightDelegate::SetPredictionSampleCount(uint32_t count)
{
if (GetShadowsEnabled())
{
GetFeatureProcessor()->SetPredictionSampleCount(GetLightHandle(), count);
}
}
void SphereLightDelegate::SetFilteringSampleCount(uint32_t count)
{
if (GetShadowsEnabled())
{
GetFeatureProcessor()->SetFilteringSampleCount(GetLightHandle(), count);
}
}
void SphereLightDelegate::SetPcfMethod(PcfMethod method)
{
if (GetShadowsEnabled())
{
GetFeatureProcessor()->SetPcfMethod(GetLightHandle(), method);
}
}
} // namespace Render
} // namespace AZ
@@ -24,6 +24,8 @@ namespace AZ
class SphereLightDelegate final
: public LightDelegateBase<PointLightFeatureProcessorInterface>
{
using Base = LightDelegateBase<PointLightFeatureProcessorInterface>;
public:
SphereLightDelegate(LmbrCentral::SphereShapeComponentRequests* shapeBus, EntityId entityId, bool isVisible);
@@ -32,6 +34,13 @@ namespace AZ
void DrawDebugDisplay(const Transform& transform, const Color& color, AzFramework::DebugDisplayRequests& debugDisplay, bool isSelected) const override;
float GetSurfaceArea() const override;
float GetEffectiveSolidAngle() const override { return PhotometricValue::OmnidirectionalSteradians; }
void SetEnableShadow(bool enabled) override;
void SetShadowmapMaxSize(ShadowmapSize size) override;
void SetShadowFilterMethod(ShadowFilterMethod method) override;
void SetSofteningBoundaryWidthAngle(float widthInDegrees) override;
void SetPredictionSampleCount(uint32_t count) override;
void SetFilteringSampleCount(uint32_t count) override;
void SetPcfMethod(PcfMethod method) override;
private: