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 {
boost::iostreams::mapped_file_source file(path);
DecoderBuffer buffer;
buffer.Init(file.data(), file.size());
buffer.Init(file.data(), file.size());
auto geotype = Decoder::GetEncodedGeometryType(&buffer);
if ((!geotype.ok()) || geotype.value() != TRIANGULAR_MESH) {
return false;
}
Decoder decoder;
Mesh dracoMesh;
Status status = decoder.DecodeBufferToGeometry(&buffer, &dracoMesh);
@@ -41,11 +41,11 @@ bool load_drc(const char *path, TriangleMesh *meshptr)
return false;
}
file.close();
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();
its.vertices.reserve(num_vertices);
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);
its.vertices.emplace_back(pos[0], pos[1], pos[2]);
}
size_t num_faces = dracoMesh.num_faces();
its.indices.reserve(num_faces);
for (FaceIndex i(0); i < num_faces; ++ i) {
Mesh::Face face = dracoMesh.face(i);
its.indices.emplace_back(
positions->mapped_index(face[0]).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)
{
TriangleMesh mesh;
bool ret = load_drc(path, &mesh);
if (ret) {
std::string object_name;
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);
} else
object_name.assign(object_name_in);
model->add_object(object_name.c_str(), path, std::move(mesh));
}
return ret;
}