GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
mesh_features.h
Go to the documentation of this file.
1// Copyright 2022 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_MESH_MESH_FEATURES_H_
16#define DRACO_MESH_MESH_FEATURES_H_
17
19
20#ifdef DRACO_TRANSCODER_SUPPORTED
21#include <string>
22#include <vector>
23
26
27namespace draco {
28
29// Describes a mesh feature ID set according to the EXT_mesh_features glTF
30// extension. Feature IDs are either associated with geometry vertices or with
31// texture pixels and stored in a geometry attribute or in texture channels,
32// respectively. Optionally, the feature ID set may be associated with a
33// property table defined in the EXT_structural_metadata glTF extension.
34class MeshFeatures {
35 public:
36 // Creates an empty feature ID set that is associated neither with vertices,
37 // nor with texture pixels, nor with property tables.
38 MeshFeatures();
39
40 // Copies all data from |src| mesh feature ID set.
41 void Copy(const MeshFeatures &src);
42
43 // Label assigned to this feature ID set.
44 void SetLabel(const std::string &label);
45 const std::string &GetLabel() const;
46
47 // The number of unique features in this feature ID set.
48 void SetFeatureCount(int feature_count);
49 int GetFeatureCount() const;
50
51 // Non-negative null feature ID value indicating the absence of an associated
52 // feature. The value of -1 indicates that the null feature ID is not set.
53 void SetNullFeatureId(int null_feature_id);
54 int GetNullFeatureId() const;
55
56 // Index of the feature ID vertex attribute, e.g., 5 for an attribute named
57 // _FEATURE_ID_5, or -1 if the feature ID is not associated with vertices.
58 void SetAttributeIndex(int attribute_index);
59 int GetAttributeIndex() const;
60
61 // Feature ID texture map and texture channels containing feature IDs
62 // associated with texture pixels. Only used when |attribute_index_| is -1.
63 // The RGBA channels are numbered from 0 to 3. See the glTF extension
64 // documentation for reconstruction of feature ID from the channel values.
65 void SetTextureMap(const TextureMap &texture_map);
66 void SetTextureMap(Texture *texture, int tex_coord_index);
67 const TextureMap &GetTextureMap() const;
68 TextureMap &GetTextureMap();
69 void SetTextureChannels(const std::vector<int> &texture_channels);
70 const std::vector<int> &GetTextureChannels() const;
71 std::vector<int> &GetTextureChannels();
72
73 // Non-negative index of the property table this feature ID set is associated
74 // with. Property tables are defined in the EXT_structural_metadata glTF
75 // extension. The value of -1 indicates that this feature ID set is not
76 // associated with any property tables.
77 void SetPropertyTableIndex(int property_table_index);
78 int GetPropertyTableIndex() const;
79
80 private:
81 std::string label_;
82 int feature_count_;
83 int null_feature_id_;
84 int attribute_index_;
85 TextureMap texture_map_;
86 std::vector<int> texture_channels_;
87 int property_table_index_;
88};
89
90} // namespace draco
91
92#endif // DRACO_TRANSCODER_SUPPORTED
93#endif // DRACO_MESH_MESH_FEATURES_H_
tag src
Definition meshpage.php:1786
Definition attribute_octahedron_transform.cc:21