Draco v1.5.5 release.

This commit is contained in:
Tom Finegan 2022-10-28 17:25:46 -07:00
parent e4e34b0c63
commit 365367a01b
19 changed files with 71 additions and 70 deletions

View File

@ -14,6 +14,12 @@ delays can result in transient errors that can be difficult to diagnose when
new Draco releases are launched. To avoid the issue pin your sites to a
versioned release.
### Version 1.5.5 release:
* Using the versioned www.gstatic.com WASM and Javascript decoders continues
to be recommended. To use v1.5.5, use this URL:
* https://www.gstatic.com/draco/versioned/decoders/1.5.5/*
* Bug fix: https://github.com/google/draco/issues/935
### Version 1.5.4 release:
* Using the versioned www.gstatic.com WASM and Javascript decoders continues
to be recommended. To use v1.5.4, use this URL:

View File

@ -60,7 +60,7 @@ macro(draco_set_build_definitions)
# passed to libtool.
#
# We set DRACO_SOVERSION = [c-a].a.r
set(LT_CURRENT 6)
set(LT_CURRENT 7)
set(LT_REVISION 0)
set(LT_AGE 0)
math(EXPR DRACO_SOVERSION_MAJOR "${LT_CURRENT} - ${LT_AGE}")

View File

@ -257,7 +257,7 @@ GEM
thread_safe (0.3.6)
typhoeus (1.4.0)
ethon (>= 0.9.0)
tzinfo (1.2.5)
tzinfo (1.2.10)
thread_safe (~> 0.1)
unf (0.1.4)
unf_ext

View File

