UstymUkhman / threejs-boilerplate

:fire: Three.js + TypeScript + SolidJS + Vite + Vitest :rocket:

Home Page:https://ustymukhman.github.io/threejs-boilerplate/dist/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Three.js Boilerplate

πŸ”₯ Three.js + TypeScript + SolidJS + Vite + Vitest πŸš€

Minimal, yet complete template for developing three.js projects.

πŸ“‚ Structure

Three.js Boilerplate
β”œβ”€β”€ __mocks__/
β”œβ”€β”€ coverage/
β”œβ”€β”€ dist/
β”œβ”€β”€ node_modules/
β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ assets/
β”‚   β”œβ”€β”€ favicons/
β”‚   β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ styles/
β”‚   β”œβ”€β”€ browserconfig.xml
β”‚   β”œβ”€β”€ manifest.json
β”‚   β”œβ”€β”€ robots.txt
β”‚   └── sitemap.xml
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ assets/
β”‚   β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ sandbox/
β”‚   β”œβ”€β”€ scss/
β”‚   β”œβ”€β”€ shaders/
β”‚   β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ global.d.ts
β”‚   └── main.tsx
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ sandbox/
β”‚   β”œβ”€β”€ shaders/
β”‚   β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ canvas.mock.d.ts
β”‚   β”œβ”€β”€ canvas.mock.ts
β”‚   └── global.spec.ts
β”œβ”€β”€ index.html
β”œβ”€β”€ package.json
β”œβ”€β”€ tsconfig.json
β”œβ”€β”€ vite.config.ts
└── vitest.config.ts

πŸ”Œ Usage

  Simply click Use this template and Create a new repository.
  This will initialize your own repository from this boilerplate.

✨ Features

β€ƒβ€ƒβ€‚βš™οΈ Basic

      β€’ Cross-platform Favicons
      β€’ Meta tags for sharing on Facebook and Twitter
      β€’ Unsupported browser and disabled JavaScript screens

β€ƒβ€ƒβ€‚πŸ§© Components

      β€’ Application entry point
      β€’ Logo label component
      β€’ Current version tag

β€ƒβ€ƒβ€‚πŸοΈ Sandbox

      β€’ Simple three.js scene with:

       β—¦ Linear Fog
       β—¦ Ground Plane
       β—¦ Orbit Controls
       β—¦ Stats Monitoring
       β—¦ Perspective Camera
       β—¦ Default WebGL2 Renderer
       β—¦ Ambient & Directional Lighting

      β€’ Scene configuration file with initial parameter values.
      β€’ Custom checkerboard-like ground plane material.
      β€’ GUI controls built on top of lil-gui.
      β€’ Uncharted 2 tone mapping shader.

β€ƒβ€ƒβ€‚πŸŽ¨ Shaders

      β€’ Custom shader support through vite-plugin-glsl.
      β€’ Three.js shaders for ground plane material.
      β€’ Three.js shaders for custom tone mapping.

β€ƒβ€ƒβ€‚πŸ› οΈ Utilities

      β€’ Assets loading manager:

       β—¦ Promise based APIs
       β—¦ Loading errors logging
       β—¦ Start, Progress & Complete loading events
       β—¦ usePublicFolder option for setting assets path
       β—¦ Audio, GLTF/GLB, CubeTexture & Texture loaders

      β€’ Array, Color, Number, String & deepFreeze methods.
      β€’ Elastic Number, Vector3 and Vector3 classes.
      β€’ Custom Events and EventEmitter manager.
      β€’ Mouse Wheel normalization function.
      β€’ debounce and throttle functions.
      β€’ requestAnimationFrame manager.
      β€’ Custom Web Worker manager.
      β€’ Unity-like Vector3 directions.
      β€’ Spline interpolation manager.
      β€’ Screen Viewport manager.

β€ƒβ€ƒβ€‚πŸ§° Miscellaneous

      β€’ Scoped SCSS and common easing functions.
      β€’ Support for common 3D formats.
      β€’ Common assets folders.
      β€’ PWA-ready manifest.
      β€’ MIT license.

β€ƒβ€ƒβ€‚πŸ“¦ Package Manager

      This project was build with pnpm, but yarn and npm are also supported.
      Just replace pnpm in all commands below with yarn or npm run.
      For npm users, one exception is the installation, where it's npm i.

β€ƒβ€ƒβ€‚πŸ“ˆ Tests Coverage

      All the code in the src/ directory has been fully tested and has a 100% code coverage.
     Show me some numbers!

      Tests Coverage

πŸ’Ύ Download

  git clone https://github.com/UstymUkhman/threejs-boilerplate.git
  cd threejs-boilerplate

⌨️ Develop

  pnpm i
  pnpm start

βœ”οΈ Lint

  pnpm lint:js
  pnpm lint:css

πŸ§ͺ Test

  pnpm test
  pnpm test:watch
  pnpm test:cover

🧱 Build

  pnpm build
  pnpm serve

About

:fire: Three.js + TypeScript + SolidJS + Vite + Vitest :rocket:

https://ustymukhman.github.io/threejs-boilerplate/dist/

License:MIT License


Languages

Language:TypeScript 88.0%Language:HTML 5.0%Language:CSS 3.3%Language:SCSS 2.7%Language:GLSL 0.6%Language:JavaScript 0.2%