add arg for ibl intensity
This commit is contained in:
@@ -362,7 +362,8 @@ public class SwiftPolyvoxFilamentPlugin: NSObject, FlutterPlugin, FlutterTexture
|
|||||||
clear_assets(viewer!)
|
clear_assets(viewer!)
|
||||||
result("OK")
|
result("OK")
|
||||||
case "loadIbl":
|
case "loadIbl":
|
||||||
load_ibl(self.viewer, call.arguments as! String)
|
let args = call.arguments as! Array<Any?>
|
||||||
|
load_ibl(self.viewer, args[0] as! String, Float(args[1] as! Double))
|
||||||
result("OK");
|
result("OK");
|
||||||
case "removeIbl":
|
case "removeIbl":
|
||||||
remove_ibl(self.viewer)
|
remove_ibl(self.viewer)
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace polyvox {
|
|||||||
void loadSkybox(const char* const skyboxUri);
|
void loadSkybox(const char* const skyboxUri);
|
||||||
void removeSkybox();
|
void removeSkybox();
|
||||||
|
|
||||||
void loadIbl(const char* const iblUri);
|
void loadIbl(const char* const iblUri, float intensity);
|
||||||
void removeIbl();
|
void removeIbl();
|
||||||
|
|
||||||
SceneAsset* loadGlb(const char* const uri);
|
SceneAsset* loadGlb(const char* const uri);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ void set_background_image(void* viewer, const char* path);
|
|||||||
void set_background_color(void* viewer, const float* color);
|
void set_background_color(void* viewer, const float* color);
|
||||||
void set_background_image_position(void* viewer, float x, float y, bool clamp);
|
void set_background_image_position(void* viewer, float x, float y, bool clamp);
|
||||||
void load_skybox(void* viewer, const char* skyboxPath);
|
void load_skybox(void* viewer, const char* skyboxPath);
|
||||||
void load_ibl(void* viewer, const char* iblPath);
|
void load_ibl(void* viewer, const char* iblPath, float intensity);
|
||||||
void remove_skybox(void* viewer);
|
void remove_skybox(void* viewer);
|
||||||
void remove_ibl(void* viewer);
|
void remove_ibl(void* viewer);
|
||||||
int32_t add_light(void* viewer, uint8_t type, float colour, float intensity, float posX, float posY, float posZ, float dirX, float dirY, float dirZ, bool shadows);
|
int32_t add_light(void* viewer, uint8_t type, float colour, float intensity, float posX, float posY, float posZ, float dirX, float dirY, float dirZ, bool shadows);
|
||||||
|
|||||||
@@ -822,7 +822,7 @@ void FilamentViewer::removeIbl() {
|
|||||||
_scene->setIndirectLight(nullptr);
|
_scene->setIndirectLight(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FilamentViewer::loadIbl(const char *const iblPath) {
|
void FilamentViewer::loadIbl(const char *const iblPath, float intensity) {
|
||||||
removeIbl();
|
removeIbl();
|
||||||
if (iblPath) {
|
if (iblPath) {
|
||||||
Log("Loading IBL from %s", iblPath);
|
Log("Loading IBL from %s", iblPath);
|
||||||
@@ -848,7 +848,7 @@ void FilamentViewer::loadIbl(const char *const iblPath) {
|
|||||||
_indirectLight = IndirectLight::Builder()
|
_indirectLight = IndirectLight::Builder()
|
||||||
.reflections(_iblTexture)
|
.reflections(_iblTexture)
|
||||||
.irradiance(3, harmonics)
|
.irradiance(3, harmonics)
|
||||||
.intensity(30000.0f)
|
.intensity(intensity)
|
||||||
.build(*_engine);
|
.build(*_engine);
|
||||||
_scene->setIndirectLight(_indirectLight);
|
_scene->setIndirectLight(_indirectLight);
|
||||||
|
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ extern "C" {
|
|||||||
((FilamentViewer*)viewer)->loadSkybox(skyboxPath);
|
((FilamentViewer*)viewer)->loadSkybox(skyboxPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_ibl(void* viewer, const char* iblPath) {
|
void load_ibl(void* viewer, const char* iblPath, float intensity) {
|
||||||
((FilamentViewer*)viewer)->loadIbl(iblPath);
|
((FilamentViewer*)viewer)->loadIbl(iblPath, intensity);
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove_skybox(void* viewer) {
|
void remove_skybox(void* viewer) {
|
||||||
|
|||||||
@@ -202,8 +202,8 @@ class PolyvoxFilamentController extends FilamentController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future loadIbl(String lightingPath) async {
|
Future loadIbl(String lightingPath, {double intensity = 30000}) async {
|
||||||
await _channel.invokeMethod("loadIbl", lightingPath);
|
await _channel.invokeMethod("loadIbl", [lightingPath, intensity]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
Reference in New Issue
Block a user