ufe 6.5
Universal Front End is a DCC-agnostic component that will allow a DCC to browse and edit data in multiple data models
light2.h
Go to the documentation of this file.
1#line 1 "D:/Jenkins/workspace/EMS/ECG/ufe/full/ufe-full-python3.11-windows/ufe/include/light2.h"
2#ifndef UFE_LIGHT2_H
3#define UFE_LIGHT2_H
4// ===========================================================================
5// Copyright 2025 Autodesk, Inc. All rights reserved.
6//
7// Use of this software is subject to the terms of the Autodesk license
8// agreement provided at the time of installation or download, or which
9// otherwise accompanies this software in either electronic or hard copy form.
10// ===========================================================================
11
12#include "common/ufeExport.h"
13#include "sceneItem.h"
14#include "observer.h"
16#include "types.h"
17#include "value.h"
18#include "lightNotification.h"
19
20#include <memory>
21#include <array>
22#include <vector>
23
25{
26
27class UndoableCommand;
28
30{
31 public:
32 typedef std::shared_ptr<LightInterface> Ptr;
36 LightInterface(const LightInterface&) = default;
38 virtual ~LightInterface();
39};
40
42{
43public:
44 typedef std::shared_ptr<AreaLightInterface> Ptr;
50 virtual ~AreaLightInterface() override;
51
55
61
65 virtual void normalize(bool nl) {
66 if (auto cmd = normalizeCmd(nl)) {
67 cmd->execute();
68 }
69 }
70
73 virtual bool normalize() const = 0;
74
78 virtual WidthUndoableCommand::Ptr widthCmd(float w) = 0;
79
82 virtual void width(float w) {
83 if (auto cmd = widthCmd(w)) {
84 cmd->execute();
85 }
86 }
87
90 virtual float width() const = 0;
91
96
99 virtual void height(float h) {
100 if (auto cmd = heightCmd(h)) {
101 cmd->execute();
102 }
103 }
104
107 virtual float height() const = 0;
108};
109
110class UFE_SDK_DECL Light2 : public std::enable_shared_from_this<Light2>
111{
112public:
113 typedef std::shared_ptr<Light2> Ptr;
114
115 enum Type
116 {
119 };
120
127
136 static Ptr light(const SceneItem::Ptr& item);
137
145 static bool addObserver(
146 const SceneItem::Ptr& item, const Observer::Ptr& obs);
154 static bool removeObserver(
155 const SceneItem::Ptr& item, const Observer::Ptr& obs);
156
162 static std::size_t nbObservers(const SceneItem::Ptr& item);
163
171 static bool hasObserver(
172 const SceneItem::Ptr& item, const Observer::Ptr& obs);
173
176 static bool hasObservers(const Path& path);
177
182 static bool hasObservers(Rtid runTimeId);
183
187 static void notify(const Ufe::LightChanged& notification);
188
189 // --------------------------------------------------------------------- //
192 // --------------------------------------------------------------------- //
193
199 virtual Value getMetadata(const std::string& key) const = 0;
200
207 virtual bool setMetadata(const std::string& key, const Value& value) = 0;
208
211 virtual UndoableCommand::Ptr setMetadataCmd(const std::string& key, const Value& value);
212
218 virtual bool clearMetadata(const std::string& key) = 0;
219
224
226 virtual bool hasMetadata(const std::string& key) const = 0;
227
228 // --------------------------------------------------------------------- //
230 // --------------------------------------------------------------------- //
231
235 Light2(const Light2&) = default;
237 virtual ~Light2();
238
240 virtual const Path& path() const = 0;
241
243 virtual SceneItem::Ptr sceneItem() const = 0;
244
246 virtual Type type() const = 0;
247
249 std::vector<LightInterface::Ptr> interfaces;
250
251 /*************************************************
252 Light intensity attribute.
253 Valid for the following light types: [all]
254 *************************************************/
255
260
263 virtual void intensity(float li) {
264 if (auto cmd = intensityCmd(li)) {
265 cmd->execute();
266 }
267 }
268
271 virtual float intensity() const = 0;
272
273 /*************************************************
274 Light color attribute, defined in energy-linear terms
275 Valid for the following light types: [all]
276 *************************************************/
277
283 virtual ColorUndoableCommand::Ptr colorCmd(float r, float g, float b) = 0;
284
287 virtual void color(float r, float g, float b) {
288 if (auto cmd = colorCmd(r, g, b)) {
289 cmd->execute();
290 }
291 }
292
295 virtual Color3f color() const = 0;
296
297 /*************************************************
298 Light shadow enable attribute.
299 Valid for the following light types: [all]
300 *************************************************/
301
306
309 virtual void shadowEnable(bool se) {
310 if (auto cmd = shadowEnableCmd(se)) {
311 cmd->execute();
312 }
313 }
314
317 virtual bool shadowEnable() const = 0;
318
319 /*************************************************
320 Shadow color attribute.
321 Valid for the following light types: [all]
322 *************************************************/
323
329 virtual ShadowColorUndoableCommand::Ptr shadowColorCmd(float r, float g, float b) = 0;
330
333 virtual void shadowColor(float r, float g, float b) {
334 if (auto cmd = shadowColorCmd(r, g, b)) {
335 cmd->execute();
336 }
337 }
338
341 virtual Color3f shadowColor() const = 0;
342
343 /*************************************************
344 Light diffuse attribute, a multiplier for the effect
345 of this light on the diffuse response of materials.
346 Valid for the following light types: [all]
347 *************************************************/
348
353
356 virtual void diffuse(float ld) {
357 if (auto cmd = diffuseCmd(ld)) {
358 cmd->execute();
359 }
360 }
361
364 virtual float diffuse() const = 0;
365
366 /*************************************************
367 Light specular attribute, a multiplier for the effect
368 of this light on the specular response of materials.
369 Valid for the following light types: [all]
370 *************************************************/
371
376
379 virtual void specular(float ls) {
380 if (auto cmd = specularCmd(ls)) {
381 cmd->execute();
382 }
383 }
384
387 virtual float specular() const = 0;
388};
389}
390
391#endif /* UFE_LIGHT2_H */
virtual bool normalize() const =0
virtual NormalizeUndoableCommand::Ptr normalizeCmd(bool nl)=0
virtual void height(float h)
Definition: light2.h:99
virtual void width(float w)
Definition: light2.h:82
virtual HeightUndoableCommand::Ptr heightCmd(float h)=0
AreaLightInterface()
Constructor.
AreaLightInterface(const AreaLightInterface &)=default
Default copy constructor.
virtual float width() const =0
std::shared_ptr< AreaLightInterface > Ptr
Definition: light2.h:44
virtual float height() const =0
virtual WidthUndoableCommand::Ptr widthCmd(float w)=0
virtual ~AreaLightInterface() override
Destructor.
virtual void normalize(bool nl)
Definition: light2.h:65
virtual float specular() const =0
virtual void shadowColor(float r, float g, float b)
Definition: light2.h:333
std::shared_ptr< Light2 > Ptr
Definition: light2.h:113
virtual void diffuse(float ld)
Definition: light2.h:356
virtual UndoableCommand::Ptr setMetadataCmd(const std::string &key, const Value &value)
virtual ~Light2()
Destructor.
virtual const Path & path() const =0
virtual IntensityUndoableCommand::Ptr intensityCmd(float li)=0
std::vector< LightInterface::Ptr > interfaces
A collection of LightInterface pointers that this light supports.
Definition: light2.h:249
Light2()
Constructor.
virtual ShadowColorUndoableCommand::Ptr shadowColorCmd(float r, float g, float b)=0
virtual ColorUndoableCommand::Ptr colorCmd(float r, float g, float b)=0
virtual bool clearMetadata(const std::string &key)=0
virtual DiffuseUndoableCommand::Ptr diffuseCmd(float ld)=0
static Ptr light(const SceneItem::Ptr &item)
virtual Value getMetadata(const std::string &key) const =0
static void notify(const Ufe::LightChanged &notification)
virtual SceneItem::Ptr sceneItem() const =0
virtual UndoableCommand::Ptr clearMetadataCmd(const std::string &key)
virtual bool setMetadata(const std::string &key, const Value &value)=0
virtual float intensity() const =0
virtual void shadowEnable(bool se)
Definition: light2.h:309
static bool hasObserver(const SceneItem::Ptr &item, const Observer::Ptr &obs)
static bool hasObservers(const Path &path)
static bool addObserver(const SceneItem::Ptr &item, const Observer::Ptr &obs)
virtual SpecularUndoableCommand::Ptr specularCmd(float ls)=0
virtual void color(float r, float g, float b)
Definition: light2.h:287
virtual ShadowEnableUndoableCommand::Ptr shadowEnableCmd(bool se)=0
virtual bool hasMetadata(const std::string &key) const =0
Returns true if metadata key has a non-empty value.
virtual void intensity(float li)
Definition: light2.h:263
virtual float diffuse() const =0
virtual bool shadowEnable() const =0
static std::size_t nbObservers(const SceneItem::Ptr &item)
virtual void specular(float ls)
Definition: light2.h:379
static bool removeObserver(const SceneItem::Ptr &item, const Observer::Ptr &obs)
static bool hasObservers(Rtid runTimeId)
virtual Color3f color() const =0
virtual Type type() const =0
Light2(const Light2 &)=default
Default copy constructor.
virtual Color3f shadowColor() const =0
Base class for all Light notifications.
LightInterface(const LightInterface &)=default
Default copy constructor.
LightInterface()
Constructor.
virtual ~LightInterface()
Destructor.
std::shared_ptr< LightInterface > Ptr
Definition: light2.h:32
std::shared_ptr< Observer > Ptr
Definition: observer.h:36
Identify an object or 3D path in the scene.
Definition: path.h:38
std::shared_ptr< SceneItem > Ptr
Definition: sceneItem.h:44
Abstract class for set value command.
std::shared_ptr< SetValueUndoableCommand > Ptr
std::shared_ptr< UndoableCommand > Ptr
std::string string(const Path &path)
Path path(const std::string &pathString)
SetValueUndoableCommand< bool > SetBoolUndoableCommand
SetValueUndoableCommand< const Color3f & > SetColor3fUndoableCommand
SetValueUndoableCommand< float > SetFloatUndoableCommand
uint32_t Rtid
Definition: rtid.h:26
#define UFE_NS_DEF
Definition: ufe.h:35
Definition of macros for symbol visibility.
#define UFE_SDK_DECL
Definition: ufeExport.h:36