All Projects → YoneChen → Webvr Webpack Boilerplate

YoneChen / Webvr Webpack Boilerplate

Licence: mit
A webvr multi-scenes Single-page application for three.js, webpack

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Webvr Webpack Boilerplate

Preact Starter
Webpack3 boilerplate for building SPA / PWA / offline front-end apps with Preact
Stars: ✭ 384 (+717.02%)
Mutual labels:  webpack, starter-kit, boilerplate, spa
Webxr Webpack Boilerplate
Starter Kit for building rich, immersive WebXR projects (featuring A-Frame) PWA with Webpack and SASS
Stars: ✭ 48 (+2.13%)
Mutual labels:  webpack, starter-kit, boilerplate, webvr
Iceberg
Front-End Boilerplate built with React + Babel + Webpack + SASS
Stars: ✭ 144 (+206.38%)
Mutual labels:  webpack, starter-kit, boilerplate
React Redux Styled Hot Universal
react boilerplate used best practices and focus on performance
Stars: ✭ 147 (+212.77%)
Mutual labels:  webpack, starter-kit, boilerplate
Electron React Boilerplate
A Foundation for Scalable Cross-Platform Apps
Stars: ✭ 18,727 (+39744.68%)
Mutual labels:  webpack, starter-kit, boilerplate
Webpack Starter
✨ A lightweight foundation for your next webpack based frontend project.
Stars: ✭ 1,745 (+3612.77%)
Mutual labels:  webpack, starter-kit, boilerplate
Eleventy Starter Boilerplate
🚀 Eleventy Starter is production-ready with SEO-friendly for quickly starting a blog. ⚡ Built with Eleventy, ESLint, Prettier, Webpack, PostCSS, Tailwind CSS and Netlify CMS (optional).
Stars: ✭ 139 (+195.74%)
Mutual labels:  webpack, starter-kit, boilerplate
React Starter Kit
React, Redux, Webpack, Material UI, Boostrap 4, Code Splitting, HMR
Stars: ✭ 229 (+387.23%)
Mutual labels:  webpack, starter-kit, boilerplate
Html5 Boilerplate
A simple, fast, modern, pure html, css (and sass), js, live reload starter template
Stars: ✭ 65 (+38.3%)
Mutual labels:  webpack, starter-kit, boilerplate
Js Library Boilerplate Basic
Javascript Minimal Starter Boilerplate - Webpack 5 🚀, Babel 7, UMD, Unit Testing
Stars: ✭ 354 (+653.19%)
Mutual labels:  webpack, starter-kit, boilerplate
Miox
Modern infrastructure of complex SPA
Stars: ✭ 374 (+695.74%)
Mutual labels:  webpack, router, spa
React Redux Graphql Apollo Bootstrap Webpack Starter
react js + redux + graphQL + Apollo + react router + hot reload + devTools + bootstrap + webpack starter
Stars: ✭ 127 (+170.21%)
Mutual labels:  webpack, router, boilerplate
Static Site Boilerplate
A better workflow for building modern static websites.
Stars: ✭ 1,633 (+3374.47%)
Mutual labels:  webpack, starter-kit, boilerplate
Project Webcube
Continuously updated JS infrastructure for modern web dev
Stars: ✭ 141 (+200%)
Mutual labels:  webpack, starter-kit, boilerplate
React Webpack Babel
Simple React Webpack Babel Starter Kit
Stars: ✭ 1,241 (+2540.43%)
Mutual labels:  webpack, starter-kit, boilerplate
Js Library Boilerplate
Javascript Starter Boilerplate - Webpack 4, Babel 7, UMD, Hot Reloading, and more
Stars: ✭ 202 (+329.79%)
Mutual labels:  webpack, starter-kit, boilerplate
Go Html Boilerplate
Starter pack for doing web development in Go
Stars: ✭ 229 (+387.23%)
Mutual labels:  starter-kit, router, boilerplate
Webpack Starter Basic
A simple webpack starter project for your basic modern web development needs.
Stars: ✭ 552 (+1074.47%)
Mutual labels:  webpack, starter-kit, spa
Nodejsstarterkit
Starter Kit for Node.js v14.x, minimum dependencies 🚀
Stars: ✭ 348 (+640.43%)
Mutual labels:  starter-kit, project, boilerplate
React Starter Kit
React Starter Kit — front-end starter kit using React, Relay, GraphQL, and JAM stack architecture
Stars: ✭ 21,060 (+44708.51%)
Mutual labels:  webpack, boilerplate, starter-kit

