Comparing version 1.0.39 to 1.0.40
{ | ||
"name": "optimesh", | ||
"version": "1.0.39", | ||
"version": "1.0.40", | ||
"description": "OptiMesh reduces meshes resolution to optimize performance, memory usage and download size", | ||
@@ -5,0 +5,0 @@ "cdn": "https://cdn.jsdelivr.net/npm/optimesh@1.0.32/build/main.js", |
import { meshSimplifier, createWorkers } from './MeshSimplifier'; | ||
import { openOptimizer } from './OptimPopup'; | ||
import { openOptimizer, setBoneCosts } from './OptimPopup'; | ||
import { skinnedMeshClone } from './skinnedMeshClone'; | ||
@@ -43,6 +43,7 @@ | ||
editorPlugin, | ||
openOptimizer | ||
openOptimizer, | ||
setBoneCosts, | ||
}; | ||
export default { OptiMesh }; | ||
export { createWorkers, meshSimplifier, editorPlugin, openOptimizer }; | ||
export { createWorkers, meshSimplifier, editorPlugin, openOptimizer, setBoneCosts }; |
@@ -208,2 +208,3 @@ import { emptyOversizedContainer, emptyOversizedContainerIndex, zeroFill } from './BufferArrayManager'; | ||
reusingDataArrays.vertexFacesView.fill(0); | ||
reusingDataArrays.boneCosts.fill(0); | ||
console.timeEnd('reusing arrays') | ||
@@ -244,2 +245,3 @@ return reusingDataArrays; | ||
const faceMaterialIndexView = new Uint8Array(faceMaterialIndexAB); | ||
const boneCosts = new Uint8Array(new SAB(200)); | ||
@@ -279,2 +281,3 @@ // 10 elements, up to 9 neighbours per vertex + first number tells how many neighbours | ||
costStore, | ||
boneCosts, | ||
costCountView, | ||
@@ -331,5 +334,13 @@ costTotalView, | ||
skinIndex, | ||
faceMaterialIndexView | ||
faceMaterialIndexView, | ||
boneCosts, | ||
} = dataArrays; | ||
if (geometry.skeleton) { | ||
Object.keys(geometry.boneCosts).forEach(boneName => { | ||
const idx = geometry.skeleton.bones.findIndex(bone => bone.name === boneName) | ||
if (!idx) return | ||
boneCosts[idx] = geometry.boneCosts[boneName] | ||
}) | ||
} | ||
// console.log('new indexed addresses', newVertexIndexByOld); | ||
@@ -563,2 +574,3 @@ | ||
costStore: dataArrays.costStore, | ||
boneCosts: dataArrays.boneCosts, | ||
faceMaterialIndexView: dataArrays.faceMaterialIndexView, | ||
@@ -565,0 +577,0 @@ vertexFacesView: dataArrays.vertexFacesView, |
@@ -10,3 +10,3 @@ import { meshSimplifier, killWorkers, createWorkers } from './MeshSimplifier'; | ||
var camera, ocontrols, modelGroup, modelOptimized, modelOptimizedGroup, modelMaxSize, modelMaxWidthDepth, fileLoader, close, done; | ||
var boneCosts = {} | ||
export function openOptimizer (model, onDone) { | ||
@@ -21,2 +21,6 @@ const webglContainer = createDOM(onDone); | ||
export function setBoneCosts (newBoneCosts) { | ||
boneCosts = newBoneCosts | ||
} | ||
function createDOM () { | ||
@@ -194,4 +198,9 @@ const parent = document.createElement('div'); | ||
); | ||
const geo = model.originalGeometry || model.geometry; | ||
if (model.skeleton) { | ||
geo.skeleton = model.skeleton | ||
geo.boneCosts = boneCosts | ||
} | ||
meshSimplifier( | ||
model.originalGeometry || model.geometry, | ||
geo, | ||
controls.optimizationLevel, | ||
@@ -198,0 +207,0 @@ controls.maximumCost, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
520576
15170