Class PointLight
- Namespace
- Egami.Operations
- Assembly
- Egami.dll
A light at one point, shining in every direction, as SVG's fePointLight and Skia's PointLit factories.
public sealed record PointLight : Light, IEquatable<Light>, IEquatable<PointLight>
- Inheritance
-
PointLight
- Implements
- Inherited Members
Examples
// Three light sources, as SVG and Skia have them. Positions are pixels: x right, y down, z up out of the image.
Light sun = new DistantLight(azimuth: 225, elevation: 40); // from the top left, 40° up
Light bulb = new PointLight(new Vector3(60, 20, 80)) { Color = new Rgba8(255, 240, 210, 255) };
Light spot = new SpotLight(new Vector3(0, 0, 150), target: new Vector3(120, 60, 0), exponent: 4, coneAngle: 30);
// Two ways a surface reflects: matte (N·L) or shiny (a highlight, (N·H)^shininess).
LightingModel matte = LightingModel.Diffuse(kd: 1.2f);
LightingModel shiny = LightingModel.Specular(ks: 1, shininess: 20);
using Raster<Rgba8> map = logo.Derive(ops => ops.Lighting(sun, matte), Ct); // the light map, opaque
using Raster<Rgba8> glints = logo.Derive(ops => ops.Lighting(bulb, shiny), Ct); // alpha = brightest channel
using Raster<Rgba8> pool = logo.Derive(ops => ops.Lighting(spot, matte), Ct);
Constructors
PointLight(Vector3)
Initializes a new instance of the PointLight class.
public PointLight(Vector3 position)
Parameters
positionVector3Where the light is, in pixels: x to the right, y down, z above the image.
Exceptions
- ArgumentOutOfRangeException
A coordinate of
positionis not finite.
Properties
Position
Gets where the light is, in pixels: x to the right, y down, z above the image.
public Vector3 Position { get; init; }
Property Value
Exceptions
- ArgumentOutOfRangeException
A coordinate is not finite.