Restructure and rename

This commit is contained in:
Thomas Krijnen
2026-03-31 15:32:36 +02:00
parent 724cdb446e
commit a07f56db6f
237 changed files with 72532 additions and 72535 deletions
+15 -15
View File
@@ -56,17 +56,17 @@ GltfSerializer::GltfSerializer(const std::string& filename, const ifcopenshell::
, filename_(filename)
, tmp_filename1_(filename + ".indices.tmp")
, tmp_filename2_(filename + ".vertices.tmp")
, fstream_(IfcUtil::path::from_utf8(filename).c_str(), std::ios_base::binary)
, tmp_fstream1_(IfcUtil::path::from_utf8(tmp_filename1_).c_str(), std::ios_base::binary)
, tmp_fstream2_(IfcUtil::path::from_utf8(tmp_filename2_).c_str(), std::ios_base::binary)
, fstream_(ifcopenshell::path::from_utf8(filename).c_str(), std::ios_base::binary)
, tmp_fstream1_(ifcopenshell::path::from_utf8(tmp_filename1_).c_str(), std::ios_base::binary)
, tmp_fstream2_(ifcopenshell::path::from_utf8(tmp_filename2_).c_str(), std::ios_base::binary)
, bufferViewId(0)
{}
GltfSerializer::~GltfSerializer() {
tmp_fstream1_.close();
tmp_fstream2_.close();
IfcUtil::path::delete_file(tmp_filename1_);
IfcUtil::path::delete_file(tmp_filename2_);
ifcopenshell::path::delete_file(tmp_filename1_);
ifcopenshell::path::delete_file(tmp_filename2_);
}
bool GltfSerializer::ready() {
@@ -444,12 +444,12 @@ void GltfSerializer::finalize() {
// nb: uint32_t is the max buffer size in glTF
uint32_t indices_length, binary_length;
{
std::ifstream ifs(IfcUtil::path::from_utf8(tmp_filename1_).c_str(), std::ios::binary);
std::ifstream ifs(ifcopenshell::path::from_utf8(tmp_filename1_).c_str(), std::ios::binary);
ifs.ignore(std::numeric_limits<std::streamsize>::max());
indices_length = ifs.gcount();
}
{
std::ifstream ifs(IfcUtil::path::from_utf8(tmp_filename2_).c_str(), std::ios::binary);
std::ifstream ifs(ifcopenshell::path::from_utf8(tmp_filename2_).c_str(), std::ios::binary);
ifs.ignore(std::numeric_limits<std::streamsize>::max());
binary_length = indices_length + ifs.gcount();
}
@@ -490,12 +490,12 @@ void GltfSerializer::finalize() {
write_header<BIN>(fstream_, binary_length);
{
//First, write the indices buffer into our glb file
std::ifstream ifs(IfcUtil::path::from_utf8(tmp_filename1_).c_str(), std::ios::binary);
std::ifstream ifs(ifcopenshell::path::from_utf8(tmp_filename1_).c_str(), std::ios::binary);
fstream_ << ifs.rdbuf();
}
{
//Next, write the vertices buffer into our glb file
std::ifstream ifs(IfcUtil::path::from_utf8(tmp_filename2_).c_str(), std::ios::binary);
std::ifstream ifs(ifcopenshell::path::from_utf8(tmp_filename2_).c_str(), std::ios::binary);
fstream_ << ifs.rdbuf();
}
write_padding<BIN>(fstream_, binary_length);
@@ -517,11 +517,11 @@ namespace {
}
void proj_log(void *, int, const char* c) {
Logger::Error("PROJ: " + std::string(c));
logger::error("PROJ: " + std::string(c));
}
}
void GltfSerializer::setFile(IfcParse::IfcFile* f) {
void GltfSerializer::setFile(ifcopenshell::file* f) {
if (!settings_.get<ifcopenshell::geometry::settings::WriteGltfEcef>().get()) {
return;
}
@@ -533,7 +533,7 @@ void GltfSerializer::setFile(IfcParse::IfcFile* f) {
std::vector<express::Base> coordops;
try {
coordops = f->instances_by_type("IfcCoordinateOperation");
} catch (IfcParse::IfcException&) {
} catch (ifcopenshell::exception&) {
// Ignored. Schema likely doesn't support IfcCoordinateOperation.
}
for (auto& coordop : coordops) {
@@ -646,7 +646,7 @@ void GltfSerializer::setFile(IfcParse::IfcFile* f) {
NULL);
if (!P) {
Logger::Error("Failed to create PROJ transformation object");
logger::error("Failed to create PROJ transformation object");
return;
}
@@ -658,7 +658,7 @@ void GltfSerializer::setFile(IfcParse::IfcFile* f) {
wgs84_point = proj_trans(P, PJ_FWD, a);
Logger::Notice("Calculated latitude: " + std::to_string(wgs84_point.lp.lam) + " longitude: " + std::to_string(wgs84_point.lp.phi));
logger::notice("Calculated latitude: " + std::to_string(wgs84_point.lp.lam) + " longitude: " + std::to_string(wgs84_point.lp.phi));
}
std::swap(wgs84_point.lp.phi, wgs84_point.lp.lam);
@@ -683,7 +683,7 @@ void GltfSerializer::setFile(IfcParse::IfcFile* f) {
PJ *ellipsoid_crs = proj_create(C, ellipsoid_def);
if (!ellipsoid_crs) {
Logger::Error("Failed to create ellipsoid CRS");
logger::error("Failed to create ellipsoid CRS");
return;
}