GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
attribute_transform.h
Go to the documentation of this file.
1// Copyright 2017 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_ATTRIBUTES_ATTRIBUTE_TRANSFORM_H_
16#define DRACO_ATTRIBUTES_ATTRIBUTE_TRANSFORM_H_
17
22
23namespace draco {
24
25// Virtual base class for various attribute transforms, enforcing common
26// interface where possible.
28 public:
29 virtual ~AttributeTransform() = default;
30
31 // Return attribute transform type.
32 virtual AttributeTransformType Type() const = 0;
33 // Try to init transform from attribute.
34 virtual bool InitFromAttribute(const PointAttribute &attribute) = 0;
35 // Copy parameter values into the provided AttributeTransformData instance.
37 AttributeTransformData *out_data) const = 0;
38 bool TransferToAttribute(PointAttribute *attribute) const;
39
40 // Applies the transform to |attribute| and stores the result in
41 // |target_attribute|. |point_ids| is an optional vector that can be used to
42 // remap values during the transform.
43 virtual bool TransformAttribute(const PointAttribute &attribute,
44 const std::vector<PointIndex> &point_ids,
45 PointAttribute *target_attribute) = 0;
46
47 // Applies an inverse transform to |attribute| and stores the result in
48 // |target_attribute|. In this case, |attribute| is an attribute that was
49 // already transformed (e.g. quantized) and |target_attribute| is the
50 // attribute before the transformation.
51 virtual bool InverseTransformAttribute(const PointAttribute &attribute,
52 PointAttribute *target_attribute) = 0;
53
54 // Encodes all data needed by the transformation into the |encoder_buffer|.
55 virtual bool EncodeParameters(EncoderBuffer *encoder_buffer) const = 0;
56
57 // Decodes all data needed to transform |attribute| back to the original
58 // format.
59 virtual bool DecodeParameters(const PointAttribute &attribute,
60 DecoderBuffer *decoder_buffer) = 0;
61
62 // Initializes a transformed attribute that can be used as target in the
63 // TransformAttribute() function call.
64 virtual std::unique_ptr<PointAttribute> InitTransformedAttribute(
65 const PointAttribute &src_attribute, int num_entries);
66
67 protected:
69 const PointAttribute &attribute) const = 0;
71 const PointAttribute &attribute) const = 0;
72};
73
74} // namespace draco
75
76#endif // DRACO_ATTRIBUTES_ATTRIBUTE_OCTAHEDRON_TRANSFORM_H_
Definition attribute_transform_data.h:30
Definition attribute_transform.h:27
virtual bool TransformAttribute(const PointAttribute &attribute, const std::vector< PointIndex > &point_ids, PointAttribute *target_attribute)=0
virtual bool DecodeParameters(const PointAttribute &attribute, DecoderBuffer *decoder_buffer)=0
virtual ~AttributeTransform()=default
virtual DataType GetTransformedDataType(const PointAttribute &attribute) const =0
virtual bool InverseTransformAttribute(const PointAttribute &attribute, PointAttribute *target_attribute)=0
virtual int GetTransformedNumComponents(const PointAttribute &attribute) const =0
virtual bool InitFromAttribute(const PointAttribute &attribute)=0
virtual bool EncodeParameters(EncoderBuffer *encoder_buffer) const =0
virtual void CopyToAttributeTransformData(AttributeTransformData *out_data) const =0
bool TransferToAttribute(PointAttribute *attribute) const
Definition attribute_transform.cc:19
virtual std::unique_ptr< PointAttribute > InitTransformedAttribute(const PointAttribute &src_attribute, int num_entries)
Definition attribute_transform.cc:27
virtual AttributeTransformType Type() const =0
Definition decoder_buffer.h:30
Definition encoder_buffer.h:29
Definition point_attribute.h:33
Definition attribute_octahedron_transform.cc:21
AttributeTransformType
Definition attribute_transform_type.h:21
DataType
Definition draco_types.h:26