Trim trailing whitespace.

This commit is contained in:
Maeyanie
2025-09-10 08:17:40 -04:00
parent bf61f94bc4
commit 5e48ed0c5c

View File

@@ -25,15 +25,15 @@ bool load_drc(const char *path, TriangleMesh *meshptr)
{ {
try { try {
boost::iostreams::mapped_file_source file(path); boost::iostreams::mapped_file_source file(path);
DecoderBuffer buffer; DecoderBuffer buffer;
buffer.Init(file.data(), file.size()); buffer.Init(file.data(), file.size());
auto geotype = Decoder::GetEncodedGeometryType(&buffer); auto geotype = Decoder::GetEncodedGeometryType(&buffer);
if ((!geotype.ok()) || geotype.value() != TRIANGULAR_MESH) { if ((!geotype.ok()) || geotype.value() != TRIANGULAR_MESH) {
return false; return false;
} }
Decoder decoder; Decoder decoder;
Mesh dracoMesh; Mesh dracoMesh;
Status status = decoder.DecodeBufferToGeometry(&buffer, &dracoMesh); Status status = decoder.DecodeBufferToGeometry(&buffer, &dracoMesh);
@@ -41,11 +41,11 @@ bool load_drc(const char *path, TriangleMesh *meshptr)
return false; return false;
} }
file.close(); file.close();
indexed_triangle_set its; indexed_triangle_set its;
const PointAttribute *const positions = dracoMesh.GetNamedAttribute(GeometryAttribute::POSITION); const PointAttribute *const positions = dracoMesh.GetNamedAttribute(GeometryAttribute::POSITION);
size_t num_vertices = positions->size(); size_t num_vertices = positions->size();
its.vertices.reserve(num_vertices); its.vertices.reserve(num_vertices);
for (AttributeValueIndex i(0); i < num_vertices; ++ i) { for (AttributeValueIndex i(0); i < num_vertices; ++ i) {
@@ -53,12 +53,12 @@ bool load_drc(const char *path, TriangleMesh *meshptr)
positions->ConvertValue<float>(i, 3, pos); positions->ConvertValue<float>(i, 3, pos);
its.vertices.emplace_back(pos[0], pos[1], pos[2]); its.vertices.emplace_back(pos[0], pos[1], pos[2]);
} }
size_t num_faces = dracoMesh.num_faces(); size_t num_faces = dracoMesh.num_faces();
its.indices.reserve(num_faces); its.indices.reserve(num_faces);
for (FaceIndex i(0); i < num_faces; ++ i) { for (FaceIndex i(0); i < num_faces; ++ i) {
Mesh::Face face = dracoMesh.face(i); Mesh::Face face = dracoMesh.face(i);
its.indices.emplace_back( its.indices.emplace_back(
positions->mapped_index(face[0]).value(), positions->mapped_index(face[0]).value(),
positions->mapped_index(face[1]).value(), positions->mapped_index(face[1]).value(),
@@ -79,9 +79,9 @@ bool load_drc(const char *path, TriangleMesh *meshptr)
bool load_drc(const char *path, Model *model, const char *object_name_in) bool load_drc(const char *path, Model *model, const char *object_name_in)
{ {
TriangleMesh mesh; TriangleMesh mesh;
bool ret = load_drc(path, &mesh); bool ret = load_drc(path, &mesh);
if (ret) { if (ret) {
std::string object_name; std::string object_name;
if (object_name_in == nullptr) { if (object_name_in == nullptr) {
@@ -89,10 +89,10 @@ bool load_drc(const char *path, Model *model, const char *object_name_in)
object_name.assign((last_slash == nullptr) ? path : last_slash + 1); object_name.assign((last_slash == nullptr) ? path : last_slash + 1);
} else } else
object_name.assign(object_name_in); object_name.assign(object_name_in);
model->add_object(object_name.c_str(), path, std::move(mesh)); model->add_object(object_name.c_str(), path, std::move(mesh));
} }
return ret; return ret;
} }