# at010303/room_portfolio architecture

> Architecture diagram of the GitHub repository at010303/room_portfolio, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/at010303/room_portfolio
- Repository: https://github.com/at010303/room_portfolio

## Overview

1. This is a client-side React + Vite portfolio that renders a single interactive 3D room in the browser. There is no backend or API layer in the repository; the app is entirely driven by static assets, local state, and scene interactions.

2. The application bootstrap is standard Vite: `index.html` loads the React entry in `src/main.jsx`, which mounts the root experience. `src/Experience.jsx` appears to be the top-level scene composition layer, and `src/style.css` provides global styling around the WebGL canvas and UI overlays.

3. The core architectural boundary is the 3D scene rendered with `react-three/fiber` on top of Three.js. The room itself lives under `src/RoomModel/`, centered around `roomModel.jsx` and supporting components for sub-objects inside the room.

4. The static environment and props come from Blender-exported `.glb` models and media in `public/assets/`. Important scene assets include `RoomModel.glb`, `chairtopDraco.glb`, `clock.glb`, plus video and audio files used by embedded displays and interactive objects. These assets are loaded directly into the client and never pass through a server.

5. Interactivity is split into small room object components rather than one monolithic scene file. Files like `DispFrame.jsx`, `Windows.jsx`, `clock.jsx`, `dispItem.jsx`, `photoFrame.jsx`, and `laptopDisp.jsx` suggest each in-room object owns its own visual model and click behavior, which keeps the room assembly modular.

6. The app includes multiple “embedded screen” experiences under `src/RoomModel/iframes/`: `desktopiFrame.jsx`, `smartphoneiFrame.jsx`, and `tvEmulator.jsx`. These are likely the bridge between the 3D world and standard DOM content, letting a monitor/phone/TV in the room display a separate web experience or emulator UI.

7. A notable interactive subsystem is the game/media content embedded in the room. The presence of `public/assets/SuperMarioAdvance4.gba` and `tvEmulator.jsx` indicates an in-browser emulator experience; the audio files under `public/assets/laptopDisp/audio/` and video wallpapers like `desktopWallpaper.mp4` and `marioWallpaper.mp4` support media playback on the room’s displays.

8. Camera behavior is isolated from the scene through `src/CameraManager/CameraManager.jsx` and shared camera state in `src/helper/CameraStore.jsx`. This separation suggests the camera can be switched or animated independently of the room objects, which is important in a portfolio where user focus moves between the room overview and close-up interactions.

9. Global UI toggles are also separated out. `src/Switch/TheamSwitch.jsx` (theme switch, misspelled in the filename) likely drives light/dark or stylistic mode changes, and the README mentions GSAP-based theme transitions, so visual changes are animated rather than instantaneous.

10. Visual fidelity is extended with custom shaders under `src/RoomModel/shaders/Room/` and shared shader helpers in `src/RoomModel/shaders/partials/`. This indicates some room surfaces or lighting effects are custom-rendered beyond standard materials, probably for mood, reflections, or blending effects.

11. The app uses `zustand` for shared state and `leva` for tweakable controls, which fits a scene-driven architecture: object interactions update global state, and that state drives camera positions, lights, theme changes, media playback, and visibility of embedded experiences.

12. Overall data flow is: user input in the 3D scene or embedded screens updates shared state; state drives camera/theme/media changes; the scene renders with Three.js, custom shaders, and postprocessing; static assets from `public/assets/` supply models, video, audio, and emulator content. The main architectural boundary is between the interactive 3D environment and the DOM-based embedded content inside certain room objects.

