Skip to content

Chapter 1 ClosedWorld 구현 - #1

Draft
eunseo-com wants to merge 16 commits into
mainfrom
ch1-closed-world
Draft

Chapter 1 ClosedWorld 구현#1
eunseo-com wants to merge 16 commits into
mainfrom
ch1-closed-world

Conversation

@eunseo-com

Copy link
Copy Markdown
Collaborator

요약

  • SwiftUI + SceneKit + Tuist 기반의 Chapter 1 ClosedWorld 구현
  • 방·돼지·가짜 소파·탭 이동 액션·노드 구조 탐구와 XCTest 추가
  • Chapter 1 DocC 튜토리얼 카탈로그 및 현재 구현 스니펫 추가

검증

  • xcodebuild test: 26개 테스트 통과
  • tuist generate --no-open 성공
  • xcodebuild docbuild 성공 및 .doccarchive 생성
  • Simulator에서 방·돼지·가짜 소파 초기 표시와 탭 액션 경로 확인

후속 보완

  • 가짜 소파의 바닥 정렬과 회귀 테스트
  • 실제 장면에서 NodeInspector 학습 예시 출력
  • DocC의 가짜 소파 코드·화면 연결 설명 보완
  • main의 공통 인수인계 문서와 병합 시 충돌 해결 및 최신화

The shallow hasGeometry check only looked one level into the loaded
node's children, but Piggy.usdc nests its meshes two levels down
(wrapper -> root -> body/eyes/tail), so the check always evaluated
false and silently overwrote the real model with the voxel fallback.
Removed the redundant check and trust AssetLoader.object(named:fallback:)'s
existing non-nil contract instead. Strengthened the geometry test with a
deep enumerateHierarchy traversal (matching the pattern already used in
boundingBox(of:)) and added a test asserting multiple meshes are placed,
not the single-box fallback.
Adds a defer block to resign key status and stop the SCNView's display
link after the test runs, so the offscreen UIWindow/SCNView never leaks
across tests in the same process. Also documents why the test relies on
the real display link + a generous 2.0s/0.5s timeout margin instead of a
fully deterministic clock (the SCNRenderer manual-pump alternative
crashes on this simulator runtime), and notes the expected
makeKeyAndVisible() deprecation warning from the windowScene-less test
window.
Wood_Color.usdc loads several meters larger than the 4x4x2.5m room,
and FakeSofa.makeSofaNode() never rescaled it (unlike PigPlacement,
which normalizes Piggy to a 0.6m standard height). Factor the
bounding-box-based normalize helper out of PigPlacement into a
shared SceneKitGeometry enum, and use it in FakeSofa to normalize
the sofa to a 0.45m furniture-scale height.

RoomBuilder's floor (Ground_Color.usdc) was also checked: its raw
footprint is undersized relative to the 4x4m room, but its "thin"
axis doesn't line up with the room's y-up convention the way the
sofa/pig's does. Applying the same toHeight/toFootprintWidth scale
uniformly inflates the wrong axis and ends up enveloping the camera
(verified in the simulator), so it's left unnormalized rather than
guess-fixed.
While re-verifying the FakeSofa scale fix in the simulator, the
screenshot still showed a scene dominated by giant close-up
polygons regardless of any scale change to the sofa or floor.
Bisecting by removing walls/floor/sofa one at a time proved the
artifact wasn't any of those nodes — it was SceneKit's own
auto-framing default camera, because view.pointOfView was never
set to the manually positioned cameraNode. Without it, the camera
placed in the code (0, 2, 1.7 looking at 0, 0.3, -0.5) was never
actually used for rendering.

Confirmed via screenshot: with pointOfView set, the scene renders
as a wall/floor plane with the sofa visible as a separate object,
instead of one giant unrecognizable polygon.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant