add setBloom method

This commit is contained in:
Nick Fisher
2023-08-24 09:36:30 +08:00
parent 482666da31
commit e1edb6299a
6 changed files with 29 additions and 4 deletions

View File

@@ -138,10 +138,7 @@ FilamentViewer::FilamentViewer(const void* context, const ResourceLoaderWrapper*
setToneMapping(ToneMapping::ACES);
decltype(_view->getBloomOptions()) opts;
opts.enabled = true;
opts.strength = 0.6f;
_view->setBloomOptions(opts);
setBloom(0.6f);
_view->setScene(_scene);
_view->setCamera(_mainCamera);
@@ -238,6 +235,13 @@ FilamentViewer::FilamentViewer(const void* context, const ResourceLoaderWrapper*
_scene->addEntity(imageEntity);
}
void FilamentViewer::setBloom(float strength) {
decltype(_view->getBloomOptions()) opts;
opts.enabled = true;
opts.strength = strength;
_view->setBloomOptions(opts);
}
void FilamentViewer::setToneMapping(ToneMapping toneMapping) {
ToneMapper* tm;

View File

@@ -52,6 +52,11 @@ extern "C" {
((FilamentViewer*)viewer)->setToneMapping((ToneMapping)toneMapping);
}
FLUTTER_PLUGIN_EXPORT void set_bloom(const void* const viewer, float strength) {
Log("Setting bloom to %f", strength);
((FilamentViewer*)viewer)->setBloom(strength);
}
FLUTTER_PLUGIN_EXPORT void load_skybox(const void* const viewer, const char* skyboxPath) {
((FilamentViewer*)viewer)->loadSkybox(skyboxPath);
}