Skip to content

yashpatil7788/interior-planner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

3D Interior Furniture Planner

An academic Computer Graphics & Visualisation (CGV) project built with
C++17 · OpenGL (3.3 core context) · GLFW · GLM · Dear ImGui.


Quick Start

# 1. Clone / extract the project, then from the project root:
chmod +x setup.sh
./setup.sh          # installs apt packages, downloads GLAD + ImGui, builds

# 2. Run
./build/InteriorPlanner

Evaluation system note: setup.sh installs libglfw3-dev, libglm-dev,
and libgl1-mesa-dev via apt, then builds the project. If vendored files in
include/ are missing, it bootstraps GLAD and Dear ImGui sources once.
Re-run cmake .. && make from the build/ directory for rebuilds.


Application Flow (3 Stages)

Stage 1 — INPUT_DIMENSIONS

The app opens in this mode.
Use the ImGui panel (top-left) to:

Control Description
Room Width (X) slider Room width in world units (1 unit ≈ 1 metre)
Room Depth (Z) slider Room depth in world units
Name text field Furniture type label (e.g. "Sofa")
Width / Depth / Height sliders Furniture bounding-box dimensions
Color picker Display colour for the item
+ Add Furniture Type button Registers the type for placement
Proceed to 2D Builder button Advances to Stage 2 (requires ≥1 type)

Stage 2 — BUILDER_2D (Orthographic top-down view)

Place furniture on the floor plan.

Input Action
Left-click viewport Place the selected furniture item at cursor position
Right-click viewport Undo the last placed item
Z key Also undoes the last placed item
Scroll wheel Zoom the 2D view in / out
ImGui buttons Switch selected furniture type, clear all, back, enter 3D

Collision rules:

  • Items cannot overlap each other (AABB test).
  • Items cannot extend outside the room walls.
  • A green preview box appears when placement is valid; red when blocked.

Stage 3 — VIEWER_3D (Perspective first-person view)

Input Action
Left-click viewport Capture mouse for FPS look-around
Mouse move Look around (yaw + pitch)
W / S Move forward / backward
A / D Strafe left / right
Esc (first press) Release mouse cursor
Esc (second press) Return to Stage 2
Move Speed slider Adjust movement speed
FOV slider Adjust field of view

Lighting: ambient + directional Blinn-Phong.
Camera height is fixed at 1.6 m (eye level).


Project Structure

project_root/
├── CMakeLists.txt          # Build configuration
├── setup.sh                # One-shot setup + build script
├── README.md
├── src/
│   ├── main.cpp            # GLFW init, state machine, input callbacks, ImGui panels
│   ├── Scene.h / .cpp      # Room data, FurnitureDef, PlacedFurniture, AABB logic
│   ├── Camera.h / .cpp     # Orthographic & perspective matrices, FPS movement
│   ├── Renderer.h / .cpp   # VAOs, VBOs, shader loading, draw2D / draw3D
├── shaders/
│   ├── flat.vert / flat.frag    # Unlit colour shader (Stage 2)
│   └── phong.vert / phong.frag  # Blinn-Phong shader (Stage 3)
└── include/                # Populated by setup.sh
    ├── glad/               # GLAD OpenGL loader
    ├── KHR/                # Khronos platform header
    └── imgui/              # Dear ImGui sources + GLFW/OpenGL3 backends

Manual Build (without setup.sh)

# Prerequisites (Ubuntu/Debian)
sudo apt-get install build-essential cmake libglfw3-dev libglm-dev libgl1-mesa-dev

# Manually place GLAD and ImGui headers in include/ (see setup.sh for URLs)

mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
cd ..
./build/InteriorPlanner

Technical Notes

  • Projection switch: glm::ortho in Stage 2 → glm::perspective in Stage 3.
  • Mouse picking (Stage 2): NDC coordinates are un-projected to world XZ by
    reversing the orthographic transform (no ray-casting needed for top-down).
  • AABB collision: Separating-axis theorem in 2D (XZ plane) prevents overlap
    and out-of-bounds placement.
  • Phong shading: transpose(inverse(model)) normal matrix ensures correct
    normals under non-uniform scaling.
  • MSAA: Window hint GLFW_SAMPLES 4 enables 4× multi-sample anti-aliasing.

Dependencies & Licences

Library Version Licence
GLFW 3.x (system) zlib
GLM system MIT
GLAD vendored generator output MIT / Apache 2.0
Dear ImGui 1.90.4 MIT

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages