Changeset View
Changeset View
Standalone View
Standalone View
extern/draco/draco/src/draco/mesh/triangle_soup_mesh_builder.cc
- This file was moved from extern/draco/dracoenc/src/draco/mesh/triangle_soup_mesh_builder.cc.
| Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | void TriangleSoupMeshBuilder::SetPerFaceAttributeValueForFace( | ||||
| PointAttribute *const att = mesh_->attribute(att_id); | PointAttribute *const att = mesh_->attribute(att_id); | ||||
| att->SetAttributeValue(AttributeValueIndex(start_index), value); | att->SetAttributeValue(AttributeValueIndex(start_index), value); | ||||
| att->SetAttributeValue(AttributeValueIndex(start_index + 1), value); | att->SetAttributeValue(AttributeValueIndex(start_index + 1), value); | ||||
| att->SetAttributeValue(AttributeValueIndex(start_index + 2), value); | att->SetAttributeValue(AttributeValueIndex(start_index + 2), value); | ||||
| mesh_->SetFace(face_id, | mesh_->SetFace(face_id, | ||||
| {{PointIndex(start_index), PointIndex(start_index + 1), | {{PointIndex(start_index), PointIndex(start_index + 1), | ||||
| PointIndex(start_index + 2)}}); | PointIndex(start_index + 2)}}); | ||||
| int8_t &element_type = attribute_element_types_[att_id]; | int8_t &element_type = attribute_element_types_[att_id]; | ||||
| if (element_type < 0) | if (element_type < 0) { | ||||
| element_type = MESH_FACE_ATTRIBUTE; | element_type = MESH_FACE_ATTRIBUTE; | ||||
| } | } | ||||
| } | |||||
| std::unique_ptr<Mesh> TriangleSoupMeshBuilder::Finalize() { | std::unique_ptr<Mesh> TriangleSoupMeshBuilder::Finalize() { | ||||
| #ifdef DRACO_ATTRIBUTE_VALUES_DEDUPLICATION_SUPPORTED | #ifdef DRACO_ATTRIBUTE_VALUES_DEDUPLICATION_SUPPORTED | ||||
| // First deduplicate attribute values. | // First deduplicate attribute values. | ||||
| if (!mesh_->DeduplicateAttributeValues()) | if (!mesh_->DeduplicateAttributeValues()) { | ||||
| return nullptr; | return nullptr; | ||||
| } | |||||
| #endif | #endif | ||||
| #ifdef DRACO_ATTRIBUTE_INDICES_DEDUPLICATION_SUPPORTED | #ifdef DRACO_ATTRIBUTE_INDICES_DEDUPLICATION_SUPPORTED | ||||
| // Also deduplicate vertex indices. | // Also deduplicate vertex indices. | ||||
| mesh_->DeduplicatePointIds(); | mesh_->DeduplicatePointIds(); | ||||
| #endif | #endif | ||||
| for (size_t i = 0; i < attribute_element_types_.size(); ++i) { | for (size_t i = 0; i < attribute_element_types_.size(); ++i) { | ||||
| if (attribute_element_types_[i] >= 0) { | if (attribute_element_types_[i] >= 0) { | ||||
| mesh_->SetAttributeElementType( | mesh_->SetAttributeElementType( | ||||
| static_cast<int>(i), | static_cast<int>(i), | ||||
| static_cast<MeshAttributeElementType>(attribute_element_types_[i])); | static_cast<MeshAttributeElementType>(attribute_element_types_[i])); | ||||
| } | } | ||||
| } | } | ||||
| return std::move(mesh_); | return std::move(mesh_); | ||||
| } | } | ||||
| } // namespace draco | } // namespace draco | ||||