MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / FALCOR_SCRIPT_BINDING

Function FALCOR_SCRIPT_BINDING

Source/Falcor/Scene/SDFs/SDFGrid.cpp:452–501  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

450 }
451
452 FALCOR_SCRIPT_BINDING(SDFGrid)
453 {
454 using namespace pybind11::literals;
455
456 auto createSBS = [](const pybind11::kwargs& args)
457 {
458 uint32_t brickWidth = 7;
459 uint32_t defaultGridWidth = 256;
460 bool compressed = false;
461
462 for (auto a : args)
463 {
464 auto key = a.first.cast<std::string>();
465 const auto& value = a.second;
466
467 bool isBool = pybind11::isinstance<pybind11::bool_>(value);
468 bool isInt = pybind11::isinstance<pybind11::int_>(value);
469
470 if (key == "brickWidth" && isInt)
471 {
472 brickWidth = pybind11::cast<uint32_t>(value);
473 }
474 if (key == "defaultGridWidth" && isInt)
475 {
476 defaultGridWidth = pybind11::cast<uint32_t>(value);
477 }
478 else if (key == "compressed" && isBool)
479 {
480 compressed = pybind11::cast<bool>(value);
481 }
482 }
483 return static_ref_cast<SDFGrid>(SDFSBS::create(accessActivePythonSceneBuilder().getDevice(), brickWidth, compressed, defaultGridWidth));
484 };
485
486 pybind11::class_<SDFGrid, ref<SDFGrid>> sdfGrid(m, "SDFGrid");
487 sdfGrid.def_static("createNDGrid", [](float narrowBandThickness) { return static_ref_cast<SDFGrid>(NDSDFGrid::create(accessActivePythonSceneBuilder().getDevice(), narrowBandThickness)); }, "narrowBandThickness"_a); // PYTHONDEPRECATED
488 sdfGrid.def_static("createSVS", [](){ return static_ref_cast<SDFGrid>(SDFSVS::create(accessActivePythonSceneBuilder().getDevice())); }); // PYTHONDEPRECATED
489 sdfGrid.def_static("createSBS", createSBS); // PYTHONDEPRECATED
490 sdfGrid.def_static("createSVO", [](){ return static_ref_cast<SDFGrid>(SDFSVO::create(accessActivePythonSceneBuilder().getDevice())); }); // PYTHONDEPRECATED
491 sdfGrid.def("loadValuesFromFile",
492 [](SDFGrid& self, const std::filesystem::path& path) { return self.loadValuesFromFile(getActiveAssetResolver().resolvePath(path)); },
493 "path"_a
494 ); // PYTHONDEPRECATED
495 sdfGrid.def("loadPrimitivesFromFile",
496 [](SDFGrid& self, const std::filesystem::path& path, uint32_t gridWidth) { return self.loadPrimitivesFromFile(getActiveAssetResolver().resolvePath(path), gridWidth); },
497 "path"_a, "gridWidth"_a
498 ); // PYTHONDEPRECATED
499 sdfGrid.def("generateCheeseValues", &SDFGrid::generateCheeseValues, "gridWidth"_a, "seed"_a);
500 sdfGrid.def_property("name", &SDFGrid::getName, &SDFGrid::setName);
501 }
502
503 void SDFGrid::createEvaluatePrimitivesPass(bool writeToTexture3D, bool mergeWithSDField)
504 {

Callers

nothing calls this directly

Calls 5

loadValuesFromFileMethod · 0.80
createFunction · 0.50
getDeviceMethod · 0.45
resolvePathMethod · 0.45

Tested by

no test coverage detected