mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-10 22:16:41 +00:00
refactor
This commit is contained in:
@@ -44,19 +44,14 @@ USDSerializer::USDSerializer(const std::string& out_filename, const SerializerSe
|
|||||||
auto world = pxr::UsdGeomXform::Define(stage_, pxr::SdfPath("/World"));
|
auto world = pxr::UsdGeomXform::Define(stage_, pxr::SdfPath("/World"));
|
||||||
stage_->SetDefaultPrim(world.GetPrim());
|
stage_->SetDefaultPrim(world.GetPrim());
|
||||||
pxr::UsdGeomScope::Define(stage_, pxr::SdfPath("/Looks"));
|
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;
|
ready_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
USDSerializer::~USDSerializer() {
|
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<pxr::UsdShadeMaterial> USDSerializer::createMaterials(const std::vector<IfcGeom::Material>& styles)
|
std::vector<pxr::UsdShadeMaterial> USDSerializer::createMaterials(const std::vector<IfcGeom::Material>& styles)
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
namespace usd_utils {
|
namespace usd_utils {
|
||||||
|
// creates a valid USD path from a string
|
||||||
inline std::string toPath(std::string& s) {
|
inline std::string toPath(std::string& s) {
|
||||||
std::replace_if(s.begin(), s.end(),
|
std::replace_if(s.begin(), s.end(),
|
||||||
[](char c) { return c < 48 || (c < 65 && c > 57) || (c < 97 && c > 90) || c > 122; },
|
[](char c) { return c < 48 || (c < 65 && c > 57) || (c < 97 && c > 90) || c > 122; },
|
||||||
@@ -65,7 +66,6 @@ private:
|
|||||||
std::map<std::string, pxr::UsdShadeMaterial> materials_;
|
std::map<std::string, pxr::UsdShadeMaterial> materials_;
|
||||||
|
|
||||||
std::vector<pxr::UsdShadeMaterial> createMaterials(const std::vector<IfcGeom::Material>&);
|
std::vector<pxr::UsdShadeMaterial> createMaterials(const std::vector<IfcGeom::Material>&);
|
||||||
void createLighting();
|
|
||||||
public:
|
public:
|
||||||
USDSerializer(const std::string&, const SerializerSettings&);
|
USDSerializer(const std::string&, const SerializerSettings&);
|
||||||
virtual ~USDSerializer();
|
virtual ~USDSerializer();
|
||||||
|
|||||||
Reference in New Issue
Block a user