Differential D9642 Diff 31337 extern/draco/draco/src/draco/compression/mesh/mesh_sequential_encoder.cc
Changeset View
Changeset View
Standalone View
Standalone View
extern/draco/draco/src/draco/compression/mesh/mesh_sequential_encoder.cc
- This file was moved from extern/draco/dracoenc/src/draco/compression/mesh/mesh_sequential_encoder.cc.
| Show All 31 Lines | Status MeshSequentialEncoder::EncodeConnectivity() { | ||||
| EncodeVarint(static_cast<uint32_t>(mesh()->num_points()), buffer()); | EncodeVarint(static_cast<uint32_t>(mesh()->num_points()), buffer()); | ||||
| // We encode all attributes in the original (possibly duplicated) format. | // We encode all attributes in the original (possibly duplicated) format. | ||||
| // TODO(ostava): This may not be optimal if we have only one attribute or if | // TODO(ostava): This may not be optimal if we have only one attribute or if | ||||
| // all attributes share the same index mapping. | // all attributes share the same index mapping. | ||||
| if (options()->GetGlobalBool("compress_connectivity", false)) { | if (options()->GetGlobalBool("compress_connectivity", false)) { | ||||
| // 0 = Encode compressed indices. | // 0 = Encode compressed indices. | ||||
| buffer()->Encode(static_cast<uint8_t>(0)); | buffer()->Encode(static_cast<uint8_t>(0)); | ||||
| if (!CompressAndEncodeIndices()) | if (!CompressAndEncodeIndices()) { | ||||
| return Status(Status::DRACO_ERROR, "Failed to compress connectivity."); | return Status(Status::DRACO_ERROR, "Failed to compress connectivity."); | ||||
| } | |||||
| } else { | } else { | ||||
| // 1 = Encode indices directly. | // 1 = Encode indices directly. | ||||
| buffer()->Encode(static_cast<uint8_t>(1)); | buffer()->Encode(static_cast<uint8_t>(1)); | ||||
| // Store vertex indices using a smallest data type that fits their range. | // Store vertex indices using a smallest data type that fits their range. | ||||
| // TODO(ostava): This can be potentially improved by using a tighter | // TODO(ostava): This can be potentially improved by using a tighter | ||||
| // fit that is not bound by a bit-length of any particular data type. | // fit that is not bound by a bit-length of any particular data type. | ||||
| if (mesh()->num_points() < 256) { | if (mesh()->num_points() < 256) { | ||||
| // Serialize indices as uint8_t. | // Serialize indices as uint8_t. | ||||
| ▲ Show 20 Lines • Show All 82 Lines • Show Last 20 Lines | |||||