Differential D9642 Diff 31337 extern/draco/draco/src/draco/compression/mesh/mesh_edgebreaker_decoder_impl.h
Changeset View
Changeset View
Standalone View
Standalone View
extern/draco/draco/src/draco/compression/mesh/mesh_edgebreaker_decoder_impl.h
- This file was moved from extern/draco/dracoenc/src/draco/compression/mesh/mesh_edgebreaker_decoder_impl.h.
| Show All 11 Lines | |||||
| // See the License for the specific language governing permissions and | // See the License for the specific language governing permissions and | ||||
| // limitations under the License. | // limitations under the License. | ||||
| // | // | ||||
| #ifndef DRACO_COMPRESSION_MESH_MESH_EDGEBREAKER_DECODER_IMPL_H_ | #ifndef DRACO_COMPRESSION_MESH_MESH_EDGEBREAKER_DECODER_IMPL_H_ | ||||
| #define DRACO_COMPRESSION_MESH_MESH_EDGEBREAKER_DECODER_IMPL_H_ | #define DRACO_COMPRESSION_MESH_MESH_EDGEBREAKER_DECODER_IMPL_H_ | ||||
| #include <unordered_map> | #include <unordered_map> | ||||
| #include <unordered_set> | #include <unordered_set> | ||||
| #include "draco/compression/mesh/traverser/mesh_traversal_sequencer.h" | |||||
| #include "draco/draco_features.h" | |||||
| #include "draco/compression/attributes/mesh_attribute_indices_encoding_data.h" | #include "draco/compression/attributes/mesh_attribute_indices_encoding_data.h" | ||||
| #include "draco/compression/mesh/mesh_edgebreaker_decoder_impl_interface.h" | #include "draco/compression/mesh/mesh_edgebreaker_decoder_impl_interface.h" | ||||
| #include "draco/compression/mesh/mesh_edgebreaker_shared.h" | #include "draco/compression/mesh/mesh_edgebreaker_shared.h" | ||||
| #include "draco/compression/mesh/traverser/mesh_traversal_sequencer.h" | |||||
| #include "draco/core/decoder_buffer.h" | #include "draco/core/decoder_buffer.h" | ||||
| #include "draco/draco_features.h" | |||||
| #include "draco/mesh/corner_table.h" | #include "draco/mesh/corner_table.h" | ||||
| #include "draco/mesh/mesh_attribute_corner_table.h" | #include "draco/mesh/mesh_attribute_corner_table.h" | ||||
| namespace draco { | namespace draco { | ||||
| // Implementation of the edgebreaker decoder that decodes data encoded with the | // Implementation of the edgebreaker decoder that decodes data encoded with the | ||||
| // MeshEdgebreakerEncoderImpl class. The implementation of the decoder is based | // MeshEdgebreakerEncoderImpl class. The implementation of the decoder is based | ||||
| // on the algorithm presented in Isenburg et al'02 "Spirale Reversi: Reverse | // on the algorithm presented in Isenburg et al'02 "Spirale Reversi: Reverse | ||||
| ▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | private: | ||||
| // Returns true if the current symbol was part of a topology split event. This | // Returns true if the current symbol was part of a topology split event. This | ||||
| // means that the current face was connected to the left edge of a face | // means that the current face was connected to the left edge of a face | ||||
| // encoded with the TOPOLOGY_S symbol. |out_symbol_edge| can be used to | // encoded with the TOPOLOGY_S symbol. |out_symbol_edge| can be used to | ||||
| // identify which edge of the source symbol was connected to the TOPOLOGY_S | // identify which edge of the source symbol was connected to the TOPOLOGY_S | ||||
| // symbol. | // symbol. | ||||
| bool IsTopologySplit(int encoder_symbol_id, EdgeFaceName *out_face_edge, | bool IsTopologySplit(int encoder_symbol_id, EdgeFaceName *out_face_edge, | ||||
| int *out_encoder_split_symbol_id) { | int *out_encoder_split_symbol_id) { | ||||
| if (topology_split_data_.size() == 0) | if (topology_split_data_.size() == 0) { | ||||
| return false; | return false; | ||||
| } | |||||
| if (topology_split_data_.back().source_symbol_id > | if (topology_split_data_.back().source_symbol_id > | ||||
| static_cast<uint32_t>(encoder_symbol_id)) { | static_cast<uint32_t>(encoder_symbol_id)) { | ||||
| // Something is wrong; if the desired source symbol is greater than the | // Something is wrong; if the desired source symbol is greater than the | ||||
| // current encoder_symbol_id, we missed it, or the input was tampered | // current encoder_symbol_id, we missed it, or the input was tampered | ||||
| // (|encoder_symbol_id| keeps decreasing). | // (|encoder_symbol_id| keeps decreasing). | ||||
| // Return invalid symbol id to notify the decoder that there was an | // Return invalid symbol id to notify the decoder that there was an | ||||
| // error. | // error. | ||||
| *out_encoder_split_symbol_id = -1; | *out_encoder_split_symbol_id = -1; | ||||
| return true; | return true; | ||||
| } | } | ||||
| if (topology_split_data_.back().source_symbol_id != encoder_symbol_id) | if (topology_split_data_.back().source_symbol_id != encoder_symbol_id) { | ||||
| return false; | return false; | ||||
| } | |||||
| *out_face_edge = | *out_face_edge = | ||||
| static_cast<EdgeFaceName>(topology_split_data_.back().source_edge); | static_cast<EdgeFaceName>(topology_split_data_.back().source_edge); | ||||
| *out_encoder_split_symbol_id = topology_split_data_.back().split_symbol_id; | *out_encoder_split_symbol_id = topology_split_data_.back().split_symbol_id; | ||||
| // Remove the latest split event. | // Remove the latest split event. | ||||
| topology_split_data_.pop_back(); | topology_split_data_.pop_back(); | ||||
| return true; | return true; | ||||
| } | } | ||||
| // Decodes event data for hole and topology split events and stores them for | // Decodes event data for hole and topology split events and stores them for | ||||
| // future use. | // future use. | ||||
| // Returns the number of parsed bytes, or -1 on error. | // Returns the number of parsed bytes, or -1 on error. | ||||
| int32_t DecodeHoleAndTopologySplitEvents(DecoderBuffer *decoder_buffer); | int32_t DecodeHoleAndTopologySplitEvents(DecoderBuffer *decoder_buffer); | ||||
| // Decodes all non-position attribute connectivity on the currently | // Decodes all non-position attribute connectivity on the currently | ||||
| // processed face. | // processed face. | ||||
| #ifdef DRACO_BACKWARDS_COMPATIBILITY_SUPPORTED | #ifdef DRACO_BACKWARDS_COMPATIBILITY_SUPPORTED | ||||
| bool DecodeAttributeConnectivitiesOnFaceLegacy(CornerIndex corner); | bool DecodeAttributeConnectivitiesOnFaceLegacy(CornerIndex corner); | ||||
| #endif | #endif | ||||
| bool DecodeAttributeConnectivitiesOnFace(CornerIndex corner); | bool DecodeAttributeConnectivitiesOnFace(CornerIndex corner); | ||||
| // Initializes mapping between corners and point ids. | // Initializes mapping between corners and point ids. | ||||
| bool AssignPointsToCorners(int num_connectivity_verts); | bool AssignPointsToCorners(int num_connectivity_verts); | ||||
| bool IsFaceVisited(CornerIndex corner_id) const { | bool IsFaceVisited(CornerIndex corner_id) const { | ||||
| if (corner_id < 0) | if (corner_id < 0) { | ||||
| return true; // Invalid corner signalizes that the face does not exist. | return true; // Invalid corner signalizes that the face does not exist. | ||||
| } | |||||
| return visited_faces_[corner_table_->Face(corner_id).value()]; | return visited_faces_[corner_table_->Face(corner_id).value()]; | ||||
| } | } | ||||
| void SetOppositeCorners(CornerIndex corner_0, CornerIndex corner_1) { | void SetOppositeCorners(CornerIndex corner_0, CornerIndex corner_1) { | ||||
| corner_table_->SetOppositeCorner(corner_0, corner_1); | corner_table_->SetOppositeCorner(corner_0, corner_1); | ||||
| corner_table_->SetOppositeCorner(corner_1, corner_0); | corner_table_->SetOppositeCorner(corner_1, corner_0); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines | |||||