@ -6,7 +6,7 @@
News
=======
Check out the [README](https://github.com/google/draco/blob/1.5.4/README.md)
Check out the [README](https://github.com/google/draco/blob/1.5.5/README.md)
file for news about this release.
Description

View File

@ -1,6 +1,6 @@
{
"name": "draco3d",
"version": "1.5.4",
"version": "1.5.5",
"description": "Draco is a library for compressing and decompressing 3D geometric meshes and point clouds. It is intended to improve the storage and transmission of 3D graphics.",
"main": "draco3d.js",
"scripts": {

View File

@ -24,7 +24,7 @@ Draco github glTF branch URL: https://github.com/google/draco/tree/gltf_2.0_drac
News
=======
Check out the [README](https://github.com/google/draco/blob/1.5.4/README.md)
Check out the [README](https://github.com/google/draco/blob/1.5.5/README.md)
file for news about this release.
NPM Package

View File

@ -1,6 +1,6 @@
{
"name": "draco3dgltf",
"version": "1.5.4",
"version": "1.5.5",
"description": "This package contains a specific version of Draco 3D geometric compression library that is used for glTF Draco mesh compression extension.",
"main": "draco3dgltf.js",
"scripts": {

Binary file not shown.

View File

@ -18,9 +18,7 @@
namespace draco {
// Draco version is comprised of <major>.<minor>.<revision>.
static const char kDracoVersion[] = "1.5.4";
const char *Version() { return kDracoVersion; }
static const char kDracoVersion[] = "1.5.5";
} // namespace draco

View File

@ -32,16 +32,6 @@ typedef draco::Vector5ui Vector5ui;
typedef draco::VectorD<int32_t, 3> Vector3i;
typedef draco::VectorD<int32_t, 4> Vector4i;
template <class CoeffT, int dimension_t>
void TestSquaredDistance(const draco::VectorD<CoeffT, dimension_t> v1,
const draco::VectorD<CoeffT, dimension_t> v2,
const CoeffT result) {
CoeffT squared_distance = SquaredDistance(v1, v2);
ASSERT_EQ(squared_distance, result);
squared_distance = SquaredDistance(v2, v1);
ASSERT_EQ(squared_distance, result);
}
TEST(VectorDTest, TestOperators) {
{
const Vector3f v;
@ -170,56 +160,6 @@ TEST(VectorTest, TestGetNormalizedWithZeroLengthVector) {
ASSERT_EQ(normalized[2], 0);
}
TEST(VectorDTest, TestSquaredDistance) {
// Test Vector2f: float, 2D.
Vector2f v1_2f(5.5, 10.5);
Vector2f v2_2f(3.5, 15.5);
float result_f = 29;
TestSquaredDistance(v1_2f, v2_2f, result_f);
// Test Vector3f: float, 3D.
Vector3f v1_3f(5.5, 10.5, 2.3);
Vector3f v2_3f(3.5, 15.5, 0);
result_f = 34.29;
TestSquaredDistance(v1_3f, v2_3f, result_f);
// Test Vector4f: float, 4D.
Vector4f v1_4f(5.5, 10.5, 2.3, 7.2);
Vector4f v2_4f(3.5, 15.5, 0, 9.9);
result_f = 41.58;
TestSquaredDistance(v1_4f, v2_4f, result_f);
// Test Vector5f: float, 5D.
Vector5f v1_5f(5.5, 10.5, 2.3, 7.2, 1.0);
Vector5f v2_5f(3.5, 15.5, 0, 9.9, 0.2);
result_f = 42.22;
TestSquaredDistance(v1_5f, v2_5f, result_f);
// Test Vector 2ui: uint32_t, 2D.
Vector2ui v1_2ui(5, 10);
Vector2ui v2_2ui(3, 15);
uint32_t result_ui = 29;
TestSquaredDistance(v1_2ui, v2_2ui, result_ui);
// Test Vector 3ui: uint32_t, 3D.
Vector3ui v1_3ui(5, 10, 2);
Vector3ui v2_3ui(3, 15, 0);
result_ui = 33;
TestSquaredDistance(v1_3ui, v2_3ui, result_ui);
// Test Vector 4ui: uint32_t, 4D.
Vector4ui v1_4ui(5, 10, 2, 7);
Vector4ui v2_4ui(3, 15, 0, 9);
result_ui = 37;
TestSquaredDistance(v1_4ui, v2_4ui, result_ui);
// Test Vector 5ui: uint32_t, 5D.
Vector5ui v1_5ui(5, 10, 2, 7, 1);
Vector5ui v2_5ui(3, 15, 0, 9, 12);
result_ui = 158;
TestSquaredDistance(v1_5ui, v2_5ui, result_ui);
}
TEST(VectorDTest, TestCrossProduct3D) {
const Vector3i e1(1, 0, 0);
const Vector3i e2(0, 1, 0);

View File

@ -121,12 +121,12 @@ class Mesh : public PointCloud {
// Removes points that are not mapped to any face of the mesh. All attribute
// values are going to be removed as well.
void RemoveIsolatedPoints();
#endif
// Adds a point attribute |att| to the mesh and returns the index of the
// newly inserted attribute. Attribute values are mapped 1:1 to face indices.
// Returns -1 in case of error.
int32_t AddPerFaceAttribute(std::unique_ptr<PointAttribute> att);
#endif // DRACO_TRANSCODER_SUPPORTED
MeshAttributeElementType GetAttributeElementType(int att_id) const {
return attribute_data_[att_id].element_type;

View File

@ -925,6 +925,38 @@ bool SceneUtils::IsDracoCompressionEnabled(const Scene &scene) {
return false;
}
IndexTypeVector<MeshIndex, Eigen::Matrix4d>
SceneUtils::FindLargestBaseMeshTransforms(const Scene &scene) {
IndexTypeVector<MeshIndex, Eigen::Matrix4d> transforms(
scene.NumMeshes(), Eigen::Matrix4d::Identity());
// In case a mesh has multiple instances we want to use the instance with
// the largest scale.
IndexTypeVector<MeshIndex, float> transform_scale(scene.NumMeshes(), 0.f);
const auto instances = SceneUtils::ComputeAllInstances(scene);
for (MeshInstanceIndex i(0); i < instances.size(); ++i) {
const auto &instance = instances[i];
// Compute the scale of the transform.
const Vector3f scale_vec(instance.transform.col(0).norm(),
instance.transform.col(1).norm(),
instance.transform.col(2).norm());
// In our framework we support uniform scale only. For now, just take the
// maximum scale across all axes.
// TODO(ostava): Investigate how to properly support non-uniform scaling.
const float max_scale = scale_vec.MaxCoeff();
if (transform_scale[instance.mesh_index] < max_scale) {
transform_scale[instance.mesh_index] = max_scale;
transforms[instance.mesh_index] = instance.transform;
}
}
return transforms;
}
} // namespace draco
#endif // DRACO_TRANSCODER_SUPPORTED

View File

@ -137,6 +137,11 @@ class SceneUtils {
// Returns true if geometry compression is eabled for any of |scene| meshes.
static bool IsDracoCompressionEnabled(const Scene &scene);
// Returns a single tranformation matrix for each base mesh of the |scene|
// corresponding to the instance with the maximum scale.
static IndexTypeVector<MeshIndex, Eigen::Matrix4d>
FindLargestBaseMeshTransforms(const Scene &scene);
};
} // namespace draco

View File

@ -738,6 +738,26 @@ TEST(SceneUtilsTest, TestSetDracoCompressionOptions) {
ASSERT_FALSE(scene->GetMesh(MeshIndex(3)).IsCompressionEnabled());
}
TEST(SceneUtilsTest, TestFindLargestBaseMeshTransforms) {
// Tests that FindLargestBaseMeshTransforms() works as expected.
auto scene =
draco::ReadSceneFromTestFile("CubeScaledInstances/glTF/cube_att.gltf");
ASSERT_NE(scene, nullptr);
// There should be one base mesh with four instances.
ASSERT_EQ(scene->NumMeshes(), 1);
ASSERT_EQ(draco::SceneUtils::ComputeAllInstances(*scene).size(), 4);
const auto transforms =
draco::SceneUtils::FindLargestBaseMeshTransforms(*scene);
ASSERT_EQ(transforms.size(), 1); // One transform for the single base mesh.
// The largest instance should have a uniform scale 4.
const draco::MeshIndex mi(0);
ASSERT_EQ(transforms[mi].diagonal(), Eigen::Vector4d(4, 4, 4, 1));
}
} // namespace
#endif // DRACO_TRANSCODER_SUPPORTED