GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
mesh_encoder.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_MESH_MESH_ENCODER_H_
16#define DRACO_COMPRESSION_MESH_MESH_ENCODER_H_
17
20#include "draco/mesh/mesh.h"
22
23namespace draco {
24
25// Abstract base class for all mesh encoders. It provides some basic
26// functionality that's shared between different encoders.
28 public:
30
31 // Sets the mesh that is going be encoded. Must be called before the Encode()
32 // method.
33 void SetMesh(const Mesh &m);
34
36 return TRIANGULAR_MESH;
37 }
38
39 // Returns the number of faces that were encoded during the last Encode().
40 // function call. Valid only if "store_number_of_encoded_faces" flag was set
41 // in the provided EncoderOptions.
42 size_t num_encoded_faces() const { return num_encoded_faces_; }
43
44 // Returns the base connectivity of the encoded mesh (or nullptr if it is not
45 // initialized).
46 virtual const CornerTable *GetCornerTable() const { return nullptr; }
47
48 // Returns the attribute connectivity data or nullptr if it does not exist.
50 int /* att_id */) const {
51 return nullptr;
52 }
53
54 // Returns the encoding data for a given attribute or nullptr when the data
55 // does not exist.
57 int /* att_id */) const {
58 return nullptr;
59 }
60
61 const Mesh *mesh() const { return mesh_; }
62
63 protected:
64 Status EncodeGeometryData() override;
65
66 // Needs to be implemented by the derived classes.
68
69 // Computes and sets the num_encoded_faces_ for the encoder.
70 virtual void ComputeNumberOfEncodedFaces() = 0;
71
72 void set_mesh(const Mesh *mesh) { mesh_ = mesh; }
73 void set_num_encoded_faces(size_t num_faces) {
74 num_encoded_faces_ = num_faces;
75 }
76
77 private:
78 const Mesh *mesh_;
79 size_t num_encoded_faces_;
80};
81
82} // namespace draco
83
84#endif // DRACO_COMPRESSION_MESH_MESH_ENCODER_H_
Definition corner_table.h:53
Definition mesh_attribute_corner_table.h:30
const Mesh * mesh() const
Definition mesh_encoder.h:61
virtual const MeshAttributeIndicesEncodingData * GetAttributeEncodingData(int) const
Definition mesh_encoder.h:56
size_t num_encoded_faces() const
Definition mesh_encoder.h:42
virtual void ComputeNumberOfEncodedFaces()=0
MeshEncoder()
Definition mesh_encoder.cc:21
void set_num_encoded_faces(size_t num_faces)
Definition mesh_encoder.h:73
EncodedGeometryType GetGeometryType() const override
Definition mesh_encoder.h:35
virtual const MeshAttributeCornerTable * GetAttributeCornerTable(int) const
Definition mesh_encoder.h:49
void SetMesh(const Mesh &m)
Definition mesh_encoder.cc:23
virtual Status EncodeConnectivity()=0
virtual const CornerTable * GetCornerTable() const
Definition mesh_encoder.h:46
Status EncodeGeometryData() override
Definition mesh_encoder.cc:28
void set_mesh(const Mesh *mesh)
Definition mesh_encoder.h:72
Definition mesh.h:52
PointCloudEncoder()
Definition point_cloud_encoder.cc:23
Definition status.h:25
Definition attribute_octahedron_transform.cc:21
EncodedGeometryType
Definition compression_shared.h:41
@ TRIANGULAR_MESH
Definition compression_shared.h:44
Definition mesh_attribute_indices_encoding_data.h:27