diff --git a/src/serializers/USDSerializer.cpp b/src/serializers/USDSerializer.cpp index 8cbb2a1986..870b15f696 100644 --- a/src/serializers/USDSerializer.cpp +++ b/src/serializers/USDSerializer.cpp @@ -44,19 +44,14 @@ USDSerializer::USDSerializer(const std::string& out_filename, const SerializerSe auto world = pxr::UsdGeomXform::Define(stage_, pxr::SdfPath("/World")); stage_->SetDefaultPrim(world.GetPrim()); pxr::UsdGeomScope::Define(stage_, pxr::SdfPath("/Looks")); - createLighting(); + auto light = pxr::UsdLuxDistantLight::Define(stage_, pxr::SdfPath("/defaultLight")); + light.CreateIntensityAttr().Set(1000.0f); + light.CreateColorAttr().Set(pxr::GfVec3f(1.0f, 1.0f, 1.0f)); ready_ = true; } USDSerializer::~USDSerializer() { - -} -void USDSerializer::createLighting() { - const std::string& light_path = "/World/defaultLight"; - auto light = pxr::UsdLuxDistantLight::Define(stage_, pxr::SdfPath(light_path)); - light.CreateIntensityAttr().Set(1000.0f); - light.CreateColorAttr().Set(pxr::GfVec3f(1.0f, 1.0f, 1.0f)); } std::vector USDSerializer::createMaterials(const std::vector& styles) diff --git a/src/serializers/USDSerializer.h b/src/serializers/USDSerializer.h index ca950961f1..ce23ee2316 100644 --- a/src/serializers/USDSerializer.h +++ b/src/serializers/USDSerializer.h @@ -41,6 +41,7 @@ #include namespace usd_utils { + // creates a valid USD path from a string inline std::string toPath(std::string& s) { std::replace_if(s.begin(), s.end(), [](char c) { return c < 48 || (c < 65 && c > 57) || (c < 97 && c > 90) || c > 122; }, @@ -65,7 +66,6 @@ private: std::map materials_; std::vector createMaterials(const std::vector&); - void createLighting(); public: USDSerializer(const std::string&, const SerializerSettings&); virtual ~USDSerializer();