Main entry points: [`src/RoomModel/roomModel.jsx`](https://github.com/at010303/room_portfolio/blob/rmain/src/RoomModel/roomModel.jsx) (Room model), [`src/Experience.jsx`](https://github.com/at010303/room_portfolio/blob/rmain/src/Experience.jsx) (Experience), [`src/main.jsx`](https://github.com/at010303/room_portfolio/blob/rmain/src/main.jsx) (main), [`src/RoomModel/clock.jsx`](https://github.com/at010303/room_portfolio/blob/rmain/src/RoomModel/clock.jsx) (Clock)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_root["App shell"]
  node_node_main["main<br/>Vite entry<br/>[main.jsx]"]
  node_node_experience["Experience<br/>scene composer<br/>[Experience.jsx]"]
  node_node_style["Global CSS<br/>app styling<br/>[style.css]"]
end

subgraph group_group_scene["3D room"]
  node_node_roommodel["Room model<br/>scene assembly<br/>[roomModel.jsx]"]
  node_node_dispframe["Disp frame<br/>room object<br/>[DispFrame.jsx]"]
  node_node_windows["Windows<br/>room object<br/>[Windows.jsx]"]
  node_node_clock["Clock<br/>room object<br/>[clock.jsx]"]
  node_node_dispitem["Display item<br/>room object<br/>[dispItem.jsx]"]
  node_node_photoframe["Photo frame<br/>room object<br/>[photoFrame.jsx]"]
  node_node_laptopdisp["Laptop display<br/>room object<br/>[laptopDisp.jsx]"]
  node_node_shader["Room shaders<br/>GLSL effects<br/>[fragment.glsl]"]
  node_node_texmat["Texture material<br/>material helper"]
end

subgraph group_group_embed["Embedded screens"]
  node_node_desktop_iframe["Desktop iframe<br/>embedded DOM<br/>[desktopiFrame.jsx]"]
  node_node_phone_iframe["Phone iframe<br/>embedded DOM"]
  node_node_tv_emulator["TV emulator<br/>embedded emulator<br/>[tvEmulator.jsx]"]
end

subgraph group_group_state["Shared state"]
  node_node_cam_mgr["Camera manager<br/>camera control<br/>[CameraManager.jsx]"]
  node_node_cam_store["Camera store<br/>zustand state<br/>[CameraStore.jsx]"]
  node_node_theme_switch["Theme switch<br/>ui toggle<br/>[TheamSwitch.jsx]"]
end

subgraph group_group_assets["Static assets"]
  node_node_room_model_glb[("Room GLB<br/>3D asset<br/>[RoomModel.glb]")]
  node_node_chair_glb[("Chair GLB<br/>3D asset<br/>[chairtopDraco.glb]")]
  node_node_clock_glb[("Clock GLB<br/>3D asset<br/>[clock.glb]")]
  node_node_media_assets["Media assets<br/>video/audio assets"]
  node_node_game_asset[("Mario GBA<br/>game asset")]
end

node_node_main -->|"mounts"| node_node_experience
node_node_main -->|"loads"| node_node_style
node_node_experience -->|"composes"| node_node_roommodel
node_node_experience -->|"uses camera"| node_node_cam_mgr
node_node_experience -->|"exposes theme"| node_node_theme_switch
node_node_roommodel -->|"loads model"| node_node_room_model_glb
node_node_roommodel -->|"includes"| node_node_dispframe
node_node_roommodel -->|"includes"| node_node_windows
node_node_roommodel -->|"includes"| node_node_clock
node_node_roommodel -->|"includes"| node_node_dispitem
node_node_roommodel -->|"includes"| node_node_photoframe
node_node_roommodel -->|"includes"| node_node_laptopdisp
node_node_roommodel -->|"styles"| node_node_shader
node_node_roommodel -->|"materials"| node_node_texmat
node_node_roommodel -->|"embeds"| node_node_desktop_iframe
node_node_roommodel -->|"embeds"| node_node_phone_iframe
node_node_roommodel -->|"embeds"| node_node_tv_emulator
node_node_dispitem -->|"loads"| node_node_chair_glb
node_node_clock -->|"loads"| node_node_clock_glb
node_node_laptopdisp -->|"plays"| node_node_media_assets
node_node_tv_emulator -->|"emulates"| node_node_game_asset
node_node_cam_mgr -->|"reads/writes"| node_node_cam_store
node_node_theme_switch -.->|"shares state"| node_node_cam_store

click node_node_main "https://github.com/at010303/room_portfolio/blob/rmain/src/main.jsx"
click node_node_experience "https://github.com/at010303/room_portfolio/blob/rmain/src/Experience.jsx"
click node_node_style "https://github.com/at010303/room_portfolio/blob/rmain/src/style.css"
click node_node_roommodel "https://github.com/at010303/room_portfolio/blob/rmain/src/RoomModel/roomModel.jsx"
click node_node_dispframe "https://github.com/at010303/room_portfolio/blob/rmain/src/RoomModel/DispFrame.jsx"
click node_node_windows "https://github.com/at010303/room_portfolio/blob/rmain/src/RoomModel/Windows.jsx"
click node_node_clock "https://github.com/at010303/room_portfolio/blob/rmain/src/RoomModel/clock.jsx"
click node_node_dispitem "https://github.com/at010303/room_portfolio/blob/rmain/src/RoomModel/dispItem.jsx"
click node_node_photoframe "https://github.com/at010303/room_portfolio/blob/rmain/src/RoomModel/photoFrame.jsx"
click node_node_laptopdisp "https://github.com/at010303/room_portfolio/blob/rmain/src/RoomModel/laptopDisp.jsx"
click node_node_shader "https://github.com/at010303/room_portfolio/blob/rmain/src/RoomModel/shaders/Room/fragment.glsl"
click node_node_texmat "https://github.com/at010303/room_portfolio/blob/rmain/src/RoomModel/textures/TextureMaterial.jsx"
click node_node_desktop_iframe "https://github.com/at010303/room_portfolio/blob/rmain/src/RoomModel/iframes/desktopiFrame.jsx"
click node_node_phone_iframe "https://github.com/at010303/room_portfolio/blob/rmain/src/RoomModel/iframes/smartphoneiFrame.jsx"
click node_node_tv_emulator "https://github.com/at010303/room_portfolio/blob/rmain/src/RoomModel/iframes/tvEmulator.jsx"
click node_node_cam_mgr "https://github.com/at010303/room_portfolio/blob/rmain/src/CameraManager/CameraManager.jsx"
click node_node_cam_store "https://github.com/at010303/room_portfolio/blob/rmain/src/helper/CameraStore.jsx"
click node_node_theme_switch "https://github.com/at010303/room_portfolio/blob/rmain/src/Switch/TheamSwitch.jsx"
click node_node_room_model_glb "https://github.com/at010303/room_portfolio/blob/rmain/public/assets/RoomModel.glb"
click node_node_chair_glb "https://github.com/at010303/room_portfolio/blob/rmain/public/assets/chairtopDraco.glb"
click node_node_clock_glb "https://github.com/at010303/room_portfolio/blob/rmain/public/assets/clock.glb"
click node_node_media_assets "https://github.com/at010303/room_portfolio/blob/rmain/public/assets/desktopWallpaper.mp4"
click node_node_game_asset "https://github.com/at010303/room_portfolio/blob/rmain/public/assets/SuperMarioAdvance4.gba"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_node_main,node_node_experience,node_node_style toneBlue
class node_node_roommodel,node_node_dispframe,node_node_windows,node_node_clock,node_node_dispitem,node_node_photoframe,node_node_laptopdisp,node_node_shader,node_node_texmat toneAmber
class node_node_desktop_iframe,node_node_phone_iframe,node_node_tv_emulator toneMint
class node_node_cam_mgr,node_node_cam_store,node_node_theme_switch toneRose
class node_node_room_model_glb,node_node_chair_glb,node_node_clock_glb,node_node_media_assets,node_node_game_asset toneIndigo
```

## Components

### App shell

Vite entry, global styles, and top-level React composition.

- [main](https://github.com/at010303/room_portfolio/blob/rmain/src/main.jsx): Vite entry · Bootstraps the React app from index.html. · `src/main.jsx`
- [Experience](https://github.com/at010303/room_portfolio/blob/rmain/src/Experience.jsx): scene composer · Top-level composition for the portfolio experience. · `src/Experience.jsx`
- [Global CSS](https://github.com/at010303/room_portfolio/blob/rmain/src/style.css): app styling · Styles for canvas layout and overlays. · `src/style.css`

### 3D room

Three.js scene, room objects, shaders, and scene-local interactions.

- [Room model](https://github.com/at010303/room_portfolio/blob/rmain/src/RoomModel/roomModel.jsx): scene assembly · Coordinates the room and its interactive objects. · `src/RoomModel/roomModel.jsx`
- [Disp frame](https://github.com/at010303/room_portfolio/blob/rmain/src/RoomModel/DispFrame.jsx): room object · Interactive display/frame component in the room. · `src/RoomModel/DispFrame.jsx`
- [Windows](https://github.com/at010303/room_portfolio/blob/rmain/src/RoomModel/Windows.jsx): room object · Window-related scene component and interactions. · `src/RoomModel/Windows.jsx`
- [Clock](https://github.com/at010303/room_portfolio/blob/rmain/src/RoomModel/clock.jsx): room object · Clock prop and its behavior. · `src/RoomModel/clock.jsx`
- [Display item](https://github.com/at010303/room_portfolio/blob/rmain/src/RoomModel/dispItem.jsx): room object · Selectable or animated in-room display element. · `src/RoomModel/dispItem.jsx`
- [Photo frame](https://github.com/at010303/room_portfolio/blob/rmain/src/RoomModel/photoFrame.jsx): room object · Framed media object within the room. · `src/RoomModel/photoFrame.jsx`
- [Laptop display](https://github.com/at010303/room_portfolio/blob/rmain/src/RoomModel/laptopDisp.jsx): room object · Laptop-based media and audio display. · `src/RoomModel/laptopDisp.jsx`
- [Room shaders](https://github.com/at010303/room_portfolio/blob/rmain/src/RoomModel/shaders/Room/fragment.glsl): GLSL effects · Custom room shader programs and shared shader helpers. · `src/RoomModel/shaders/Room/fragment.glsl`
- [Texture material](https://github.com/at010303/room_portfolio/blob/rmain/src/RoomModel/textures/TextureMaterial.jsx): material helper · Shared texture/material wrapper for scene assets. · `src/RoomModel/textures/TextureMaterial.jsx`

### Embedded screens

DOM-based iframe/emulator experiences mounted inside room objects.

- [Desktop iframe](https://github.com/at010303/room_portfolio/blob/rmain/src/RoomModel/iframes/desktopiFrame.jsx): embedded DOM · Desktop-sized embedded experience shown in the room. · `src/RoomModel/iframes/desktopiFrame.jsx`
- [Phone iframe](https://github.com/at010303/room_portfolio/blob/rmain/src/RoomModel/iframes/smartphoneiFrame.jsx): embedded DOM · Smartphone-sized embedded experience shown in the room. · `src/RoomModel/iframes/smartphoneiFrame.jsx`
- [TV emulator](https://github.com/at010303/room_portfolio/blob/rmain/src/RoomModel/iframes/tvEmulator.jsx): embedded emulator · TV-mounted emulator or screen bridge for game/media content. · `src/RoomModel/iframes/tvEmulator.jsx`

### Shared state

Cross-cutting camera and theme coordination.

- [Camera manager](https://github.com/at010303/room_portfolio/blob/rmain/src/CameraManager/CameraManager.jsx): camera control · Controls camera movement and framing. · `src/CameraManager/CameraManager.jsx`
- [Camera store](https://github.com/at010303/room_portfolio/blob/rmain/src/helper/CameraStore.jsx): zustand state · Shared camera state used across the experience. · `src/helper/CameraStore.jsx`
- [Theme switch](https://github.com/at010303/room_portfolio/blob/rmain/src/Switch/TheamSwitch.jsx): ui toggle · Theme or mood switching with animated transitions. · `src/Switch/TheamSwitch.jsx`

### Static assets

Blender models and media loaded directly by the client.

- [Room GLB](https://github.com/at010303/room_portfolio/blob/rmain/public/assets/RoomModel.glb): 3D asset · Main Blender-exported room model. · `public/assets/RoomModel.glb`
- [Chair GLB](https://github.com/at010303/room_portfolio/blob/rmain/public/assets/chairtopDraco.glb): 3D asset · Imported chair mesh asset. · `public/assets/chairtopDraco.glb`
- [Clock GLB](https://github.com/at010303/room_portfolio/blob/rmain/public/assets/clock.glb): 3D asset · Imported clock mesh asset. · `public/assets/clock.glb`
- [Media assets](https://github.com/at010303/room_portfolio/blob/rmain/public/assets/desktopWallpaper.mp4): video/audio assets · Wallpaper videos and laptop audio tracks used by room displays. · `public/assets/desktopWallpaper.mp4`
- [Mario GBA](https://github.com/at010303/room_portfolio/blob/rmain/public/assets/SuperMarioAdvance4.gba): game asset · ROM used by the TV emulator experience. · `public/assets/SuperMarioAdvance4.gba`

## Connections

- main → Experience: mounts · React entry mounts the main experience.
- main → Global CSS: loads · Global CSS is applied during boot.
- Experience → Room model: composes · Top-level experience includes the 3D room.
- Experience → Camera manager: uses camera · Experience coordinates scene framing.
- Experience → Theme switch: exposes theme · Theme control is part of the outer experience.
- Room model → Room GLB: loads model · Main room assembly consumes the exported room mesh.
- Room model → Disp frame: includes · Room assembly includes display-frame interaction.
- Room model → Windows: includes · Room assembly includes window components.
- Room model → Clock: includes · Room assembly includes clock prop.
- Room model → Display item: includes · Room assembly includes display items.
- Room model → Photo frame: includes · Room assembly includes photo frames.
- Room model → Laptop display: includes · Room assembly includes laptop display.
- Room model → Room shaders: styles · Custom shaders shape the room rendering.
- Room model → Texture material: materials · Shared texture/material helper supports scene surfaces.
- Room model → Desktop iframe: embeds · Room contains desktop screen content.
- Room model → Phone iframe: embeds · Room contains phone screen content.
- Room model → TV emulator: embeds · Room contains TV/emulator content.
- Display item → Chair GLB: loads · Display item may use the chair asset.
- Clock → Clock GLB: loads · Clock component uses the clock mesh asset.
- Laptop display → Media assets: plays · Laptop display consumes audio/video media.
- TV emulator → Mario GBA: emulates · TV emulator loads the game ROM.
- Camera manager → Camera store: reads/writes · Camera manager synchronizes with shared camera state.
- Theme switch → Camera store: shares state · Theme transitions likely coordinate through global state.
