/src/draco/src/draco/compression/mesh/mesh_edgebreaker_decoder.cc
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright 2016 The Draco Authors. |
2 | | // |
3 | | // Licensed under the Apache License, Version 2.0 (the "License"); |
4 | | // you may not use this file except in compliance with the License. |
5 | | // You may obtain a copy of the License at |
6 | | // |
7 | | // http://www.apache.org/licenses/LICENSE-2.0 |
8 | | // |
9 | | // Unless required by applicable law or agreed to in writing, software |
10 | | // distributed under the License is distributed on an "AS IS" BASIS, |
11 | | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | | // See the License for the specific language governing permissions and |
13 | | // limitations under the License. |
14 | | // |
15 | | #include "draco/compression/mesh/mesh_edgebreaker_decoder.h" |
16 | | |
17 | | #include "draco/compression/mesh/mesh_edgebreaker_decoder_impl.h" |
18 | | #include "draco/compression/mesh/mesh_edgebreaker_traversal_predictive_decoder.h" |
19 | | #include "draco/compression/mesh/mesh_edgebreaker_traversal_valence_decoder.h" |
20 | | |
21 | | namespace draco { |
22 | | |
23 | 398 | MeshEdgebreakerDecoder::MeshEdgebreakerDecoder() {} |
24 | | |
25 | 167 | bool MeshEdgebreakerDecoder::CreateAttributesDecoder(int32_t att_decoder_id) { |
26 | 167 | return impl_->CreateAttributesDecoder(att_decoder_id); |
27 | 167 | } |
28 | | |
29 | 343 | bool MeshEdgebreakerDecoder::InitializeDecoder() { |
30 | 343 | uint8_t traversal_decoder_type; |
31 | 343 | if (!buffer()->Decode(&traversal_decoder_type)) { |
32 | 0 | return false; |
33 | 0 | } |
34 | 343 | impl_ = nullptr; |
35 | 343 | if (traversal_decoder_type == MESH_EDGEBREAKER_STANDARD_ENCODING) { |
36 | 166 | #ifdef DRACO_STANDARD_EDGEBREAKER_SUPPORTED |
37 | 166 | impl_ = std::unique_ptr<MeshEdgebreakerDecoderImplInterface>( |
38 | 166 | new MeshEdgebreakerDecoderImpl<MeshEdgebreakerTraversalDecoder>()); |
39 | 166 | #endif |
40 | 177 | } else if (traversal_decoder_type == MESH_EDGEBREAKER_PREDICTIVE_ENCODING) { |
41 | 76 | #ifdef DRACO_BACKWARDS_COMPATIBILITY_SUPPORTED |
42 | 76 | #ifdef DRACO_PREDICTIVE_EDGEBREAKER_SUPPORTED |
43 | 76 | impl_ = std::unique_ptr<MeshEdgebreakerDecoderImplInterface>( |
44 | 76 | new MeshEdgebreakerDecoderImpl< |
45 | 76 | MeshEdgebreakerTraversalPredictiveDecoder>()); |
46 | 76 | #endif |
47 | 76 | #endif |
48 | 101 | } else if (traversal_decoder_type == MESH_EDGEBREAKER_VALENCE_ENCODING) { |
49 | 101 | impl_ = std::unique_ptr<MeshEdgebreakerDecoderImplInterface>( |
50 | 101 | new MeshEdgebreakerDecoderImpl< |
51 | 101 | MeshEdgebreakerTraversalValenceDecoder>()); |
52 | 101 | } |
53 | 343 | if (!impl_) { |
54 | 0 | return false; |
55 | 0 | } |
56 | 343 | if (!impl_->Init(this)) { |
57 | 0 | return false; |
58 | 0 | } |
59 | 343 | return true; |
60 | 343 | } |
61 | | |
62 | 343 | bool MeshEdgebreakerDecoder::DecodeConnectivity() { |
63 | 343 | return impl_->DecodeConnectivity(); |
64 | 343 | } |
65 | | |
66 | 16 | bool MeshEdgebreakerDecoder::OnAttributesDecoded() { |
67 | 16 | return impl_->OnAttributesDecoded(); |
68 | 16 | } |
69 | | |
70 | | } // namespace draco |