Link: https://city-map-chi.vercel.app/
Interactive 3D Map with custom models for desktop and mobile.
-
run
npm install
-
run
npm run dev
-
project will automatically open in your browser
-
to view it on mobile, after running
npm install
look for the Network address in the console. -
run
npm run build
to build for deployment. This will also createstats.html
file which is a Rollup Visualizer that we can open in any browser -
npm run preview
to locally preview the production build -
npm run test
to run vitest -
npm run coverage
to generate coverage report
The biggest files are textures. If faster performance is needed, you can easily reduce the quality of texture images for faster load.
Desktop
- Left Mouse - Move
- Right Mouse - Rotate
- Scroll Wheel - Zoom In/Out
- SHIFT + Left Mouse(Drag) - Select location
Mobile
- One finger - Move
- Two fingers - Rotate
- Pinch - Zoom In/Out
-
typescript
-
tailwindcss
for custom styles -
shadcnui
library for css components -
threejs
,react-three/drei
,react-three-fiber
,react-map-gl
,mapbox
installed and configure -
vite
andvite.config.js
file.Rollup
is used for bundling -
tests
configured tests(vitest) for use with typescript. Added node.js.yml file to trigger github actions and run tests on push to main branch. -
performance
keep eye on performance using r3f-perf -
eslint
configured with custom rules -
leva
GUI installed and configured to be used with basic features needed for webgl. Make your scene perfect using leva controls for:- canvas control
- directional light control
- shadow camera control
- soft shadow control
- environment map control
- background control
- axes helper control
- grid helper control
- performance monitor(Perf) control
To show/hide the GUI press "h" on the keyboard.
This features can be easily turned off/on or changed.
Leva also exports
set
function that can be used to control it outside of GUI -
preparation
for easy loading and implementation:- model loading - takes compressed and normal version (.glb),
- texture loading - add any texture (diffuse, AO...),
- environment map loading
- assets preloading - assets like model, texture, hdr... are preloaded so that app starts quicker