From 83a264f84b376464238c24473ffd4bcb6c231318 Mon Sep 17 00:00:00 2001 From: Richard Date: Thu, 18 May 2023 15:09:13 +0100 Subject: [PATCH] [Tizen] Fix the normalization factor calculation for blendshapes This patch fixes two issue: 1. Fix the calculation of the blendshape normalization factor so that it can handle smaller maximum distance between the original mesh and the deformed mesh. 2. Apply the min and max properties of the accessor to all the elements in the accessor, not just the elements in the sparse storage. Change-Id: Iea90cbacf91fc7311242d9a47454b06afee82200 --- dali-scene3d/public-api/loader/mesh-definition.cpp | 33 ++++++---------------- 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/dali-scene3d/public-api/loader/mesh-definition.cpp b/dali-scene3d/public-api/loader/mesh-definition.cpp index 5ccf70c..a398bad 100644 --- a/dali-scene3d/public-api/loader/mesh-definition.cpp +++ b/dali-scene3d/public-api/loader/mesh-definition.cpp @@ -595,7 +595,7 @@ void CalculateGltf2BlendShapes(uint8_t* geometryBuffer, const std::vector& min, const std: return; } - // If there are sparse indices then process only relevant data - if(sparseIndices && !sparseIndices->empty()) + auto end = values + count * numComponents; + while(values != end) { - for(auto elementIndex : *sparseIndices) + auto nextElement = values + numComponents; + uint32_t i = 0; + while(values != nextElement) { - auto value = values + (elementIndex * numComponents); - for(auto i = 0u; i < numComponents; ++i) - { - clampFn(min.data(), max.data(), i, *value); - } - } - } - else // if there's no sparse indices process all vertices - { - auto end = values + count * numComponents; - while(values != end) - { - auto nextElement = values + numComponents; - uint32_t i = 0; - while(values != nextElement) - { - clampFn(min.data(), max.data(), i, *values); - ++values; - ++i; - } + clampFn(min.data(), max.data(), i, *values); + ++values; + ++i; } } } -- 2.7.4