GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
decode.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_DECODE_H_
16#define DRACO_COMPRESSION_DECODE_H_
17
23#include "draco/mesh/mesh.h"
24
25namespace draco {
26
27// Class responsible for decoding of meshes and point clouds that were
28// compressed by a Draco encoder.
29class Decoder {
30 public:
31 // Returns the geometry type encoded in the input |in_buffer|.
32 // The return value is one of POINT_CLOUD, MESH or INVALID_GEOMETRY in case
33 // the input data is invalid.
34 // The decoded geometry type can be used to choose an appropriate decoding
35 // function for a given geometry type (see below).
37 DecoderBuffer *in_buffer);
38
39 // Decodes point cloud from the provided buffer. The buffer must be filled
40 // with data that was encoded with either the EncodePointCloudToBuffer or
41 // EncodeMeshToBuffer methods in encode.h. In case the input buffer contains
42 // mesh, the returned instance can be down-casted to Mesh.
44 DecoderBuffer *in_buffer);
45
46 // Decodes a triangular mesh from the provided buffer. The mesh must be filled
47 // with data that was encoded using the EncodeMeshToBuffer method in encode.h.
48 // The function will return nullptr in case the input is invalid or if it was
49 // encoded with the EncodePointCloudToBuffer method.
51 DecoderBuffer *in_buffer);
52
53 // Decodes the buffer into a provided geometry. If the geometry is
54 // incompatible with the encoded data. For example, when |out_geometry| is
55 // draco::Mesh while the data contains a point cloud, the function will return
56 // an error status.
58 PointCloud *out_geometry);
59 Status DecodeBufferToGeometry(DecoderBuffer *in_buffer, Mesh *out_geometry);
60
61 // When set, the decoder is going to skip attribute transform for a given
62 // attribute type. For example for quantized attributes, the decoder would
63 // skip the dequantization step and the returned geometry would contain an
64 // attribute with quantized values. The attribute would also contain an
65 // instance of AttributeTransform class that is used to describe the skipped
66 // transform, including all parameters that are needed to perform the
67 // transform manually.
69
70 // Returns the options instance used by the decoder that can be used by users
71 // to control the decoding process.
72 DecoderOptions *options() { return &options_; }
73
74 private:
75 DecoderOptions options_;
76};
77
78} // namespace draco
79
80#endif // DRACO_COMPRESSION_DECODE_H_
Definition decoder_buffer.h:30
Definition decode.h:29
StatusOr< std::unique_ptr< PointCloud > > DecodePointCloudFromBuffer(DecoderBuffer *in_buffer)
Definition decode.cc:66
Status DecodeBufferToGeometry(DecoderBuffer *in_buffer, PointCloud *out_geometry)
Definition decode.cc:93
static StatusOr< EncodedGeometryType > GetEncodedGeometryType(DecoderBuffer *in_buffer)
Definition decode.cc:55
void SetSkipAttributeTransform(GeometryAttribute::Type att_type)
Definition decode.cc:131
StatusOr< std::unique_ptr< Mesh > > DecodeMeshFromBuffer(DecoderBuffer *in_buffer)
Definition decode.cc:86
DecoderOptions * options()
Definition decode.h:72
Type
Definition geometry_attribute.h:46
Definition mesh.h:52
Definition point_cloud.h:29
Definition status_or.h:30
Definition status.h:25
Definition attribute_octahedron_transform.cc:21
DracoOptions< GeometryAttribute::Type > DecoderOptions
Definition decoder_options.h:30