Differential D6342 Diff 20011 extern/draco/dracoenc/src/draco/compression/mesh/mesh_edgebreaker_encoder_impl.cc
Changeset View
Changeset View
Standalone View
Standalone View
extern/draco/dracoenc/src/draco/compression/mesh/mesh_edgebreaker_encoder_impl.cc
| Context not available. | |||||
| } | } | ||||
| template <class TraversalEncoder> | template <class TraversalEncoder> | ||||
| bool MeshEdgebreakerEncoderImpl<TraversalEncoder>::EncodeConnectivity() { | Status MeshEdgebreakerEncoderImpl<TraversalEncoder>::EncodeConnectivity() { | ||||
| // To encode the mesh, we need face connectivity data stored in a corner | // To encode the mesh, we need face connectivity data stored in a corner | ||||
| // table. To compute the connectivity we must use indices associated with | // table. To compute the connectivity we must use indices associated with | ||||
| // POSITION attribute, because they define which edges can be connected | // POSITION attribute, because they define which edges can be connected | ||||
| Context not available. | |||||
| corner_table_->num_faces() == corner_table_->NumDegeneratedFaces()) { | corner_table_->num_faces() == corner_table_->NumDegeneratedFaces()) { | ||||
| // Failed to construct the corner table. | // Failed to construct the corner table. | ||||
| // TODO(ostava): Add better error reporting. | // TODO(ostava): Add better error reporting. | ||||
| return false; | return Status(Status::DRACO_ERROR, "All triangles are degenerate."); | ||||
| } | } | ||||
| traversal_encoder_.Init(this); | traversal_encoder_.Init(this); | ||||
| Context not available. | |||||
| pos_encoding_data_.num_values = 0; | pos_encoding_data_.num_values = 0; | ||||
| if (!FindHoles()) | if (!FindHoles()) | ||||
| return false; | return Status(Status::DRACO_ERROR, "Failed to process mesh holes."); | ||||
| if (!InitAttributeData()) | if (!InitAttributeData()) | ||||
| return false; | return Status(Status::DRACO_ERROR, "Failed to initialize attribute data."); | ||||
| const uint8_t num_attribute_data = | const uint8_t num_attribute_data = | ||||
| static_cast<uint8_t>(attribute_data_.size()); | static_cast<uint8_t>(attribute_data_.size()); | ||||
| Context not available. | |||||
| if (opp_face_id != kInvalidFaceIndex && | if (opp_face_id != kInvalidFaceIndex && | ||||
| !visited_faces_[opp_face_id.value()]) { | !visited_faces_[opp_face_id.value()]) { | ||||
| if (!EncodeConnectivityFromCorner(opp_id)) | if (!EncodeConnectivityFromCorner(opp_id)) | ||||
| return false; | return Status(Status::DRACO_ERROR, "Failed to encode mesh component."); | ||||
| } | } | ||||
| } else { | } else { | ||||
| // Boundary configuration. We start on a boundary rather than on a face. | // Boundary configuration. We start on a boundary rather than on a face. | ||||
| Context not available. | |||||
| // Start processing the face opposite to the boundary edge (the face | // Start processing the face opposite to the boundary edge (the face | ||||
| // containing the start_corner). | // containing the start_corner). | ||||
| if (!EncodeConnectivityFromCorner(start_corner)) | if (!EncodeConnectivityFromCorner(start_corner)) | ||||
| return false; | return Status(Status::DRACO_ERROR, "Failed to encode mesh component."); | ||||
| } | } | ||||
| } | } | ||||
| // Reverse the order of connectivity corners to match the order in which | // Reverse the order of connectivity corners to match the order in which | ||||
| Context not available. | |||||
| // Append the traversal buffer. | // Append the traversal buffer. | ||||
| if (!EncodeSplitData()) | if (!EncodeSplitData()) | ||||
| return false; | return Status(Status::DRACO_ERROR, "Failed to encode split data."); | ||||
| encoder_->buffer()->Encode(traversal_encoder_.buffer().data(), | encoder_->buffer()->Encode(traversal_encoder_.buffer().data(), | ||||
| traversal_encoder_.buffer().size()); | traversal_encoder_.buffer().size()); | ||||
| return true; | return OkStatus(); | ||||
| } | } | ||||
| template <class TraversalEncoder> | template <class TraversalEncoder> | ||||
| Context not available. | |||||