From 994bbe7f926d0e1fb191862973c59bafa71cf235 Mon Sep 17 00:00:00 2001 From: Stephens Nunnally Date: Fri, 29 Jul 2022 13:37:39 -0700 Subject: [PATCH] Version 1.0.2 --- build/index.module.js | 108 ++++++++++++++++++++++---------------- build/index.module.js.map | 2 +- build/index.umd.cjs | 108 ++++++++++++++++++++++---------------- build/index.umd.cjs.map | 2 +- package.json | 2 +- 5 files changed, 127 insertions(+), 95 deletions(-) diff --git a/build/index.module.js b/build/index.module.js index e1737fc..3f825e3 100644 --- a/build/index.module.js +++ b/build/index.module.js @@ -1,13 +1,13 @@ import * as THREE from 'three'; /** ///////////////////////////////////////////////////////////////////////////////// -// +// // @description Loop Subdivision Surface // @about Smooth subdivision surface modifier for use with three.js BufferGeometry // @author Stephens Nunnally <@stevinz> // @license MIT - Copyright (c) 2022 Stephens Nunnally and Scidian Software // @source https://github.com/stevinz/three-subdivide -// +// // See end of file for license details and acknowledgements // ///////////////////////////////////////////////////////////////////////////////////*/ @@ -23,7 +23,6 @@ const _center = new THREE.Vector3(); const _midpoint = new THREE.Vector3(); const _normal = new THREE.Vector3(); const _temp = new THREE.Vector3(); -const _vector = new THREE.Vector3(); const _vector0 = new THREE.Vector3(); // .Vector4(); const _vector1 = new THREE.Vector3(); // .Vector4(); const _vector2 = new THREE.Vector3(); // .Vector4(); @@ -48,14 +47,14 @@ const _triangle = new THREE.Triangle(); /** Loop subdivision surface modifier for use with modern three.js BufferGeometry */ class LoopSubdivision { - + ///////////////////////////////////////////////////////////////////////////////////// ///// Modify //////////////////// /** * Applies Loop subdivision modifier to geometry - * + * * @param {Object} bufferGeometry - Three.js geometry to be subdivided * @param {Number} iterations - How many times to run subdividion * @param {Boolean} split - Should coplanar faces be divided along shared edges before running Loop subdivision @@ -65,29 +64,34 @@ class LoopSubdivision { * @returns {Object} Returns new, subdivided, three.js BufferGeometry object */ static modify(bufferGeometry, iterations = 1, split = true, uvSmooth = false, flatOnly = false, maxTriangles = Infinity) { - - // Check for 'position' Attribute - if (bufferGeometry.attributes.position === undefined) { - console.warn(`LoopSubdivision.modify(): Geometry missing required attribute, 'position'`); - return bufferGeometry; + + ///// Geometries + if (! verifyGeometry(bufferGeometry)) return bufferGeometry; + let modifiedGeometry = bufferGeometry.clone(); + + ///// Presplit + if (split) { + const splitGeometry = LoopSubdivision.edgeSplit(modifiedGeometry); + modifiedGeometry.dispose(); + modifiedGeometry = splitGeometry; } - // Presplit - if (split) bufferGeometry = LoopSubdivision.edgeSplit(bufferGeometry); - - // Apply Subdivision + ///// Apply Subdivision for (let i = 0; i < iterations; i++) { - let currentTriangles = bufferGeometry.attributes.position.count / 3; + let currentTriangles = modifiedGeometry.attributes.position.count / 3; if (currentTriangles < maxTriangles) { + let subdividedGeometry; if (flatOnly) { - bufferGeometry = LoopSubdivision.flat(bufferGeometry); + subdividedGeometry = LoopSubdivision.flat(modifiedGeometry); } else { - bufferGeometry = LoopSubdivision.smooth(bufferGeometry, uvSmooth); + subdividedGeometry = LoopSubdivision.smooth(modifiedGeometry, uvSmooth); } + modifiedGeometry.dispose(); + modifiedGeometry = subdividedGeometry; } } - return bufferGeometry; + return modifiedGeometry; } ///////////////////////////////////////////////////////////////////////////////////// @@ -171,7 +175,7 @@ class LoopSubdivision { attributeList.forEach((attributeName) => { const attribute = existing.getAttribute(attributeName); if (! attribute) return; - const newTriangles = 4; // <-- need to calculate better? + const newTriangles = 4; /* maximum number of new triangles */ const arrayLength = (vertexCount * attribute.itemSize) * newTriangles; const floatArray = new Float32Array(arrayLength); @@ -265,7 +269,15 @@ class LoopSubdivision { } } - split.setAttribute(attributeName, new THREE.BufferAttribute(floatArray, attribute.itemSize)); + // Resize Array + const reducedCount = (index * 3) / step; + const reducedArray = new Float32Array(reducedCount); + for (let i = 0; i < reducedCount; i++) { + reducedArray[i] = floatArray[i]; + } + + // Set Attribute + split.setAttribute(attributeName, new THREE.BufferAttribute(reducedArray, attribute.itemSize)); }); // Clean Up, Return New Geometry @@ -279,7 +291,7 @@ class LoopSubdivision { /** Applies one iteration of Loop (flat) subdivision (1 triangle split into 4 triangles) */ static flat(geometry) { - + ///// Geometries if (! verifyGeometry(geometry)) return geometry; const existing = (geometry.index !== null) ? geometry.toNonIndexed() : geometry.clone(); @@ -346,7 +358,6 @@ class LoopSubdivision { const norAttribute = existing.getAttribute('normal'); const hashToIndex = {}; // Map by hash that contains arrays of index values of same position const indexToHash = []; // Position_Normal hash stored for each index - const indexToPos = []; // Position only hash stored for each index const existingNeighbors = {}; // Position hash mapped to Sets of existing vertex neighbors const flatOpposites = {}; // Position hash mapped to Sets of new edge point opposites @@ -357,23 +368,31 @@ class LoopSubdivision { _vertex[2].fromBufferAttribute(posAttribute, i + 2); // Map Vertex Hashes - for (let j = 0; j < 3; j++) { - const positionHash = hashFromVector(_vertex[j]); - const normalHash = hashFromVector(_vector.fromBufferAttribute(norAttribute, i + j)); + const positionHashes = []; // Position only hash + for (let v = 0; v < 3; v++) { + // Position + const positionHash = hashFromVector(_vertex[v]); + positionHashes.push(positionHash); + + // Normal + _normal.fromBufferAttribute(norAttribute, i + v); + // calcNormal(_normal, _vertex[0], _vertex[1], _vertex[2]); + const normalHash = hashFromVector(_normal); + + // Combined const pointHash = `${positionHash}_${normalHash}`; - addToMapArray(hashToIndex, pointHash, (i + j)); - indexToPos.push(positionHash); + addToMapArray(hashToIndex, pointHash, (i + v)); indexToHash.push(pointHash); } - + // Neighbors (Existing Geometry) - addToObjectSet(existingNeighbors, indexToPos[i + 0], indexToHash[i + 1]); - addToObjectSet(existingNeighbors, indexToPos[i + 0], indexToHash[i + 2]); - addToObjectSet(existingNeighbors, indexToPos[i + 1], indexToHash[i + 0]); - addToObjectSet(existingNeighbors, indexToPos[i + 1], indexToHash[i + 2]); - addToObjectSet(existingNeighbors, indexToPos[i + 2], indexToHash[i + 0]); - addToObjectSet(existingNeighbors, indexToPos[i + 2], indexToHash[i + 1]); - + addToObjectSet(existingNeighbors, positionHashes[0], indexToHash[i + 1]); + addToObjectSet(existingNeighbors, positionHashes[0], indexToHash[i + 2]); + addToObjectSet(existingNeighbors, positionHashes[1], indexToHash[i + 0]); + addToObjectSet(existingNeighbors, positionHashes[1], indexToHash[i + 2]); + addToObjectSet(existingNeighbors, positionHashes[2], indexToHash[i + 0]); + addToObjectSet(existingNeighbors, positionHashes[2], indexToHash[i + 1]); + // Midpoints / Opposites _vec0to1.copy(_vertex[0]).add(_vertex[1]).divideScalar(2.0); _vec1to2.copy(_vertex[1]).add(_vertex[2]).divideScalar(2.0); @@ -412,7 +431,7 @@ class LoopSubdivision { let positionHash = hashFromVector(_position[v]); let neighbors = existingNeighbors[positionHash]; let opposites = flatOpposites[positionHash]; - + ///// Adjust Source Vertex if (neighbors && (neighbors instanceof Set)) { const k = neighbors.size; @@ -422,7 +441,7 @@ class LoopSubdivision { ///// Warren's Formula // const beta = (k > 3) ? 3 / (8 * k) : ((k === 3) ? 3 / 16 : 0); - + ///// Stevinz' Formula // const beta = 0.5 / k; @@ -533,7 +552,7 @@ function setTriangle(positions, index, step, vec0, vec1, vec2) { positions[index + 0 + (step * 0)] = vec0.x; positions[index + 0 + (step * 1)] = vec1.x; positions[index + 0 + (step * 2)] = vec2.x; - } + } if (step >= 2) { positions[index + 1 + (step * 0)] = vec0.y; positions[index + 1 + (step * 1)] = vec1.y; @@ -572,17 +591,15 @@ function verifyGeometry(geometry) { ///// Reference ///////////////////////////////////////////////////////////////////////////////////// // +// Subdivision Surfaces // https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/thesis-10.pdf // https://en.wikipedia.org/wiki/Loop_subdivision_surface // https://cseweb.ucsd.edu/~alchern/teaching/cse167_fa21/6-3Surfaces.pdf // -///////////////////////////////////////////////////////////////////////////////////// -///// Original three.js SubdivisionModifier -///////////////////////////////////////////////////////////////////////////////////// -// -// Loop, r124 +// Original three.js SubdivisionModifier, r124 (Loop) // https://github.com/mrdoob/three.js/blob/r124/examples/jsm/modifiers/SubdivisionModifier.js -// Catmull-Clark, r59 +// +// Original three.js SubdivisionModifier, r59 (Catmull-Clark) // https://github.com/mrdoob/three.js/blob/r59/examples/js/modifiers/SubdivisionModifier.js // ///////////////////////////////////////////////////////////////////////////////////// @@ -591,8 +608,7 @@ function verifyGeometry(geometry) { // // MIT License // -// Subdivide Modifier -// Copyright (c) 2022 Stephens Nunnally <@stevinz> +// Copyright (c) 2022 Stephens Nunnally <@stevinz> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal diff --git a/build/index.module.js.map b/build/index.module.js.map index 3f7d2d2..efa0ba8 100644 --- a/build/index.module.js.map +++ b/build/index.module.js.map @@ -1 +1 @@ -{"version":3,"file":"index.module.js","sources":["../src/LoopSubdivision.js"],"sourcesContent":["/** /////////////////////////////////////////////////////////////////////////////////\n// \n// @description Loop Subdivision Surface\n// @about Smooth subdivision surface modifier for use with three.js BufferGeometry\n// @author Stephens Nunnally <@stevinz>\n// @license MIT - Copyright (c) 2022 Stephens Nunnally and Scidian Software\n// @source https://github.com/stevinz/three-subdivide\n// \n// See end of file for license details and acknowledgements\n//\n///////////////////////////////////////////////////////////////////////////////////*/\n//\n// Functions\n// modify Applies Loop subdivision to BufferGeometry, returns new BufferGeometry\n// edgeSplit Splits all triangles at edges shared by coplanar triangles\n// flat One iteration of Loop subdivision, without point averaging\n// smooth One iteration of Loop subdivision, with point averaging\n//\n// Info\n// This modifier uses the Loop (Charles Loop, 1987) subdivision surface algorithm to smooth\n// modern three.js BufferGeometry.\n//\n// At one point, three.js included a subdivision surface modifier in the extended examples (see bottom\n// of file for links), it was removed in r125. This modifier was originally based on the Catmull-Clark\n// algorithm, which works best for geometry with convex coplanar n-gon faces. In three.js r60 the modifier\n// was changed to use the Loop algorithm, which was designed to work better with triangle based meshes.\n//\n// The Loop algorithm, however, doesn't always provide uniform results as the vertices are skewed toward\n// the most used vertex positions. A triangle based box (e.g. BoxGeometry) will favor the corners. To\n// alleviate this issue, this implementation includes an initial pass to split coplanar faces at their\n// shared edges. It starts by splitting along the longest shared edge first, and then from that midpoint it\n// splits to any remaining coplanar shared edges. This can be disabled by passing 'split' as false.\n//\n// Also by default, this implementation inserts new uv coordinates, but does not average them using the Loop\n// algorithm. In some cases (usually in round-ish geometries), this will produce undesired results, a\n// noticeable tearing will occur. In such cases, try passing 'uvSmooth' as true to enable uv averaging.\n// \n// Note(s)\n// - This modifier returns a new BufferGeometry instance, it does not dispose() of the old geometry.\n//\n// - This modifier returns a NonIndexed geometry. An Indexed geometry can be created by using the\n// BufferGeometryUtils.mergeVertices() function, see:\n// https://threejs.org/docs/?q=buffer#examples/en/utils/BufferGeometryUtils.mergeVertices\n//\n// - This modifier works best with geometry whose triangles share edges AND edge vertices. See diagram below.\n//\n// OKAY NOT OKAY\n// O O\n// /|\\ / \\\n// / | \\ / \\\n// / | \\ / \\\n// O---O---O O---O---O\n// \\ | / \\ | /\n// \\ | / \\ | /\n// \\|/ \\|/\n// O O\n//\n/////////////////////////////////////////////////////////////////////////////////////\n\nimport * as THREE from 'three';\n\n///// Constants\n\nconst POSITION_DECIMALS = 2;\n\n///// Local Variables\n\nconst _average = new THREE.Vector3();\nconst _center = new THREE.Vector3();\nconst _midpoint = new THREE.Vector3();\nconst _normal = new THREE.Vector3();\nconst _temp = new THREE.Vector3();\nconst _vector = new THREE.Vector3();\nconst _vector0 = new THREE.Vector3(); // .Vector4();\nconst _vector1 = new THREE.Vector3(); // .Vector4();\nconst _vector2 = new THREE.Vector3(); // .Vector4();\nconst _vec0to1 = new THREE.Vector3();\nconst _vec1to2 = new THREE.Vector3();\nconst _vec2to0 = new THREE.Vector3();\nconst _position = [\n new THREE.Vector3(),\n new THREE.Vector3(),\n new THREE.Vector3(),\n];\nconst _vertex = [\n new THREE.Vector3(),\n new THREE.Vector3(),\n new THREE.Vector3(),\n];\nconst _triangle = new THREE.Triangle();\n\n/////////////////////////////////////////////////////////////////////////////////////\n///// Loop Subdivision Surface\n/////////////////////////////////////////////////////////////////////////////////////\n\n/** Loop subdivision surface modifier for use with modern three.js BufferGeometry */\nclass LoopSubdivision {\n \n /////////////////////////////////////////////////////////////////////////////////////\n ///// Modify\n ////////////////////\n\n /**\n * Applies Loop subdivision modifier to geometry\n * \n * @param {Object} bufferGeometry - Three.js geometry to be subdivided\n * @param {Number} iterations - How many times to run subdividion\n * @param {Boolean} split - Should coplanar faces be divided along shared edges before running Loop subdivision\n * @param {Boolean} uvSmooth - Should UV values be averaged during subdivision\n * @param {Boolean} flatOnly - If true, subdivision generates triangles, but does not modify positions\n * @param {Number} maxTriangles - If geometry contains more than this many triangles, subdivision will not contiunue\n * @returns {Object} Returns new, subdivided, three.js BufferGeometry object\n */\n static modify(bufferGeometry, iterations = 1, split = true, uvSmooth = false, flatOnly = false, maxTriangles = Infinity) {\n \n // Check for 'position' Attribute\n if (bufferGeometry.attributes.position === undefined) {\n console.warn(`LoopSubdivision.modify(): Geometry missing required attribute, 'position'`); \n return bufferGeometry;\n }\n\n // Presplit\n if (split) bufferGeometry = LoopSubdivision.edgeSplit(bufferGeometry);\n \n // Apply Subdivision\n for (let i = 0; i < iterations; i++) {\n let currentTriangles = bufferGeometry.attributes.position.count / 3;\n if (currentTriangles < maxTriangles) {\n if (flatOnly) {\n bufferGeometry = LoopSubdivision.flat(bufferGeometry);\n } else {\n bufferGeometry = LoopSubdivision.smooth(bufferGeometry, uvSmooth);\n }\n }\n }\n\n return bufferGeometry;\n }\n\n /////////////////////////////////////////////////////////////////////////////////////\n ///// Split Hypotenuse\n ////////////////////\n\n /**\n * Applies one iteration of split subdivision. Splits all triangles at edges shared by coplanar triangles.\n * Starts by splitting at longest shared edge, followed by splitting from that new center edge point to the\n * center of any other shared edges.\n */\n static edgeSplit(geometry) {\n\n ///// Geometries\n if (! verifyGeometry(geometry)) return geometry;\n const existing = (geometry.index !== null) ? geometry.toNonIndexed() : geometry.clone();\n const split = new THREE.BufferGeometry();\n\n ///// Attributes\n const attributeList = gatherAttributes(existing);\n const vertexCount = existing.attributes.position.count;\n const posAttribute = existing.getAttribute('position');\n const norAttribute = existing.getAttribute('normal');\n const edgeHashToTriangle = {};\n const triangleEdgeHashes = [];\n const edgeLength = {};\n const triangleExist = [];\n\n ///// Edges\n for (let i = 0; i < vertexCount; i += 3) {\n // Positions\n _vector0.fromBufferAttribute(posAttribute, i + 0);\n _vector1.fromBufferAttribute(posAttribute, i + 1);\n _vector2.fromBufferAttribute(posAttribute, i + 2);\n _normal.fromBufferAttribute(norAttribute, i);\n const vecHash0 = hashFromVector(_vector0);\n const vecHash1 = hashFromVector(_vector1);\n const vecHash2 = hashFromVector(_vector2);\n\n // Verify Area\n const triangleSize = _triangle.set(_vector0, _vector1, _vector2).getArea();\n triangleExist.push(! fuzzy(triangleSize, 0));\n if (! triangleExist[i / 3]) {\n triangleEdgeHashes.push([]);\n continue;\n }\n\n // Calculate Normals\n calcNormal(_normal, _vector0, _vector1, _vector2);\n const normalHash = hashFromVector(_normal);\n\n // Vertex Hashes\n let hashes = [\n `${vecHash0}_${vecHash1}_${normalHash}`, // [0]: 0to1\n `${vecHash1}_${vecHash0}_${normalHash}`, // [1]: 1to0\n `${vecHash1}_${vecHash2}_${normalHash}`, // [2]: 1to2\n `${vecHash2}_${vecHash1}_${normalHash}`, // [3]: 2to1\n `${vecHash2}_${vecHash0}_${normalHash}`, // [4]: 2to0\n `${vecHash0}_${vecHash2}_${normalHash}`, // [5]: 0to2\n ];\n\n // Store Edge Hashes\n let index = i / 3;\n for (let j = 0; j < hashes.length; j++) {\n // Attach Triangle Index to Edge Hash\n addToMapArray(edgeHashToTriangle, hashes[j], index);;\n\n // Edge Length\n if (! edgeLength[hashes[j]]) {\n if (j === 0 || j === 1) edgeLength[hashes[j]] = _vector0.distanceTo(_vector1);\n if (j === 2 || j === 3) edgeLength[hashes[j]] = _vector1.distanceTo(_vector2);\n if (j === 4 || j === 5) edgeLength[hashes[j]] = _vector2.distanceTo(_vector0);\n }\n }\n\n // Triangle Edge Reference\n triangleEdgeHashes.push([ hashes[0], hashes[2], hashes[4] ]);\n }\n\n ///// Build Geometry\n attributeList.forEach((attributeName) => {\n const attribute = existing.getAttribute(attributeName);\n if (! attribute) return;\n const newTriangles = 4; // <-- need to calculate better?\n const arrayLength = (vertexCount * attribute.itemSize) * newTriangles;\n const floatArray = new Float32Array(arrayLength);\n\n let index = 0;\n let step = attribute.itemSize;\n for (let i = 0; i < vertexCount; i += 3) {\n if (! triangleExist[i / 3]) continue;\n\n _vector0.fromBufferAttribute(attribute, i + 0);\n _vector1.fromBufferAttribute(attribute, i + 1);\n _vector2.fromBufferAttribute(attribute, i + 2);\n\n // Check for Shared Edges\n const existingIndex = i / 3;\n const edgeHash0to1 = triangleEdgeHashes[existingIndex][0];\n const edgeHash1to2 = triangleEdgeHashes[existingIndex][1];\n const edgeHash2to0 = triangleEdgeHashes[existingIndex][2];\n\n const edgeCount0to1 = edgeHashToTriangle[edgeHash0to1].length;\n const edgeCount1to2 = edgeHashToTriangle[edgeHash1to2].length;\n const edgeCount2to0 = edgeHashToTriangle[edgeHash2to0].length;\n const sharedCount = (edgeCount0to1 + edgeCount1to2 + edgeCount2to0) - 3;\n\n // No Shared Edges\n if (sharedCount === 0) {\n setTriangle(floatArray, index, step, _vector0, _vector1, _vector2); index += (step * 3);\n\n // Shared Edges\n } else {\n const length0to1 = edgeLength[edgeHash0to1];\n const length1to2 = edgeLength[edgeHash1to2];\n const length2to0 = edgeLength[edgeHash2to0];\n\n // Add New Triangle Positions\n if ((length0to1 > length1to2 || edgeCount1to2 <= 1) &&\n (length0to1 > length2to0 || edgeCount2to0 <= 1) && edgeCount0to1 > 1) {\n _center.copy(_vector0).add(_vector1).divideScalar(2.0);\n if (edgeCount2to0 > 1) {\n _midpoint.copy(_vector2).add(_vector0).divideScalar(2.0);\n setTriangle(floatArray, index, step, _vector0, _center, _midpoint); index += (step * 3);\n setTriangle(floatArray, index, step, _center, _vector2, _midpoint); index += (step * 3);\n } else {\n setTriangle(floatArray, index, step, _vector0, _center, _vector2); index += (step * 3);\n }\n if (edgeCount1to2 > 1) {\n _midpoint.copy(_vector1).add(_vector2).divideScalar(2.0);\n setTriangle(floatArray, index, step, _center, _vector1, _midpoint); index += (step * 3);\n setTriangle(floatArray, index, step, _midpoint, _vector2, _center); index += (step * 3);\n } else {\n setTriangle(floatArray, index, step, _vector1, _vector2, _center); index += (step * 3);\n }\n\n } else if ((length1to2 > length2to0 || edgeCount2to0 <= 1) && edgeCount1to2 > 1) {\n _center.copy(_vector1).add(_vector2).divideScalar(2.0);\n if (edgeCount0to1 > 1) {\n _midpoint.copy(_vector0).add(_vector1).divideScalar(2.0);\n setTriangle(floatArray, index, step, _center, _midpoint, _vector1); index += (step * 3);\n setTriangle(floatArray, index, step, _midpoint, _center, _vector0); index += (step * 3);\n } else {\n setTriangle(floatArray, index, step, _vector1, _center, _vector0); index += (step * 3);\n }\n if (edgeCount2to0 > 1) {\n _midpoint.copy(_vector2).add(_vector0).divideScalar(2.0);\n setTriangle(floatArray, index, step, _center, _vector2, _midpoint); index += (step * 3);\n setTriangle(floatArray, index, step, _midpoint, _vector0, _center); index += (step * 3);\n } else {\n setTriangle(floatArray, index, step, _vector2, _vector0, _center); index += (step * 3);\n }\n\n } else if (edgeCount2to0 > 1) {\n _center.copy(_vector2).add(_vector0).divideScalar(2.0);\n if (edgeCount1to2 > 1) {\n _midpoint.copy(_vector1).add(_vector2).divideScalar(2.0);\n setTriangle(floatArray, index, step, _vector2, _center, _midpoint); index += (step * 3);\n setTriangle(floatArray, index, step, _center, _vector1, _midpoint); index += (step * 3);\n } else {\n setTriangle(floatArray, index, step, _vector2, _center, _vector1); index += (step * 3);\n }\n if (edgeCount0to1 > 1) {\n _midpoint.copy(_vector0).add(_vector1).divideScalar(2.0);\n setTriangle(floatArray, index, step, _vector0, _midpoint, _center); index += (step * 3);\n setTriangle(floatArray, index, step, _midpoint, _vector1, _center); index += (step * 3);\n } else {\n setTriangle(floatArray, index, step, _vector0, _vector1, _center); index += (step * 3);\n }\n\n } else {\n setTriangle(floatArray, index, step, _vector0, _vector1, _vector2); index += (step * 3);\n }\n\n }\n }\n\n split.setAttribute(attributeName, new THREE.BufferAttribute(floatArray, attribute.itemSize));\n });\n\n // Clean Up, Return New Geometry\n existing.dispose();\n return split;\n }\n\n /////////////////////////////////////////////////////////////////////////////////////\n ///// Flat\n ////////////////////\n\n /** Applies one iteration of Loop (flat) subdivision (1 triangle split into 4 triangles) */\n static flat(geometry) {\n \n ///// Geometries\n if (! verifyGeometry(geometry)) return geometry;\n const existing = (geometry.index !== null) ? geometry.toNonIndexed() : geometry.clone();\n const loop = new THREE.BufferGeometry();\n\n ///// Attributes\n const attributeList = gatherAttributes(existing);\n const vertexCount = existing.attributes.position.count;\n\n ///// Build Geometry\n attributeList.forEach((attributeName) => {\n const attribute = existing.getAttribute(attributeName);\n if (! attribute) return;\n const newTriangles = 4;\n const arrayLength = (vertexCount * attribute.itemSize) * newTriangles;\n const floatArray = new Float32Array(arrayLength);\n\n let index = 0;\n let step = attribute.itemSize;\n for (let i = 0; i < vertexCount; i += 3) {\n\n // Original Vertices\n _vector0.fromBufferAttribute(attribute, i + 0);\n _vector1.fromBufferAttribute(attribute, i + 1);\n _vector2.fromBufferAttribute(attribute, i + 2);\n\n // Midpoints\n _vec0to1.copy(_vector0).add(_vector1).divideScalar(2.0);\n _vec1to2.copy(_vector1).add(_vector2).divideScalar(2.0);\n _vec2to0.copy(_vector2).add(_vector0).divideScalar(2.0);\n\n // Add New Triangle Positions\n setTriangle(floatArray, index, step, _vector0, _vec0to1, _vec2to0); index += (step * 3);\n setTriangle(floatArray, index, step, _vector1, _vec1to2, _vec0to1); index += (step * 3);\n setTriangle(floatArray, index, step, _vector2, _vec2to0, _vec1to2); index += (step * 3);\n setTriangle(floatArray, index, step, _vec0to1, _vec1to2, _vec2to0); index += (step * 3);\n }\n\n loop.setAttribute(attributeName, new THREE.BufferAttribute(floatArray, attribute.itemSize));\n });\n\n ///// Clean Up\n existing.dispose();\n return loop;\n }\n\n /////////////////////////////////////////////////////////////////////////////////////\n ///// Smooth\n ////////////////////\n\n /** Applies one iteration of Loop (smooth) subdivision (1 triangle split into 4 triangles) */\n static smooth(geometry, uvSmooth = false) {\n\n ///// Geometries\n if (! verifyGeometry(geometry)) return geometry;\n const existing = (geometry.index !== null) ? geometry.toNonIndexed() : geometry.clone();\n const flat = LoopSubdivision.flat(existing);\n const loop = new THREE.BufferGeometry();\n\n ///// Attributes\n const attributeList = gatherAttributes(existing);\n const vertexCount = existing.attributes.position.count;\n const posAttribute = existing.getAttribute('position');\n const norAttribute = existing.getAttribute('normal');\n const hashToIndex = {}; // Map by hash that contains arrays of index values of same position\n const indexToHash = []; // Position_Normal hash stored for each index\n const indexToPos = []; // Position only hash stored for each index\n const existingNeighbors = {}; // Position hash mapped to Sets of existing vertex neighbors\n const flatOpposites = {}; // Position hash mapped to Sets of new edge point opposites\n\n ///// Existing Vertex Hashes\n for (let i = 0; i < vertexCount; i += 3) {\n _vertex[0].fromBufferAttribute(posAttribute, i + 0);\n _vertex[1].fromBufferAttribute(posAttribute, i + 1);\n _vertex[2].fromBufferAttribute(posAttribute, i + 2);\n\n // Map Vertex Hashes\n for (let j = 0; j < 3; j++) {\n const positionHash = hashFromVector(_vertex[j]);\n const normalHash = hashFromVector(_vector.fromBufferAttribute(norAttribute, i + j));\n const pointHash = `${positionHash}_${normalHash}`;\n addToMapArray(hashToIndex, pointHash, (i + j));\n indexToPos.push(positionHash);\n indexToHash.push(pointHash);\n }\n \n // Neighbors (Existing Geometry)\n addToObjectSet(existingNeighbors, indexToPos[i + 0], indexToHash[i + 1]);\n addToObjectSet(existingNeighbors, indexToPos[i + 0], indexToHash[i + 2]);\n addToObjectSet(existingNeighbors, indexToPos[i + 1], indexToHash[i + 0]);\n addToObjectSet(existingNeighbors, indexToPos[i + 1], indexToHash[i + 2]);\n addToObjectSet(existingNeighbors, indexToPos[i + 2], indexToHash[i + 0]);\n addToObjectSet(existingNeighbors, indexToPos[i + 2], indexToHash[i + 1]);\n \n // Midpoints / Opposites\n _vec0to1.copy(_vertex[0]).add(_vertex[1]).divideScalar(2.0);\n _vec1to2.copy(_vertex[1]).add(_vertex[2]).divideScalar(2.0);\n _vec2to0.copy(_vertex[2]).add(_vertex[0]).divideScalar(2.0);\n const hash0to1 = hashFromVector(_vec0to1);\n const hash1to2 = hashFromVector(_vec1to2);\n const hash2to0 = hashFromVector(_vec2to0);\n addToObjectSet(flatOpposites, hash0to1, indexToHash[i + 2]);\n addToObjectSet(flatOpposites, hash1to2, indexToHash[i + 0]);\n addToObjectSet(flatOpposites, hash2to0, indexToHash[i + 1]);\n }\n\n ///// Build Geometry\n attributeList.forEach((attributeName) => {\n const existingAttribute = existing.getAttribute(attributeName);\n const flatAttribute = flat.getAttribute(attributeName);\n const flatPosition = flat.getAttribute('position');\n if (existingAttribute === undefined || flatAttribute === undefined) return;\n\n const arrayLength = (flat.attributes.position.count * flatAttribute.itemSize);\n const floatArray = new Float32Array(arrayLength);\n\n let index = 0;\n for (let i = 0; i < flat.attributes.position.count; i += 3) {\n\n if (attributeName === 'uv' && ! uvSmooth) {\n for (let v = 0; v < 3; v++) {\n _vertex[v].fromBufferAttribute(flatAttribute, i + v);\n }\n\n } else { // 'normal', 'position', 'color', etc...\n for (let v = 0; v < 3; v++) {\n _vertex[v].fromBufferAttribute(flatAttribute, i + v);\n _position[v].fromBufferAttribute(flatPosition, i + v);\n\n let positionHash = hashFromVector(_position[v]);\n let neighbors = existingNeighbors[positionHash];\n let opposites = flatOpposites[positionHash]\n \n ///// Adjust Source Vertex\n if (neighbors && (neighbors instanceof Set)) {\n const k = neighbors.size;\n\n ///// Loop's Formula\n const beta = 1 / k * ((5/8) - Math.pow((3/8) + (1/4) * Math.cos(2 * Math.PI / k), 2));\n\n ///// Warren's Formula\n // const beta = (k > 3) ? 3 / (8 * k) : ((k === 3) ? 3 / 16 : 0);\n \n ///// Stevinz' Formula\n // const beta = 0.5 / k;\n\n ///// Average with Neighbors\n const startWeight = 1.0 - (beta * k);\n _vertex[v].multiplyScalar(startWeight);\n\n neighbors.forEach(neighborHash => {\n _average.fromBufferAttribute(existingAttribute, hashToIndex[neighborHash][0]);\n _average.multiplyScalar(beta);\n _vertex[v].add(_average);\n });\n\n ///// Newly Added Edge Vertex\n } else if (opposites && (opposites instanceof Set) && opposites.size === 2) {\n const k = opposites.size;\n const beta = 0.125; /* 1/8 */\n const startWeight = 1.0 - (beta * k);\n _vertex[v].multiplyScalar(startWeight);\n\n opposites.forEach(oppositeHash => {\n _average.fromBufferAttribute(existingAttribute, hashToIndex[oppositeHash][0]);\n _average.multiplyScalar(beta);\n _vertex[v].add(_average);\n });\n }\n }\n }\n\n // Add New Triangle Position\n setTriangle(floatArray, index, flatAttribute.itemSize, _vertex[0], _vertex[1], _vertex[2]);\n index += (flatAttribute.itemSize * 3);\n }\n\n loop.setAttribute(attributeName, new THREE.BufferAttribute(floatArray, flatAttribute.itemSize));\n });\n\n ///// Clean Up\n flat.dispose();\n existing.dispose();\n return loop;\n }\n\n}\n\n/////////////////////////////////////////////////////////////////////////////////////\n///// Local Functions, Hash\n/////////////////////////////////////////////////////////////////////////////////////\n\nconst _positionShift = Math.pow(10, POSITION_DECIMALS);\n\n/** Compares two numbers to see if they're almost the same */\nfunction fuzzy(a, b, tolerance = 0.00001) {\n return ((a < (b + tolerance)) && (a > (b - tolerance)));\n}\n\n/** Generates hash strong from Number */\nfunction hashFromNumber(num, shift = _positionShift) {\n let roundedNumber = round(num * shift);\n if (roundedNumber == 0) roundedNumber = 0; /* prevent -0 (signed 0 can effect Math.atan2(), etc.) */\n return `${roundedNumber}`;\n}\n\n/** Generates hash strong from Vector3 */\nfunction hashFromVector(vector, shift = _positionShift) {\n return `${hashFromNumber(vector.x, shift)},${hashFromNumber(vector.y, shift)},${hashFromNumber(vector.z, shift)}`;\n}\n\nfunction round(x) {\n return (x + ((x > 0) ? 0.5 : -0.5)) << 0;\n}\n\n/////////////////////////////////////////////////////////////////////////////////////\n///// Local Functions, Maps\n/////////////////////////////////////////////////////////////////////////////////////\n\n/** Adds a value into set array */\nfunction addToObjectSet(object, hash, value) {\n if (! object[hash]) object[hash] = new Set();\n object[hash].add(value);\n}\n\n/** Adds value into map array */\nfunction addToMapArray(map, key, value) {\n if (! map[key]) map[key] = [];\n map[key].push(value);\n}\n\n/////////////////////////////////////////////////////////////////////////////////////\n///// Local Functions, Geometry\n/////////////////////////////////////////////////////////////////////////////////////\n\nfunction calcNormal(target, vec1, vec2, vec3) {\n _temp.subVectors(vec1, vec2);\n target.subVectors(vec2, vec3);\n target.cross(_temp).normalize();\n}\n\nfunction gatherAttributes(geometry) {\n const desired = [ 'position', 'normal', 'uv' ];\n const contains = Object.keys(geometry.attributes);\n const attributeList = Array.from(new Set(desired.concat(contains)));\n return attributeList;\n}\n\nfunction setTriangle(positions, index, step, vec0, vec1, vec2) {\n if (step >= 1) {\n positions[index + 0 + (step * 0)] = vec0.x;\n positions[index + 0 + (step * 1)] = vec1.x;\n positions[index + 0 + (step * 2)] = vec2.x;\n } \n if (step >= 2) {\n positions[index + 1 + (step * 0)] = vec0.y;\n positions[index + 1 + (step * 1)] = vec1.y;\n positions[index + 1 + (step * 2)] = vec2.y;\n }\n if (step >= 3) {\n positions[index + 2 + (step * 0)] = vec0.z;\n positions[index + 2 + (step * 1)] = vec1.z;\n positions[index + 2 + (step * 2)] = vec2.z;\n }\n if (step >= 4) {\n positions[index + 3 + (step * 0)] = vec0.w;\n positions[index + 3 + (step * 1)] = vec1.w;\n positions[index + 3 + (step * 2)] = vec2.w;\n }\n}\n\nfunction verifyGeometry(geometry) {\n if (! geometry.isBufferGeometry) {\n console.warn(`LoopSubdivision: Geometry must be 'BufferGeometry' type`);\n return false;\n }\n\n if (geometry.attributes.position === undefined) {\n console.warn(`LoopSubdivision: Missing required attribute - 'position'`);\n return false;\n }\n\n if (geometry.attributes.normal === undefined) {\n geometry.computeVertexNormals();\n }\n return true;\n}\n\n/////////////////////////////////////////////////////////////////////////////////////\n///// Exports\n/////////////////////////////////////////////////////////////////////////////////////\n\nexport { LoopSubdivision };\n\n/////////////////////////////////////////////////////////////////////////////////////\n///// Reference\n/////////////////////////////////////////////////////////////////////////////////////\n//\n// https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/thesis-10.pdf\n// https://en.wikipedia.org/wiki/Loop_subdivision_surface\n// https://cseweb.ucsd.edu/~alchern/teaching/cse167_fa21/6-3Surfaces.pdf\n//\n/////////////////////////////////////////////////////////////////////////////////////\n///// Original three.js SubdivisionModifier\n/////////////////////////////////////////////////////////////////////////////////////\n// \n// Loop, r124\n// https://github.com/mrdoob/three.js/blob/r124/examples/jsm/modifiers/SubdivisionModifier.js\n// Catmull-Clark, r59\n// https://github.com/mrdoob/three.js/blob/r59/examples/js/modifiers/SubdivisionModifier.js\n//\n/////////////////////////////////////////////////////////////////////////////////////\n///// License\n/////////////////////////////////////////////////////////////////////////////////////\n//\n// MIT License\n//\n// Subdivide Modifier\n// Copyright (c) 2022 Stephens Nunnally <@stevinz>\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE."],"names":[],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AAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;AACnD,QAAQ,SAAS,CAAC,KAAK,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;AACnD,KAAK;AACL,CAAC;AACD;AACA,SAAS,cAAc,CAAC,QAAQ,EAAE;AAClC,IAAI,IAAI,EAAE,QAAQ,CAAC,gBAAgB,EAAE;AACrC,QAAQ,OAAO,CAAC,IAAI,CAAC,CAAC,uDAAuD,CAAC,CAAC,CAAC;AAChF,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK;AACL;AACA,IAAI,IAAI,QAAQ,CAAC,UAAU,CAAC,QAAQ,KAAK,SAAS,EAAE;AACpD,QAAQ,OAAO,CAAC,IAAI,CAAC,CAAC,wDAAwD,CAAC,CAAC,CAAC;AACjF,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK;AACL;AACA,IAAI,IAAI,QAAQ,CAAC,UAAU,CAAC,MAAM,KAAK,SAAS,EAAE;AAClD,QAAQ,QAAQ,CAAC,oBAAoB,EAAE,CAAC;AACxC,KAAK;AACL,IAAI,OAAO,IAAI,CAAC;AAChB,CAAC;AAOD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;"} \ No newline at end of file +{"version":3,"file":"index.module.js","sources":["../src/LoopSubdivision.js"],"sourcesContent":["/** /////////////////////////////////////////////////////////////////////////////////\n//\n// @description Loop Subdivision Surface\n// @about Smooth subdivision surface modifier for use with three.js BufferGeometry\n// @author Stephens Nunnally <@stevinz>\n// @license MIT - Copyright (c) 2022 Stephens Nunnally and Scidian Software\n// @source https://github.com/stevinz/three-subdivide\n//\n// See end of file for license details and acknowledgements\n//\n///////////////////////////////////////////////////////////////////////////////////*/\n//\n// Functions\n// modify Applies Loop subdivision to BufferGeometry, returns new BufferGeometry\n// edgeSplit Splits all triangles at edges shared by coplanar triangles\n// flat One iteration of Loop subdivision, without point averaging\n// smooth One iteration of Loop subdivision, with point averaging\n//\n// Info\n// This modifier uses the Loop (Charles Loop, 1987) subdivision surface algorithm to smooth\n// modern three.js BufferGeometry.\n//\n// At one point, three.js included a subdivision surface modifier in the extended examples (see bottom\n// of file for links), it was removed in r125. This modifier was originally based on the Catmull-Clark\n// algorithm, which works best for geometry with convex coplanar n-gon faces. In three.js r60 the modifier\n// was changed to use the Loop algorithm, which was designed to work better with triangle based meshes.\n//\n// The Loop algorithm, however, doesn't always provide uniform results as the vertices are skewed toward\n// the most used vertex positions. A triangle based box (e.g. BoxGeometry) will favor the corners. To\n// alleviate this issue, this implementation includes an initial pass to split coplanar faces at their\n// shared edges. It starts by splitting along the longest shared edge first, and then from that midpoint it\n// splits to any remaining coplanar shared edges. This can be disabled by passing 'split' as false.\n//\n// Also by default, this implementation inserts new uv coordinates, but does not average them using the Loop\n// algorithm. In some cases (often in flat geometries) this will produce undesired results, a\n// noticeable tearing will occur. In such cases, try passing 'uvSmooth' as true to enable uv averaging.\n//\n// Note(s)\n// - This modifier returns a new BufferGeometry instance, it does not dispose() of the old geometry.\n//\n// - This modifier returns a NonIndexed geometry. An Indexed geometry can be created by using the\n// BufferGeometryUtils.mergeVertices() function, see:\n// https://threejs.org/docs/?q=buffer#examples/en/utils/BufferGeometryUtils.mergeVertices\n//\n// - This modifier works best with geometry whose triangles share edges AND edge vertices. See diagram below.\n//\n// OKAY NOT OKAY\n// O O\n// /|\\ / \\\n// / | \\ / \\\n// / | \\ / \\\n// O---O---O O---O---O\n// \\ | / \\ | /\n// \\ | / \\ | /\n// \\|/ \\|/\n// O O\n//\n/////////////////////////////////////////////////////////////////////////////////////\n\nimport * as THREE from 'three';\n\n///// Constants\n\nconst POSITION_DECIMALS = 2;\n\n///// Local Variables\n\nconst _average = new THREE.Vector3();\nconst _center = new THREE.Vector3();\nconst _midpoint = new THREE.Vector3();\nconst _normal = new THREE.Vector3();\nconst _temp = new THREE.Vector3();\nconst _vector0 = new THREE.Vector3(); // .Vector4();\nconst _vector1 = new THREE.Vector3(); // .Vector4();\nconst _vector2 = new THREE.Vector3(); // .Vector4();\nconst _vec0to1 = new THREE.Vector3();\nconst _vec1to2 = new THREE.Vector3();\nconst _vec2to0 = new THREE.Vector3();\nconst _position = [\n new THREE.Vector3(),\n new THREE.Vector3(),\n new THREE.Vector3(),\n];\nconst _vertex = [\n new THREE.Vector3(),\n new THREE.Vector3(),\n new THREE.Vector3(),\n];\nconst _triangle = new THREE.Triangle();\n\n/////////////////////////////////////////////////////////////////////////////////////\n///// Loop Subdivision Surface\n/////////////////////////////////////////////////////////////////////////////////////\n\n/** Loop subdivision surface modifier for use with modern three.js BufferGeometry */\nclass LoopSubdivision {\n\n /////////////////////////////////////////////////////////////////////////////////////\n ///// Modify\n ////////////////////\n\n /**\n * Applies Loop subdivision modifier to geometry\n *\n * @param {Object} bufferGeometry - Three.js geometry to be subdivided\n * @param {Number} iterations - How many times to run subdividion\n * @param {Boolean} split - Should coplanar faces be divided along shared edges before running Loop subdivision\n * @param {Boolean} uvSmooth - Should UV values be averaged during subdivision\n * @param {Boolean} flatOnly - If true, subdivision generates triangles, but does not modify positions\n * @param {Number} maxTriangles - If geometry contains more than this many triangles, subdivision will not contiunue\n * @returns {Object} Returns new, subdivided, three.js BufferGeometry object\n */\n static modify(bufferGeometry, iterations = 1, split = true, uvSmooth = false, flatOnly = false, maxTriangles = Infinity) {\n\n ///// Geometries\n if (! verifyGeometry(bufferGeometry)) return bufferGeometry;\n let modifiedGeometry = bufferGeometry.clone();\n\n ///// Presplit\n if (split) {\n const splitGeometry = LoopSubdivision.edgeSplit(modifiedGeometry)\n modifiedGeometry.dispose();\n modifiedGeometry = splitGeometry;\n }\n\n ///// Apply Subdivision\n for (let i = 0; i < iterations; i++) {\n let currentTriangles = modifiedGeometry.attributes.position.count / 3;\n if (currentTriangles < maxTriangles) {\n let subdividedGeometry;\n if (flatOnly) {\n subdividedGeometry = LoopSubdivision.flat(modifiedGeometry);\n } else {\n subdividedGeometry = LoopSubdivision.smooth(modifiedGeometry, uvSmooth);\n }\n modifiedGeometry.dispose();\n modifiedGeometry = subdividedGeometry;\n }\n }\n\n return modifiedGeometry;\n }\n\n /////////////////////////////////////////////////////////////////////////////////////\n ///// Split Hypotenuse\n ////////////////////\n\n /**\n * Applies one iteration of split subdivision. Splits all triangles at edges shared by coplanar triangles.\n * Starts by splitting at longest shared edge, followed by splitting from that new center edge point to the\n * center of any other shared edges.\n */\n static edgeSplit(geometry) {\n\n ///// Geometries\n if (! verifyGeometry(geometry)) return geometry;\n const existing = (geometry.index !== null) ? geometry.toNonIndexed() : geometry.clone();\n const split = new THREE.BufferGeometry();\n\n ///// Attributes\n const attributeList = gatherAttributes(existing);\n const vertexCount = existing.attributes.position.count;\n const posAttribute = existing.getAttribute('position');\n const norAttribute = existing.getAttribute('normal');\n const edgeHashToTriangle = {};\n const triangleEdgeHashes = [];\n const edgeLength = {};\n const triangleExist = [];\n\n ///// Edges\n for (let i = 0; i < vertexCount; i += 3) {\n // Positions\n _vector0.fromBufferAttribute(posAttribute, i + 0);\n _vector1.fromBufferAttribute(posAttribute, i + 1);\n _vector2.fromBufferAttribute(posAttribute, i + 2);\n _normal.fromBufferAttribute(norAttribute, i);\n const vecHash0 = hashFromVector(_vector0);\n const vecHash1 = hashFromVector(_vector1);\n const vecHash2 = hashFromVector(_vector2);\n\n // Verify Area\n const triangleSize = _triangle.set(_vector0, _vector1, _vector2).getArea();\n triangleExist.push(! fuzzy(triangleSize, 0));\n if (! triangleExist[i / 3]) {\n triangleEdgeHashes.push([]);\n continue;\n }\n\n // Calculate Normals\n calcNormal(_normal, _vector0, _vector1, _vector2);\n const normalHash = hashFromVector(_normal);\n\n // Vertex Hashes\n let hashes = [\n `${vecHash0}_${vecHash1}_${normalHash}`, // [0]: 0to1\n `${vecHash1}_${vecHash0}_${normalHash}`, // [1]: 1to0\n `${vecHash1}_${vecHash2}_${normalHash}`, // [2]: 1to2\n `${vecHash2}_${vecHash1}_${normalHash}`, // [3]: 2to1\n `${vecHash2}_${vecHash0}_${normalHash}`, // [4]: 2to0\n `${vecHash0}_${vecHash2}_${normalHash}`, // [5]: 0to2\n ];\n\n // Store Edge Hashes\n let index = i / 3;\n for (let j = 0; j < hashes.length; j++) {\n // Attach Triangle Index to Edge Hash\n addToMapArray(edgeHashToTriangle, hashes[j], index);;\n\n // Edge Length\n if (! edgeLength[hashes[j]]) {\n if (j === 0 || j === 1) edgeLength[hashes[j]] = _vector0.distanceTo(_vector1);\n if (j === 2 || j === 3) edgeLength[hashes[j]] = _vector1.distanceTo(_vector2);\n if (j === 4 || j === 5) edgeLength[hashes[j]] = _vector2.distanceTo(_vector0);\n }\n }\n\n // Triangle Edge Reference\n triangleEdgeHashes.push([ hashes[0], hashes[2], hashes[4] ]);\n }\n\n ///// Build Geometry\n attributeList.forEach((attributeName) => {\n const attribute = existing.getAttribute(attributeName);\n if (! attribute) return;\n const newTriangles = 4; /* maximum number of new triangles */\n const arrayLength = (vertexCount * attribute.itemSize) * newTriangles;\n const floatArray = new Float32Array(arrayLength);\n\n let index = 0;\n let step = attribute.itemSize;\n for (let i = 0; i < vertexCount; i += 3) {\n if (! triangleExist[i / 3]) continue;\n\n _vector0.fromBufferAttribute(attribute, i + 0);\n _vector1.fromBufferAttribute(attribute, i + 1);\n _vector2.fromBufferAttribute(attribute, i + 2);\n\n // Check for Shared Edges\n const existingIndex = i / 3;\n const edgeHash0to1 = triangleEdgeHashes[existingIndex][0];\n const edgeHash1to2 = triangleEdgeHashes[existingIndex][1];\n const edgeHash2to0 = triangleEdgeHashes[existingIndex][2];\n\n const edgeCount0to1 = edgeHashToTriangle[edgeHash0to1].length;\n const edgeCount1to2 = edgeHashToTriangle[edgeHash1to2].length;\n const edgeCount2to0 = edgeHashToTriangle[edgeHash2to0].length;\n const sharedCount = (edgeCount0to1 + edgeCount1to2 + edgeCount2to0) - 3;\n\n // No Shared Edges\n if (sharedCount === 0) {\n setTriangle(floatArray, index, step, _vector0, _vector1, _vector2); index += (step * 3);\n\n // Shared Edges\n } else {\n const length0to1 = edgeLength[edgeHash0to1];\n const length1to2 = edgeLength[edgeHash1to2];\n const length2to0 = edgeLength[edgeHash2to0];\n\n // Add New Triangle Positions\n if ((length0to1 > length1to2 || edgeCount1to2 <= 1) &&\n (length0to1 > length2to0 || edgeCount2to0 <= 1) && edgeCount0to1 > 1) {\n _center.copy(_vector0).add(_vector1).divideScalar(2.0);\n if (edgeCount2to0 > 1) {\n _midpoint.copy(_vector2).add(_vector0).divideScalar(2.0);\n setTriangle(floatArray, index, step, _vector0, _center, _midpoint); index += (step * 3);\n setTriangle(floatArray, index, step, _center, _vector2, _midpoint); index += (step * 3);\n } else {\n setTriangle(floatArray, index, step, _vector0, _center, _vector2); index += (step * 3);\n }\n if (edgeCount1to2 > 1) {\n _midpoint.copy(_vector1).add(_vector2).divideScalar(2.0);\n setTriangle(floatArray, index, step, _center, _vector1, _midpoint); index += (step * 3);\n setTriangle(floatArray, index, step, _midpoint, _vector2, _center); index += (step * 3);\n } else {\n setTriangle(floatArray, index, step, _vector1, _vector2, _center); index += (step * 3);\n }\n\n } else if ((length1to2 > length2to0 || edgeCount2to0 <= 1) && edgeCount1to2 > 1) {\n _center.copy(_vector1).add(_vector2).divideScalar(2.0);\n if (edgeCount0to1 > 1) {\n _midpoint.copy(_vector0).add(_vector1).divideScalar(2.0);\n setTriangle(floatArray, index, step, _center, _midpoint, _vector1); index += (step * 3);\n setTriangle(floatArray, index, step, _midpoint, _center, _vector0); index += (step * 3);\n } else {\n setTriangle(floatArray, index, step, _vector1, _center, _vector0); index += (step * 3);\n }\n if (edgeCount2to0 > 1) {\n _midpoint.copy(_vector2).add(_vector0).divideScalar(2.0);\n setTriangle(floatArray, index, step, _center, _vector2, _midpoint); index += (step * 3);\n setTriangle(floatArray, index, step, _midpoint, _vector0, _center); index += (step * 3);\n } else {\n setTriangle(floatArray, index, step, _vector2, _vector0, _center); index += (step * 3);\n }\n\n } else if (edgeCount2to0 > 1) {\n _center.copy(_vector2).add(_vector0).divideScalar(2.0);\n if (edgeCount1to2 > 1) {\n _midpoint.copy(_vector1).add(_vector2).divideScalar(2.0);\n setTriangle(floatArray, index, step, _vector2, _center, _midpoint); index += (step * 3);\n setTriangle(floatArray, index, step, _center, _vector1, _midpoint); index += (step * 3);\n } else {\n setTriangle(floatArray, index, step, _vector2, _center, _vector1); index += (step * 3);\n }\n if (edgeCount0to1 > 1) {\n _midpoint.copy(_vector0).add(_vector1).divideScalar(2.0);\n setTriangle(floatArray, index, step, _vector0, _midpoint, _center); index += (step * 3);\n setTriangle(floatArray, index, step, _midpoint, _vector1, _center); index += (step * 3);\n } else {\n setTriangle(floatArray, index, step, _vector0, _vector1, _center); index += (step * 3);\n }\n\n } else {\n setTriangle(floatArray, index, step, _vector0, _vector1, _vector2); index += (step * 3);\n }\n\n }\n }\n\n // Resize Array\n const reducedCount = (index * 3) / step;\n const reducedArray = new Float32Array(reducedCount);\n for (let i = 0; i < reducedCount; i++) {\n reducedArray[i] = floatArray[i];\n }\n\n // Set Attribute\n split.setAttribute(attributeName, new THREE.BufferAttribute(reducedArray, attribute.itemSize));\n });\n\n // Clean Up, Return New Geometry\n existing.dispose();\n return split;\n }\n\n /////////////////////////////////////////////////////////////////////////////////////\n ///// Flat\n ////////////////////\n\n /** Applies one iteration of Loop (flat) subdivision (1 triangle split into 4 triangles) */\n static flat(geometry) {\n\n ///// Geometries\n if (! verifyGeometry(geometry)) return geometry;\n const existing = (geometry.index !== null) ? geometry.toNonIndexed() : geometry.clone();\n const loop = new THREE.BufferGeometry();\n\n ///// Attributes\n const attributeList = gatherAttributes(existing);\n const vertexCount = existing.attributes.position.count;\n\n ///// Build Geometry\n attributeList.forEach((attributeName) => {\n const attribute = existing.getAttribute(attributeName);\n if (! attribute) return;\n const newTriangles = 4;\n const arrayLength = (vertexCount * attribute.itemSize) * newTriangles;\n const floatArray = new Float32Array(arrayLength);\n\n let index = 0;\n let step = attribute.itemSize;\n for (let i = 0; i < vertexCount; i += 3) {\n\n // Original Vertices\n _vector0.fromBufferAttribute(attribute, i + 0);\n _vector1.fromBufferAttribute(attribute, i + 1);\n _vector2.fromBufferAttribute(attribute, i + 2);\n\n // Midpoints\n _vec0to1.copy(_vector0).add(_vector1).divideScalar(2.0);\n _vec1to2.copy(_vector1).add(_vector2).divideScalar(2.0);\n _vec2to0.copy(_vector2).add(_vector0).divideScalar(2.0);\n\n // Add New Triangle Positions\n setTriangle(floatArray, index, step, _vector0, _vec0to1, _vec2to0); index += (step * 3);\n setTriangle(floatArray, index, step, _vector1, _vec1to2, _vec0to1); index += (step * 3);\n setTriangle(floatArray, index, step, _vector2, _vec2to0, _vec1to2); index += (step * 3);\n setTriangle(floatArray, index, step, _vec0to1, _vec1to2, _vec2to0); index += (step * 3);\n }\n\n loop.setAttribute(attributeName, new THREE.BufferAttribute(floatArray, attribute.itemSize));\n });\n\n ///// Clean Up\n existing.dispose();\n return loop;\n }\n\n /////////////////////////////////////////////////////////////////////////////////////\n ///// Smooth\n ////////////////////\n\n /** Applies one iteration of Loop (smooth) subdivision (1 triangle split into 4 triangles) */\n static smooth(geometry, uvSmooth = false) {\n\n ///// Geometries\n if (! verifyGeometry(geometry)) return geometry;\n const existing = (geometry.index !== null) ? geometry.toNonIndexed() : geometry.clone();\n const flat = LoopSubdivision.flat(existing);\n const loop = new THREE.BufferGeometry();\n\n ///// Attributes\n const attributeList = gatherAttributes(existing);\n const vertexCount = existing.attributes.position.count;\n const posAttribute = existing.getAttribute('position');\n const norAttribute = existing.getAttribute('normal');\n const hashToIndex = {}; // Map by hash that contains arrays of index values of same position\n const indexToHash = []; // Position_Normal hash stored for each index\n const existingNeighbors = {}; // Position hash mapped to Sets of existing vertex neighbors\n const flatOpposites = {}; // Position hash mapped to Sets of new edge point opposites\n\n ///// Existing Vertex Hashes\n for (let i = 0; i < vertexCount; i += 3) {\n _vertex[0].fromBufferAttribute(posAttribute, i + 0);\n _vertex[1].fromBufferAttribute(posAttribute, i + 1);\n _vertex[2].fromBufferAttribute(posAttribute, i + 2);\n\n // Map Vertex Hashes\n const positionHashes = []; // Position only hash\n for (let v = 0; v < 3; v++) {\n // Position\n const positionHash = hashFromVector(_vertex[v]);\n positionHashes.push(positionHash);\n\n // Normal\n _normal.fromBufferAttribute(norAttribute, i + v);\n // calcNormal(_normal, _vertex[0], _vertex[1], _vertex[2]);\n const normalHash = hashFromVector(_normal);\n\n // Combined\n const pointHash = `${positionHash}_${normalHash}`;\n addToMapArray(hashToIndex, pointHash, (i + v));\n indexToHash.push(pointHash);\n }\n\n // Neighbors (Existing Geometry)\n addToObjectSet(existingNeighbors, positionHashes[0], indexToHash[i + 1]);\n addToObjectSet(existingNeighbors, positionHashes[0], indexToHash[i + 2]);\n addToObjectSet(existingNeighbors, positionHashes[1], indexToHash[i + 0]);\n addToObjectSet(existingNeighbors, positionHashes[1], indexToHash[i + 2]);\n addToObjectSet(existingNeighbors, positionHashes[2], indexToHash[i + 0]);\n addToObjectSet(existingNeighbors, positionHashes[2], indexToHash[i + 1]);\n\n // Midpoints / Opposites\n _vec0to1.copy(_vertex[0]).add(_vertex[1]).divideScalar(2.0);\n _vec1to2.copy(_vertex[1]).add(_vertex[2]).divideScalar(2.0);\n _vec2to0.copy(_vertex[2]).add(_vertex[0]).divideScalar(2.0);\n const hash0to1 = hashFromVector(_vec0to1);\n const hash1to2 = hashFromVector(_vec1to2);\n const hash2to0 = hashFromVector(_vec2to0);\n addToObjectSet(flatOpposites, hash0to1, indexToHash[i + 2]);\n addToObjectSet(flatOpposites, hash1to2, indexToHash[i + 0]);\n addToObjectSet(flatOpposites, hash2to0, indexToHash[i + 1]);\n }\n\n ///// Build Geometry\n attributeList.forEach((attributeName) => {\n const existingAttribute = existing.getAttribute(attributeName);\n const flatAttribute = flat.getAttribute(attributeName);\n const flatPosition = flat.getAttribute('position');\n if (existingAttribute === undefined || flatAttribute === undefined) return;\n\n const arrayLength = (flat.attributes.position.count * flatAttribute.itemSize);\n const floatArray = new Float32Array(arrayLength);\n\n let index = 0;\n for (let i = 0; i < flat.attributes.position.count; i += 3) {\n\n if (attributeName === 'uv' && ! uvSmooth) {\n for (let v = 0; v < 3; v++) {\n _vertex[v].fromBufferAttribute(flatAttribute, i + v);\n }\n\n } else { // 'normal', 'position', 'color', etc...\n for (let v = 0; v < 3; v++) {\n _vertex[v].fromBufferAttribute(flatAttribute, i + v);\n _position[v].fromBufferAttribute(flatPosition, i + v);\n\n let positionHash = hashFromVector(_position[v]);\n let neighbors = existingNeighbors[positionHash];\n let opposites = flatOpposites[positionHash]\n\n ///// Adjust Source Vertex\n if (neighbors && (neighbors instanceof Set)) {\n const k = neighbors.size;\n\n ///// Loop's Formula\n const beta = 1 / k * ((5/8) - Math.pow((3/8) + (1/4) * Math.cos(2 * Math.PI / k), 2));\n\n ///// Warren's Formula\n // const beta = (k > 3) ? 3 / (8 * k) : ((k === 3) ? 3 / 16 : 0);\n\n ///// Stevinz' Formula\n // const beta = 0.5 / k;\n\n ///// Average with Neighbors\n const startWeight = 1.0 - (beta * k);\n _vertex[v].multiplyScalar(startWeight);\n\n neighbors.forEach(neighborHash => {\n _average.fromBufferAttribute(existingAttribute, hashToIndex[neighborHash][0]);\n _average.multiplyScalar(beta);\n _vertex[v].add(_average);\n });\n\n ///// Newly Added Edge Vertex\n } else if (opposites && (opposites instanceof Set) && opposites.size === 2) {\n const k = opposites.size;\n const beta = 0.125; /* 1/8 */\n const startWeight = 1.0 - (beta * k);\n _vertex[v].multiplyScalar(startWeight);\n\n opposites.forEach(oppositeHash => {\n _average.fromBufferAttribute(existingAttribute, hashToIndex[oppositeHash][0]);\n _average.multiplyScalar(beta);\n _vertex[v].add(_average);\n });\n }\n }\n }\n\n // Add New Triangle Position\n setTriangle(floatArray, index, flatAttribute.itemSize, _vertex[0], _vertex[1], _vertex[2]);\n index += (flatAttribute.itemSize * 3);\n }\n\n loop.setAttribute(attributeName, new THREE.BufferAttribute(floatArray, flatAttribute.itemSize));\n });\n\n ///// Clean Up\n flat.dispose();\n existing.dispose();\n return loop;\n }\n\n}\n\n/////////////////////////////////////////////////////////////////////////////////////\n///// Local Functions, Hash\n/////////////////////////////////////////////////////////////////////////////////////\n\nconst _positionShift = Math.pow(10, POSITION_DECIMALS);\n\n/** Compares two numbers to see if they're almost the same */\nfunction fuzzy(a, b, tolerance = 0.00001) {\n return ((a < (b + tolerance)) && (a > (b - tolerance)));\n}\n\n/** Generates hash strong from Number */\nfunction hashFromNumber(num, shift = _positionShift) {\n let roundedNumber = round(num * shift);\n if (roundedNumber == 0) roundedNumber = 0; /* prevent -0 (signed 0 can effect Math.atan2(), etc.) */\n return `${roundedNumber}`;\n}\n\n/** Generates hash strong from Vector3 */\nfunction hashFromVector(vector, shift = _positionShift) {\n return `${hashFromNumber(vector.x, shift)},${hashFromNumber(vector.y, shift)},${hashFromNumber(vector.z, shift)}`;\n}\n\nfunction round(x) {\n return (x + ((x > 0) ? 0.5 : -0.5)) << 0;\n}\n\n/////////////////////////////////////////////////////////////////////////////////////\n///// Local Functions, Maps\n/////////////////////////////////////////////////////////////////////////////////////\n\n/** Adds a value into set array */\nfunction addToObjectSet(object, hash, value) {\n if (! object[hash]) object[hash] = new Set();\n object[hash].add(value);\n}\n\n/** Adds value into map array */\nfunction addToMapArray(map, key, value) {\n if (! map[key]) map[key] = [];\n map[key].push(value);\n}\n\n/////////////////////////////////////////////////////////////////////////////////////\n///// Local Functions, Geometry\n/////////////////////////////////////////////////////////////////////////////////////\n\nfunction calcNormal(target, vec1, vec2, vec3) {\n _temp.subVectors(vec1, vec2);\n target.subVectors(vec2, vec3);\n target.cross(_temp).normalize();\n}\n\nfunction gatherAttributes(geometry) {\n const desired = [ 'position', 'normal', 'uv' ];\n const contains = Object.keys(geometry.attributes);\n const attributeList = Array.from(new Set(desired.concat(contains)));\n return attributeList;\n}\n\nfunction setTriangle(positions, index, step, vec0, vec1, vec2) {\n if (step >= 1) {\n positions[index + 0 + (step * 0)] = vec0.x;\n positions[index + 0 + (step * 1)] = vec1.x;\n positions[index + 0 + (step * 2)] = vec2.x;\n }\n if (step >= 2) {\n positions[index + 1 + (step * 0)] = vec0.y;\n positions[index + 1 + (step * 1)] = vec1.y;\n positions[index + 1 + (step * 2)] = vec2.y;\n }\n if (step >= 3) {\n positions[index + 2 + (step * 0)] = vec0.z;\n positions[index + 2 + (step * 1)] = vec1.z;\n positions[index + 2 + (step * 2)] = vec2.z;\n }\n if (step >= 4) {\n positions[index + 3 + (step * 0)] = vec0.w;\n positions[index + 3 + (step * 1)] = vec1.w;\n positions[index + 3 + (step * 2)] = vec2.w;\n }\n}\n\nfunction verifyGeometry(geometry) {\n if (! geometry.isBufferGeometry) {\n console.warn(`LoopSubdivision: Geometry must be 'BufferGeometry' type`);\n return false;\n }\n\n if (geometry.attributes.position === undefined) {\n console.warn(`LoopSubdivision: Missing required attribute - 'position'`);\n return false;\n }\n\n if (geometry.attributes.normal === undefined) {\n geometry.computeVertexNormals();\n }\n return true;\n}\n\n/////////////////////////////////////////////////////////////////////////////////////\n///// Exports\n/////////////////////////////////////////////////////////////////////////////////////\n\nexport { LoopSubdivision };\n\n/////////////////////////////////////////////////////////////////////////////////////\n///// Reference\n/////////////////////////////////////////////////////////////////////////////////////\n//\n// Subdivision Surfaces\n// https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/thesis-10.pdf\n// https://en.wikipedia.org/wiki/Loop_subdivision_surface\n// https://cseweb.ucsd.edu/~alchern/teaching/cse167_fa21/6-3Surfaces.pdf\n//\n// Original three.js SubdivisionModifier, r124 (Loop)\n// https://github.com/mrdoob/three.js/blob/r124/examples/jsm/modifiers/SubdivisionModifier.js\n//\n// Original three.js SubdivisionModifier, r59 (Catmull-Clark)\n// https://github.com/mrdoob/three.js/blob/r59/examples/js/modifiers/SubdivisionModifier.js\n//\n/////////////////////////////////////////////////////////////////////////////////////\n///// License\n/////////////////////////////////////////////////////////////////////////////////////\n//\n// MIT License\n//\n// Copyright (c) 2022 Stephens Nunnally <@stevinz>\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE."],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAkDA;AACA;AACA;AACA,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B;AACA;AACA;AACA,MAAM,QAAQ,GAAG,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;AACrC,MAAM,OAAO,GAAG,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;AACpC,MAAM,SAAS,GAAG,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;AACtC,MAAM,OAAO,GAAG,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;AACpC,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;AAClC,MAAM,QAAQ,GA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CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;AACnD,QAAQ,SAAS,CAAC,KAAK,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;AACnD,KAAK;AACL,CAAC;AACD;AACA,SAAS,cAAc,CAAC,QAAQ,EAAE;AAClC,IAAI,IAAI,EAAE,QAAQ,CAAC,gBAAgB,EAAE;AACrC,QAAQ,OAAO,CAAC,IAAI,CAAC,CAAC,uDAAuD,CAAC,CAAC,CAAC;AAChF,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK;AACL;AACA,IAAI,IAAI,QAAQ,CAAC,UAAU,CAAC,QAAQ,KAAK,SAAS,EAAE;AACpD,QAAQ,OAAO,CAAC,IAAI,CAAC,CAAC,wDAAwD,CAAC,CAAC,CAAC;AACjF,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK;AACL;AACA,IAAI,IAAI,QAAQ,CAAC,UAAU,CAAC,MAAM,KAAK,SAAS,EAAE;AAClD,QAAQ,QAAQ,CAAC,oBAAoB,EAAE,CAAC;AACxC,KAAK;AACL,IAAI,OAAO,IAAI,CAAC;AAChB,CAAC;AAOD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;"} \ No newline at end of file diff --git a/build/index.umd.cjs b/build/index.umd.cjs index f477118..4961be7 100644 --- a/build/index.umd.cjs +++ b/build/index.umd.cjs @@ -25,13 +25,13 @@ var THREE__namespace = /*#__PURE__*/_interopNamespace(THREE); /** ///////////////////////////////////////////////////////////////////////////////// - // + // // @description Loop Subdivision Surface // @about Smooth subdivision surface modifier for use with three.js BufferGeometry // @author Stephens Nunnally <@stevinz> // @license MIT - Copyright (c) 2022 Stephens Nunnally and Scidian Software // @source https://github.com/stevinz/three-subdivide - // + // // See end of file for license details and acknowledgements // ///////////////////////////////////////////////////////////////////////////////////*/ @@ -47,7 +47,6 @@ const _midpoint = new THREE__namespace.Vector3(); const _normal = new THREE__namespace.Vector3(); const _temp = new THREE__namespace.Vector3(); - const _vector = new THREE__namespace.Vector3(); const _vector0 = new THREE__namespace.Vector3(); // .Vector4(); const _vector1 = new THREE__namespace.Vector3(); // .Vector4(); const _vector2 = new THREE__namespace.Vector3(); // .Vector4(); @@ -72,14 +71,14 @@ /** Loop subdivision surface modifier for use with modern three.js BufferGeometry */ class LoopSubdivision { - + ///////////////////////////////////////////////////////////////////////////////////// ///// Modify //////////////////// /** * Applies Loop subdivision modifier to geometry - * + * * @param {Object} bufferGeometry - Three.js geometry to be subdivided * @param {Number} iterations - How many times to run subdividion * @param {Boolean} split - Should coplanar faces be divided along shared edges before running Loop subdivision @@ -89,29 +88,34 @@ * @returns {Object} Returns new, subdivided, three.js BufferGeometry object */ static modify(bufferGeometry, iterations = 1, split = true, uvSmooth = false, flatOnly = false, maxTriangles = Infinity) { - - // Check for 'position' Attribute - if (bufferGeometry.attributes.position === undefined) { - console.warn(`LoopSubdivision.modify(): Geometry missing required attribute, 'position'`); - return bufferGeometry; + + ///// Geometries + if (! verifyGeometry(bufferGeometry)) return bufferGeometry; + let modifiedGeometry = bufferGeometry.clone(); + + ///// Presplit + if (split) { + const splitGeometry = LoopSubdivision.edgeSplit(modifiedGeometry); + modifiedGeometry.dispose(); + modifiedGeometry = splitGeometry; } - // Presplit - if (split) bufferGeometry = LoopSubdivision.edgeSplit(bufferGeometry); - - // Apply Subdivision + ///// Apply Subdivision for (let i = 0; i < iterations; i++) { - let currentTriangles = bufferGeometry.attributes.position.count / 3; + let currentTriangles = modifiedGeometry.attributes.position.count / 3; if (currentTriangles < maxTriangles) { + let subdividedGeometry; if (flatOnly) { - bufferGeometry = LoopSubdivision.flat(bufferGeometry); + subdividedGeometry = LoopSubdivision.flat(modifiedGeometry); } else { - bufferGeometry = LoopSubdivision.smooth(bufferGeometry, uvSmooth); + subdividedGeometry = LoopSubdivision.smooth(modifiedGeometry, uvSmooth); } + modifiedGeometry.dispose(); + modifiedGeometry = subdividedGeometry; } } - return bufferGeometry; + return modifiedGeometry; } ///////////////////////////////////////////////////////////////////////////////////// @@ -195,7 +199,7 @@ attributeList.forEach((attributeName) => { const attribute = existing.getAttribute(attributeName); if (! attribute) return; - const newTriangles = 4; // <-- need to calculate better? + const newTriangles = 4; /* maximum number of new triangles */ const arrayLength = (vertexCount * attribute.itemSize) * newTriangles; const floatArray = new Float32Array(arrayLength); @@ -289,7 +293,15 @@ } } - split.setAttribute(attributeName, new THREE__namespace.BufferAttribute(floatArray, attribute.itemSize)); + // Resize Array + const reducedCount = (index * 3) / step; + const reducedArray = new Float32Array(reducedCount); + for (let i = 0; i < reducedCount; i++) { + reducedArray[i] = floatArray[i]; + } + + // Set Attribute + split.setAttribute(attributeName, new THREE__namespace.BufferAttribute(reducedArray, attribute.itemSize)); }); // Clean Up, Return New Geometry @@ -303,7 +315,7 @@ /** Applies one iteration of Loop (flat) subdivision (1 triangle split into 4 triangles) */ static flat(geometry) { - + ///// Geometries if (! verifyGeometry(geometry)) return geometry; const existing = (geometry.index !== null) ? geometry.toNonIndexed() : geometry.clone(); @@ -370,7 +382,6 @@ const norAttribute = existing.getAttribute('normal'); const hashToIndex = {}; // Map by hash that contains arrays of index values of same position const indexToHash = []; // Position_Normal hash stored for each index - const indexToPos = []; // Position only hash stored for each index const existingNeighbors = {}; // Position hash mapped to Sets of existing vertex neighbors const flatOpposites = {}; // Position hash mapped to Sets of new edge point opposites @@ -381,23 +392,31 @@ _vertex[2].fromBufferAttribute(posAttribute, i + 2); // Map Vertex Hashes - for (let j = 0; j < 3; j++) { - const positionHash = hashFromVector(_vertex[j]); - const normalHash = hashFromVector(_vector.fromBufferAttribute(norAttribute, i + j)); + const positionHashes = []; // Position only hash + for (let v = 0; v < 3; v++) { + // Position + const positionHash = hashFromVector(_vertex[v]); + positionHashes.push(positionHash); + + // Normal + _normal.fromBufferAttribute(norAttribute, i + v); + // calcNormal(_normal, _vertex[0], _vertex[1], _vertex[2]); + const normalHash = hashFromVector(_normal); + + // Combined const pointHash = `${positionHash}_${normalHash}`; - addToMapArray(hashToIndex, pointHash, (i + j)); - indexToPos.push(positionHash); + addToMapArray(hashToIndex, pointHash, (i + v)); indexToHash.push(pointHash); } - + // Neighbors (Existing Geometry) - addToObjectSet(existingNeighbors, indexToPos[i + 0], indexToHash[i + 1]); - addToObjectSet(existingNeighbors, indexToPos[i + 0], indexToHash[i + 2]); - addToObjectSet(existingNeighbors, indexToPos[i + 1], indexToHash[i + 0]); - addToObjectSet(existingNeighbors, indexToPos[i + 1], indexToHash[i + 2]); - addToObjectSet(existingNeighbors, indexToPos[i + 2], indexToHash[i + 0]); - addToObjectSet(existingNeighbors, indexToPos[i + 2], indexToHash[i + 1]); - + addToObjectSet(existingNeighbors, positionHashes[0], indexToHash[i + 1]); + addToObjectSet(existingNeighbors, positionHashes[0], indexToHash[i + 2]); + addToObjectSet(existingNeighbors, positionHashes[1], indexToHash[i + 0]); + addToObjectSet(existingNeighbors, positionHashes[1], indexToHash[i + 2]); + addToObjectSet(existingNeighbors, positionHashes[2], indexToHash[i + 0]); + addToObjectSet(existingNeighbors, positionHashes[2], indexToHash[i + 1]); + // Midpoints / Opposites _vec0to1.copy(_vertex[0]).add(_vertex[1]).divideScalar(2.0); _vec1to2.copy(_vertex[1]).add(_vertex[2]).divideScalar(2.0); @@ -436,7 +455,7 @@ let positionHash = hashFromVector(_position[v]); let neighbors = existingNeighbors[positionHash]; let opposites = flatOpposites[positionHash]; - + ///// Adjust Source Vertex if (neighbors && (neighbors instanceof Set)) { const k = neighbors.size; @@ -446,7 +465,7 @@ ///// Warren's Formula // const beta = (k > 3) ? 3 / (8 * k) : ((k === 3) ? 3 / 16 : 0); - + ///// Stevinz' Formula // const beta = 0.5 / k; @@ -557,7 +576,7 @@ positions[index + 0 + (step * 0)] = vec0.x; positions[index + 0 + (step * 1)] = vec1.x; positions[index + 0 + (step * 2)] = vec2.x; - } + } if (step >= 2) { positions[index + 1 + (step * 0)] = vec0.y; positions[index + 1 + (step * 1)] = vec1.y; @@ -596,17 +615,15 @@ ///// Reference ///////////////////////////////////////////////////////////////////////////////////// // + // Subdivision Surfaces // https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/thesis-10.pdf // https://en.wikipedia.org/wiki/Loop_subdivision_surface // https://cseweb.ucsd.edu/~alchern/teaching/cse167_fa21/6-3Surfaces.pdf // - ///////////////////////////////////////////////////////////////////////////////////// - ///// Original three.js SubdivisionModifier - ///////////////////////////////////////////////////////////////////////////////////// - // - // Loop, r124 + // Original three.js SubdivisionModifier, r124 (Loop) // https://github.com/mrdoob/three.js/blob/r124/examples/jsm/modifiers/SubdivisionModifier.js - // Catmull-Clark, r59 + // + // Original three.js SubdivisionModifier, r59 (Catmull-Clark) // https://github.com/mrdoob/three.js/blob/r59/examples/js/modifiers/SubdivisionModifier.js // ///////////////////////////////////////////////////////////////////////////////////// @@ -615,8 +632,7 @@ // // MIT License // - // Subdivide Modifier - // Copyright (c) 2022 Stephens Nunnally <@stevinz> + // Copyright (c) 2022 Stephens Nunnally <@stevinz> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal diff --git a/build/index.umd.cjs.map b/build/index.umd.cjs.map index 9092863..96a6c6a 100644 --- a/build/index.umd.cjs.map +++ b/build/index.umd.cjs.map @@ -1 +1 @@ -{"version":3,"file":"index.umd.cjs","sources":["../src/LoopSubdivision.js"],"sourcesContent":["/** /////////////////////////////////////////////////////////////////////////////////\n// \n// @description Loop Subdivision Surface\n// @about Smooth subdivision surface modifier for use with three.js BufferGeometry\n// @author Stephens Nunnally <@stevinz>\n// @license MIT - Copyright (c) 2022 Stephens Nunnally and Scidian Software\n// @source https://github.com/stevinz/three-subdivide\n// \n// See end of file for license details and acknowledgements\n//\n///////////////////////////////////////////////////////////////////////////////////*/\n//\n// Functions\n// modify Applies Loop subdivision to BufferGeometry, returns new BufferGeometry\n// edgeSplit Splits all triangles at edges shared by coplanar triangles\n// flat One iteration of Loop subdivision, without point averaging\n// smooth One iteration of Loop subdivision, with point averaging\n//\n// Info\n// This modifier uses the Loop (Charles Loop, 1987) subdivision surface algorithm to smooth\n// modern three.js BufferGeometry.\n//\n// At one point, three.js included a subdivision surface modifier in the extended examples (see bottom\n// of file for links), it was removed in r125. This modifier was originally based on the Catmull-Clark\n// algorithm, which works best for geometry with convex coplanar n-gon faces. In three.js r60 the modifier\n// was changed to use the Loop algorithm, which was designed to work better with triangle based meshes.\n//\n// The Loop algorithm, however, doesn't always provide uniform results as the vertices are skewed toward\n// the most used vertex positions. A triangle based box (e.g. BoxGeometry) will favor the corners. To\n// alleviate this issue, this implementation includes an initial pass to split coplanar faces at their\n// shared edges. It starts by splitting along the longest shared edge first, and then from that midpoint it\n// splits to any remaining coplanar shared edges. This can be disabled by passing 'split' as false.\n//\n// Also by default, this implementation inserts new uv coordinates, but does not average them using the Loop\n// algorithm. In some cases (usually in round-ish geometries), this will produce undesired results, a\n// noticeable tearing will occur. In such cases, try passing 'uvSmooth' as true to enable uv averaging.\n// \n// Note(s)\n// - This modifier returns a new BufferGeometry instance, it does not dispose() of the old geometry.\n//\n// - This modifier returns a NonIndexed geometry. An Indexed geometry can be created by using the\n// BufferGeometryUtils.mergeVertices() function, see:\n// https://threejs.org/docs/?q=buffer#examples/en/utils/BufferGeometryUtils.mergeVertices\n//\n// - This modifier works best with geometry whose triangles share edges AND edge vertices. See diagram below.\n//\n// OKAY NOT OKAY\n// O O\n// /|\\ / \\\n// / | \\ / \\\n// / | \\ / \\\n// O---O---O O---O---O\n// \\ | / \\ | /\n// \\ | / \\ | /\n// \\|/ \\|/\n// O O\n//\n/////////////////////////////////////////////////////////////////////////////////////\n\nimport * as THREE from 'three';\n\n///// Constants\n\nconst POSITION_DECIMALS = 2;\n\n///// Local Variables\n\nconst _average = new THREE.Vector3();\nconst _center = new THREE.Vector3();\nconst _midpoint = new THREE.Vector3();\nconst _normal = new THREE.Vector3();\nconst _temp = new THREE.Vector3();\nconst _vector = new THREE.Vector3();\nconst _vector0 = new THREE.Vector3(); // .Vector4();\nconst _vector1 = new THREE.Vector3(); // .Vector4();\nconst _vector2 = new THREE.Vector3(); // .Vector4();\nconst _vec0to1 = new THREE.Vector3();\nconst _vec1to2 = new THREE.Vector3();\nconst _vec2to0 = new THREE.Vector3();\nconst _position = [\n new THREE.Vector3(),\n new THREE.Vector3(),\n new THREE.Vector3(),\n];\nconst _vertex = [\n new THREE.Vector3(),\n new THREE.Vector3(),\n new THREE.Vector3(),\n];\nconst _triangle = new THREE.Triangle();\n\n/////////////////////////////////////////////////////////////////////////////////////\n///// Loop Subdivision Surface\n/////////////////////////////////////////////////////////////////////////////////////\n\n/** Loop subdivision surface modifier for use with modern three.js BufferGeometry */\nclass LoopSubdivision {\n \n /////////////////////////////////////////////////////////////////////////////////////\n ///// Modify\n ////////////////////\n\n /**\n * Applies Loop subdivision modifier to geometry\n * \n * @param {Object} bufferGeometry - Three.js geometry to be subdivided\n * @param {Number} iterations - How many times to run subdividion\n * @param {Boolean} split - Should coplanar faces be divided along shared edges before running Loop subdivision\n * @param {Boolean} uvSmooth - Should UV values be averaged during subdivision\n * @param {Boolean} flatOnly - If true, subdivision generates triangles, but does not modify positions\n * @param {Number} maxTriangles - If geometry contains more than this many triangles, subdivision will not contiunue\n * @returns {Object} Returns new, subdivided, three.js BufferGeometry object\n */\n static modify(bufferGeometry, iterations = 1, split = true, uvSmooth = false, flatOnly = false, maxTriangles = Infinity) {\n \n // Check for 'position' Attribute\n if (bufferGeometry.attributes.position === undefined) {\n console.warn(`LoopSubdivision.modify(): Geometry missing required attribute, 'position'`); \n return bufferGeometry;\n }\n\n // Presplit\n if (split) bufferGeometry = LoopSubdivision.edgeSplit(bufferGeometry);\n \n // Apply Subdivision\n for (let i = 0; i < iterations; i++) {\n let currentTriangles = bufferGeometry.attributes.position.count / 3;\n if (currentTriangles < maxTriangles) {\n if (flatOnly) {\n bufferGeometry = LoopSubdivision.flat(bufferGeometry);\n } else {\n bufferGeometry = LoopSubdivision.smooth(bufferGeometry, uvSmooth);\n }\n }\n }\n\n return bufferGeometry;\n }\n\n /////////////////////////////////////////////////////////////////////////////////////\n ///// Split Hypotenuse\n ////////////////////\n\n /**\n * Applies one iteration of split subdivision. Splits all triangles at edges shared by coplanar triangles.\n * Starts by splitting at longest shared edge, followed by splitting from that new center edge point to the\n * center of any other shared edges.\n */\n static edgeSplit(geometry) {\n\n ///// Geometries\n if (! verifyGeometry(geometry)) return geometry;\n const existing = (geometry.index !== null) ? geometry.toNonIndexed() : geometry.clone();\n const split = new THREE.BufferGeometry();\n\n ///// Attributes\n const attributeList = gatherAttributes(existing);\n const vertexCount = existing.attributes.position.count;\n const posAttribute = existing.getAttribute('position');\n const norAttribute = existing.getAttribute('normal');\n const edgeHashToTriangle = {};\n const triangleEdgeHashes = [];\n const edgeLength = {};\n const triangleExist = [];\n\n ///// Edges\n for (let i = 0; i < vertexCount; i += 3) {\n // Positions\n _vector0.fromBufferAttribute(posAttribute, i + 0);\n _vector1.fromBufferAttribute(posAttribute, i + 1);\n _vector2.fromBufferAttribute(posAttribute, i + 2);\n _normal.fromBufferAttribute(norAttribute, i);\n const vecHash0 = hashFromVector(_vector0);\n const vecHash1 = hashFromVector(_vector1);\n const vecHash2 = hashFromVector(_vector2);\n\n // Verify Area\n const triangleSize = _triangle.set(_vector0, _vector1, _vector2).getArea();\n triangleExist.push(! fuzzy(triangleSize, 0));\n if (! triangleExist[i / 3]) {\n triangleEdgeHashes.push([]);\n continue;\n }\n\n // Calculate Normals\n calcNormal(_normal, _vector0, _vector1, _vector2);\n const normalHash = hashFromVector(_normal);\n\n // Vertex Hashes\n let hashes = [\n `${vecHash0}_${vecHash1}_${normalHash}`, // [0]: 0to1\n `${vecHash1}_${vecHash0}_${normalHash}`, // [1]: 1to0\n `${vecHash1}_${vecHash2}_${normalHash}`, // [2]: 1to2\n `${vecHash2}_${vecHash1}_${normalHash}`, // [3]: 2to1\n `${vecHash2}_${vecHash0}_${normalHash}`, // [4]: 2to0\n `${vecHash0}_${vecHash2}_${normalHash}`, // [5]: 0to2\n ];\n\n // Store Edge Hashes\n let index = i / 3;\n for (let j = 0; j < hashes.length; j++) {\n // Attach Triangle Index to Edge Hash\n addToMapArray(edgeHashToTriangle, hashes[j], index);;\n\n // Edge Length\n if (! edgeLength[hashes[j]]) {\n if (j === 0 || j === 1) edgeLength[hashes[j]] = _vector0.distanceTo(_vector1);\n if (j === 2 || j === 3) edgeLength[hashes[j]] = _vector1.distanceTo(_vector2);\n if (j === 4 || j === 5) edgeLength[hashes[j]] = _vector2.distanceTo(_vector0);\n }\n }\n\n // Triangle Edge Reference\n triangleEdgeHashes.push([ hashes[0], hashes[2], hashes[4] ]);\n }\n\n ///// Build Geometry\n attributeList.forEach((attributeName) => {\n const attribute = existing.getAttribute(attributeName);\n if (! attribute) return;\n const newTriangles = 4; // <-- need to calculate better?\n const arrayLength = (vertexCount * attribute.itemSize) * newTriangles;\n const floatArray = new Float32Array(arrayLength);\n\n let index = 0;\n let step = attribute.itemSize;\n for (let i = 0; i < vertexCount; i += 3) {\n if (! triangleExist[i / 3]) continue;\n\n _vector0.fromBufferAttribute(attribute, i + 0);\n _vector1.fromBufferAttribute(attribute, i + 1);\n _vector2.fromBufferAttribute(attribute, i + 2);\n\n // Check for Shared Edges\n const existingIndex = i / 3;\n const edgeHash0to1 = triangleEdgeHashes[existingIndex][0];\n const edgeHash1to2 = triangleEdgeHashes[existingIndex][1];\n const edgeHash2to0 = triangleEdgeHashes[existingIndex][2];\n\n const edgeCount0to1 = edgeHashToTriangle[edgeHash0to1].length;\n const edgeCount1to2 = edgeHashToTriangle[edgeHash1to2].length;\n const edgeCount2to0 = edgeHashToTriangle[edgeHash2to0].length;\n const sharedCount = (edgeCount0to1 + edgeCount1to2 + edgeCount2to0) - 3;\n\n // No Shared Edges\n if (sharedCount === 0) {\n setTriangle(floatArray, index, step, _vector0, _vector1, _vector2); index += (step * 3);\n\n // Shared Edges\n } else {\n const length0to1 = edgeLength[edgeHash0to1];\n const length1to2 = edgeLength[edgeHash1to2];\n const length2to0 = edgeLength[edgeHash2to0];\n\n // Add New Triangle Positions\n if ((length0to1 > length1to2 || edgeCount1to2 <= 1) &&\n (length0to1 > length2to0 || edgeCount2to0 <= 1) && edgeCount0to1 > 1) {\n _center.copy(_vector0).add(_vector1).divideScalar(2.0);\n if (edgeCount2to0 > 1) {\n _midpoint.copy(_vector2).add(_vector0).divideScalar(2.0);\n setTriangle(floatArray, index, step, _vector0, _center, _midpoint); index += (step * 3);\n setTriangle(floatArray, index, step, _center, _vector2, _midpoint); index += (step * 3);\n } else {\n setTriangle(floatArray, index, step, _vector0, _center, _vector2); index += (step * 3);\n }\n if (edgeCount1to2 > 1) {\n _midpoint.copy(_vector1).add(_vector2).divideScalar(2.0);\n setTriangle(floatArray, index, step, _center, _vector1, _midpoint); index += (step * 3);\n setTriangle(floatArray, index, step, _midpoint, _vector2, _center); index += (step * 3);\n } else {\n setTriangle(floatArray, index, step, _vector1, _vector2, _center); index += (step * 3);\n }\n\n } else if ((length1to2 > length2to0 || edgeCount2to0 <= 1) && edgeCount1to2 > 1) {\n _center.copy(_vector1).add(_vector2).divideScalar(2.0);\n if (edgeCount0to1 > 1) {\n _midpoint.copy(_vector0).add(_vector1).divideScalar(2.0);\n setTriangle(floatArray, index, step, _center, _midpoint, _vector1); index += (step * 3);\n setTriangle(floatArray, index, step, _midpoint, _center, _vector0); index += (step * 3);\n } else {\n setTriangle(floatArray, index, step, _vector1, _center, _vector0); index += (step * 3);\n }\n if (edgeCount2to0 > 1) {\n _midpoint.copy(_vector2).add(_vector0).divideScalar(2.0);\n setTriangle(floatArray, index, step, _center, _vector2, _midpoint); index += (step * 3);\n setTriangle(floatArray, index, step, _midpoint, _vector0, _center); index += (step * 3);\n } else {\n setTriangle(floatArray, index, step, _vector2, _vector0, _center); index += (step * 3);\n }\n\n } else if (edgeCount2to0 > 1) {\n _center.copy(_vector2).add(_vector0).divideScalar(2.0);\n if (edgeCount1to2 > 1) {\n _midpoint.copy(_vector1).add(_vector2).divideScalar(2.0);\n setTriangle(floatArray, index, step, _vector2, _center, _midpoint); index += (step * 3);\n setTriangle(floatArray, index, step, _center, _vector1, _midpoint); index += (step * 3);\n } else {\n setTriangle(floatArray, index, step, _vector2, _center, _vector1); index += (step * 3);\n }\n if (edgeCount0to1 > 1) {\n _midpoint.copy(_vector0).add(_vector1).divideScalar(2.0);\n setTriangle(floatArray, index, step, _vector0, _midpoint, _center); index += (step * 3);\n setTriangle(floatArray, index, step, _midpoint, _vector1, _center); index += (step * 3);\n } else {\n setTriangle(floatArray, index, step, _vector0, _vector1, _center); index += (step * 3);\n }\n\n } else {\n setTriangle(floatArray, index, step, _vector0, _vector1, _vector2); index += (step * 3);\n }\n\n }\n }\n\n split.setAttribute(attributeName, new THREE.BufferAttribute(floatArray, attribute.itemSize));\n });\n\n // Clean Up, Return New Geometry\n existing.dispose();\n return split;\n }\n\n /////////////////////////////////////////////////////////////////////////////////////\n ///// Flat\n ////////////////////\n\n /** Applies one iteration of Loop (flat) subdivision (1 triangle split into 4 triangles) */\n static flat(geometry) {\n \n ///// Geometries\n if (! verifyGeometry(geometry)) return geometry;\n const existing = (geometry.index !== null) ? geometry.toNonIndexed() : geometry.clone();\n const loop = new THREE.BufferGeometry();\n\n ///// Attributes\n const attributeList = gatherAttributes(existing);\n const vertexCount = existing.attributes.position.count;\n\n ///// Build Geometry\n attributeList.forEach((attributeName) => {\n const attribute = existing.getAttribute(attributeName);\n if (! attribute) return;\n const newTriangles = 4;\n const arrayLength = (vertexCount * attribute.itemSize) * newTriangles;\n const floatArray = new Float32Array(arrayLength);\n\n let index = 0;\n let step = attribute.itemSize;\n for (let i = 0; i < vertexCount; i += 3) {\n\n // Original Vertices\n _vector0.fromBufferAttribute(attribute, i + 0);\n _vector1.fromBufferAttribute(attribute, i + 1);\n _vector2.fromBufferAttribute(attribute, i + 2);\n\n // Midpoints\n _vec0to1.copy(_vector0).add(_vector1).divideScalar(2.0);\n _vec1to2.copy(_vector1).add(_vector2).divideScalar(2.0);\n _vec2to0.copy(_vector2).add(_vector0).divideScalar(2.0);\n\n // Add New Triangle Positions\n setTriangle(floatArray, index, step, _vector0, _vec0to1, _vec2to0); index += (step * 3);\n setTriangle(floatArray, index, step, _vector1, _vec1to2, _vec0to1); index += (step * 3);\n setTriangle(floatArray, index, step, _vector2, _vec2to0, _vec1to2); index += (step * 3);\n setTriangle(floatArray, index, step, _vec0to1, _vec1to2, _vec2to0); index += (step * 3);\n }\n\n loop.setAttribute(attributeName, new THREE.BufferAttribute(floatArray, attribute.itemSize));\n });\n\n ///// Clean Up\n existing.dispose();\n return loop;\n }\n\n /////////////////////////////////////////////////////////////////////////////////////\n ///// Smooth\n ////////////////////\n\n /** Applies one iteration of Loop (smooth) subdivision (1 triangle split into 4 triangles) */\n static smooth(geometry, uvSmooth = false) {\n\n ///// Geometries\n if (! verifyGeometry(geometry)) return geometry;\n const existing = (geometry.index !== null) ? geometry.toNonIndexed() : geometry.clone();\n const flat = LoopSubdivision.flat(existing);\n const loop = new THREE.BufferGeometry();\n\n ///// Attributes\n const attributeList = gatherAttributes(existing);\n const vertexCount = existing.attributes.position.count;\n const posAttribute = existing.getAttribute('position');\n const norAttribute = existing.getAttribute('normal');\n const hashToIndex = {}; // Map by hash that contains arrays of index values of same position\n const indexToHash = []; // Position_Normal hash stored for each index\n const indexToPos = []; // Position only hash stored for each index\n const existingNeighbors = {}; // Position hash mapped to Sets of existing vertex neighbors\n const flatOpposites = {}; // Position hash mapped to Sets of new edge point opposites\n\n ///// Existing Vertex Hashes\n for (let i = 0; i < vertexCount; i += 3) {\n _vertex[0].fromBufferAttribute(posAttribute, i + 0);\n _vertex[1].fromBufferAttribute(posAttribute, i + 1);\n _vertex[2].fromBufferAttribute(posAttribute, i + 2);\n\n // Map Vertex Hashes\n for (let j = 0; j < 3; j++) {\n const positionHash = hashFromVector(_vertex[j]);\n const normalHash = hashFromVector(_vector.fromBufferAttribute(norAttribute, i + j));\n const pointHash = `${positionHash}_${normalHash}`;\n addToMapArray(hashToIndex, pointHash, (i + j));\n indexToPos.push(positionHash);\n indexToHash.push(pointHash);\n }\n \n // Neighbors (Existing Geometry)\n addToObjectSet(existingNeighbors, indexToPos[i + 0], indexToHash[i + 1]);\n addToObjectSet(existingNeighbors, indexToPos[i + 0], indexToHash[i + 2]);\n addToObjectSet(existingNeighbors, indexToPos[i + 1], indexToHash[i + 0]);\n addToObjectSet(existingNeighbors, indexToPos[i + 1], indexToHash[i + 2]);\n addToObjectSet(existingNeighbors, indexToPos[i + 2], indexToHash[i + 0]);\n addToObjectSet(existingNeighbors, indexToPos[i + 2], indexToHash[i + 1]);\n \n // Midpoints / Opposites\n _vec0to1.copy(_vertex[0]).add(_vertex[1]).divideScalar(2.0);\n _vec1to2.copy(_vertex[1]).add(_vertex[2]).divideScalar(2.0);\n _vec2to0.copy(_vertex[2]).add(_vertex[0]).divideScalar(2.0);\n const hash0to1 = hashFromVector(_vec0to1);\n const hash1to2 = hashFromVector(_vec1to2);\n const hash2to0 = hashFromVector(_vec2to0);\n addToObjectSet(flatOpposites, hash0to1, indexToHash[i + 2]);\n addToObjectSet(flatOpposites, hash1to2, indexToHash[i + 0]);\n addToObjectSet(flatOpposites, hash2to0, indexToHash[i + 1]);\n }\n\n ///// Build Geometry\n attributeList.forEach((attributeName) => {\n const existingAttribute = existing.getAttribute(attributeName);\n const flatAttribute = flat.getAttribute(attributeName);\n const flatPosition = flat.getAttribute('position');\n if (existingAttribute === undefined || flatAttribute === undefined) return;\n\n const arrayLength = (flat.attributes.position.count * flatAttribute.itemSize);\n const floatArray = new Float32Array(arrayLength);\n\n let index = 0;\n for (let i = 0; i < flat.attributes.position.count; i += 3) {\n\n if (attributeName === 'uv' && ! uvSmooth) {\n for (let v = 0; v < 3; v++) {\n _vertex[v].fromBufferAttribute(flatAttribute, i + v);\n }\n\n } else { // 'normal', 'position', 'color', etc...\n for (let v = 0; v < 3; v++) {\n _vertex[v].fromBufferAttribute(flatAttribute, i + v);\n _position[v].fromBufferAttribute(flatPosition, i + v);\n\n let positionHash = hashFromVector(_position[v]);\n let neighbors = existingNeighbors[positionHash];\n let opposites = flatOpposites[positionHash]\n \n ///// Adjust Source Vertex\n if (neighbors && (neighbors instanceof Set)) {\n const k = neighbors.size;\n\n ///// Loop's Formula\n const beta = 1 / k * ((5/8) - Math.pow((3/8) + (1/4) * Math.cos(2 * Math.PI / k), 2));\n\n ///// Warren's Formula\n // const beta = (k > 3) ? 3 / (8 * k) : ((k === 3) ? 3 / 16 : 0);\n \n ///// Stevinz' Formula\n // const beta = 0.5 / k;\n\n ///// Average with Neighbors\n const startWeight = 1.0 - (beta * k);\n _vertex[v].multiplyScalar(startWeight);\n\n neighbors.forEach(neighborHash => {\n _average.fromBufferAttribute(existingAttribute, hashToIndex[neighborHash][0]);\n _average.multiplyScalar(beta);\n _vertex[v].add(_average);\n });\n\n ///// Newly Added Edge Vertex\n } else if (opposites && (opposites instanceof Set) && opposites.size === 2) {\n const k = opposites.size;\n const beta = 0.125; /* 1/8 */\n const startWeight = 1.0 - (beta * k);\n _vertex[v].multiplyScalar(startWeight);\n\n opposites.forEach(oppositeHash => {\n _average.fromBufferAttribute(existingAttribute, hashToIndex[oppositeHash][0]);\n _average.multiplyScalar(beta);\n _vertex[v].add(_average);\n });\n }\n }\n }\n\n // Add New Triangle Position\n setTriangle(floatArray, index, flatAttribute.itemSize, _vertex[0], _vertex[1], _vertex[2]);\n index += (flatAttribute.itemSize * 3);\n }\n\n loop.setAttribute(attributeName, new THREE.BufferAttribute(floatArray, flatAttribute.itemSize));\n });\n\n ///// Clean Up\n flat.dispose();\n existing.dispose();\n return loop;\n }\n\n}\n\n/////////////////////////////////////////////////////////////////////////////////////\n///// Local Functions, Hash\n/////////////////////////////////////////////////////////////////////////////////////\n\nconst _positionShift = Math.pow(10, POSITION_DECIMALS);\n\n/** Compares two numbers to see if they're almost the same */\nfunction fuzzy(a, b, tolerance = 0.00001) {\n return ((a < (b + tolerance)) && (a > (b - tolerance)));\n}\n\n/** Generates hash strong from Number */\nfunction hashFromNumber(num, shift = _positionShift) {\n let roundedNumber = round(num * shift);\n if (roundedNumber == 0) roundedNumber = 0; /* prevent -0 (signed 0 can effect Math.atan2(), etc.) */\n return `${roundedNumber}`;\n}\n\n/** Generates hash strong from Vector3 */\nfunction hashFromVector(vector, shift = _positionShift) {\n return `${hashFromNumber(vector.x, shift)},${hashFromNumber(vector.y, shift)},${hashFromNumber(vector.z, shift)}`;\n}\n\nfunction round(x) {\n return (x + ((x > 0) ? 0.5 : -0.5)) << 0;\n}\n\n/////////////////////////////////////////////////////////////////////////////////////\n///// Local Functions, Maps\n/////////////////////////////////////////////////////////////////////////////////////\n\n/** Adds a value into set array */\nfunction addToObjectSet(object, hash, value) {\n if (! object[hash]) object[hash] = new Set();\n object[hash].add(value);\n}\n\n/** Adds value into map array */\nfunction addToMapArray(map, key, value) {\n if (! map[key]) map[key] = [];\n map[key].push(value);\n}\n\n/////////////////////////////////////////////////////////////////////////////////////\n///// Local Functions, Geometry\n/////////////////////////////////////////////////////////////////////////////////////\n\nfunction calcNormal(target, vec1, vec2, vec3) {\n _temp.subVectors(vec1, vec2);\n target.subVectors(vec2, vec3);\n target.cross(_temp).normalize();\n}\n\nfunction gatherAttributes(geometry) {\n const desired = [ 'position', 'normal', 'uv' ];\n const contains = Object.keys(geometry.attributes);\n const attributeList = Array.from(new Set(desired.concat(contains)));\n return attributeList;\n}\n\nfunction setTriangle(positions, index, step, vec0, vec1, vec2) {\n if (step >= 1) {\n positions[index + 0 + (step * 0)] = vec0.x;\n positions[index + 0 + (step * 1)] = vec1.x;\n positions[index + 0 + (step * 2)] = vec2.x;\n } \n if (step >= 2) {\n positions[index + 1 + (step * 0)] = vec0.y;\n positions[index + 1 + (step * 1)] = vec1.y;\n positions[index + 1 + (step * 2)] = vec2.y;\n }\n if (step >= 3) {\n positions[index + 2 + (step * 0)] = vec0.z;\n positions[index + 2 + (step * 1)] = vec1.z;\n positions[index + 2 + (step * 2)] = vec2.z;\n }\n if (step >= 4) {\n positions[index + 3 + (step * 0)] = vec0.w;\n positions[index + 3 + (step * 1)] = vec1.w;\n positions[index + 3 + (step * 2)] = vec2.w;\n }\n}\n\nfunction verifyGeometry(geometry) {\n if (! geometry.isBufferGeometry) {\n console.warn(`LoopSubdivision: Geometry must be 'BufferGeometry' type`);\n return false;\n }\n\n if (geometry.attributes.position === undefined) {\n console.warn(`LoopSubdivision: Missing required attribute - 'position'`);\n return false;\n }\n\n if (geometry.attributes.normal === undefined) {\n geometry.computeVertexNormals();\n }\n return true;\n}\n\n/////////////////////////////////////////////////////////////////////////////////////\n///// Exports\n/////////////////////////////////////////////////////////////////////////////////////\n\nexport { LoopSubdivision };\n\n/////////////////////////////////////////////////////////////////////////////////////\n///// Reference\n/////////////////////////////////////////////////////////////////////////////////////\n//\n// https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/thesis-10.pdf\n// https://en.wikipedia.org/wiki/Loop_subdivision_surface\n// https://cseweb.ucsd.edu/~alchern/teaching/cse167_fa21/6-3Surfaces.pdf\n//\n/////////////////////////////////////////////////////////////////////////////////////\n///// Original three.js SubdivisionModifier\n/////////////////////////////////////////////////////////////////////////////////////\n// \n// Loop, r124\n// https://github.com/mrdoob/three.js/blob/r124/examples/jsm/modifiers/SubdivisionModifier.js\n// Catmull-Clark, r59\n// https://github.com/mrdoob/three.js/blob/r59/examples/js/modifiers/SubdivisionModifier.js\n//\n/////////////////////////////////////////////////////////////////////////////////////\n///// License\n/////////////////////////////////////////////////////////////////////////////////////\n//\n// MIT License\n//\n// Subdivide Modifier\n// Copyright (c) 2022 Stephens Nunnally <@stevinz>\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE."],"names":["THREE"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;IAAA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;AAkDA;IACA;AACA;IACA,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B;IACA;AACA;IACA,MAAM,QAAQ,GAAG,IAAIA,gBAAK,CAAC,OAAO,EAAE,CAAC;IACrC,MAAM,OAAO,GAAG,IAAIA,gBAAK,CAAC,OAAO,EAAE,CAAC;IACpC,MAAM,SAAS,GAAG,IAAIA,gBAAK,CAAC,OAAO,EAAE,CAAC;IACtC,MAAM,OAAO,GAAG,IAAIA,gBAAK,CAAC,OAAO,EAAE,CAAC;IACpC,MAAM,KAAK,GAAG,IAAIA,gBAAK,CAAC,OAAO,EAAE,CAAC;IAClC,MAAM,OAAO,GAAG,IAAIA,gBAAK,CAAC,OAAO,EAAE,CAAC;IACpC,MAAM,QAAQ,GAAG,IAAIA,gBAAK,CAAC,OAAO,EAAE,CAAC;IACrC,MAAM,QAAQ,GAAG,IAAIA,gBAAK,CAAC,OAAO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,KAAK;AACL;IACA,IAAI,IAAI,QAAQ,CAAC,UAAU,CAAC,MAAM,KAAK,SAAS,EAAE;IAClD,QAAQ,QAAQ,CAAC,oBAAoB,EAAE,CAAC;IACxC,KAAK;IACL,IAAI,OAAO,IAAI,CAAC;IAChB,CAAC;AAOD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"index.umd.cjs","sources":["../src/LoopSubdivision.js"],"sourcesContent":["/** /////////////////////////////////////////////////////////////////////////////////\n//\n// @description Loop Subdivision Surface\n// @about Smooth subdivision surface modifier for use with three.js BufferGeometry\n// @author Stephens Nunnally <@stevinz>\n// @license MIT - Copyright (c) 2022 Stephens Nunnally and Scidian Software\n// @source https://github.com/stevinz/three-subdivide\n//\n// See end of file for license details and acknowledgements\n//\n///////////////////////////////////////////////////////////////////////////////////*/\n//\n// Functions\n// modify Applies Loop subdivision to BufferGeometry, returns new BufferGeometry\n// edgeSplit Splits all triangles at edges shared by coplanar triangles\n// flat One iteration of Loop subdivision, without point averaging\n// smooth One iteration of Loop subdivision, with point averaging\n//\n// Info\n// This modifier uses the Loop (Charles Loop, 1987) subdivision surface algorithm to smooth\n// modern three.js BufferGeometry.\n//\n// At one point, three.js included a subdivision surface modifier in the extended examples (see bottom\n// of file for links), it was removed in r125. This modifier was originally based on the Catmull-Clark\n// algorithm, which works best for geometry with convex coplanar n-gon faces. In three.js r60 the modifier\n// was changed to use the Loop algorithm, which was designed to work better with triangle based meshes.\n//\n// The Loop algorithm, however, doesn't always provide uniform results as the vertices are skewed toward\n// the most used vertex positions. A triangle based box (e.g. BoxGeometry) will favor the corners. To\n// alleviate this issue, this implementation includes an initial pass to split coplanar faces at their\n// shared edges. It starts by splitting along the longest shared edge first, and then from that midpoint it\n// splits to any remaining coplanar shared edges. This can be disabled by passing 'split' as false.\n//\n// Also by default, this implementation inserts new uv coordinates, but does not average them using the Loop\n// algorithm. In some cases (often in flat geometries) this will produce undesired results, a\n// noticeable tearing will occur. In such cases, try passing 'uvSmooth' as true to enable uv averaging.\n//\n// Note(s)\n// - This modifier returns a new BufferGeometry instance, it does not dispose() of the old geometry.\n//\n// - This modifier returns a NonIndexed geometry. An Indexed geometry can be created by using the\n// BufferGeometryUtils.mergeVertices() function, see:\n// https://threejs.org/docs/?q=buffer#examples/en/utils/BufferGeometryUtils.mergeVertices\n//\n// - This modifier works best with geometry whose triangles share edges AND edge vertices. See diagram below.\n//\n// OKAY NOT OKAY\n// O O\n// /|\\ / \\\n// / | \\ / \\\n// / | \\ / \\\n// O---O---O O---O---O\n// \\ | / \\ | /\n// \\ | / \\ | /\n// \\|/ \\|/\n// O O\n//\n/////////////////////////////////////////////////////////////////////////////////////\n\nimport * as THREE from 'three';\n\n///// Constants\n\nconst POSITION_DECIMALS = 2;\n\n///// Local Variables\n\nconst _average = new THREE.Vector3();\nconst _center = new THREE.Vector3();\nconst _midpoint = new THREE.Vector3();\nconst _normal = new THREE.Vector3();\nconst _temp = new THREE.Vector3();\nconst _vector0 = new THREE.Vector3(); // .Vector4();\nconst _vector1 = new THREE.Vector3(); // .Vector4();\nconst _vector2 = new THREE.Vector3(); // .Vector4();\nconst _vec0to1 = new THREE.Vector3();\nconst _vec1to2 = new THREE.Vector3();\nconst _vec2to0 = new THREE.Vector3();\nconst _position = [\n new THREE.Vector3(),\n new THREE.Vector3(),\n new THREE.Vector3(),\n];\nconst _vertex = [\n new THREE.Vector3(),\n new THREE.Vector3(),\n new THREE.Vector3(),\n];\nconst _triangle = new THREE.Triangle();\n\n/////////////////////////////////////////////////////////////////////////////////////\n///// Loop Subdivision Surface\n/////////////////////////////////////////////////////////////////////////////////////\n\n/** Loop subdivision surface modifier for use with modern three.js BufferGeometry */\nclass LoopSubdivision {\n\n /////////////////////////////////////////////////////////////////////////////////////\n ///// Modify\n ////////////////////\n\n /**\n * Applies Loop subdivision modifier to geometry\n *\n * @param {Object} bufferGeometry - Three.js geometry to be subdivided\n * @param {Number} iterations - How many times to run subdividion\n * @param {Boolean} split - Should coplanar faces be divided along shared edges before running Loop subdivision\n * @param {Boolean} uvSmooth - Should UV values be averaged during subdivision\n * @param {Boolean} flatOnly - If true, subdivision generates triangles, but does not modify positions\n * @param {Number} maxTriangles - If geometry contains more than this many triangles, subdivision will not contiunue\n * @returns {Object} Returns new, subdivided, three.js BufferGeometry object\n */\n static modify(bufferGeometry, iterations = 1, split = true, uvSmooth = false, flatOnly = false, maxTriangles = Infinity) {\n\n ///// Geometries\n if (! verifyGeometry(bufferGeometry)) return bufferGeometry;\n let modifiedGeometry = bufferGeometry.clone();\n\n ///// Presplit\n if (split) {\n const splitGeometry = LoopSubdivision.edgeSplit(modifiedGeometry)\n modifiedGeometry.dispose();\n modifiedGeometry = splitGeometry;\n }\n\n ///// Apply Subdivision\n for (let i = 0; i < iterations; i++) {\n let currentTriangles = modifiedGeometry.attributes.position.count / 3;\n if (currentTriangles < maxTriangles) {\n let subdividedGeometry;\n if (flatOnly) {\n subdividedGeometry = LoopSubdivision.flat(modifiedGeometry);\n } else {\n subdividedGeometry = LoopSubdivision.smooth(modifiedGeometry, uvSmooth);\n }\n modifiedGeometry.dispose();\n modifiedGeometry = subdividedGeometry;\n }\n }\n\n return modifiedGeometry;\n }\n\n /////////////////////////////////////////////////////////////////////////////////////\n ///// Split Hypotenuse\n ////////////////////\n\n /**\n * Applies one iteration of split subdivision. Splits all triangles at edges shared by coplanar triangles.\n * Starts by splitting at longest shared edge, followed by splitting from that new center edge point to the\n * center of any other shared edges.\n */\n static edgeSplit(geometry) {\n\n ///// Geometries\n if (! verifyGeometry(geometry)) return geometry;\n const existing = (geometry.index !== null) ? geometry.toNonIndexed() : geometry.clone();\n const split = new THREE.BufferGeometry();\n\n ///// Attributes\n const attributeList = gatherAttributes(existing);\n const vertexCount = existing.attributes.position.count;\n const posAttribute = existing.getAttribute('position');\n const norAttribute = existing.getAttribute('normal');\n const edgeHashToTriangle = {};\n const triangleEdgeHashes = [];\n const edgeLength = {};\n const triangleExist = [];\n\n ///// Edges\n for (let i = 0; i < vertexCount; i += 3) {\n // Positions\n _vector0.fromBufferAttribute(posAttribute, i + 0);\n _vector1.fromBufferAttribute(posAttribute, i + 1);\n _vector2.fromBufferAttribute(posAttribute, i + 2);\n _normal.fromBufferAttribute(norAttribute, i);\n const vecHash0 = hashFromVector(_vector0);\n const vecHash1 = hashFromVector(_vector1);\n const vecHash2 = hashFromVector(_vector2);\n\n // Verify Area\n const triangleSize = _triangle.set(_vector0, _vector1, _vector2).getArea();\n triangleExist.push(! fuzzy(triangleSize, 0));\n if (! triangleExist[i / 3]) {\n triangleEdgeHashes.push([]);\n continue;\n }\n\n // Calculate Normals\n calcNormal(_normal, _vector0, _vector1, _vector2);\n const normalHash = hashFromVector(_normal);\n\n // Vertex Hashes\n let hashes = [\n `${vecHash0}_${vecHash1}_${normalHash}`, // [0]: 0to1\n `${vecHash1}_${vecHash0}_${normalHash}`, // [1]: 1to0\n `${vecHash1}_${vecHash2}_${normalHash}`, // [2]: 1to2\n `${vecHash2}_${vecHash1}_${normalHash}`, // [3]: 2to1\n `${vecHash2}_${vecHash0}_${normalHash}`, // [4]: 2to0\n `${vecHash0}_${vecHash2}_${normalHash}`, // [5]: 0to2\n ];\n\n // Store Edge Hashes\n let index = i / 3;\n for (let j = 0; j < hashes.length; j++) {\n // Attach Triangle Index to Edge Hash\n addToMapArray(edgeHashToTriangle, hashes[j], index);;\n\n // Edge Length\n if (! edgeLength[hashes[j]]) {\n if (j === 0 || j === 1) edgeLength[hashes[j]] = _vector0.distanceTo(_vector1);\n if (j === 2 || j === 3) edgeLength[hashes[j]] = _vector1.distanceTo(_vector2);\n if (j === 4 || j === 5) edgeLength[hashes[j]] = _vector2.distanceTo(_vector0);\n }\n }\n\n // Triangle Edge Reference\n triangleEdgeHashes.push([ hashes[0], hashes[2], hashes[4] ]);\n }\n\n ///// Build Geometry\n attributeList.forEach((attributeName) => {\n const attribute = existing.getAttribute(attributeName);\n if (! attribute) return;\n const newTriangles = 4; /* maximum number of new triangles */\n const arrayLength = (vertexCount * attribute.itemSize) * newTriangles;\n const floatArray = new Float32Array(arrayLength);\n\n let index = 0;\n let step = attribute.itemSize;\n for (let i = 0; i < vertexCount; i += 3) {\n if (! triangleExist[i / 3]) continue;\n\n _vector0.fromBufferAttribute(attribute, i + 0);\n _vector1.fromBufferAttribute(attribute, i + 1);\n _vector2.fromBufferAttribute(attribute, i + 2);\n\n // Check for Shared Edges\n const existingIndex = i / 3;\n const edgeHash0to1 = triangleEdgeHashes[existingIndex][0];\n const edgeHash1to2 = triangleEdgeHashes[existingIndex][1];\n const edgeHash2to0 = triangleEdgeHashes[existingIndex][2];\n\n const edgeCount0to1 = edgeHashToTriangle[edgeHash0to1].length;\n const edgeCount1to2 = edgeHashToTriangle[edgeHash1to2].length;\n const edgeCount2to0 = edgeHashToTriangle[edgeHash2to0].length;\n const sharedCount = (edgeCount0to1 + edgeCount1to2 + edgeCount2to0) - 3;\n\n // No Shared Edges\n if (sharedCount === 0) {\n setTriangle(floatArray, index, step, _vector0, _vector1, _vector2); index += (step * 3);\n\n // Shared Edges\n } else {\n const length0to1 = edgeLength[edgeHash0to1];\n const length1to2 = edgeLength[edgeHash1to2];\n const length2to0 = edgeLength[edgeHash2to0];\n\n // Add New Triangle Positions\n if ((length0to1 > length1to2 || edgeCount1to2 <= 1) &&\n (length0to1 > length2to0 || edgeCount2to0 <= 1) && edgeCount0to1 > 1) {\n _center.copy(_vector0).add(_vector1).divideScalar(2.0);\n if (edgeCount2to0 > 1) {\n _midpoint.copy(_vector2).add(_vector0).divideScalar(2.0);\n setTriangle(floatArray, index, step, _vector0, _center, _midpoint); index += (step * 3);\n setTriangle(floatArray, index, step, _center, _vector2, _midpoint); index += (step * 3);\n } else {\n setTriangle(floatArray, index, step, _vector0, _center, _vector2); index += (step * 3);\n }\n if (edgeCount1to2 > 1) {\n _midpoint.copy(_vector1).add(_vector2).divideScalar(2.0);\n setTriangle(floatArray, index, step, _center, _vector1, _midpoint); index += (step * 3);\n setTriangle(floatArray, index, step, _midpoint, _vector2, _center); index += (step * 3);\n } else {\n setTriangle(floatArray, index, step, _vector1, _vector2, _center); index += (step * 3);\n }\n\n } else if ((length1to2 > length2to0 || edgeCount2to0 <= 1) && edgeCount1to2 > 1) {\n _center.copy(_vector1).add(_vector2).divideScalar(2.0);\n if (edgeCount0to1 > 1) {\n _midpoint.copy(_vector0).add(_vector1).divideScalar(2.0);\n setTriangle(floatArray, index, step, _center, _midpoint, _vector1); index += (step * 3);\n setTriangle(floatArray, index, step, _midpoint, _center, _vector0); index += (step * 3);\n } else {\n setTriangle(floatArray, index, step, _vector1, _center, _vector0); index += (step * 3);\n }\n if (edgeCount2to0 > 1) {\n _midpoint.copy(_vector2).add(_vector0).divideScalar(2.0);\n setTriangle(floatArray, index, step, _center, _vector2, _midpoint); index += (step * 3);\n setTriangle(floatArray, index, step, _midpoint, _vector0, _center); index += (step * 3);\n } else {\n setTriangle(floatArray, index, step, _vector2, _vector0, _center); index += (step * 3);\n }\n\n } else if (edgeCount2to0 > 1) {\n _center.copy(_vector2).add(_vector0).divideScalar(2.0);\n if (edgeCount1to2 > 1) {\n _midpoint.copy(_vector1).add(_vector2).divideScalar(2.0);\n setTriangle(floatArray, index, step, _vector2, _center, _midpoint); index += (step * 3);\n setTriangle(floatArray, index, step, _center, _vector1, _midpoint); index += (step * 3);\n } else {\n setTriangle(floatArray, index, step, _vector2, _center, _vector1); index += (step * 3);\n }\n if (edgeCount0to1 > 1) {\n _midpoint.copy(_vector0).add(_vector1).divideScalar(2.0);\n setTriangle(floatArray, index, step, _vector0, _midpoint, _center); index += (step * 3);\n setTriangle(floatArray, index, step, _midpoint, _vector1, _center); index += (step * 3);\n } else {\n setTriangle(floatArray, index, step, _vector0, _vector1, _center); index += (step * 3);\n }\n\n } else {\n setTriangle(floatArray, index, step, _vector0, _vector1, _vector2); index += (step * 3);\n }\n\n }\n }\n\n // Resize Array\n const reducedCount = (index * 3) / step;\n const reducedArray = new Float32Array(reducedCount);\n for (let i = 0; i < reducedCount; i++) {\n reducedArray[i] = floatArray[i];\n }\n\n // Set Attribute\n split.setAttribute(attributeName, new THREE.BufferAttribute(reducedArray, attribute.itemSize));\n });\n\n // Clean Up, Return New Geometry\n existing.dispose();\n return split;\n }\n\n /////////////////////////////////////////////////////////////////////////////////////\n ///// Flat\n ////////////////////\n\n /** Applies one iteration of Loop (flat) subdivision (1 triangle split into 4 triangles) */\n static flat(geometry) {\n\n ///// Geometries\n if (! verifyGeometry(geometry)) return geometry;\n const existing = (geometry.index !== null) ? geometry.toNonIndexed() : geometry.clone();\n const loop = new THREE.BufferGeometry();\n\n ///// Attributes\n const attributeList = gatherAttributes(existing);\n const vertexCount = existing.attributes.position.count;\n\n ///// Build Geometry\n attributeList.forEach((attributeName) => {\n const attribute = existing.getAttribute(attributeName);\n if (! attribute) return;\n const newTriangles = 4;\n const arrayLength = (vertexCount * attribute.itemSize) * newTriangles;\n const floatArray = new Float32Array(arrayLength);\n\n let index = 0;\n let step = attribute.itemSize;\n for (let i = 0; i < vertexCount; i += 3) {\n\n // Original Vertices\n _vector0.fromBufferAttribute(attribute, i + 0);\n _vector1.fromBufferAttribute(attribute, i + 1);\n _vector2.fromBufferAttribute(attribute, i + 2);\n\n // Midpoints\n _vec0to1.copy(_vector0).add(_vector1).divideScalar(2.0);\n _vec1to2.copy(_vector1).add(_vector2).divideScalar(2.0);\n _vec2to0.copy(_vector2).add(_vector0).divideScalar(2.0);\n\n // Add New Triangle Positions\n setTriangle(floatArray, index, step, _vector0, _vec0to1, _vec2to0); index += (step * 3);\n setTriangle(floatArray, index, step, _vector1, _vec1to2, _vec0to1); index += (step * 3);\n setTriangle(floatArray, index, step, _vector2, _vec2to0, _vec1to2); index += (step * 3);\n setTriangle(floatArray, index, step, _vec0to1, _vec1to2, _vec2to0); index += (step * 3);\n }\n\n loop.setAttribute(attributeName, new THREE.BufferAttribute(floatArray, attribute.itemSize));\n });\n\n ///// Clean Up\n existing.dispose();\n return loop;\n }\n\n /////////////////////////////////////////////////////////////////////////////////////\n ///// Smooth\n ////////////////////\n\n /** Applies one iteration of Loop (smooth) subdivision (1 triangle split into 4 triangles) */\n static smooth(geometry, uvSmooth = false) {\n\n ///// Geometries\n if (! verifyGeometry(geometry)) return geometry;\n const existing = (geometry.index !== null) ? geometry.toNonIndexed() : geometry.clone();\n const flat = LoopSubdivision.flat(existing);\n const loop = new THREE.BufferGeometry();\n\n ///// Attributes\n const attributeList = gatherAttributes(existing);\n const vertexCount = existing.attributes.position.count;\n const posAttribute = existing.getAttribute('position');\n const norAttribute = existing.getAttribute('normal');\n const hashToIndex = {}; // Map by hash that contains arrays of index values of same position\n const indexToHash = []; // Position_Normal hash stored for each index\n const existingNeighbors = {}; // Position hash mapped to Sets of existing vertex neighbors\n const flatOpposites = {}; // Position hash mapped to Sets of new edge point opposites\n\n ///// Existing Vertex Hashes\n for (let i = 0; i < vertexCount; i += 3) {\n _vertex[0].fromBufferAttribute(posAttribute, i + 0);\n _vertex[1].fromBufferAttribute(posAttribute, i + 1);\n _vertex[2].fromBufferAttribute(posAttribute, i + 2);\n\n // Map Vertex Hashes\n const positionHashes = []; // Position only hash\n for (let v = 0; v < 3; v++) {\n // Position\n const positionHash = hashFromVector(_vertex[v]);\n positionHashes.push(positionHash);\n\n // Normal\n _normal.fromBufferAttribute(norAttribute, i + v);\n // calcNormal(_normal, _vertex[0], _vertex[1], _vertex[2]);\n const normalHash = hashFromVector(_normal);\n\n // Combined\n const pointHash = `${positionHash}_${normalHash}`;\n addToMapArray(hashToIndex, pointHash, (i + v));\n indexToHash.push(pointHash);\n }\n\n // Neighbors (Existing Geometry)\n addToObjectSet(existingNeighbors, positionHashes[0], indexToHash[i + 1]);\n addToObjectSet(existingNeighbors, positionHashes[0], indexToHash[i + 2]);\n addToObjectSet(existingNeighbors, positionHashes[1], indexToHash[i + 0]);\n addToObjectSet(existingNeighbors, positionHashes[1], indexToHash[i + 2]);\n addToObjectSet(existingNeighbors, positionHashes[2], indexToHash[i + 0]);\n addToObjectSet(existingNeighbors, positionHashes[2], indexToHash[i + 1]);\n\n // Midpoints / Opposites\n _vec0to1.copy(_vertex[0]).add(_vertex[1]).divideScalar(2.0);\n _vec1to2.copy(_vertex[1]).add(_vertex[2]).divideScalar(2.0);\n _vec2to0.copy(_vertex[2]).add(_vertex[0]).divideScalar(2.0);\n const hash0to1 = hashFromVector(_vec0to1);\n const hash1to2 = hashFromVector(_vec1to2);\n const hash2to0 = hashFromVector(_vec2to0);\n addToObjectSet(flatOpposites, hash0to1, indexToHash[i + 2]);\n addToObjectSet(flatOpposites, hash1to2, indexToHash[i + 0]);\n addToObjectSet(flatOpposites, hash2to0, indexToHash[i + 1]);\n }\n\n ///// Build Geometry\n attributeList.forEach((attributeName) => {\n const existingAttribute = existing.getAttribute(attributeName);\n const flatAttribute = flat.getAttribute(attributeName);\n const flatPosition = flat.getAttribute('position');\n if (existingAttribute === undefined || flatAttribute === undefined) return;\n\n const arrayLength = (flat.attributes.position.count * flatAttribute.itemSize);\n const floatArray = new Float32Array(arrayLength);\n\n let index = 0;\n for (let i = 0; i < flat.attributes.position.count; i += 3) {\n\n if (attributeName === 'uv' && ! uvSmooth) {\n for (let v = 0; v < 3; v++) {\n _vertex[v].fromBufferAttribute(flatAttribute, i + v);\n }\n\n } else { // 'normal', 'position', 'color', etc...\n for (let v = 0; v < 3; v++) {\n _vertex[v].fromBufferAttribute(flatAttribute, i + v);\n _position[v].fromBufferAttribute(flatPosition, i + v);\n\n let positionHash = hashFromVector(_position[v]);\n let neighbors = existingNeighbors[positionHash];\n let opposites = flatOpposites[positionHash]\n\n ///// Adjust Source Vertex\n if (neighbors && (neighbors instanceof Set)) {\n const k = neighbors.size;\n\n ///// Loop's Formula\n const beta = 1 / k * ((5/8) - Math.pow((3/8) + (1/4) * Math.cos(2 * Math.PI / k), 2));\n\n ///// Warren's Formula\n // const beta = (k > 3) ? 3 / (8 * k) : ((k === 3) ? 3 / 16 : 0);\n\n ///// Stevinz' Formula\n // const beta = 0.5 / k;\n\n ///// Average with Neighbors\n const startWeight = 1.0 - (beta * k);\n _vertex[v].multiplyScalar(startWeight);\n\n neighbors.forEach(neighborHash => {\n _average.fromBufferAttribute(existingAttribute, hashToIndex[neighborHash][0]);\n _average.multiplyScalar(beta);\n _vertex[v].add(_average);\n });\n\n ///// Newly Added Edge Vertex\n } else if (opposites && (opposites instanceof Set) && opposites.size === 2) {\n const k = opposites.size;\n const beta = 0.125; /* 1/8 */\n const startWeight = 1.0 - (beta * k);\n _vertex[v].multiplyScalar(startWeight);\n\n opposites.forEach(oppositeHash => {\n _average.fromBufferAttribute(existingAttribute, hashToIndex[oppositeHash][0]);\n _average.multiplyScalar(beta);\n _vertex[v].add(_average);\n });\n }\n }\n }\n\n // Add New Triangle Position\n setTriangle(floatArray, index, flatAttribute.itemSize, _vertex[0], _vertex[1], _vertex[2]);\n index += (flatAttribute.itemSize * 3);\n }\n\n loop.setAttribute(attributeName, new THREE.BufferAttribute(floatArray, flatAttribute.itemSize));\n });\n\n ///// Clean Up\n flat.dispose();\n existing.dispose();\n return loop;\n }\n\n}\n\n/////////////////////////////////////////////////////////////////////////////////////\n///// Local Functions, Hash\n/////////////////////////////////////////////////////////////////////////////////////\n\nconst _positionShift = Math.pow(10, POSITION_DECIMALS);\n\n/** Compares two numbers to see if they're almost the same */\nfunction fuzzy(a, b, tolerance = 0.00001) {\n return ((a < (b + tolerance)) && (a > (b - tolerance)));\n}\n\n/** Generates hash strong from Number */\nfunction hashFromNumber(num, shift = _positionShift) {\n let roundedNumber = round(num * shift);\n if (roundedNumber == 0) roundedNumber = 0; /* prevent -0 (signed 0 can effect Math.atan2(), etc.) */\n return `${roundedNumber}`;\n}\n\n/** Generates hash strong from Vector3 */\nfunction hashFromVector(vector, shift = _positionShift) {\n return `${hashFromNumber(vector.x, shift)},${hashFromNumber(vector.y, shift)},${hashFromNumber(vector.z, shift)}`;\n}\n\nfunction round(x) {\n return (x + ((x > 0) ? 0.5 : -0.5)) << 0;\n}\n\n/////////////////////////////////////////////////////////////////////////////////////\n///// Local Functions, Maps\n/////////////////////////////////////////////////////////////////////////////////////\n\n/** Adds a value into set array */\nfunction addToObjectSet(object, hash, value) {\n if (! object[hash]) object[hash] = new Set();\n object[hash].add(value);\n}\n\n/** Adds value into map array */\nfunction addToMapArray(map, key, value) {\n if (! map[key]) map[key] = [];\n map[key].push(value);\n}\n\n/////////////////////////////////////////////////////////////////////////////////////\n///// Local Functions, Geometry\n/////////////////////////////////////////////////////////////////////////////////////\n\nfunction calcNormal(target, vec1, vec2, vec3) {\n _temp.subVectors(vec1, vec2);\n target.subVectors(vec2, vec3);\n target.cross(_temp).normalize();\n}\n\nfunction gatherAttributes(geometry) {\n const desired = [ 'position', 'normal', 'uv' ];\n const contains = Object.keys(geometry.attributes);\n const attributeList = Array.from(new Set(desired.concat(contains)));\n return attributeList;\n}\n\nfunction setTriangle(positions, index, step, vec0, vec1, vec2) {\n if (step >= 1) {\n positions[index + 0 + (step * 0)] = vec0.x;\n positions[index + 0 + (step * 1)] = vec1.x;\n positions[index + 0 + (step * 2)] = vec2.x;\n }\n if (step >= 2) {\n positions[index + 1 + (step * 0)] = vec0.y;\n positions[index + 1 + (step * 1)] = vec1.y;\n positions[index + 1 + (step * 2)] = vec2.y;\n }\n if (step >= 3) {\n positions[index + 2 + (step * 0)] = vec0.z;\n positions[index + 2 + (step * 1)] = vec1.z;\n positions[index + 2 + (step * 2)] = vec2.z;\n }\n if (step >= 4) {\n positions[index + 3 + (step * 0)] = vec0.w;\n positions[index + 3 + (step * 1)] = vec1.w;\n positions[index + 3 + (step * 2)] = vec2.w;\n }\n}\n\nfunction verifyGeometry(geometry) {\n if (! geometry.isBufferGeometry) {\n console.warn(`LoopSubdivision: Geometry must be 'BufferGeometry' type`);\n return false;\n }\n\n if (geometry.attributes.position === undefined) {\n console.warn(`LoopSubdivision: Missing required attribute - 'position'`);\n return false;\n }\n\n if (geometry.attributes.normal === undefined) {\n geometry.computeVertexNormals();\n }\n return true;\n}\n\n/////////////////////////////////////////////////////////////////////////////////////\n///// Exports\n/////////////////////////////////////////////////////////////////////////////////////\n\nexport { LoopSubdivision };\n\n/////////////////////////////////////////////////////////////////////////////////////\n///// Reference\n/////////////////////////////////////////////////////////////////////////////////////\n//\n// Subdivision Surfaces\n// https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/thesis-10.pdf\n// https://en.wikipedia.org/wiki/Loop_subdivision_surface\n// https://cseweb.ucsd.edu/~alchern/teaching/cse167_fa21/6-3Surfaces.pdf\n//\n// Original three.js SubdivisionModifier, r124 (Loop)\n// https://github.com/mrdoob/three.js/blob/r124/examples/jsm/modifiers/SubdivisionModifier.js\n//\n// Original three.js SubdivisionModifier, r59 (Catmull-Clark)\n// https://github.com/mrdoob/three.js/blob/r59/examples/js/modifiers/SubdivisionModifier.js\n//\n/////////////////////////////////////////////////////////////////////////////////////\n///// License\n/////////////////////////////////////////////////////////////////////////////////////\n//\n// MIT License\n//\n// Copyright (c) 2022 Stephens Nunnally <@stevinz>\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n// SOFTWARE."],"names":["THREE"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;IAAA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;AAkDA;IACA;AACA;IACA,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B;IACA;AACA;IACA,MAAM,QAAQ,GAAG,IAAIA,gBAAK,CAAC,OAAO,EAAE,CAAC;IACrC,MAAM,OAAO,GAAG,IAAIA,gBAAK,CAAC,OAAO,EAAE,CAAC;IACpC,MAAM,SAAS,GAAG,IAAIA,gBAAK,CAAC,OAAO,EAAE,CAAC;IACtC,MAAM,OAAO,GAAG,IAAIA,gBAAK,CAAC,OAAO,EAAE,CAAC;IACpC,MAAM,KAAK,GAAG,IAAIA,gBAAK,CAAC,OAAO,EAAE,CAAC;IAClC,MAAM,QAAQ,GAAG,IAAIA,gBAAK,CAAC,OAAO,EAAE,CAAC;IACrC,MAAM,QAAQ,GAAG,IAAIA,gBAAK,CAAC,OAAO,EAAE,CAAC;IACrC,MAAM,QAAQ,GAAG,IAAIA,gBAAK,CAAC,OAAO,EAAE,CAAC;IACrC,MAAM,QAAQ,GAAG,IAAIA,gBAAK,CAAC,OAAO,EAAE,CAAC;IACrC,MAAM,QAAQ,GAAG,IAAIA,gBAAK,CAAC,OAAO,EAAE,CAAC;IACrC,MAAM,QAAQ,GAAG,IAAIA,gBAAK,CAAC,OAAO,EAAE,CAAC;IACrC,MAAM,SAAS,GAAG;IAClB,IAAI,IAAIA,gBAAK,CAAC,OAAO,EAAE;IACvB,IAAI,IAAIA,gBAAK,CAAC,OAAO,EAAE;IACvB,IAAI,IAAIA,gBAAK,CAAC,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pD,QAAQ,OAAO,CAAC,IAAI,CAAC,CAAC,wDAAwD,CAAC,CAAC,CAAC;IACjF,QAAQ,OAAO,KAAK,CAAC;IACrB,KAAK;AACL;IACA,IAAI,IAAI,QAAQ,CAAC,UAAU,CAAC,MAAM,KAAK,SAAS,EAAE;IAClD,QAAQ,QAAQ,CAAC,oBAAoB,EAAE,CAAC;IACxC,KAAK;IACL,IAAI,OAAO,IAAI,CAAC;IAChB,CAAC;AAOD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;;;;;;;;;"} \ No newline at end of file diff --git a/package.json b/package.json index 0d43b55..22382f4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "three-subdivide", - "version": "1.0.1", + "version": "1.0.2", "description": "Smooth subdivision surface modifier for use with three.js BufferGeometry.", "module": "src/index.js", "main": "build/index.umd.cjs",