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.
@@ -476,6 +476,56 @@ var MMDPlayerBase = forwardRef((props, ref) => {
476
476
  });
477
477
  scene.add(mesh);
478
478
  console.log("[MMDPlayerBase] \u2705 Model added to scene (fully loaded)");
479
+ const isMobileDevice = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 768;
480
+ if (isMobileDevice) {
481
+ console.log("[MMDPlayerBase] \u{1F4F1} Mobile device detected, applying optimizations...");
482
+ if (renderer.capabilities.vertexTextures) {
483
+ console.log("[MMDPlayerBase] \u2705 Vertex textures supported");
484
+ } else {
485
+ console.log("[MMDPlayerBase] \u26A0\uFE0F Vertex textures NOT supported");
486
+ }
487
+ let simplifiedMaterialCount = 0;
488
+ mesh.traverse((child) => {
489
+ if (child instanceof THREE.Mesh || child instanceof THREE.SkinnedMesh) {
490
+ const materials = Array.isArray(child.material) ? child.material : [child.material];
491
+ materials.forEach((material, idx) => {
492
+ if (material instanceof THREE.MeshPhongMaterial || material instanceof THREE.MeshStandardMaterial) {
493
+ const originalColor = material.color?.clone();
494
+ const originalMap = material.map;
495
+ const basicMaterial = new THREE.MeshBasicMaterial({
496
+ color: originalColor || 16777215,
497
+ map: originalMap,
498
+ transparent: material.transparent,
499
+ opacity: material.opacity,
500
+ side: material.side,
501
+ alphaTest: material.alphaTest
502
+ });
503
+ if (Array.isArray(child.material)) {
504
+ child.material[idx] = basicMaterial;
505
+ } else {
506
+ child.material = basicMaterial;
507
+ }
508
+ material.dispose();
509
+ simplifiedMaterialCount++;
510
+ }
511
+ });
512
+ }
513
+ });
514
+ if (simplifiedMaterialCount > 0) {
515
+ console.log(`[MMDPlayerBase] \u2705 Simplified ${simplifiedMaterialCount} materials to MeshBasicMaterial`);
516
+ }
517
+ const MAX_BONES = 64;
518
+ if (mesh.skeleton) {
519
+ const boneCount = mesh.skeleton.bones.length;
520
+ if (boneCount > MAX_BONES) {
521
+ console.warn(`[MMDPlayerBase] \u26A0\uFE0F Model has ${boneCount} bones (max recommended: ${MAX_BONES})`);
522
+ console.warn(`[MMDPlayerBase] This may cause performance issues on mobile devices`);
523
+ } else {
524
+ console.log(`[MMDPlayerBase] \u2705 Bone count: ${boneCount} (within limit)`);
525
+ }
526
+ }
527
+ console.log("[MMDPlayerBase] \u{1F4F1} Mobile optimizations applied");
528
+ }
479
529
  if (resources.cameraPath) {
480
530
  loader.loadAnimation(
481
531
  resources.cameraPath,
@@ -2270,7 +2320,7 @@ var LoadingScreen = ({
2270
2320
  /* @__PURE__ */ React6.createElement(
2271
2321
  "div",
2272
2322
  {
2273
- className: "flex items-center justify-center flex-col inset-0 w-full h-full opacity-25 pointer-events-none",
2323
+ className: "flex items-center justify-center flex-col inset-0 w-full h-full pointer-events-none",
2274
2324
  style: {
2275
2325
  background: `linear-gradient(45deg,
2276
2326
  rgba(255, 182, 193, 0.2) 0%,
@@ -2364,7 +2414,7 @@ var StartScreen = ({
2364
2414
  /* @__PURE__ */ React6.createElement(
2365
2415
  "div",
2366
2416
  {
2367
- className: "flex items-center justify-center flex-col inset-0 w-full h-full opacity-30 pointer-events-none",
2417
+ className: "flex items-center justify-center flex-col inset-0 w-full h-full pointer-events-none",
2368
2418
  style: {
2369
2419
  background: `linear-gradient(45deg,
2370
2420
  rgba(255, 182, 193, 0.25) 0%,