![]() |
Workspace 7.1.0
|
Defines a spot light which is a source at specific position with edge fall-off and attentuation. More...
#include <Rendering/SceneComponents/Lights/spotlight.h>
Public Member Functions | |
SpotLight () | |
SpotLight (const SpotLight &light) | |
~SpotLight () override | |
void | clearAttenuationFactors () |
SpotLight * | clone () const override |
double | getAttenuationFactor (unsigned power) const |
double | getCutoffAngle () const |
double | getEdgeFalloff () const |
double | getFadeAngle () const |
unsigned | numAttenuationFactors () const |
SpotLight & | operator= (const SpotLight &light) |
void | setAttenuationFactor (unsigned power, double factor) |
void | setCutoffAngle (double angle) |
void | setEdgeFalloff (double f) |
void | setFadeAngle (double angle) |
bool | visit (LightsProcessor &processor) override |
![]() | |
Light (const QString &id="") | |
~Light () override | |
Light * | clone () const override=0 |
const QColor & | getColor () const |
double | getIntensity () const |
Mesh::Vector3d | getOrientation () const |
Mesh::Vector3d | getPosition () const |
void | setColor (const QColor &color) |
void | setIntensity (double d) |
virtual bool | visit (LightsProcessor &processor)=0 |
bool | visit (SceneItemProcessor &processor) override |
![]() | |
~SceneItem () override | |
SceneItem * | clone () const override=0 |
bool | getEnabled () const |
const QString & | getId () const |
const Mesh::BoundingBoxMinimal & | getLocalBoundingBox () const |
virtual Mesh::TransformMatrix | getMatrixGlobal () const |
virtual Mesh::TransformMatrix | getMatrixLocal () const |
const QString & | getName () const |
Mesh::TransformMatrix | getParentMatrixGlobal () const |
Transform * | getParentTransform () |
void | setEnabled (bool b) |
void | setId (const QString &itemId) |
virtual void | setLocalBoundingBox (const Mesh::BoundingBoxMinimal &bb) |
void | setName (const QString &name) |
virtual Transform * | toTransform () |
virtual const Transform * | toTransform () const |
virtual void | updateGlobalMatrix () |
virtual bool | visit (SceneItemProcessor &processor)=0 |
![]() | |
virtual | ~Observable () |
void | attachObserver (Observer &observer) |
void | destroy () |
void | detachObserver (Observer &observer) |
void | notifyEvent (const ObservableEvent &event) |
![]() | |
virtual | ~Clonable ()=default |
virtual Clonable * | clone () const =0 |
Additional Inherited Members | |
![]() | |
Light (const Light &light) | |
Light & | operator= (const Light &light) |
![]() | |
SceneItem (const QString &id) | |
SceneItem (const SceneItem &item) | |
virtual void | addToScene (Scene &scene, const QString &opIdPath="") |
bool | isTransformModified () const |
SceneItem & | operator= (const SceneItem &item) |
void | setTransformModified (bool b) |
![]() | |
Observable () | |
Observable (const Observable &) | |
Spot lights do support attenuation and edge fall-off. These characteristics can be modified to yield different spot light effects and can be used to generate a reasonably good approximation to a real spot light. This is more complex to set up than a DirectionalLight.
SpotLight | ( | ) |
|
override |
void clearAttenuationFactors | ( | ) |
Clears all the attenuation factors. This will result in a light with no attenuation with distance from the light source.
|
overridevirtual |
Subclasses must reimplement this function to return a clone of themselves.
Implements Light.
double getAttenuationFactor | ( | unsigned | power | ) | const |
power | The power of the factor to retrieve. |
double getCutoffAngle | ( | ) | const |
double getEdgeFalloff | ( | ) | const |
double getFadeAngle | ( | ) | const |
unsigned numAttenuationFactors | ( | ) | const |
void setAttenuationFactor | ( | unsigned | power, |
double | factor | ||
) |
power | The integer power whose factor will be set. If this is beyond the end of the current set of factors (ie if power is greater or equal to the result from numAttenuationFactors()), the factors will be zero-filled to extend them up to the specified power. |
factor | The factor to apply to the power attenuation factor. |
The attentuation factors correspond to integer powers starting with a power of zero. The factors may be interpretted differently by different renderers, so ensure you understand how they will be used when setting them. Most renderers will have a fairly small limit on the number of supported powers, but it would normally be safe to assume that up to at least a power of 2 would be supported (this is the limit OpenGL specifies, for example).
void setCutoffAngle | ( | double | angle | ) |
angle | The maximum spread angle (in degrees) of the light. This controls the cone angle of the light. It must be non-negative and would normally not exceed 180. Some renderers will treat angles beyond 180 with special meaning (eg the OpenGL fixed function pipeline treats an angle of 180 as giving uniform light distribution and it rejects all other values greater than 90). |
void setEdgeFalloff | ( | double | f | ) |
f | The edge fall-off to use for the light. It must be non-negative. If it is not, the function leaves the fall-off at its old value. |
The edge fall-off of a light controls how focused it is. The higher the value, the more tightly focused the light should appear. An edge fall-off of zero results in a uniform light distribution within the cone of the light and a sharp edge.
void setFadeAngle | ( | double | angle | ) |
angle | The angle from the light's direction at which its intensity will start to fade. Must be smaller than or equal to the cutoff angle. Some renderers will ignore this angle altogether and only use the cutoff angle. |
|
overridevirtual |