A basic boilerplate for a Three.js project including the use of Webpack and ES6 syntax via Babel.
build - Directory for built and compressed files from the npm build script
src - Directory for all dev files
βββ css - Contains all SCSS files, that are compiled to `src/public/css`
βββ js - All the Three.js app files, with `app.js` as entry point. Compiled to `src/public/js` with webpack
β βββ app
β β βββ components - Three.js components that get initialized in `main.js`
β β βββ helpers - Classes that provide ideas on how to set up and work with defaults
β β βββ managers - Manage complex tasks such as GUI or input
β β βββ model - Classes that set up the model object
β βββ data - Any data to be imported into app
β βββ utils - Various helpers and vendor classes
βββ public - Used by webpack-dev-server to serve content. Webpack builds local dev files here.
βββ assets - Is copied over to build folder with build command. Place external asset files here.
Install dependencies:
npm install
Then run dev script:
npm run dev
Spins up a webpack dev server at localhost:8080 and keeps track of all js and sass changes to files.
npm run build
Cleans existing build folder while linting js folder and copies over the public assets folder from src. Then sets environment to production and compiles js and css into build.
You need to provide the username and password of the MQTT broker, when you are visiting the web interface for the first time. After the first visit, the login details will be stored in the browser cache.
Example URL (for local run): http://localhost:8080/?username={user_name}&password={password}
Example URL (for production run): http://pera-swarm.github.io/visualizer/?username={user_name}&password={password}
You can run any of these individually if you'd like with the npm run command:
prebuild- Cleans up build folder and lintssrc/jsclean- Cleans build folderlint- Runs lint on thesrc/jsfolder and uses the.eslintrcfile in root for linting ruleswebpack-server- Start up a webpack-dev-server with hot-module-replacementwebpack-watch- Run webpack in dev environment with watchdev:js- Run webpack in dev environment without watchbuild:dir- Copy files and folders fromsrc/publictobuildbuild:js- Run webpack in production environment
- Arrow controls will pan
- Mouse left click will rotate/right click will pan
- Scroll wheel zooms in and out
You can see the latest deployment of this repository from https://pera-swarm.ce.pdn.ac.lk/visualizer/