GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
points_sequencer.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#ifndef DRACO_COMPRESSION_ATTRIBUTES_POINTS_SEQUENCER_H_
16#define DRACO_COMPRESSION_ATTRIBUTES_POINTS_SEQUENCER_H_
17
18#include <vector>
19
21
22namespace draco {
23
24// Class for generating a sequence of point ids that can be used to encode
25// or decode attribute values in a specific order.
26// See sequential_attribute_encoders/decoders_controller.h for more details.
28 public:
29 PointsSequencer() : out_point_ids_(nullptr) {}
30 virtual ~PointsSequencer() = default;
31
32 // Fills the |out_point_ids| with the generated sequence of point ids.
33 bool GenerateSequence(std::vector<PointIndex> *out_point_ids) {
34 out_point_ids_ = out_point_ids;
36 }
37
38 // Appends a point to the sequence.
39 void AddPointId(PointIndex point_id) { out_point_ids_->push_back(point_id); }
40
41 // Sets the correct mapping between point ids and value ids. I.e., the inverse
42 // of the |out_point_ids|. In general, |out_point_ids_| does not contain
43 // sufficient information to compute the inverse map, because not all point
44 // ids are necessarily contained within the map.
45 // Must be implemented for sequencers that are used by attribute decoders.
47 return false;
48 }
49
50 protected:
51 // Method that needs to be implemented by the derived classes. The
52 // implementation is responsible for filling |out_point_ids_| with the valid
53 // sequence of point ids.
54 virtual bool GenerateSequenceInternal() = 0;
55 std::vector<PointIndex> *out_point_ids() const { return out_point_ids_; }
56
57 private:
58 std::vector<PointIndex> *out_point_ids_;
59};
60
61} // namespace draco
62
63#endif // DRACO_COMPRESSION_ATTRIBUTES_POINTS_SEQUENCER_H_
Definition point_attribute.h:33
std::vector< PointIndex > * out_point_ids() const
Definition points_sequencer.h:55
PointsSequencer()
Definition points_sequencer.h:29
bool GenerateSequence(std::vector< PointIndex > *out_point_ids)
Definition points_sequencer.h:33
virtual ~PointsSequencer()=default
void AddPointId(PointIndex point_id)
Definition points_sequencer.h:39
virtual bool UpdatePointToAttributeIndexMapping(PointAttribute *)
Definition points_sequencer.h:46
virtual bool GenerateSequenceInternal()=0
Definition attribute_octahedron_transform.cc:21
Definition GameApi_pl.cc:29382