Ocean
Ocean::Rendering::PointLight Class Reference

This class is the base class for all point lights. More...

Inheritance diagram for Ocean::Rendering::PointLight:

Public Member Functions

virtual Vector3 position () const
 Returns the position of the light object. More...
 
virtual Vector3 attenuation () const
 Returns the attenuation factors of the point light. More...
 
virtual void setPosition (const Vector3 &position)
 Sets the position of the light object. More...
 
virtual bool setAttenuation (const Vector3 &factors)
 Sets the attenuation factors for the point light. More...
 
ObjectType type () const override
 Returns the type of this object. More...
 
- Public Member Functions inherited from Ocean::Rendering::LightSource
virtual RGBAColor ambientColor () const
 Returns the ambient color of this light source. More...
 
virtual RGBAColor diffuseColor () const
 Returns the diffuse color of this light source. More...
 
virtual RGBAColor specularColor () const
 Returns the specular color of this light source. More...
 
virtual Scalar intensity () const
 Returns the intensity of this light source. More...
 
virtual TransformationType transformationType () const
 Returns the transformation type of this light. More...
 
virtual bool enabled () const
 Returns whether this light source is enabled. More...
 
virtual void get (RGBAColor &ambient, RGBAColor &diffuse, RGBAColor &specular, Scalar &intensity)
 Gets all color values of the light at once. More...
 
virtual bool setAmbientColor (const RGBAColor &color)
 Sets the ambient color of the light source. More...
 
virtual bool setDiffuseColor (const RGBAColor &color)
 Sets the diffuse color of the light source. More...
 
virtual bool setSpecularColor (const RGBAColor &color)
 Sets the specular color of the light source. More...
 
virtual bool setIntensity (const Scalar intensity)
 Sets the specular exponent of this material. More...
 
virtual bool set (const RGBAColor &ambient, const RGBAColor &diffuse, const RGBAColor &specular, const Scalar intensity)
 Sets all color values of the light source at once. More...
 
virtual void setTransformationType (const TransformationType transformationType)
 Sets the transformation type of this light. More...
 
virtual void setEnabled (const bool state)
 Sets whether the light source is enabled. More...
 
- Public Member Functions inherited from Ocean::Rendering::Object
ObjectId id () const
 Returns the unique object id of this object. More...
 
const std::string & name () const
 Returns the name of this object. More...
 
virtual void setName (const std::string &name)
 Sets or changes the name of this object. More...
 
virtual const std::string & engineName () const =0
 Returns the name of the owner engine. More...
 
ObjectRefs parentObjects () const
 Returns all parent objects. More...
 
ObjectRefSet parentNodes () const
 Returns all parent nodes. More...
 
virtual std::string descriptiveInformation () const
 Returns descriptive information about the object as string. More...
 

Protected Member Functions

 PointLight ()
 Creates a new point light. More...
 
 ~PointLight () override
 Destructs a point light. More...
 
- Protected Member Functions inherited from Ocean::Rendering::LightSource
 LightSource ()
 Creates a new light source object. More...
 
 ~LightSource () override
 Destructs a light source object. More...
 
- Protected Member Functions inherited from Ocean::Rendering::Object
 Object ()
 Creates a new object. More...
 
 Object (const Object &object)=delete
 Disabled copy constructor. More...
 
virtual ~Object ()
 Destructs an object. More...
 
Engineengine () const
 Returns the render engine which is owner of this object. More...
 
void registerParent (const ObjectId parentId)
 Registers a parent node for this (child) node. More...
 
void unregisterParent (const ObjectId parentId)
 Unregisters a parent node for this (child) node. More...
 
void registerThisObjectAsParent (const ObjectRef &child)
 Registers this object at a child as parent object. More...
 
void unregisterThisObjectAsParent (const ObjectRef &child)
 Unregisters this object from a child as parent. More...
 
Objectoperator= (const Object &object)=delete
 Disabled copy operator. More...
 

Additional Inherited Members

- Public Types inherited from Ocean::Rendering::LightSource
enum  TransformationType { TT_PARENT , TT_WORLD }
 Defines different transformation types. More...
 
