COmmit manual

This commit is contained in:
MartinSereyC committed 2026-03-18 13:18:52 -03:00
1 parent 73973720a5
commit 92c8142f5a
6 files changed
+226 -12

No files matched your search

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 318 KiB

+22
View File
@@ -0,0 +1,22 @@
const fs = require('fs');
function checkIndices(filePath) {
const buffer = fs.readFileSync(filePath);
const jsonLen = buffer.readUInt32LE(12);
const jsonBuf = buffer.slice(20, 20 + jsonLen);
const gltf = JSON.parse(jsonBuf.toString());
[37, 41].forEach(idx => {
console.log(`Node [${idx}]:`, gltf.nodes[idx] ? gltf.nodes[idx].name : 'OUT OF RANGE');
if (gltf.nodes[idx] && gltf.nodes[idx].mesh !== undefined) {
const meshIdx = gltf.nodes[idx].mesh;
console.log(` Mesh [${meshIdx}]:`, gltf.meshes[meshIdx].name);
}
});
[37, 41].forEach(idx => {
console.log(`Mesh [${idx}]:`, gltf.meshes[idx] ? gltf.meshes[idx].name : 'OUT OF RANGE');
});
}
checkIndices('Cabinet v2.5 con eje.glb');
+92 -12
View File
@@ -104,6 +104,37 @@
backdrop-filter: blur(10px); backdrop-filter: blur(10px);
text-align: center; text-align: center;
z-index: 5; z-index: 5;
display: flex;
align-items: center;
gap: 15px;
}
#btn-home {
background: var(--primary);
color: white;
border: none;
padding: 8px 16px;
border-radius: 20px;
cursor: pointer;
font-size: 13px;
font-weight: 600;
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
pointer-events: auto;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 4px 10px rgba(0, 122, 255, 0.3);
white-space: nowrap;
}
#btn-home:hover {
background: #005bb7;
transform: translateY(-2px);
box-shadow: 0 6px 15px rgba(0, 122, 255, 0.4);
}
#btn-home:active {
transform: translateY(0);
} }
/* Interaction Tooltip (Click to open) */ /* Interaction Tooltip (Click to open) */
@@ -342,7 +373,8 @@
</div> </div>
<div class="info-panel"> <div class="info-panel">
🖱️ Click to interact | Right-click to pan | Simulator on the right <span id="info-content">🖱️ Click to interact | Right-click to pan | Simulator on the right</span>
<button id="btn-home">🏠 Home</button>
</div> </div>
<div id="camera-debug"> <div id="camera-debug">
@@ -441,6 +473,12 @@
dracoLoader.setDecoderPath('https://www.gstatic.com/draco/versioned/decoders/1.5.6/'); dracoLoader.setDecoderPath('https://www.gstatic.com/draco/versioned/decoders/1.5.6/');
loader.setDRACOLoader(dracoLoader); loader.setDRACOLoader(dracoLoader);
// --- Texture Loading ---
const textureLoader = new THREE.TextureLoader();
const standbyTexture = textureLoader.load('GUI_Standby.png');
standbyTexture.colorSpace = THREE.SRGBColorSpace;
standbyTexture.flipY = false; // GLTF standard
let model = null; let model = null;
let isDoorOpen = false; let isDoorOpen = false;
let hingePivot = null; // THREE.Group at the hinge axis let hingePivot = null; // THREE.Group at the hinge axis
@@ -455,6 +493,15 @@
if (child.isMesh) { if (child.isMesh) {
child.castShadow = true; child.castShadow = true;
child.receiveShadow = true; child.receiveShadow = true;
// Ensure smooth shading
if (child.geometry) {
child.geometry.computeVertexNormals();
}
if (child.material) {
child.material.flatShading = false;
child.material.needsUpdate = true;
}
} }
}); });
} }
@@ -471,7 +518,8 @@
ior: 1.58, // Index of Refraction for PC ior: 1.58, // Index of Refraction for PC
depthWrite: true, // Better for Physical materials in many cases depthWrite: true, // Better for Physical materials in many cases
envMapIntensity: 2.5, // Stronger reflections envMapIntensity: 2.5, // Stronger reflections
side: THREE.DoubleSide side: THREE.DoubleSide,
flatShading: false
}); });
// Highly transparent glass material (Clear) // Highly transparent glass material (Clear)
@@ -485,7 +533,8 @@
ior: 1.5, // Index of Refraction for Class ior: 1.5, // Index of Refraction for Class
depthWrite: true, depthWrite: true,
envMapIntensity: 3.0, envMapIntensity: 3.0,
side: THREE.DoubleSide side: THREE.DoubleSide,
flatShading: false
}); });
// White non-transparent acrylic material // White non-transparent acrylic material
@@ -495,7 +544,8 @@
metalness: 0.0, metalness: 0.0,
transparent: false, transparent: false,
envMapIntensity: 0.8, envMapIntensity: 0.8,
side: THREE.DoubleSide side: THREE.DoubleSide,
flatShading: false
}); });
// Aluminum material for the lock // Aluminum material for the lock
@@ -503,7 +553,8 @@
color: 0xe5e5e5, // Lighter, typical of aluminum color: 0xe5e5e5, // Lighter, typical of aluminum
metalness: 1.0, metalness: 1.0,
roughness: 0.4, // Slightly more matte than stainless steel roughness: 0.4, // Slightly more matte than stainless steel
envMapIntensity: 1.5 envMapIntensity: 1.5,
flatShading: false
}); });
const acrylicTargetNames = [ const acrylicTargetNames = [
@@ -540,6 +591,17 @@
}); });
const lastEntry = meshList[meshList.length - 1]; const lastEntry = meshList[meshList.length - 1];
// 0. GUI STANDBY (Specific Screen Mesh)
if (normMesh.includes('SOLID1_61')) {
child.material = new THREE.MeshBasicMaterial({
map: standbyTexture,
transparent: true,
side: THREE.DoubleSide
});
lastEntry.matched = "📺 GUI STANDBY";
console.log(`📺 [HIERARCHY MATCH] Applied GUI_Standby.png to: Mesh="${meshName}" Parent="${parentName}"`);
}
// Capture Console Material for synchronization // Capture Console Material for synchronization
if (combinedNorm.includes('LADODERECHOCONSOLA')) { if (combinedNorm.includes('LADODERECHOCONSOLA')) {
consoleMaterial = child.material; consoleMaterial = child.material;
@@ -657,7 +719,8 @@
emissive: 0xffffff, emissive: 0xffffff,
emissiveIntensity: 10, // High intensity to simulate glow emissiveIntensity: 10, // High intensity to simulate glow
metalness: 0.1, metalness: 0.1,
roughness: 0.1 roughness: 0.1,
flatShading: false
}); });
// Add an actual interior light source to simulate light coming from the LED bar // Add an actual interior light source to simulate light coming from the LED bar
@@ -795,7 +858,8 @@
color: 0x555555, // Base grey color: 0x555555, // Base grey
emissive: 0x333333, // Subtle glow to look "lighter" emissive: 0x333333, // Subtle glow to look "lighter"
metalness: 0.6, metalness: 0.6,
roughness: 0.4 roughness: 0.4,
flatShading: false
}); });
mesh.material = newMat; mesh.material = newMat;
fixedCount++; fixedCount++;
@@ -982,6 +1046,9 @@
</div> </div>
`); `);
if (!isDoorOpen) toggleDoor(); if (!isDoorOpen) toggleDoor();
} else if (normName.includes('SOLID1_103')) {
zoomToBiometric(object);
showAnnotation(object, "<strong>Reconocimiento facial (Opcional)</strong><br>Apertura de puerta con reconocimiento facial");
} else if (normName.includes('MESHFEATURE1') || normName.includes('SOLID1_105')) { } else if (normName.includes('MESHFEATURE1') || normName.includes('SOLID1_105')) {
zoomToCamera(object); zoomToCamera(object);
showAnnotation(object, "<strong>Cámara (Opcional)</strong><br>Grabación de sesión cuando se abre la puerta."); showAnnotation(object, "<strong>Cámara (Opcional)</strong><br>Grabación de sesión cuando se abre la puerta.");
@@ -1040,8 +1107,8 @@
} }
function zoomToBiometric(target) { function zoomToBiometric(target) {
const cameraFrontalPos = new THREE.Vector3(0, 1.2, 4); const cameraFrontalPos = new THREE.Vector3(0.048, 0.720, 4.001);
const lookAtTarget = new THREE.Vector3(0, 0.8, 0); const lookAtTarget = new THREE.Vector3(-0.033, -0.279, 0.108);
smoothCameraTransition(cameraFrontalPos, lookAtTarget); smoothCameraTransition(cameraFrontalPos, lookAtTarget);
} }
@@ -1114,7 +1181,7 @@
if (intersects.length > 0) { if (intersects.length > 0) {
const name = intersects[0].object.name.toLowerCase(); const name = intersects[0].object.name.toLowerCase();
if (name.includes('puerta') || name.includes('bisagra') || name.includes('lector') || name.includes('solid') || name.includes('cilindro') || name.includes('cerradura') || name.includes('solid1_102')) { if (name.includes('puerta') || name.includes('bisagra') || name.includes('lector') || name.includes('solid') || name.includes('cilindro') || name.includes('cerradura') || name.includes('solid1_102') || name.includes('solid1_103')) {
canvas.style.cursor = 'pointer'; canvas.style.cursor = 'pointer';
return; return;
} }
@@ -1123,17 +1190,30 @@
}); });
function showInfo(title, text) { function showInfo(title, text) {
const content = document.getElementById('info-content');
const panel = document.querySelector('.info-panel'); const panel = document.querySelector('.info-panel');
panel.innerHTML = `<strong>${title}</strong><br>${text}`; content.innerHTML = `<strong>${title}</strong><br>${text}`;
panel.style.background = 'rgba(0, 122, 255, 0.9)'; panel.style.background = 'rgba(0, 122, 255, 0.9)';
} }
function hideInfo() { function hideInfo() {
const content = document.getElementById('info-content');
const panel = document.querySelector('.info-panel'); const panel = document.querySelector('.info-panel');
panel.innerHTML = '🖱️ Click components to explore | Right-click to pan | Scroll to zoom'; content.innerHTML = '🖱️ Click components to explore | Right-click to pan | Scroll to zoom';
panel.style.background = 'rgba(0, 0, 0, 0.7)'; panel.style.background = 'rgba(0, 0, 0, 0.7)';
} }
function resetView() {
const defaultPos = new THREE.Vector3(3.000, 1.500, 5.000);
const defaultTarget = new THREE.Vector3(0.000, 0.000, 0.000);
smoothCameraTransition(defaultPos, defaultTarget);
}
document.getElementById('btn-home').addEventListener('click', (e) => {
e.stopPropagation();
resetView();
});
function toggleDoor() { function toggleDoor() {
if (!hingePivot) return; if (!hingePivot) return;
isDoorOpen = !isDoorOpen; isDoorOpen = !isDoorOpen;
+51
View File
@@ -0,0 +1,51 @@
const fs = require('fs');
function inspectMesh(filePath, query) {
const buffer = fs.readFileSync(filePath);
const jsonLen = buffer.readUInt32LE(12);
const jsonBuf = buffer.slice(20, 20 + jsonLen);
const gltf = JSON.parse(jsonBuf.toString());
console.log(`Inspecting mesh named "${query}"...`);
let targetMesh = null;
let targetNode = null;
if (gltf.nodes) {
gltf.nodes.forEach((n, i) => {
if (n.name && n.name.toUpperCase().includes(query.toUpperCase())) {
console.log(`Node [${i}]: ${n.name}`);
targetNode = n;
if (n.mesh !== undefined) {
targetMesh = gltf.meshes[n.mesh];
console.log(` Linked Mesh: ${targetMesh.name || 'unnamed'}`);
}
}
});
}
if (!targetMesh && gltf.meshes) {
gltf.meshes.forEach((m, i) => {
if (m.name && m.name.toUpperCase().includes(query.toUpperCase())) {
console.log(`Mesh [${i}]: ${m.name}`);
targetMesh = m;
}
});
}
if (targetMesh) {
console.log('\nMesh Details:');
targetMesh.primitives.forEach((p, i) => {
console.log(` Primitive [${i}]:`);
console.log(` Attributes: ${Object.keys(p.attributes).join(', ')}`);
if (p.material !== undefined) {
const mat = gltf.materials[p.material];
console.log(` Material: ${mat.name || 'unnamed'}`);
}
});
} else {
console.log('Target mesh not found.');
}
}
inspectMesh('Cabinet v2.5 con eje.glb', 'Solid1_61');
+28
View File
@@ -0,0 +1,28 @@
const fs = require('fs');
function searchNames(filePath, query1, query2) {
const buffer = fs.readFileSync(filePath);
const jsonLen = buffer.readUInt32LE(12);
const jsonBuf = buffer.slice(20, 20 + jsonLen);
const gltf = JSON.parse(jsonBuf.toString());
console.log(`Searching for "${query1}" and "${query2}"...`);
if (gltf.nodes) {
gltf.nodes.forEach((n, i) => {
if (n.name && (n.name.includes(query1) || n.name.includes(query2))) {
console.log(`Node [${i}]: ${n.name}`);
}
});
}
if (gltf.meshes) {
gltf.meshes.forEach((m, i) => {
if (m.name && (m.name.includes(query1) || m.name.includes(query2))) {
console.log(`Mesh [${i}]: ${m.name}`);
}
});
}
}
searchNames('Cabinet v2.5 con eje.glb', '37', '41');
+33
View File
@@ -0,0 +1,33 @@
const THREE = require('three');
const { GLTFLoader } = require('three/examples/jsm/loaders/GLTFLoader.js');
const fs = require('fs');
const { JSDOM } = require('jsdom');
// Mock window and document for GLTFLoader
const dom = new JSDOM();
global.window = dom.window;
global.document = dom.window.document;
global.navigator = dom.window.navigator;
const loader = new GLTFLoader();
const data = fs.readFileSync('Cabinet v2.5 con eje.glb');
const arrayBuffer = data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
loader.parse(arrayBuffer, '', (gltf) => {
const targetNames = ['Solid1_114', 'Solid1_37', 'Solid1_41'];
console.log('--- Searching for specific meshes ---');
gltf.scene.traverse((child) => {
if (targetNames.includes(child.name)) {
console.log(`Found: ${child.name} | Type: ${child.type} | Parent: ${child.parent ? child.parent.name : 'None'}`);
}
// Also check if they are contained in the name
targetNames.forEach(tn => {
if (child.name.includes(tn) && child.name !== tn) {
console.log(`Partial Match: ${child.name} (contains ${tn}) | Type: ${child.type}`);
}
});
});
}, (err) => {
console.error(err);
});