webvr-webpack-boilerplate

A webvr multi-pages project for three.js, es6/7, webpack and postcss.

中文

Features

  • webvr: a webvr boilerplate supporting scenes changing
  • three.js: use as the global varriable
  • es6/7: by babel and it's presets and plugins
  • postcss: by postcss-loader
  • webpack provides faster compilation
  • glsl: import .glsl files for shaders

Installation

$ npm install
# or
$ yarn install

Configuration

You can custom your local environment port via webpack.config.js.

Run in development

$ npm start

Build for production

$ npm run build

This will generator minified scripts to dist/.

Create webvr page

Here comes the basic script to create a webvr page. See more pages in src/views/*.js .

import { VRScene } from '@/core';

class Index extends VRScene {
  assets() {
    return {
      TEXTURE_SKYBOX: 'texture/360bg.jpg'
    }
  }
  start() {
     // create panorama
    const { TEXTURE_SKYBOX } = this.assets;
    const geometry = new THREE.SphereGeometry(radius,50,50);
    const material = new THREE.MeshBasicMaterial( { map: new THREE.TextureLoader().load(TEXTURE_SKYBOX),side:THREE.BackSide } );
    const panorama = new THREE.Mesh(geometry,material);
    this.add(panorama);
  }
  loaded() {
    console.log('assets has been loaded.');
  }
  update(delta) {
    // animate
  }
}
export default Index;

Init WebVR and Add Routers

import WebVRApp from '@/core'
// create router map
WebVRApp.create([
    {
        path: '/', // e.g 127.0.0.1:8080/
        component: () => import('@/views/index.js')
    },
    {
        path: '/user', // e.g 127.0.0.1:8080/1
        component: () => import('@/views/userPage.js')
    },
    {
        path: '/detail', // e.g 127.0.0.1:8080/2
        component: () => import('@/views/detailPage.js')
    }
],document.querySelector('.webvr-container')
);

VRScene class API

VRScene class is a class for create a scene below the root scene.

name type description
start Function() excute before the first rendering
loaded Function() excute after all the textures,3d models and audio are loaded
update Function() excute during each rendering
assets Function() declear assets path for the scene
root Object gobal property ,incluing root.scene, root.camera and so on.

VRScene.root

Using this.root to get gobal variable among all VRScenes. It is a property of the VRScene instance, incluing root.scene, root.camera and so on.

name type description
root.router Object router for controling the action between vr scenes
root.scene THREE.Scene global webvr scene
root.camera THREE.PerspectiveCamera global camera of first person
root.renderer THREE.Renderer global renderer
root.crossHair THREE.Object3d global crosshair
root.display VRDisplay vrdispaly[0]

root.router

root.router is a router controling the action between vr pages.

  • push(routerName) this.root.router.push('home') // goto 127.0.0.1:8080/home,history will push state
  • replace(routerName) this.root.router.replace('home') // goto 127.0.0.1:8080/home,history will replace state
  • back()

By using this.root.router.push can just fetch the script of page when you need to goto other vr pages.

this.root.router.push('2'); // it will redirect to e.g: 127.0.0.1:8080/2

How it work

Need Help

Ask questions here.

Any advise

PR welcome here.

Contributors

Yone Chen [email protected]

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].