Differential D9642 Diff 31357 extern/draco/draco/src/draco/compression/mesh/mesh_edgebreaker_traversal_valence_encoder.h
Changeset View
Changeset View
Standalone View
Standalone View
extern/draco/draco/src/draco/compression/mesh/mesh_edgebreaker_traversal_valence_encoder.h
- This file was moved from extern/draco/dracoenc/src/draco/compression/mesh/mesh_edgebreaker_traversal_valence_encoder.h.
| Show All 37 Lines | MeshEdgebreakerTraversalValenceEncoder() | ||||
| : corner_table_(nullptr), | : corner_table_(nullptr), | ||||
| prev_symbol_(-1), | prev_symbol_(-1), | ||||
| last_corner_(kInvalidCornerIndex), | last_corner_(kInvalidCornerIndex), | ||||
| num_symbols_(0), | num_symbols_(0), | ||||
| min_valence_(2), | min_valence_(2), | ||||
| max_valence_(7) {} | max_valence_(7) {} | ||||
| bool Init(MeshEdgebreakerEncoderImplInterface *encoder) { | bool Init(MeshEdgebreakerEncoderImplInterface *encoder) { | ||||
| if (!MeshEdgebreakerTraversalEncoder::Init(encoder)) | if (!MeshEdgebreakerTraversalEncoder::Init(encoder)) { | ||||
| return false; | return false; | ||||
| } | |||||
| min_valence_ = 2; | min_valence_ = 2; | ||||
| max_valence_ = 7; | max_valence_ = 7; | ||||
| corner_table_ = encoder->GetCornerTable(); | corner_table_ = encoder->GetCornerTable(); | ||||
| // Initialize valences of all vertices. | // Initialize valences of all vertices. | ||||
| vertex_valences_.resize(corner_table_->num_vertices()); | vertex_valences_.resize(corner_table_->num_vertices()); | ||||
| for (VertexIndex i(0); i < static_cast<uint32_t>(vertex_valences_.size()); | for (VertexIndex i(0); i < static_cast<uint32_t>(vertex_valences_.size()); | ||||
| ++i) { | ++i) { | ||||
| ▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | switch (symbol) { | ||||
| // *.......* | // *.......* | ||||
| // | // | ||||
| // Count the number of faces on the left side of the split vertex and | // Count the number of faces on the left side of the split vertex and | ||||
| // update the valence on the "left vertex". | // update the valence on the "left vertex". | ||||
| int num_left_faces = 0; | int num_left_faces = 0; | ||||
| CornerIndex act_c = corner_table_->Opposite(prev); | CornerIndex act_c = corner_table_->Opposite(prev); | ||||
| while (act_c != kInvalidCornerIndex) { | while (act_c != kInvalidCornerIndex) { | ||||
| if (encoder_impl()->IsFaceEncoded(corner_table_->Face(act_c))) | if (encoder_impl()->IsFaceEncoded(corner_table_->Face(act_c))) { | ||||
| break; // Stop when we reach the first visited face. | break; // Stop when we reach the first visited face. | ||||
| } | |||||
| ++num_left_faces; | ++num_left_faces; | ||||
| act_c = corner_table_->Opposite(corner_table_->Next(act_c)); | act_c = corner_table_->Opposite(corner_table_->Next(act_c)); | ||||
| } | } | ||||
| vertex_valences_[corner_to_vertex_map_[last_corner_]] = | vertex_valences_[corner_to_vertex_map_[last_corner_]] = | ||||
| num_left_faces + 1; | num_left_faces + 1; | ||||
| // Create a new vertex for the right side and count the number of | // Create a new vertex for the right side and count the number of | ||||
| // faces that should be attached to this vertex. | // faces that should be attached to this vertex. | ||||
| const int new_vert_id = static_cast<int>(vertex_valences_.size()); | const int new_vert_id = static_cast<int>(vertex_valences_.size()); | ||||
| int num_right_faces = 0; | int num_right_faces = 0; | ||||
| act_c = corner_table_->Opposite(next); | act_c = corner_table_->Opposite(next); | ||||
| while (act_c != kInvalidCornerIndex) { | while (act_c != kInvalidCornerIndex) { | ||||
| if (encoder_impl()->IsFaceEncoded(corner_table_->Face(act_c))) | if (encoder_impl()->IsFaceEncoded(corner_table_->Face(act_c))) { | ||||
| break; // Stop when we reach the first visited face. | break; // Stop when we reach the first visited face. | ||||
| } | |||||
| ++num_right_faces; | ++num_right_faces; | ||||
| // Map corners on the right side to the newly created vertex. | // Map corners on the right side to the newly created vertex. | ||||
| corner_to_vertex_map_[corner_table_->Next(act_c)] = new_vert_id; | corner_to_vertex_map_[corner_table_->Next(act_c)] = new_vert_id; | ||||
| act_c = corner_table_->Opposite(corner_table_->Previous(act_c)); | act_c = corner_table_->Opposite(corner_table_->Previous(act_c)); | ||||
| } | } | ||||
| vertex_valences_.push_back(num_right_faces + 1); | vertex_valences_.push_back(num_right_faces + 1); | ||||
| } | } | ||||
| break; | break; | ||||
| ▲ Show 20 Lines • Show All 79 Lines • Show Last 20 Lines | |||||