|
19 | 19 | #ifndef _SLG_LIGHTSOURCEDEFINITIONS_H |
20 | 20 | #define _SLG_LIGHTSOURCEDEFINITIONS_H |
21 | 21 |
|
| 22 | +#include <functional> |
22 | 23 | #include <robin_hood.h> |
23 | 24 |
|
24 | 25 | #include "luxrays/utils/properties.h" |
@@ -76,27 +77,37 @@ class LightSourceDefinitions { |
76 | 77 | return std::addressof(lights[n].get()); |
77 | 78 | } |
78 | 79 |
|
79 | | - auto GetEnvLightSources() { |
| 80 | + auto ViewEnvLightSources() { |
80 | 81 | // Returns a view of references to the objects |
81 | 82 | return envLightSources | |
82 | 83 | std::views::transform([](const auto& obj) -> EnvLightSourceRef { |
83 | 84 | return obj.get(); |
84 | 85 | }); |
85 | 86 | } |
86 | | - auto GetEnvLightSources() const { |
| 87 | + auto ViewEnvLightSources() const { |
87 | 88 | // Returns a view of references to the objects |
88 | 89 | return envLightSources | |
89 | 90 | std::views::transform([](const auto& obj) -> const EnvLightSourceRef { |
90 | 91 | return obj.get(); |
91 | 92 | }); |
92 | 93 | } |
93 | | - auto GetIntersectableLightSources() const { |
| 94 | + auto GetEnvLightSources() const { |
| 95 | + auto view = ViewEnvLightSources(); |
| 96 | + return std::vector<std::reference_wrapper<EnvLightSource>>(view.begin(), view.end()); |
| 97 | + } |
| 98 | + |
| 99 | + auto ViewIntersectableLightSources() const { |
94 | 100 | // Returns a view of references to the objects |
95 | 101 | return intersectableLightSources | |
96 | 102 | std::views::transform([](const auto& obj) -> const TriangleLightRef { |
97 | 103 | return obj.get(); |
98 | 104 | }); |
99 | 105 | } |
| 106 | + auto GetIntersectableLightSources() const { |
| 107 | + auto view = ViewIntersectableLightSources(); |
| 108 | + return std::vector<std::reference_wrapper<IntersectableLightSource>>(view.begin(), view.end()); |
| 109 | + } |
| 110 | + |
100 | 111 | const std::vector<u_int> &GetLightIndexOffsetByMeshIndex() const { |
101 | 112 | return lightIndexOffsetByMeshIndex; |
102 | 113 | } |
|
0 commit comments