Class Light
Describes a light source in the scene. Assimp supports multiple light sources including spot, point, and directional lights. All are defined by a single structure and distinguished by their parameters. Lights have corresponding nodes in the scenegraph.
Some file formats such as 3DS and ASE export a "target point", e.g. the point a spot light is looking at (it can even be animated). Assimp writes the target point as a subnode of a spotlight's main node called "spotName.Target". However, this is just additional information then, the transform tracks of the main node make the spot light already point in the right direction.
Implements
Inherited Members
Namespace: SharpAssimp
Assembly: SharpAssimp.dll
Syntax
public sealed class Light : IMarshalable<Light, AiLight>
Constructors
| Edit this page View SourceLight()
Constructs a new instance of the Light class.
Declaration
public Light()
Properties
| Edit this page View SourceAngleInnerCone
Gets or sets the inner angle of a spot light's light cone. The spot light has maximum influence on objects inside this angle. The angle is given in radians, it is 2PI for point lights and defined for directional lights.
Declaration
public float AngleInnerCone { get; set; }
Property Value
Type | Description |
---|---|
float |
AngleOuterCone
Gets or sets the outer angle of a spot light's light cone. The spot light does not affect objects outside this angle. The angle is given in radians. It is 2PI for point lights and undefined for directional lights. The outer angle must be greater than or equal to the inner angle.
Declaration
public float AngleOuterCone { get; set; }
Property Value
Type | Description |
---|---|
float |
AreaSize
Gets or sets the Width (X) and Height (Y) of the area that represents an Area light.
Declaration
public Vector2 AreaSize { get; set; }
Property Value
Type | Description |
---|---|
Vector2 |
AttenuationConstant
Gets or sets the constant light attenuation factor. The intensity of the light source at a given distance 'd' from the light position is
Atten = 1 / (att0 + att1 * d + att2 * d*d)
.
This member corresponds to the att0 variable in the equation and is undefined for directional lights.
Declaration
public float AttenuationConstant { get; set; }
Property Value
Type | Description |
---|---|
float |
AttenuationLinear
Gets or sets the linear light attenuation factor. The intensity of the light source at a given distance 'd' from the light position is
Atten = 1 / (att0 + att1 * d + att2 * d*d)
This member corresponds to the att1 variable in the equation and is undefined for directional lights.
Declaration
public float AttenuationLinear { get; set; }
Property Value
Type | Description |
---|---|
float |
AttenuationQuadratic
Gets or sets the quadratic light attenuation factor. The intensity of the light source at a given distance 'd' from the light position is
Atten = 1 / (att0 + att1 * d + att2 * d*d)
.
This member corresponds to the att2 variable in the equation and is undefined for directional lights.
Declaration
public float AttenuationQuadratic { get; set; }
Property Value
Type | Description |
---|---|
float |
ColorAmbient
Gets or sets the ambient color of the light source. The ambient light color is multiplied with the ambient material color to obtain the final color that contributes to the ambient shading term.
Declaration
public Vector3 ColorAmbient { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
ColorDiffuse
Gets or sets the diffuse color of the light source. The diffuse light color is multiplied with the diffuse material color to obtain the final color that contributes to the diffuse shading term.
Declaration
public Vector3 ColorDiffuse { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
ColorSpecular
Gets or sets the specular color of the light source. The specular light color is multiplied with the specular material color to obtain the final color that contributes to the specular shading term.
Declaration
public Vector3 ColorSpecular { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
Direction
Gets or sets the direction of the light source in space, relative to the transformation of the node corresponding to the light. This is undefined for point lights.
Declaration
public Vector3 Direction { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
LightType
Gets or sets the type of light source. This should never be undefined.
Declaration
public LightSourceType LightType { get; set; }
Property Value
Type | Description |
---|---|
LightSourceType |
Name
Gets or sets the name of the light source. This corresponds to a node present in the scenegraph.
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
string |
Position
Gets or sets the position of the light source in space, relative to the transformation of the node corresponding to the light. This is undefined for directional lights.
Declaration
public Vector3 Position { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
Up
Gets or sets the up vector of the light source in space, relative to the transformation of the node corresponding to the light. This is undefined for point lights.
Declaration
public Vector3 Up { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
Methods
| Edit this page View SourceFreeNative(nint, bool)
Frees unmanaged memory created by ToNative(nint, out Native).
Declaration
public static void FreeNative(nint nativeValue, bool freeNative)
Parameters
Type | Name | Description |
---|---|---|
nint | nativeValue | Native value to free |
bool | freeNative | True if the unmanaged memory should be freed, false otherwise. |