ufe 5.5
Universal Front End is a DCC-agnostic component that will allow a DCC to browse and edit data in multiple data models
Ufe::Light Class Referenceabstract

Abstract base class for light interface. More...

#include <light.h>

Inheritance diagram for Ufe::Light:

Classes

class  AreaInterface
 
class  ConeInterface
 
struct  ConeProps
 
class  DirectionalInterface
 
class  SphereInterface
 
struct  SphereProps
 

Public Types

enum  Type {
  Invalid , Directional , Point , Spot ,
  Area , Sphere , Cylinder , Disk ,
  Dome
}
 
typedef std::shared_ptr< LightPtr
 
using IntensityUndoableCommand = SetFloatUndoableCommand
 
using ColorUndoableCommand = SetColor3fUndoableCommand
 
using ShadowEnableUndoableCommand = SetBoolUndoableCommand
 
using ShadowColorUndoableCommand = SetColor3fUndoableCommand
 
using DiffuseUndoableCommand = SetFloatUndoableCommand
 
using SpecularUndoableCommand = SetFloatUndoableCommand
 
using AngleUndoableCommand = SetFloatUndoableCommand
 
using SpherePropsUndoableCommand = SetValueUndoableCommand< const SphereProps & >
 
using ConePropsUndoableCommand = SetValueUndoableCommand< const ConeProps & >
 
using NormalizeUndoableCommand = SetBoolUndoableCommand
 

Public Member Functions

 Light ()
 Constructor. More...
 
 Light (const Light &)=default
 Default copy constructor. More...
 
virtual ~Light ()
 Destructor. More...
 
virtual const Pathpath () const =0
 
virtual SceneItem::Ptr sceneItem () const =0
 
virtual Type type () const =0
 
virtual IntensityUndoableCommand::Ptr intensityCmd (float li)=0
 
virtual void intensity (float li)
 
virtual float intensity () const =0
 
virtual ColorUndoableCommand::Ptr colorCmd (float r, float g, float b)=0
 
virtual void color (float r, float g, float b)
 
virtual Color3f color () const =0
 
virtual ShadowEnableUndoableCommand::Ptr shadowEnableCmd (bool se)=0
 
virtual void shadowEnable (bool se)
 
virtual bool shadowEnable () const =0
 
virtual ShadowColorUndoableCommand::Ptr shadowColorCmd (float r, float g, float b)=0
 
virtual void shadowColor (float r, float g, float b)
 
virtual Color3f shadowColor () const =0
 
virtual DiffuseUndoableCommand::Ptr diffuseCmd (float ld)=0
 
virtual void diffuse (float ld)
 
virtual float diffuse () const =0
 
virtual SpecularUndoableCommand::Ptr specularCmd (float ls)=0
 
virtual void specular (float ls)
 
virtual float specular () const =0
 
std::shared_ptr< DirectionalInterfacedirectionalInterface ()
 
std::shared_ptr< SphereInterfacesphereInterface ()
 
std::shared_ptr< ConeInterfaceconeInterface ()
 
std::shared_ptr< AreaInterfaceareaInterface ()
 

Static Public Member Functions

static Ptr light (const SceneItem::Ptr &item)
 
static bool addObserver (const SceneItem::Ptr &item, const Observer::Ptr &obs)
 
static bool removeObserver (const SceneItem::Ptr &item, const Observer::Ptr &obs)
 
static std::size_t nbObservers (const SceneItem::Ptr &item)
 
static bool hasObserver (const SceneItem::Ptr &item, const Observer::Ptr &obs)
 
static bool hasObservers (const Path &path)
 
static bool hasObservers (Rtid runTimeId)
 
static void notify (const Path &path)
 

Protected Member Functions

virtual std::shared_ptr< DirectionalInterfacedirectionalInterfaceImpl ()=0
 
virtual std::shared_ptr< SphereInterfacesphereInterfaceImpl ()=0
 
virtual std::shared_ptr< ConeInterfaceconeInterfaceImpl ()=0
 
virtual std::shared_ptr< AreaInterfaceareaInterfaceImpl ()=0
 

Detailed Description

Abstract base class for light interface.

This base class defines the interface that runtimes can implement for lights.

The Light interface provides members that are common to all light types. To access interfaces that are appropriate for different light types, the Light interface provides accessors to sub-interfaces:

For example, the SphereInterface is available for Light::Spot and Light::Point types.

To determine the transform of a light, attach a transform3d interface to the scene item, or to the first ancestor scene item which is a Transform3d.

Each operation has two calls, one with undo capability, and one without. Providing undo capability typically involves code complexity, and using undo capability incurs runtime cost in processing and memory. Therefore, non- interactive use of this interface should use calls without undo capability.

As with the rest of UFE, observation is done through the Observer Pattern. Observers can be added to an individual scene item, to be notified when an object's transformation changes.

To avoid the memory-consuming "one proxy object per scene object" approach, Light interface objects should be obtained and used within a local scope, and not stored. Light interfaces should be considered stateless, and can be bound to new selection items.

Definition at line 60 of file light.h.

Member Typedef Documentation

◆ AngleUndoableCommand

◆ ColorUndoableCommand

◆ ConePropsUndoableCommand

◆ DiffuseUndoableCommand

◆ IntensityUndoableCommand

◆ NormalizeUndoableCommand

◆ Ptr

typedef std::shared_ptr<Light> Ufe::Light::Ptr

Definition at line 63 of file light.h.

◆ ShadowColorUndoableCommand

◆ ShadowEnableUndoableCommand

◆ SpecularUndoableCommand

◆ SpherePropsUndoableCommand

Member Enumeration Documentation

◆ Type

Enumerator
Invalid 
Directional 
Point 
Spot 
Area 
Sphere 
Cylinder 
Disk 
Dome 

Definition at line 65 of file light.h.

Constructor & Destructor Documentation

◆ Light() [1/2]

Ufe::Light::Light ( )

Constructor.

◆ Light() [2/2]

Ufe::Light::Light ( const Light )
default

Default copy constructor.

◆ ~Light()

virtual Ufe::Light::~Light ( )
virtual

Destructor.

Member Function Documentation

◆ addObserver()

static bool Ufe::Light::addObserver ( const SceneItem::Ptr item,
const Observer::Ptr obs 
)
static

Add observation on the argument item for Light changes.

Parameters
itemSceneItem to observe.
obsObserver to add.
Returns
True if the observer is added. Add does nothing and returns false if the observer is already present.

◆ areaInterface()

std::shared_ptr< AreaInterface > Ufe::Light::areaInterface ( )

Retrieve the area interface for the light

Returns
the area interface

◆ areaInterfaceImpl()

virtual std::shared_ptr< AreaInterface > Ufe::Light::areaInterfaceImpl ( )
protectedpure virtual

◆ color() [1/2]

virtual Color3f Ufe::Light::color ( ) const
pure virtual

Retrieve the color for the light

Returns
the color value

◆ color() [2/2]

virtual void Ufe::Light::color ( float  r,
float  g,
float  b 
)
inlinevirtual

Set the color. Default implementation uses ColorUndoableCommand.

Parameters
rred component
ggreen component
bblue component

Definition at line 218 of file light.h.

◆ colorCmd()

virtual ColorUndoableCommand::Ptr Ufe::Light::colorCmd ( float  r,
float  g,
float  b 
)
pure virtual

Create an undoable command to set the color. The command is not executed.

Parameters
rRed component of the new color value.
gGreen component of the new color value.
bBlue component of the new color value.
Returns
Undoable command to set the color

◆ coneInterface()

std::shared_ptr< ConeInterface > Ufe::Light::coneInterface ( )

Retrieve the cone interface for the light

Returns
the cone interface

◆ coneInterfaceImpl()

virtual std::shared_ptr< ConeInterface > Ufe::Light::coneInterfaceImpl ( )
protectedpure virtual

◆ diffuse() [1/2]

virtual float Ufe::Light::diffuse ( ) const
pure virtual

Retrieve the diffuse for the light

Returns
the diffuse value

◆ diffuse() [2/2]

virtual void Ufe::Light::diffuse ( float  ld)
inlinevirtual

Set the diffuse. Default implementation uses DiffuseUndoableCommand.

Parameters
ldthe new diffuse value.

Definition at line 287 of file light.h.

◆ diffuseCmd()

virtual DiffuseUndoableCommand::Ptr Ufe::Light::diffuseCmd ( float  ld)
pure virtual

Create an undoable command to set the diffuse. The command is not executed.

Parameters
ldthe new diffuse value.
Returns
Undoable command to set the diffuse

◆ directionalInterface()

std::shared_ptr< DirectionalInterface > Ufe::Light::directionalInterface ( )

Retrieve the directional interface for the light

Returns
the directional interface

◆ directionalInterfaceImpl()

virtual std::shared_ptr< DirectionalInterface > Ufe::Light::directionalInterfaceImpl ( )
protectedpure virtual

◆ hasObserver()

static bool Ufe::Light::hasObserver ( const SceneItem::Ptr item,
const Observer::Ptr obs 
)
static

Query observation on argument item for light changes.

Parameters
itemSceneItem to check if has observation.
obsObserver to query.
Returns
True if there is observation on argument item for light changes.

◆ hasObservers() [1/2]

static bool Ufe::Light::hasObservers ( const Path path)
static
Parameters
pathPath to verify if being observed.
Returns
True if the given path is being observed.

◆ hasObservers() [2/2]

static bool Ufe::Light::hasObservers ( Rtid  runTimeId)
static

Helper query for runtimes, to determine if any path they are responsible for is being observed.

Parameters
runTimeIdruntime Id to find observers on.
Returns
True if any path of given runtime Id are being observed.

◆ intensity() [1/2]

virtual float Ufe::Light::intensity ( ) const
pure virtual

Retrieve the intensity for the light

Returns
the intensity value

◆ intensity() [2/2]

virtual void Ufe::Light::intensity ( float  li)
inlinevirtual

Set the intensity. Default implementation uses IntensityUndoableCommand.

Parameters
lithe new intensity value.

Definition at line 194 of file light.h.

◆ intensityCmd()

virtual IntensityUndoableCommand::Ptr Ufe::Light::intensityCmd ( float  li)
pure virtual

Create an undoable command to set the intensity. The command is not executed.

Parameters
lithe new intensity value.
Returns
Undoable command to set the intensity

◆ light()

static Ptr Ufe::Light::light ( const SceneItem::Ptr item)
static

Convenience method that calls the Ufe::LightHandler::light() method on the Light handler for the item. Returns a null pointer if the argument is null, is an empty path or if the item does not support the Light interface.

Parameters
itemSceneItem's Light to retrieve
Returns
Light of the given SceneItem

◆ nbObservers()

static std::size_t Ufe::Light::nbObservers ( const SceneItem::Ptr item)
static

Number of observers on the given SceneItem.

Parameters
itemSceneItem for which to count observers.
Returns
Number of observers on SceneItem.

◆ notify()

static void Ufe::Light::notify ( const Path path)
static

Notify all observers of the item with this path. If no observer exists, does nothing.

Parameters
pathPath to use on the notify action.

◆ path()

virtual const Path & Ufe::Light::path ( ) const
pure virtual
Returns
the object's Path.

◆ removeObserver()

static bool Ufe::Light::removeObserver ( const SceneItem::Ptr item,
const Observer::Ptr obs 
)
static

Remove observation on the argument item for Light changes.

Parameters
itemSceneItem to remove observation on.
obsObserver to remove.
Returns
True if the observer is removed. False if the observer isn't found.

◆ sceneItem()

virtual SceneItem::Ptr Ufe::Light::sceneItem ( ) const
pure virtual
Returns
the object's SceneItem.

◆ shadowColor() [1/2]

virtual Color3f Ufe::Light::shadowColor ( ) const
pure virtual

Retrieve the shadow color for the light

Returns
the shadow color value

◆ shadowColor() [2/2]

virtual void Ufe::Light::shadowColor ( float  r,
float  g,
float  b 
)
inlinevirtual

Set the shadow color. Default implementation uses ShadowColorUndoableCommand.

Parameters
rred component
ggreen component
bblue component

Definition at line 264 of file light.h.

◆ shadowColorCmd()

virtual ShadowColorUndoableCommand::Ptr Ufe::Light::shadowColorCmd ( float  r,
float  g,
float  b 
)
pure virtual

Create an undoable command to set the shadow color. The command is not executed.

Parameters
rRed component of the new shadow color value.
gGreen component of the new shadow color value.
bBlue component of the new shadow color value.
Returns
Undoable command to set the shadow color

◆ shadowEnable() [1/2]

virtual bool Ufe::Light::shadowEnable ( ) const
pure virtual

Retrieve the shadow enable flag

Returns
the shadow enable flag value

◆ shadowEnable() [2/2]

virtual void Ufe::Light::shadowEnable ( bool  se)
inlinevirtual

Set the shadow enable flag. Default implementation uses ShadowEnableUndoableCommand.

Parameters
sethe new shadow enable flag value.

Definition at line 240 of file light.h.

◆ shadowEnableCmd()

virtual ShadowEnableUndoableCommand::Ptr Ufe::Light::shadowEnableCmd ( bool  se)
pure virtual

Create an undoable command to set the shadow enable flag. The command is not executed.

Parameters
sethe new shadow enable flag value.
Returns
Undoable command to set the shadow enable flag

◆ specular() [1/2]

virtual float Ufe::Light::specular ( ) const
pure virtual

Retrieve the specular for the light

Returns
the specular value

◆ specular() [2/2]

virtual void Ufe::Light::specular ( float  ls)
inlinevirtual

Set the specular. Default implementation uses SpecularUndoableCommand.

Parameters
lsthe new specular value.

Definition at line 310 of file light.h.

◆ specularCmd()

virtual SpecularUndoableCommand::Ptr Ufe::Light::specularCmd ( float  ls)
pure virtual

Create an undoable command to set the specular. The command is not executed.

Parameters
lsthe new specular value.
Returns
Undoable command to set the specular

◆ sphereInterface()

std::shared_ptr< SphereInterface > Ufe::Light::sphereInterface ( )

Retrieve the sphere interface for the light

Returns
the sphere interface

◆ sphereInterfaceImpl()

virtual std::shared_ptr< SphereInterface > Ufe::Light::sphereInterfaceImpl ( )
protectedpure virtual

◆ type()

virtual Type Ufe::Light::type ( ) const
pure virtual
Returns
the light type

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