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 #ifndef DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_MESH_PREDICTION_SCHEME_DATA_H_ 16 #define DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_MESH_PREDICTION_SCHEME_DATA_H_ 17 18 #include "draco/mesh/corner_table.h" 19 #include "draco/mesh/mesh.h" 20 21 namespace draco { 22 23 // Class stores data about the connectivity data of the mesh and information 24 // about how the connectivity was encoded/decoded. 25 template <class CornerTableT> 26 class MeshPredictionSchemeData { 27 public: 28 typedef CornerTableT CornerTable; MeshPredictionSchemeData()29 MeshPredictionSchemeData() 30 : mesh_(nullptr), 31 corner_table_(nullptr), 32 vertex_to_data_map_(nullptr), 33 data_to_corner_map_(nullptr) {} 34 Set(const Mesh * mesh,const CornerTable * table,const std::vector<CornerIndex> * data_to_corner_map,const std::vector<int32_t> * vertex_to_data_map)35 void Set(const Mesh *mesh, const CornerTable *table, 36 const std::vector<CornerIndex> *data_to_corner_map, 37 const std::vector<int32_t> *vertex_to_data_map) { 38 mesh_ = mesh; 39 corner_table_ = table; 40 data_to_corner_map_ = data_to_corner_map; 41 vertex_to_data_map_ = vertex_to_data_map; 42 } 43 mesh()44 const Mesh *mesh() const { return mesh_; } corner_table()45 const CornerTable *corner_table() const { return corner_table_; } vertex_to_data_map()46 const std::vector<int32_t> *vertex_to_data_map() const { 47 return vertex_to_data_map_; 48 } data_to_corner_map()49 const std::vector<CornerIndex> *data_to_corner_map() const { 50 return data_to_corner_map_; 51 } IsInitialized()52 bool IsInitialized() const { 53 return mesh_ != nullptr && corner_table_ != nullptr && 54 vertex_to_data_map_ != nullptr && data_to_corner_map_ != nullptr; 55 } 56 57 private: 58 const Mesh *mesh_; 59 const CornerTable *corner_table_; 60 61 // Mapping between vertices and their encoding order. I.e. when an attribute 62 // entry on a given vertex was encoded. 63 const std::vector<int32_t> *vertex_to_data_map_; 64 65 // Array that stores which corner was processed when a given attribute entry 66 // was encoded or decoded. 67 const std::vector<CornerIndex> *data_to_corner_map_; 68 }; 69 70 } // namespace draco 71 72 #endif // DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_MESH_PREDICTION_SCHEME_DATA_H_ 73