Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Schmithüsen <UX3D-schmithuesen>2019-04-11 12:26:23 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-04-11 13:04:53 +0300
commit4bad4bfc6ae5a81c44038cb1259f44befbb3afe0 (patch)
tree9b196d3ed0466406ba85441ea2314bedaeaea783 /extern/draco/dracoenc/src/draco/compression/attributes/sequential_normal_attribute_encoder.cc
parenta9d6356fee28d3567e956415a8eb08ab0bb7a0ab (diff)
glTF: add Draco shared library for mesh compression.
Draco is added as a library under extern/ and builds a shared library that is installed into the Python site-packages. This is then loaded by the glTF add-on to do mesh compression. Differential Revision: https://developer.blender.org/D4501
Diffstat (limited to 'extern/draco/dracoenc/src/draco/compression/attributes/sequential_normal_attribute_encoder.cc')
-rw-r--r--extern/draco/dracoenc/src/draco/compression/attributes/sequential_normal_attribute_encoder.cc50
1 files changed, 50 insertions, 0 deletions
diff --git a/extern/draco/dracoenc/src/draco/compression/attributes/sequential_normal_attribute_encoder.cc b/extern/draco/dracoenc/src/draco/compression/attributes/sequential_normal_attribute_encoder.cc
new file mode 100644
index 00000000000..af207a87111
--- /dev/null
+++ b/extern/draco/dracoenc/src/draco/compression/attributes/sequential_normal_attribute_encoder.cc
@@ -0,0 +1,50 @@
+// Copyright 2016 The Draco Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+#include "draco/compression/attributes/sequential_normal_attribute_encoder.h"
+#include "draco/compression/attributes/normal_compression_utils.h"
+
+namespace draco {
+
+bool SequentialNormalAttributeEncoder::Init(PointCloudEncoder *encoder,
+ int attribute_id) {
+ if (!SequentialIntegerAttributeEncoder::Init(encoder, attribute_id))
+ return false;
+ // Currently this encoder works only for 3-component normal vectors.
+ if (attribute()->num_components() != 3)
+ return false;
+
+ // Initialize AttributeOctahedronTransform.
+ const int quantization_bits = encoder->options()->GetAttributeInt(
+ attribute_id, "quantization_bits", -1);
+ if (quantization_bits < 1)
+ return false;
+ attribute_octahedron_transform_.SetParameters(quantization_bits);
+ return true;
+}
+
+bool SequentialNormalAttributeEncoder::EncodeDataNeededByPortableTransform(
+ EncoderBuffer *out_buffer) {
+ return attribute_octahedron_transform_.EncodeParameters(out_buffer);
+}
+
+bool SequentialNormalAttributeEncoder::PrepareValues(
+ const std::vector<PointIndex> &point_ids, int num_points) {
+ SetPortableAttribute(
+ attribute_octahedron_transform_.GeneratePortableAttribute(
+ *(attribute()), point_ids, num_points));
+ return true;
+}
+
+} // namespace draco