GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
attribute_octahedron_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
16#ifndef DRACO_ATTRIBUTES_ATTRIBUTE_OCTAHEDRON_TRANSFORM_H_
17#define DRACO_ATTRIBUTES_ATTRIBUTE_OCTAHEDRON_TRANSFORM_H_
18
22
23namespace draco {
24
25// Attribute transform for attributes transformed to octahedral coordinates.
27 public:
28 AttributeOctahedronTransform() : quantization_bits_(-1) {}
29
30 // Return attribute transform type.
34 // Try to init transform from attribute.
35 bool InitFromAttribute(const PointAttribute &attribute) override;
36 // Copy parameter values into the provided AttributeTransformData instance.
38 AttributeTransformData *out_data) const override;
39
40 bool TransformAttribute(const PointAttribute &attribute,
41 const std::vector<PointIndex> &point_ids,
42 PointAttribute *target_attribute) override;
43
44 bool InverseTransformAttribute(const PointAttribute &attribute,
45 PointAttribute *target_attribute) override;
46
47 // Set number of quantization bits.
49
50 // Encode relevant parameters into buffer.
51 bool EncodeParameters(EncoderBuffer *encoder_buffer) const override;
52
53 bool DecodeParameters(const PointAttribute &attribute,
54 DecoderBuffer *decoder_buffer) override;
55
56 bool is_initialized() const { return quantization_bits_ != -1; }
57 int32_t quantization_bits() const { return quantization_bits_; }
58
59 protected:
61 const PointAttribute &attribute) const override {
62 return DT_UINT32;
63 }
65 const PointAttribute &attribute) const override {
66 return 2;
67 }
68
69 // Perform the actual transformation.
70 bool GeneratePortableAttribute(const PointAttribute &attribute,
71 const std::vector<PointIndex> &point_ids,
72 int num_points,
73 PointAttribute *target_attribute) const;
74
75 private:
76 int32_t quantization_bits_;
77};
78
79} // namespace draco
80
81#endif // DRACO_ATTRIBUTES_ATTRIBUTE_OCTAHEDRON_TRANSFORM_H_
DataType GetTransformedDataType(const PointAttribute &attribute) const override
Definition attribute_octahedron_transform.h:60
AttributeTransformType Type() const override
Definition attribute_octahedron_transform.h:31
int32_t quantization_bits() const
Definition attribute_octahedron_transform.h:57
bool InitFromAttribute(const PointAttribute &attribute) override
Definition attribute_octahedron_transform.cc:23
bool GeneratePortableAttribute(const PointAttribute &attribute, const std::vector< PointIndex > &point_ids, int num_points, PointAttribute *target_attribute) const
Definition attribute_octahedron_transform.cc:104
AttributeOctahedronTransform()
Definition attribute_octahedron_transform.h:28
void CopyToAttributeTransformData(AttributeTransformData *out_data) const override
Definition attribute_octahedron_transform.cc:35
bool TransformAttribute(const PointAttribute &attribute, const std::vector< PointIndex > &point_ids, PointAttribute *target_attribute) override
Definition attribute_octahedron_transform.cc:41
bool EncodeParameters(EncoderBuffer *encoder_buffer) const override
Definition attribute_octahedron_transform.cc:85
int GetTransformedNumComponents(const PointAttribute &attribute) const override
Definition attribute_octahedron_transform.h:64
void SetParameters(int quantization_bits)
Definition attribute_octahedron_transform.cc:81
bool InverseTransformAttribute(const PointAttribute &attribute, PointAttribute *target_attribute) override
Definition attribute_octahedron_transform.cc:48
bool is_initialized() const
Definition attribute_octahedron_transform.h:56
bool DecodeParameters(const PointAttribute &attribute, DecoderBuffer *decoder_buffer) override
Definition attribute_octahedron_transform.cc:94
Definition attribute_transform_data.h:30
Definition attribute_transform.h:27
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
@ ATTRIBUTE_OCTAHEDRON_TRANSFORM
Definition attribute_transform_type.h:25
DataType
Definition draco_types.h:26
@ DT_UINT32
Definition draco_types.h:34