Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/Svg.Model/SvgFilterContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1393,6 +1393,14 @@ private SKPoint3 GetPoint3(float x, float y, float z)
var location = GetPoint3(svgSpotLight.X, svgSpotLight.Y, svgSpotLight.Z);
var target = GetPoint3(svgSpotLight.PointsAtX, svgSpotLight.PointsAtY, svgSpotLight.PointsAtZ);
var specularExponentSpotLight = svgSpotLight.SpecularExponent;
if (specularExponentSpotLight < 1f)
{
specularExponentSpotLight = 1f;
}
else if (specularExponentSpotLight > 128f)
{
specularExponentSpotLight = 128f;
}
var limitingConeAngle = svgSpotLight.LimitingConeAngle;
if (float.IsNaN(limitingConeAngle) || limitingConeAngle > 90f || limitingConeAngle < -90f)
{
Expand Down Expand Up @@ -1607,7 +1615,19 @@ private SKColorChannel GetColorChannel(SvgChannelSelector svgChannelSelector)

var surfaceScale = svgSpecularLighting.SurfaceScale;
var specularConstant = svgSpecularLighting.SpecularConstant;
if (specularConstant < 0f)
{
specularConstant = 0f;
}
var specularExponent = svgSpecularLighting.SpecularExponent;
if (specularExponent < 1f)
{
specularExponent = 1f;
}
else if (specularExponent > 128f)
{
specularExponent = 128f;
}
// TODO: svgSpecularLighting.KernelUnitLength

switch (svgSpecularLighting.LightSource)
Expand All @@ -1627,6 +1647,14 @@ private SKColorChannel GetColorChannel(SvgChannelSelector svgChannelSelector)
var location = GetPoint3(svgSpotLight.X, svgSpotLight.Y, svgSpotLight.Z);
var target = GetPoint3(svgSpotLight.PointsAtX, svgSpotLight.PointsAtY, svgSpotLight.PointsAtZ);
var specularExponentSpotLight = svgSpotLight.SpecularExponent;
if (specularExponentSpotLight < 1f)
{
specularExponentSpotLight = 1f;
}
else if (specularExponentSpotLight > 128f)
{
specularExponentSpotLight = 128f;
}
var limitingConeAngle = svgSpotLight.LimitingConeAngle;
if (float.IsNaN(limitingConeAngle) || limitingConeAngle > 90f || limitingConeAngle < -90f)
{
Expand Down
Loading