sa2kit 1.4.0 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mmd/index.js
CHANGED
|
@@ -501,6 +501,56 @@ var MMDPlayerBase = React6.forwardRef((props, ref) => {
|
|
|
501
501
|
});
|
|
502
502
|
scene.add(mesh);
|
|
503
503
|
console.log("[MMDPlayerBase] \u2705 Model added to scene (fully loaded)");
|
|
504
|
+
const isMobileDevice = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 768;
|
|
505
|
+
if (isMobileDevice) {
|
|
506
|
+
console.log("[MMDPlayerBase] \u{1F4F1} Mobile device detected, applying optimizations...");
|
|
507
|
+
if (renderer.capabilities.vertexTextures) {
|
|
508
|
+
console.log("[MMDPlayerBase] \u2705 Vertex textures supported");
|
|
509
|
+
} else {
|
|
510
|
+
console.log("[MMDPlayerBase] \u26A0\uFE0F Vertex textures NOT supported");
|
|
511
|
+
}
|
|
512
|
+
let simplifiedMaterialCount = 0;
|
|
513
|
+
mesh.traverse((child) => {
|
|
514
|
+
if (child instanceof THREE__namespace.Mesh || child instanceof THREE__namespace.SkinnedMesh) {
|
|
515
|
+
const materials = Array.isArray(child.material) ? child.material : [child.material];
|
|
516
|
+
materials.forEach((material, idx) => {
|
|
517
|
+
if (material instanceof THREE__namespace.MeshPhongMaterial || material instanceof THREE__namespace.MeshStandardMaterial) {
|
|
518
|
+
const originalColor = material.color?.clone();
|
|
519
|
+
const originalMap = material.map;
|
|
520
|
+
const basicMaterial = new THREE__namespace.MeshBasicMaterial({
|
|
521
|
+
color: originalColor || 16777215,
|
|
522
|
+
map: originalMap,
|
|
523
|
+
transparent: material.transparent,
|
|
524
|
+
opacity: material.opacity,
|
|
525
|
+
side: material.side,
|
|
526
|
+
alphaTest: material.alphaTest
|
|
527
|
+
});
|
|
528
|
+
if (Array.isArray(child.material)) {
|
|
529
|
+
child.material[idx] = basicMaterial;
|
|
530
|
+
} else {
|
|
531
|
+
child.material = basicMaterial;
|
|
532
|
+
}
|
|
533
|
+
material.dispose();
|
|
534
|
+
simplifiedMaterialCount++;
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
if (simplifiedMaterialCount > 0) {
|
|
540
|
+
console.log(`[MMDPlayerBase] \u2705 Simplified ${simplifiedMaterialCount} materials to MeshBasicMaterial`);
|
|
541
|
+
}
|
|
542
|
+
const MAX_BONES = 64;
|
|
543
|
+
if (mesh.skeleton) {
|
|
544
|
+
const boneCount = mesh.skeleton.bones.length;
|
|
545
|
+
if (boneCount > MAX_BONES) {
|
|
546
|
+
console.warn(`[MMDPlayerBase] \u26A0\uFE0F Model has ${boneCount} bones (max recommended: ${MAX_BONES})`);
|
|
547
|
+
console.warn(`[MMDPlayerBase] This may cause performance issues on mobile devices`);
|
|
548
|
+
} else {
|
|
549
|
+
console.log(`[MMDPlayerBase] \u2705 Bone count: ${boneCount} (within limit)`);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
console.log("[MMDPlayerBase] \u{1F4F1} Mobile optimizations applied");
|
|
553
|
+
}
|
|
504
554
|
if (resources.cameraPath) {
|
|
505
555
|
loader.loadAnimation(
|
|
506
556
|
resources.cameraPath,
|
|
@@ -2295,7 +2345,7 @@ var LoadingScreen = ({
|
|
|
2295
2345
|
/* @__PURE__ */ React6__default.default.createElement(
|
|
2296
2346
|
"div",
|
|
2297
2347
|
{
|
|
2298
|
-
className: "flex items-center justify-center flex-col inset-0 w-full h-full
|
|
2348
|
+
className: "flex items-center justify-center flex-col inset-0 w-full h-full pointer-events-none",
|
|
2299
2349
|
style: {
|
|
2300
2350
|
background: `linear-gradient(45deg,
|
|
2301
2351
|
rgba(255, 182, 193, 0.2) 0%,
|
|
@@ -2389,7 +2439,7 @@ var StartScreen = ({
|
|
|
2389
2439
|
/* @__PURE__ */ React6__default.default.createElement(
|
|
2390
2440
|
"div",
|
|
2391
2441
|
{
|
|
2392
|
-
className: "flex items-center justify-center flex-col inset-0 w-full h-full
|
|
2442
|
+
className: "flex items-center justify-center flex-col inset-0 w-full h-full pointer-events-none",
|
|
2393
2443
|
style: {
|
|
2394
2444
|
background: `linear-gradient(45deg,
|
|
2395
2445
|
rgba(255, 182, 193, 0.25) 0%,
|