Differential D9642 Diff 31357 extern/draco/draco/src/draco/compression/mesh/traverser/depth_first_traverser.h
Changeset View
Changeset View
Standalone View
Standalone View
extern/draco/draco/src/draco/compression/mesh/traverser/depth_first_traverser.h
- This file was moved from extern/draco/dracoenc/src/draco/compression/mesh/traverser/depth_first_traverser.h.
| Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | public: | ||||
| // Called before any traversing starts. | // Called before any traversing starts. | ||||
| void OnTraversalStart() {} | void OnTraversalStart() {} | ||||
| // Called when all the traversing is done. | // Called when all the traversing is done. | ||||
| void OnTraversalEnd() {} | void OnTraversalEnd() {} | ||||
| bool TraverseFromCorner(CornerIndex corner_id) { | bool TraverseFromCorner(CornerIndex corner_id) { | ||||
| if (this->IsFaceVisited(corner_id)) | if (this->IsFaceVisited(corner_id)) { | ||||
| return true; // Already traversed. | return true; // Already traversed. | ||||
| } | |||||
| corner_traversal_stack_.clear(); | corner_traversal_stack_.clear(); | ||||
| corner_traversal_stack_.push_back(corner_id); | corner_traversal_stack_.push_back(corner_id); | ||||
| // For the first face, check the remaining corners as they may not be | // For the first face, check the remaining corners as they may not be | ||||
| // processed yet. | // processed yet. | ||||
| const VertexIndex next_vert = | const VertexIndex next_vert = | ||||
| this->corner_table()->Vertex(this->corner_table()->Next(corner_id)); | this->corner_table()->Vertex(this->corner_table()->Next(corner_id)); | ||||
| const VertexIndex prev_vert = | const VertexIndex prev_vert = | ||||
| this->corner_table()->Vertex(this->corner_table()->Previous(corner_id)); | this->corner_table()->Vertex(this->corner_table()->Previous(corner_id)); | ||||
| if (next_vert == kInvalidVertexIndex || prev_vert == kInvalidVertexIndex) | if (next_vert == kInvalidVertexIndex || prev_vert == kInvalidVertexIndex) { | ||||
| return false; | return false; | ||||
| } | |||||
| if (!this->IsVertexVisited(next_vert)) { | if (!this->IsVertexVisited(next_vert)) { | ||||
| this->MarkVertexVisited(next_vert); | this->MarkVertexVisited(next_vert); | ||||
| this->traversal_observer().OnNewVertexVisited( | this->traversal_observer().OnNewVertexVisited( | ||||
| next_vert, this->corner_table()->Next(corner_id)); | next_vert, this->corner_table()->Next(corner_id)); | ||||
| } | } | ||||
| if (!this->IsVertexVisited(prev_vert)) { | if (!this->IsVertexVisited(prev_vert)) { | ||||
| this->MarkVertexVisited(prev_vert); | this->MarkVertexVisited(prev_vert); | ||||
| this->traversal_observer().OnNewVertexVisited( | this->traversal_observer().OnNewVertexVisited( | ||||
| Show All 10 Lines | while (!corner_traversal_stack_.empty()) { | ||||
| // This face has been already traversed. | // This face has been already traversed. | ||||
| corner_traversal_stack_.pop_back(); | corner_traversal_stack_.pop_back(); | ||||
| continue; | continue; | ||||
| } | } | ||||
| while (true) { | while (true) { | ||||
| this->MarkFaceVisited(face_id); | this->MarkFaceVisited(face_id); | ||||
| this->traversal_observer().OnNewFaceVisited(face_id); | this->traversal_observer().OnNewFaceVisited(face_id); | ||||
| const VertexIndex vert_id = this->corner_table()->Vertex(corner_id); | const VertexIndex vert_id = this->corner_table()->Vertex(corner_id); | ||||
| if (vert_id == kInvalidVertexIndex) | if (vert_id == kInvalidVertexIndex) { | ||||
| return false; | return false; | ||||
| } | |||||
| if (!this->IsVertexVisited(vert_id)) { | if (!this->IsVertexVisited(vert_id)) { | ||||
| const bool on_boundary = this->corner_table()->IsOnBoundary(vert_id); | const bool on_boundary = this->corner_table()->IsOnBoundary(vert_id); | ||||
| this->MarkVertexVisited(vert_id); | this->MarkVertexVisited(vert_id); | ||||
| this->traversal_observer().OnNewVertexVisited(vert_id, corner_id); | this->traversal_observer().OnNewVertexVisited(vert_id, corner_id); | ||||
| if (!on_boundary) { | if (!on_boundary) { | ||||
| corner_id = this->corner_table()->GetRightCorner(corner_id); | corner_id = this->corner_table()->GetRightCorner(corner_id); | ||||
| face_id = FaceIndex(corner_id.value() / 3); | face_id = FaceIndex(corner_id.value() / 3); | ||||
| continue; | continue; | ||||
| ▲ Show 20 Lines • Show All 61 Lines • Show Last 20 Lines | |||||