- Public Types inherited from Ocean::Rendering::Object
enum  ObjectType {
  TYPE_UNKNOWN , TYPE_ABSOLUTE_TRANSFORM , TYPE_ATTRIBUTE , TYPE_ATTRIBUTE_SET ,
  TYPE_BACKGROUND , TYPE_BILLBOARD , TYPE_BITMAP_FRAMEBUFFER , TYPE_BLEND_ATTRIBUTE ,
  TYPE_BOX , TYPE_CONE , TYPE_CYLINDER , TYPE_DEPTH_ATTRIBUTE ,
  TYPE_DIRECTIONAL_LIGHT , TYPE_FRAMEBUFFER , TYPE_FRAME_TEXTURE_2D , TYPE_GEOMETRY ,
  TYPE_GROUP , TYPE_INDEPENDENT_PRIMITIVE , TYPE_LIGHT_SOURCE , TYPE_LINES ,
  TYPE_LINE_STRIPS , TYPE_LOD , TYPE_MATERIAL , TYPE_NODE ,
  TYPE_OBJECT , TYPE_PARALLEL_VIEW , TYPE_PERSPECTIVE_VIEW , TYPE_PHANTOM_ATTRIBUTE ,
  TYPE_POINT_LIGHT , TYPE_POINTS , TYPE_PRIMITIVE , TYPE_PRIMITIVE_ATTRIBUTE ,
  TYPE_QUAD_STRIPS , TYPE_QUADS , TYPE_RENDERABLE , TYPE_SCENE ,
  TYPE_SHADER_PROGRAM , TYPE_SHAPE , TYPE_SKY_BACKGROUND , TYPE_SPHERE ,
  TYPE_SPOT_LIGHT , TYPE_STEREO_ATTRIBUTE , TYPE_STEREO_VIEW , TYPE_STRIP_PRIMITIVE ,
  TYPE_SWITCH , TYPE_TEXT , TYPE_TEXTURE , TYPE_TEXTURE_2D ,
  TYPE_MEDIA_TEXTURE_2D , TYPE_TEXTURE_FRAMEBUFFER , TYPE_TEXTURES , TYPE_TRANSFORM ,
  TYPE_TRIANGLE_FANS , TYPE_TRIANGLES , TYPE_TRIANGLE_STRIPS , TYPE_UNDISTORTED_BACKGROUND ,
  TYPE_VERTEX_SET , TYPE_VIEW , TYPE_WINDOW_FRAMEBUFFER
}
 Definition of different object type. More...
 
typedef std::unordered_map< ObjectId, unsigned int > ObjectIdMap
 Definition of a map holding object ids to reference counters. More...
 
- Static Public Member Functions inherited from Ocean::Rendering::Object
static std::string translateObjectType (const ObjectType objectType)
 Translates an object type to a readable string. More...
 
- Protected Attributes inherited from Ocean::Rendering::Object
Lock objectLock
 Lock for the object. More...
 

Detailed Description

This class is the base class for all point lights.

In addition to the values of each light source a point light is defined by a position and three attenuation factors.
The position defined the 3D position of the point light in relation to the local coordinate system.
Default position is (0, 0, 0).
The attenuation factors define the light attenuation depending on the distance between light source and object.
A three element vector with a constant, a linear and a quadratic attenuation factor can be defined.
The entire attenuation factor is defined by: 1 / constant + linear * r + quadratic * r^2, with distance r.
Default attenuation factors are (1, 0, 0) meaning a disabled light attenuation.

See also
LightSource, SpotLight, DirectionalLight.

Constructor & Destructor Documentation

◆ PointLight()

Ocean::Rendering::PointLight::PointLight ( )
protected

Creates a new point light.

◆ ~PointLight()

Ocean::Rendering::PointLight::~PointLight ( )
overrideprotected

Destructs a point light.

Member Function Documentation

◆ attenuation()

virtual Vector3 Ocean::Rendering::PointLight::attenuation ( ) const
virtual

Returns the attenuation factors of the point light.

Returns
Three element vector with attenuation factors, with order (constant, linear, quadratic)
Exceptions
NotSupportedExceptionIs thrown if this function is not supported

Reimplemented in Ocean::Rendering::GlobalIllumination::GIPointLight, and Ocean::Rendering::GLESceneGraph::GLESPointLight.

◆ position()

virtual Vector3 Ocean::Rendering::PointLight::position ( ) const
virtual

Returns the position of the light object.

Returns
Light position, default is (0, 0, 0)
Exceptions
NotSupportedExceptionIs thrown if this function is not supported

Reimplemented in Ocean::Rendering::GlobalIllumination::GIPointLight, and Ocean::Rendering::GLESceneGraph::GLESPointLight.

◆ setAttenuation()

virtual bool Ocean::Rendering::PointLight::setAttenuation ( const Vector3 factors)
virtual

Sets the attenuation factors for the point light.

Parameters
factorsThree element attenuation factor vector with order (constant, linear, quadratic)
Returns
True, if all three attenuation parameters are valid and could be set
Exceptions
NotSupportedExceptionIs thrown if this function is not supported

Reimplemented in Ocean::Rendering::GlobalIllumination::GIPointLight, and Ocean::Rendering::GLESceneGraph::GLESPointLight.

◆ setPosition()

virtual void Ocean::Rendering::PointLight::setPosition ( const Vector3 position)
virtual

Sets the position of the light object.

Parameters
positionLight position to set
Exceptions
NotSupportedExceptionIs thrown if this function is not supported

Reimplemented in Ocean::Rendering::GlobalIllumination::GIPointLight, and Ocean::Rendering::GLESceneGraph::GLESPointLight.

◆ type()

ObjectType Ocean::Rendering::PointLight::type ( ) const
overridevirtual

Returns the type of this object.

See also
Object::type().

Reimplemented from Ocean::Rendering::LightSource.

Reimplemented in Ocean::Rendering::SpotLight.


The documentation for this class was generated from the following file: