ufe 7.0
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.13-windows/ufe/include/light2.h"
2#ifndef UFE_LIGHT2_H
3#define UFE_LIGHT2_H
4
5// ===========================================================================
6// Copyright 2025 Autodesk, Inc. All rights reserved.
7//
8// The use of this software is subject to the Autodesk Terms of Use or other
9// license agreement provided at the time of installation or download, or
10// which otherwise accompanies this software.
11// ===========================================================================
12
13#include "common/ufeExport.h"
14#include "sceneItem.h"
15#include "observer.h"
17#include "types.h"
18#include "value.h"
19#include "lightNotification.h"
20
21#include <memory>
22#include <array>
23#include <vector>
24
26{
27
28class UndoableCommand;
29
31{
32 public:
33 typedef std::shared_ptr<LightInterface> Ptr;
37 LightInterface(const LightInterface&) = default;
39 virtual ~LightInterface();
40};
41
43{
44public:
45 typedef std::shared_ptr<AreaLightInterface> Ptr;
51 virtual ~AreaLightInterface() override;
52
56
62
66 virtual void normalize(bool nl) {
67 if (auto cmd = normalizeCmd(nl)) {
68 cmd->execute();
69 }
70 }
71
74 virtual bool normalize() const = 0;
75
79 virtual WidthUndoableCommand::Ptr widthCmd(float w) = 0;
80
83 virtual void width(float w) {
84 if (auto cmd = widthCmd(w)) {
85 cmd->execute();
86 }
87 }
88
91 virtual float width() const = 0;
92
97
100 virtual void height(float h) {
101 if (auto cmd = heightCmd(h)) {
102 cmd->execute();
103 }
104 }
105
108 virtual float height() const = 0;
109};
110
111class UFE_SDK_DECL Light2 : public std::enable_shared_from_this<Light2>
112{
113public:
114 typedef std::shared_ptr<Light2> Ptr;
115
116 enum Type
117 {
120 };
121
128
137 static Ptr light(const SceneItem::Ptr& item);
138
146 static bool addObserver(
147 const SceneItem::Ptr& item, const Observer::Ptr& obs);
155 static bool removeObserver(
156 const SceneItem::Ptr& item, const Observer::Ptr& obs);
157
163 static std::size_t nbObservers(const SceneItem::Ptr& item);
164
172 static bool hasObserver(
173 const SceneItem::Ptr& item, const Observer::Ptr& obs);
174
177 static bool hasObservers(const Path& path);
178
183 static bool hasObservers(Rtid runTimeId);
184
188 static void notify(const Ufe::LightChanged& notification);
189
190 // --------------------------------------------------------------------- //
193 // --------------------------------------------------------------------- //
194
200 virtual Value getMetadata(const std::string& key) const = 0;
201
208 virtual bool setMetadata(const std::string& key, const Value& value) = 0;
209
212 virtual UndoableCommand::Ptr setMetadataCmd(const std::string& key, const Value& value);
213
219 virtual bool clearMetadata(const std::string& key) = 0;
220
225
227 virtual bool hasMetadata(const std::string& key) const = 0;
228
229 // --------------------------------------------------------------------- //
231 // --------------------------------------------------------------------- //
232
236 Light2(const Light2&) = default;
238 virtual ~Light2();
239
241 virtual const Path& path() const = 0;
242
244 virtual SceneItem::Ptr sceneItem() const = 0;
245
247 virtual Type type() const = 0;
248
250 std::vector<LightInterface::Ptr> interfaces;
251
252 /*************************************************
253 Light intensity attribute.
254 Valid for the following light types: [all]
255 *************************************************/
256
261
264 virtual void intensity(float li) {
265 if (auto cmd = intensityCmd(li)) {
266 cmd->execute();
267 }
268 }
269
272 virtual float intensity() const = 0;
273
274 /*************************************************
275 Light color attribute, defined in energy-linear terms
276 Valid for the following light types: [all]
277 *************************************************/
278
284 virtual ColorUndoableCommand::Ptr colorCmd(float r, float g, float b) = 0;
285
288 virtual void color(float r, float g, float b) {
289 if (auto cmd = colorCmd(r, g, b)) {
290 cmd->execute();
291 }
292 }
293
296 virtual Color3f color() const = 0;
297
298 /*************************************************
299 Light shadow enable attribute.
300 Valid for the following light types: [all]
301 *************************************************/
302
307
310 virtual void shadowEnable(bool se) {
311 if (auto cmd = shadowEnableCmd(se)) {
312 cmd->execute();
313 }
314 }
315
318 virtual bool shadowEnable() const = 0;
319
320 /*************************************************
321 Shadow color attribute.
322 Valid for the following light types: [all]
323 *************************************************/
324
330 virtual ShadowColorUndoableCommand::Ptr shadowColorCmd(float r, float g, float b) = 0;
331
334 virtual void shadowColor(float r, float g, float b) {
335 if (auto cmd = shadowColorCmd(r, g, b)) {
336 cmd->execute();
337 }
338 }
339
342 virtual Color3f shadowColor() const = 0;
343
344 /*************************************************
345 Light diffuse attribute, a multiplier for the effect
346 of this light on the diffuse response of materials.
347 Valid for the following light types: [all]
348 *************************************************/
349
354
357 virtual void diffuse(float ld) {
358 if (auto cmd = diffuseCmd(ld)) {
359 cmd->execute();
360 }
361 }
362
365 virtual float diffuse() const = 0;
366
367 /*************************************************
368 Light specular attribute, a multiplier for the effect
369 of this light on the specular response of materials.
370 Valid for the following light types: [all]
371 *************************************************/
372
377
380 virtual void specular(float ls) {
381 if (auto cmd = specularCmd(ls)) {
382 cmd->execute();
383 }
384 }
385
388 virtual float specular() const = 0;
389};
390}
391
392#endif /* UFE_LIGHT2_H */
virtual bool normalize() const =0
virtual NormalizeUndoableCommand::Ptr normalizeCmd(bool nl)=0
virtual void height(float h)
Definition: light2.h:100
virtual void width(float w)
Definition: light2.h:83
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:45
virtual float height() const =0
virtual WidthUndoableCommand::Ptr widthCmd(float w)=0
virtual ~AreaLightInterface() override
Destructor.
virtual void normalize(bool nl)
Definition: light2.h:66
virtual float specular() const =0
virtual void shadowColor(float r, float g, float b)
Definition: light2.h:334
std::shared_ptr< Light2 > Ptr
Definition: light2.h:114
virtual void diffuse(float ld)
Definition: light2.h:357
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:250
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:310
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:288
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:264
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:380
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:33
std::shared_ptr< Observer > Ptr
Definition: observer.h:37
Identify an object or 3D path in the scene.
Definition: path.h:40
std::shared_ptr< SceneItem > Ptr
Definition: sceneItem.h:45
Abstract class for set value command.
std::shared_ptr< SetValueUndoableCommand > Ptr
std::shared_ptr< UndoableCommand > Ptr
Value class that can hold a wide set of types.
Definition: value.h:66
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:27
#define UFE_NS_DEF
Definition: ufe.h:36
Definition of macros for symbol visibility.
#define UFE_SDK_DECL
Definition: ufeExport.h:35