Skip to content

Commit

Permalink
Merge pull request #918 from tribiahq/quantizationunderflowfix
Browse files Browse the repository at this point in the history
Fix quantization underflow for reused geometries #917
  • Loading branch information
xeolabs authored Aug 19, 2022
2 parents 6749995 + e4f1a8c commit f10140a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/viewer/scene/math/geometryCompressionUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ function compressPosition(p, aabb, q) {
aabb[4] !== aabb[1] ? 65535 / (aabb[4] - aabb[1]) : 0,
aabb[5] !== aabb[2] ? 65535 / (aabb[5] - aabb[2]) : 0
]);
q[0] = Math.floor((p[0] - aabb[0]) * multiplier[0]);
q[1] = Math.floor((p[1] - aabb[1]) * multiplier[1]);
q[2] = Math.floor((p[2] - aabb[2]) * multiplier[2]);
q[0] = Math.max(0, Math.min(65535, Math.floor((p[0] - aabb[0]) * multiplier[0])));
q[1] = Math.max(0, Math.min(65535, Math.floor((p[1] - aabb[1]) * multiplier[1])));
q[2] = Math.max(0, Math.min(65535, Math.floor((p[2] - aabb[2]) * multiplier[2])));
}

function decompressPosition(position, decodeMatrix, dest) {
Expand Down

0 comments on commit f10140a

Please sign in to comment.