Class GLPointLight
- Namespace
- SearchAThing.OpenGL.Core
- Assembly
- netcore-opengl-core.dll
Gl point light.
[JsonObject(MemberSerialization.OptIn)]
public class GLPointLight : INotifyPropertyChanged
- Inheritance
-
GLPointLight
- Implements
- Inherited Members
Constructors
GLPointLight(Vector3?, Color?, bool)
Create a gl point light at given coordinates [local].
public GLPointLight(Vector3? pos = null, Color? color = null, bool showPoint = false)
Parameters
pos
Vector3?Light coordinate [local].
color
Color?Light color (ambient, diffuse, specular).
showPoint
boolIf true a gl point will displayed where light is.
GLPointLight(float, float, float, in Color?, bool)
Create a gl point light at given coordinates [local].
public GLPointLight(float x, float y, float z, in Color? color = null, bool showPoint = false)
Parameters
x
floatX coordinate [local].
y
floatY coordinate [local].
z
floatZ coordinate [local].
color
Color?Light color (ambient, diffuse, specular).
showPoint
boolIf true a gl point will displayed where light is.
Properties
Active
If false light don't drop any shadow nor affects vertex colours.
[JsonProperty]
public bool Active { get; set; }
Property Value
Ambient
Ambient light color (Default:White).
[JsonProperty]
public Color Ambient { get; set; }
Property Value
Constant
Light attenuation constant factor.
[JsonProperty]
public float Constant { get; set; }
Property Value
Diffuse
Diffuse light color (Default:white).
[JsonProperty]
public Color Diffuse { get; set; }
Property Value
Linear
Light attenuation linear factor.
[JsonProperty]
public float Linear { get; set; }
Property Value
Position
Position [local].
[JsonProperty]
public Vector3 Position { get; set; }
Property Value
Quadratic
Light attenuation quadratica factor.
[JsonProperty]
public float Quadratic { get; set; }
Property Value
ShowPoint
If true a Gl point will be shown where the light is positioned.
Colored yellow if light is active, darkgray if inactive.
[JsonProperty]
public bool ShowPoint { get; set; }
Property Value
Specular
Specular light color (Default:white).
[JsonProperty]
public Color Specular { get; set; }
Property Value
Methods
OnPropertyChanged(string?)
invoke this method to forward propertchanged event notification. note: not needed to specify propertyName set by compiler service to called property.
protected void OnPropertyChanged(string? propertyName = null)
Parameters
propertyName
string
SetupAttenuation(GLModel, float?, float?, float?)
Setup light attenuation factor based on model bbox size.
public void SetupAttenuation(GLModel model, float? adjustConstant = 1, float? adjustLinear = 0, float? adjustQuadratic = 0)
Parameters
model
GLModelGl model.
adjustConstant
float?Light constant attenuation factor.
adjustLinear
float?Light linear attenuation factor.
adjustQuadratic
float?Light quadratic attenuation factor.
Events
PropertyChanged
public event PropertyChangedEventHandler? PropertyChanged