diff --git a/Assets/GUI_Standby.png b/Assets/GUI_Standby.png new file mode 100644 index 0000000..0488fdc Binary files /dev/null and b/Assets/GUI_Standby.png differ diff --git a/Assets/logo-vitalmex-1.png b/Assets/logo-vitalmex-1.png new file mode 100644 index 0000000..7b12f94 Binary files /dev/null and b/Assets/logo-vitalmex-1.png differ diff --git a/Bita-3D-Explorer b/Bita-3D-Explorer deleted file mode 160000 index 5fb1cb8..0000000 --- a/Bita-3D-Explorer +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5fb1cb86725639e1f9a8311d6d4793633e951634 diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..028e928 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,156 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +--- + +# Bitua 3D Explorer + +## Project Overview +Interactive web-based 3D product visualization for the **Bitua Smart Cabinet Series** (medical/laboratory equipment). Users can explore the cabinet in 3D, interact with features (door, biometric reader, lock, camera), and simulate product storage capacity. + +## Tech Stack +- **Three.js v0.162.0** — 3D rendering (loaded via CDN) +- **GSAP** — smooth camera transitions and door animations (loaded via CDN) +- **Vanilla JS ES6 modules** — no framework, no build step +- **GLB/GLTF** — 3D model format with DRACO compression support + +## Architecture +The entire application lives in a single file: `index.html` (56 KB). There is no build system, no package.json, no bundler. All dependencies are loaded from CDN at runtime. + +### Key Assets +- `Cabinet v2.5 con eje.glb` — main 3D model (~5.7 MB) +- `GUI_Standby.png` — texture applied to the GUI screen mesh (solid1_61) + +### Responsive Design +The app is mobile-responsive with three breakpoints: +- **0–480px** (Mobile): Bottom-sheet sidebar UI with floating action button (FAB) +- **481–768px** (Tablet): Narrower sidebar (240px), optimized spacing +- **769px+** (Desktop): Original layout with right-side panel (280px) + +See `RESPONSIVE_DESIGN_IMPLEMENTATION.md` for detailed CSS changes (lines 506–767 in `index.html`). + +## Key Systems (all inside index.html) + +### 1. Scene & Rendering +- WebGLRenderer with MSAA, PCFSoftShadowMap shadows, ACESFilmicToneMapping +- PerspectiveCamera (45° FOV), OrbitControls with damping + +### 2. Material System +Materials are assigned by matching mesh names (regex patterns): +- Glass trays → MeshPhysicalMaterial (transmission: 1.0, IOR: 1.5) +- Green polycarbonate → MeshPhysicalMaterial (transmission: 0.95, green tint) +- Lock/hinges → MeshStandardMaterial (metalness: 1.0) +- LED bar → emissive MeshStandardMaterial (emissiveIntensity: 10) + +### 3. Door/Hinge Animation +- Door meshes (names containing "PUERTA") are reparented into a THREE.Group pivot at the hinge axis +- GSAP animates rotation −120° (−2.09 rad) around Y-axis, 1.2s "power2.inOut" + +### 4. Interaction System +Raycasting on click detects: +- **Lock** (solid1_102, CERRADURA, CILINDRO) → zoom + annotation +- **Biometric readers** (solid1_114, solid1_37–41) → zoom + auto-open door +- **Facial recognition** (solid1_103) → zoom + annotation +- **Camera** (solid1_105, MESHFEATURE1) → zoom + annotation +- **Door/hinges** (PUERTA, BISAGRA) → toggle door open/closed +- **GUI/Console** (solid1_61) → info panel + +### 5. Annotation System +Semi-transparent callout panels with SVG leader lines connecting to 3D objects in screen space. Updates position every frame. + +### 6. Capacity Simulator +Right sidebar with product dimension inputs. Spawns blue semi-transparent boxes inside the cabinet using a grid-packing algorithm. Interior dimensions: {x: 0.8, y: 1.6, z: 0.5} meters. + +### 7. Debug Overlay +Press `D` to toggle camera position/target display with copy-to-clipboard. + +## Common Development Tasks + +### Adding a New Interaction +1. Find the target mesh name using Node.js scripts: `node search_meshes.js ` +2. Add mesh name pattern to the `raycastTargets` array in `index.html` +3. Add handler in the click event listener's if-else chain +4. Test with debug overlay (press `D`) to verify camera zoom targets + +### Modifying Materials +1. All material assignments happen in `initMaterials()` - materials are matched by regex patterns on mesh names +2. Glass trays use `MeshPhysicalMaterial` with `transmission: 1.0` +3. To adjust colors/metalness/roughness: find the regex pattern and modify the material properties +4. Re-serve the app to see changes (hard refresh in browser) + +### Adjusting Capacity Simulator Grid +- Interior cabinet dimensions are hardcoded: `{x: 0.8, y: 1.6, z: 0.5}` meters +- Grid-packing algorithm spawns blue boxes inside these bounds +- Modify `spawnProductBox()` function to change packing behavior or visual style + +### Inspecting the 3D Model +Use Node.js utility scripts to understand the GLB structure without modifying code: +```bash +node list_names.js # All mesh names +node print_hierarchy.js # Full scene tree +node search_meshes.js "pattern" # Find meshes by regex +node inspect_solid1_61.js # Details on GUI screen mesh +``` + +## Development + +### Running Locally +Serve the directory with any static file server: +```bash +# Python +python -m http.server 8080 + +# Node.js (npx) +npx serve . + +# VS Code Live Server extension also works +``` +Then open `http://localhost:8080` in a browser. + +**Note:** Must be served over HTTP (not opened as a `file://` URL) due to CORS restrictions on GLB loading. + +## Utility Scripts +Node.js analysis scripts for inspecting the GLB model (not part of the runtime app): + +| Script | Purpose | +|---|---| +| `list_names.js` | List all mesh/node names in the model | +| `print_hierarchy.js` | Print full scene hierarchy | +| `search_meshes.js` | Search for meshes by name pattern | +| `search_target_meshes.js` | Find specific interaction target meshes | +| `extract_hinges.js` | Extract BISAGRA (hinge) components | +| `find_led.js` | Locate LED bar mesh | +| `inspect_solid1_61.js` | Deep inspect GUI screen mesh | +| `check_indices.js` | Validate geometry index data | +| `compare_models.js` | Compare two model variants | + +Run with: `node @@ -787,10 +787,35 @@ const lastEntry = meshList[meshList.length - 1]; // 0. GUI STANDBY (Specific Screen Mesh) - if (normMesh.includes('SOLID1_61') || normMesh.includes('PANTALLANUEVA')) { + // Also check combinedNorm so parent "V2.5 PANTALLA NUEVA:1" matches (Solid1_43) + if (normMesh.includes('SOLID1_61') || combinedNorm.includes('PANTALLANUEVA')) { + // Generate planar UV coordinates — this mesh has none in the GLB (CAD export) + const geo = child.geometry; + const positions = geo.attributes.position; + const bbox = new THREE.Box3().setFromBufferAttribute(positions); + const size = new THREE.Vector3(); + bbox.getSize(size); + // Pick the two largest dimensions as the UV plane axes + const dims = [ + { axis: 'x', size: size.x }, + { axis: 'y', size: size.y }, + { axis: 'z', size: size.z } + ].sort((a, b) => b.size - a.size); + const uAxis = dims[0].axis; + const vAxis = dims[1].axis; + const uvArr = new Float32Array(positions.count * 2); + for (let i = 0; i < positions.count; i++) { + const coords = { x: positions.getX(i), y: positions.getY(i), z: positions.getZ(i) }; + const u0 = (coords[uAxis] - bbox.min[uAxis]) / size[uAxis]; + const v0 = (coords[vAxis] - bbox.min[vAxis]) / size[vAxis]; + // Rotate 90° CCW + mirror on Y: new_u = 1 - v0, new_v = 1 - u0 + uvArr[i * 2] = 1 - v0; + uvArr[i * 2 + 1] = 1 - u0; + } + geo.setAttribute('uv', new THREE.BufferAttribute(uvArr, 2)); + child.material = new THREE.MeshBasicMaterial({ map: standbyTexture, - transparent: true, side: THREE.DoubleSide }); lastEntry.matched = "📺 GUI STANDBY"; @@ -1203,6 +1228,7 @@ norm.includes('HUELLERO') || norm.includes('LECTOR') || norm.includes('BIOMETRICO')) return true; if (norm.includes('SOLID1_103')) return true; if (norm.includes('MESHFEATURE1') || norm.includes('SOLID1_105')) return true; + if (norm.includes('SOLID1_81')) return true; let isDoor = false; object.traverseAncestors((ancestor) => { if (ancestor.name && ( @@ -1312,6 +1338,12 @@ } else if (normName.includes('MESHFEATURE1') || normName.includes('SOLID1_105')) { zoomToCamera(object); showAnnotation(object, "Cámara (Opcional)
Grabación de sesión cuando se abre la puerta."); + } else if (normName.includes('SOLID1_81')) { + smoothCameraTransition( + new THREE.Vector3(0.3826, 0.3248, 0.657), + new THREE.Vector3(0.3328, 0.2782, 0.121) + ); + showAnnotation(object, "Pantalla
Pantalla táctil para ingresar"); } else if (object.name.includes('PUERTA') || object.name.includes('BISAGRA') || isDoorClick) { toggleDoor(); hideAnnotation();