GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
prediction_scheme_factory.h
Go to the documentation of this file.
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// Functions for creating prediction schemes from a provided prediction method
16// name. The functions in this file can create only basic prediction schemes
17// that don't require any encoder or decoder specific data. To create more
18// sophisticated prediction schemes, use functions from either
19// prediction_scheme_encoder_factory.h or,
20// prediction_scheme_decoder_factory.h.
21
22#ifndef DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_FACTORY_H_
23#define DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_FACTORY_H_
24
29
30namespace draco {
31
32template <class EncodingDataSourceT, class PredictionSchemeT,
33 class MeshPredictionSchemeFactoryT>
34std::unique_ptr<PredictionSchemeT> CreateMeshPredictionScheme(
35 const EncodingDataSourceT *source, PredictionSchemeMethod method,
36 int att_id, const typename PredictionSchemeT::Transform &transform,
37 uint16_t bitstream_version) {
38 const PointAttribute *const att = source->point_cloud()->attribute(att_id);
39 if (source->GetGeometryType() == TRIANGULAR_MESH &&
46 const CornerTable *const ct = source->GetCornerTable();
47 const MeshAttributeIndicesEncodingData *const encoding_data =
48 source->GetAttributeEncodingData(att_id);
49 if (ct == nullptr || encoding_data == nullptr) {
50 // No connectivity data found.
51 return nullptr;
52 }
53 // Connectivity data exists.
54 const MeshAttributeCornerTable *const att_ct =
55 source->GetAttributeCornerTable(att_id);
56 if (att_ct != nullptr) {
58 MeshData md;
59 md.Set(source->mesh(), att_ct,
62 MeshPredictionSchemeFactoryT factory;
63 auto ret = factory(method, att, transform, md, bitstream_version);
64 if (ret) {
65 return ret;
66 }
67 } else {
69 MeshData md;
70 md.Set(source->mesh(), ct,
73 MeshPredictionSchemeFactoryT factory;
74 auto ret = factory(method, att, transform, md, bitstream_version);
75 if (ret) {
76 return ret;
77 }
78 }
79 }
80 return nullptr;
81}
82
83} // namespace draco
84
85#endif // DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_PREDICTION_SCHEME_FACTORY_H_
Definition corner_table.h:53
Definition mesh_attribute_corner_table.h:30
Definition mesh_prediction_scheme_data.h:26
void Set(const Mesh *mesh, const CornerTable *table, const std::vector< CornerIndex > *data_to_corner_map, const std::vector< int32_t > *vertex_to_data_map)
Definition mesh_prediction_scheme_data.h:35
Definition point_attribute.h:33
ret($return)
Definition mesh_login_result.php:5
Definition attribute_octahedron_transform.cc:21
@ TRIANGULAR_MESH
Definition compression_shared.h:44
std::unique_ptr< PredictionSchemeT > CreateMeshPredictionScheme(const EncodingDataSourceT *source, PredictionSchemeMethod method, int att_id, const typename PredictionSchemeT::Transform &transform, uint16_t bitstream_version)
Definition prediction_scheme_factory.h:34
PredictionSchemeMethod
Definition compression_shared.h:80
@ MESH_PREDICTION_PARALLELOGRAM
Definition compression_shared.h:86
@ MESH_PREDICTION_TEX_COORDS_DEPRECATED
Definition compression_shared.h:88
@ MESH_PREDICTION_CONSTRAINED_MULTI_PARALLELOGRAM
Definition compression_shared.h:89
@ MESH_PREDICTION_GEOMETRIC_NORMAL
Definition compression_shared.h:91
@ MESH_PREDICTION_TEX_COORDS_PORTABLE
Definition compression_shared.h:90
@ MESH_PREDICTION_MULTI_PARALLELOGRAM
Definition compression_shared.h:87
Definition mesh_attribute_indices_encoding_data.h:27
std::vector< CornerIndex > encoded_attribute_value_index_to_corner_map
Definition mesh_attribute_indices_encoding_data.h:44
std::vector< int32_t > vertex_to_encoded_attribute_value_index_map
Definition mesh_attribute_indices_encoding_data.h:50