3D 모델 렌더링 디버깅 추가

개선사항:
1. 상세한 콘솔 로그 추가
   - 뷰어 초기화 정보
   - JSON 로드 상태
   - 부재 추가 진행 상황

2. 테스트용 샘플 부재
   - 녹색 박스 1개 (위치: 부재 중심)
   - emissive 색상 추가 (어두운 곳에도 보임)

3. 추가 조명
   - PointLight 추가 (밝기 강화)

4. 상세한 에러 추적
   - fetch 응답 상태 확인
   - JSON 파싱 상태 확인
   - 부재별 추가 로그

사용자가 콘솔(F12)을 확인할 수 있도록 함
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Claude Haiku committed 2026-10-19 17:21:24 +09:00
1 parent 17042d395c
commit 0802285951
1 file changed
+39 -10
+39 -10
View File
@@ -364,24 +364,49 @@
const DISPLAY_SCALE = 0.01; // mm → cm (1:100)
// 먼저 샘플 부재 1개로 테스트
console.log('=== 샘플 부재 테스트 ===');
const testGeometry = new THREE.BoxGeometry(4, 4, 80); // 400×400×8000mm → 4×4×80 (축소)
const testMaterial = new THREE.MeshStandardMaterial({ color: 0x7ed321, roughness: 0.7 });
// 디버깅 정보 추가
console.log('=== 3D 뷰어 초기화 ===');
console.log('카메라 위치:', camera.position);
console.log('카메라 타겟:', controls.target);
// 배경 밝게 변경해서 테스트
scene.background = new THREE.Color(0x1a3a52);
console.log('배경색 설정 완료');
// 샘플 부재 추가 (테스트용)
console.log('샘플 부재 생성 중...');
const testGeometry = new THREE.BoxGeometry(4, 4, 80); // 400×400×8000mm → 4×4×80
const testMaterial = new THREE.MeshStandardMaterial({
color: 0x7ed321,
roughness: 0.7,
emissive: 0x2d5a2d
});
const testMesh = new THREE.Mesh(testGeometry, testMaterial);
testMesh.position.set(470, -2830, 100); // 첫 번째 h-pile2 좌표
testMesh.position.set(0, -2554, 100); // 부재 중심 좌표
scene.add(testMesh);
console.log('✓ 샘플 부재 추가됨 @ (470, -2830)');
console.log('✓ 샘플 부재 @ (0, -2554, 100) - 녹색');
// 추가 조명
const testLight = new THREE.PointLight(0xffffff, 1.0, 10000);
testLight.position.set(500, 500, 500);
scene.add(testLight);
console.log('✓ 테스트 조명 추가됨');
// stats.json 로드 및 부재 생성
console.log('stats.json 로드 시작...');
fetch('gasiseol-correct-v2-stats.json')
.then(r => r.json())
.then(r => {
console.log('응답 상태:', r.status);
return r.json();
})
.then(data => {
console.log('📊 로드됨:', data.totalParts, '개 부재');
console.log('📊 JSON 파싱 완료');
console.log('총 부재:', data.totalParts);
console.log('배치 부재:', data.parts.length);
let addedCount = 0;
// 각 부재를 3D 메시로 생성
data.parts.forEach(part => {
data.parts.forEach((part, idx) => {
let geometry;
const { blockType, type, spec, position, volume } = part;
@@ -445,9 +470,13 @@
scene.add(mesh);
addedCount++;
if (addedCount <= 3 || addedCount % 100 === 0) {
console.log(`[${addedCount}] ${blockType} @ (${position.x.toFixed(0)}, ${position.y.toFixed(0)}, ${position.z})`);
}
});
console.log('✅ ' + addedCount + '개 부재 추가됨');
console.log('✅ ' + addedCount + '개 부재 씬에 추가됨');
// UI 업데이트
document.getElementById('totalParts').textContent = data.totalParts + '개';