Differential D9642 Diff 31357 extern/draco/draco/src/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_encoder.h
Changeset View
Changeset View
Standalone View
Standalone View
extern/draco/draco/src/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_encoder.h
- This file was moved from extern/draco/dracoenc/src/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_encoder.h.
| Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | public: | ||||
| bool EncodePredictionData(EncoderBuffer *buffer) override; | bool EncodePredictionData(EncoderBuffer *buffer) override; | ||||
| PredictionSchemeMethod GetPredictionMethod() const override { | PredictionSchemeMethod GetPredictionMethod() const override { | ||||
| return MESH_PREDICTION_GEOMETRIC_NORMAL; | return MESH_PREDICTION_GEOMETRIC_NORMAL; | ||||
| } | } | ||||
| bool IsInitialized() const override { | bool IsInitialized() const override { | ||||
| if (!predictor_.IsInitialized()) | if (!predictor_.IsInitialized()) { | ||||
| return false; | return false; | ||||
| if (!this->mesh_data().IsInitialized()) | } | ||||
| if (!this->mesh_data().IsInitialized()) { | |||||
| return false; | return false; | ||||
| } | |||||
| return true; | return true; | ||||
| } | } | ||||
| int GetNumParentAttributes() const override { return 1; } | int GetNumParentAttributes() const override { return 1; } | ||||
| GeometryAttribute::Type GetParentAttributeType(int i) const override { | GeometryAttribute::Type GetParentAttributeType(int i) const override { | ||||
| DRACO_DCHECK_EQ(i, 0); | DRACO_DCHECK_EQ(i, 0); | ||||
| (void)i; | (void)i; | ||||
| return GeometryAttribute::POSITION; | return GeometryAttribute::POSITION; | ||||
| } | } | ||||
| bool SetParentAttribute(const PointAttribute *att) override { | bool SetParentAttribute(const PointAttribute *att) override { | ||||
| if (att->attribute_type() != GeometryAttribute::POSITION) | if (att->attribute_type() != GeometryAttribute::POSITION) { | ||||
| return false; // Invalid attribute type. | return false; // Invalid attribute type. | ||||
| if (att->num_components() != 3) | } | ||||
| if (att->num_components() != 3) { | |||||
| return false; // Currently works only for 3 component positions. | return false; // Currently works only for 3 component positions. | ||||
| } | |||||
| predictor_.SetPositionAttribute(*att); | predictor_.SetPositionAttribute(*att); | ||||
| return true; | return true; | ||||
| } | } | ||||
| private: | private: | ||||
| void SetQuantizationBits(int q) { | void SetQuantizationBits(int q) { | ||||
| DRACO_DCHECK_GE(q, 2); | DRACO_DCHECK_GE(q, 2); | ||||
| DRACO_DCHECK_LE(q, 30); | DRACO_DCHECK_LE(q, 30); | ||||
| ▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | bool MeshPredictionSchemeGeometricNormalEncoder<DataTypeT, TransformT, | ||||
| } | } | ||||
| return true; | return true; | ||||
| } | } | ||||
| template <typename DataTypeT, class TransformT, class MeshDataT> | template <typename DataTypeT, class TransformT, class MeshDataT> | ||||
| bool MeshPredictionSchemeGeometricNormalEncoder< | bool MeshPredictionSchemeGeometricNormalEncoder< | ||||
| DataTypeT, TransformT, MeshDataT>::EncodePredictionData(EncoderBuffer | DataTypeT, TransformT, MeshDataT>::EncodePredictionData(EncoderBuffer | ||||
| *buffer) { | *buffer) { | ||||
| if (!this->transform().EncodeTransformData(buffer)) | if (!this->transform().EncodeTransformData(buffer)) { | ||||
| return false; | return false; | ||||
| } | |||||
| // Encode normal flips. | // Encode normal flips. | ||||
| flip_normal_bit_encoder_.EndEncoding(buffer); | flip_normal_bit_encoder_.EndEncoding(buffer); | ||||
| return true; | return true; | ||||
| } | } | ||||
| } // namespace draco | } // namespace draco | ||||
| #endif // DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_MESH_PREDICTION_SCHEME_GEOMETRIC_NORMAL_ENCODER_H_ | #endif // DRACO_COMPRESSION_ATTRIBUTES_PREDICTION_SCHEMES_MESH_PREDICTION_SCHEME_GEOMETRIC_NORMAL_ENCODER_H_ | ||||