Base class for all light types supported in a Scene.
#include <Rendering/SceneComponents/Lights/light.h>
◆ Light() [1/2]
◆ Light() [2/2]
Light |
( |
const QString & |
id = "" | ) |
|
Creates a light with full intensity (ie intensity == 1) and with a white color. The light will be enabled by default.
◆ ~Light()
◆ clone()
◆ getColor()
const QColor & getColor |
( |
| ) |
const |
◆ getIntensity()
double getIntensity |
( |
| ) |
const |
◆ getOrientation()
- Returns
- The light's orientation in global co-ordinates of the scene it is part of. If it is not part of a scene, then the orientation will be looking down the negative Z axis direction.
A light with no transformation points in the direction of the negative Z axis. This is the same convention as used by cameras and it also matches the default direction of spot lights for OpenGL.
- Note
- Not all lights make use of the orientation, since some are only positional with no directionality (eg ambient and point lights).
- See also
- getPosition()
◆ getPosition()
- Returns
- The light's position in global co-ordinates of the scene it is part of. If it is not part of a scene, then the position will be the origin because the light will have no parent transform.
This is just the translation component of the parent global matrix. It is defined in the same way as for Camera objects except a Camera also has its own local transform, whereas a Light does not.
- See also
- getOrientation()
◆ operator=()
◆ setColor()
void setColor |
( |
const QColor & |
color | ) |
|
- Parameters
-
color | The new color for the light. |
The light's color controls what color content the light casts into the scene. You can think of the color as being similar to applying a color filter in front of a white light. The color is multiplied by the light's intensity when used in a scene.
- See also
- getColor()
◆ setIntensity()
void setIntensity |
( |
double |
d | ) |
|
- Parameters
-
d | The new intensity for the light. |
The intensity of the light acts like a multiplier on the light's color (only its red, green and blue components, not the alpha component). It allows the light intensity to be easily adjusted without affecting the color balance. Setting the intensity to zero does not disable the light, it only has the effect of turning the light off but it is still processed by LightsProcessor subclasses. For some rendering engines with support for only a limited number of lights, this is important because only the enabled/disabled state determines whether or not the processor can skip the light.
It should also be noted that some rendering engines might allow negative intensities to give the artificial effect of subtracting light from a surface. Not all renderers will support this behavior though, in which case they must treat the negative intensities the same as a zero intensity.
- See also
- getIntensity(), setEnabled()
◆ visit() [1/2]
- Parameters
-
processor | The light processor visiting this light. |
Light subclasses should reimplement this function to call processor.visit()
and return the result of that call. This is the usual visitor pattern as used for other scene items and model processors.
Implemented in AmbientLight, DirectionalLight, PointLight, and SpotLight.
◆ visit() [2/2]