Skip to content

Commit b5c35e6

Browse files
committed
Implement add_environment_probe
1 parent 9e3f2dc commit b5c35e6

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

src/rpcore/render_pipeline.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@
6464
#include "render_pipeline/rpcore/native/rp_point_light.h"
6565
#include "render_pipeline/rpcore/native/rp_spot_light.h"
6666

67+
#include "rpplugins/env_probes/include/rpplugins/env_probes/env_probes_plugin.hpp"
68+
6769
#include "rpcore/common_resources.hpp"
6870
#include "rpcore/gui/debugger.hpp"
6971
#include "rpcore/gui/error_message_display.hpp"
@@ -1086,7 +1088,7 @@ rpplugins::EnvironmentProbe* RenderPipeline::add_environment_probe()
10861088
if (!impl_->plugin_mgr_->is_plugin_enabled("env_probes"))
10871089
return nullptr;
10881090

1089-
return nullptr;
1091+
return static_cast<rpplugins::EnvProbesPlugin*>(impl_->plugin_mgr_->get_instance("env_probes")->downcast())->create_probe();
10901092
}
10911093

10921094
void RenderPipeline::prepare_scene(const NodePath& scene)

src/rpplugins/env_probes/include/rpplugins/env_probes/env_probes_plugin.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727
namespace rpplugins {
2828

29+
class EnvironmentProbe;
30+
2931
class EnvProbesPlugin : public rpcore::BasePlugin
3032
{
3133
public:
@@ -39,6 +41,7 @@ class EnvProbesPlugin : public rpcore::BasePlugin
3941
void on_pre_render_update() final;
4042

4143
virtual rpcore::RenderStage* get_capture_stage();
44+
virtual EnvironmentProbe* create_probe();
4245

4346
private:
4447
class Impl;

src/rpplugins/env_probes/src/env_probes_plugin.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,4 +203,14 @@ rpcore::RenderStage* EnvProbesPlugin::get_capture_stage()
203203
return impl_->capture_stage_;
204204
}
205205

206+
EnvironmentProbe* EnvProbesPlugin::create_probe()
207+
{
208+
auto probe = std::make_unique<EnvironmentProbe>();
209+
auto probe_raw = probe.get();
210+
if (impl_->probe_mgr_->add_probe(std::move(probe)))
211+
return probe_raw;
212+
else
213+
return nullptr;
214+
}
215+
206216
}

0 commit comments

Comments
 (0)