diff --git "a/preprocess_manual.js" "b/preprocess_manual.js" new file mode 100644--- /dev/null +++ "b/preprocess_manual.js" @@ -0,0 +1,3085 @@ +// apps/preprocess/preprocess_manual.js +// 2025/12/12 18:08 manual mode for human completed +// 2025/12/12 20:55 manual mode for statue completed + +import * as THREE from 'three'; +import { GVRM } from '../../gvrm-format/gvrm.js'; +import { PLYParser } from '../../gvrm-format/ply.js'; +import * as GVRMUtils from '../../gvrm-format/utils.js'; +import { DropInViewer } from 'gaussian-splats-3d'; +// ========================================== +// ADD THESE IMPORTS AT THE TOP +// ========================================== + +import { OrbitControls } from '../../lib/OrbitControls.js'; + +console.log('[preprocess_manual.js] ===== MODULE LOADING ====='); + +/** + * Manual UI作成関数 + * 手動でのBOX設定と部位割り当て用のUIを提供 + */ + +// プリセット定義 +// プリセット定義 - 必須18ボーンをすべてカバー +const PRESET_BONE_GROUPS = { + 'required19': [ + { name: '1. Head', bones: ['head'], color: [255, 0, 0] }, + { name: '2. Neck', bones: ['neck'], color: [255, 100, 100] }, + { name: '3. Chest', bones: ['chest'], color: [0, 255, 0] }, + { name: '4. Upper Chest', bones: ['upperChest'], color: [50, 255, 50] }, + { name: '5. Spine', bones: ['spine'], color: [100, 255, 100] }, + { name: '6. Hips', bones: ['hips'], color: [150, 255, 150] }, + { name: '7. Left Shoulder', bones: ['leftShoulder'], color: [0, 0, 255] }, + { name: '8. Left Upper Arm', bones: ['leftUpperArm'], color: [50, 50, 255] }, + { name: '9. Left Lower Arm', bones: ['leftLowerArm'], color: [100, 100, 255] }, + { name: '10. Left Hand', bones: ['leftHand'], color: [150, 150, 255] }, + { name: '11. Right Shoulder', bones: ['rightShoulder'], color: [255, 255, 0] }, + { name: '12. Right Upper Arm', bones: ['rightUpperArm'], color: [255, 200, 0] }, + { name: '13. Right Lower Arm', bones: ['rightLowerArm'], color: [255, 150, 0] }, + { name: '14. Right Hand', bones: ['rightHand'], color: [255, 100, 0] }, + { name: '15. Left Upper Leg', bones: ['leftUpperLeg'], color: [255, 0, 255] }, + { name: '16. Left Lower Leg', bones: ['leftLowerLeg'], color: [255, 100, 255] }, + { name: '17. Left Foot', bones: ['leftFoot'], color: [255, 150, 255] }, + { name: '18. Right Upper Leg', bones: ['rightUpperLeg'], color: [0, 255, 255] }, + { name: '19. Right Lower Leg', bones: ['rightLowerLeg'], color: [100, 255, 255] }, + { name: '20. Right Foot', bones: ['rightFoot'], color: [150, 255, 255] } + ] +}; + + + +// ========================================== +// FIX 3: Add Camera Controls Setup +// Add this function before createManualUI +// ========================================== + +function setupCameraControls(camera, renderer) { + const controls = new OrbitControls(camera, renderer.domElement); + controls.enableDamping = true; + controls.dampingFactor = 0.05; + controls.screenSpacePanning = false; + controls.minDistance = 1; + controls.maxDistance = 20; + controls.maxPolarAngle = Math.PI; + + return { controls }; +} + + + +// ========================================== +// FIX 4: Enhanced UI with Paint Mode +// Replace the createManualUI function 2025/12/07 +// ========================================== + +//////////////////////////////////////////12/13 17:30 + +// ======================================== +// 完全に修正された createManualUI 関数 +// Line 75 から Line 537 までを、この全体で置き換えてください +// ======================================== + +function createManualUI(scene, camera, renderer) { + console.log('[createManualUI] Creating manual preprocessing UI...'); + + const uiContainer = document.createElement('div'); + uiContainer.id = 'manual-ui-container'; + uiContainer.style.cssText = ` + position: fixed; + top: 20px; + right: 20px; + background: rgba(0, 0, 0, 0.85); + padding: 20px; + border-radius: 10px; + color: white; + z-index: 10000; + max-width: 350px; + max-height: 90vh; + overflow-y: auto; + display: none; + box-shadow: 0 4px 20px rgba(0,0,0,0.5); + `; + + uiContainer.innerHTML = ` +

Manual Preprocessing

+
Loading PLY file...
+ + +
+ 🎮 Camera Controls:
+ • Left Mouse: Rotate view
+ • Right Mouse: Pan
+ • Scroll: Zoom in/out +
+ + + + + +