├── .editorconfig ├── .eslintrc.js ├── .gitignore ├── README.md ├── assets └── README.md ├── components ├── BackgroundCube.vue ├── Logo.vue ├── README.md ├── threeComponents.js └── threejs │ ├── Cameras │ ├── Camera.vue │ └── PerspectiveCamera.vue │ ├── Core │ ├── Geometry.vue │ └── Object3D.vue │ ├── Geometries │ └── BoxGeometry.vue │ ├── Lights │ ├── AmbientLight.vue │ ├── DirectionalLight.vue │ └── Light.vue │ ├── Materials │ ├── Material.vue │ ├── MeshBasicMaterial.vue │ └── MeshPhongMaterial.vue │ ├── Objects │ └── Mesh.vue │ ├── Renderers │ └── WebGLRenderer.vue │ └── Scenes │ └── Scene.vue ├── layouts ├── README.md └── default.vue ├── middleware └── README.md ├── nuxt.config.js ├── package.json ├── pages ├── README.md └── index.vue ├── plugins └── README.md ├── static ├── README.md └── favicon.ico ├── store └── README.md └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_size = 2 6 | indent_style = space 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | parser: 'babel-eslint', 4 | env: { 5 | browser: true, 6 | node: true 7 | }, 8 | extends: 'standard', 9 | // required to lint *.vue files 10 | plugins: [ 11 | 'html' 12 | ], 13 | // add your custom rules here 14 | rules: {}, 15 | globals: {} 16 | } 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | node_modules 3 | 4 | # logs 5 | npm-debug.log 6 | 7 | # Nuxt build 8 | .nuxt 9 | 10 | # Nuxt generate 11 | dist 12 | 13 | # IDE 14 | .vscode -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # nuxt-threejs 2 | 3 | [Three.js](https://threejs.org/)をコンポーネント化したBackgroundでCubeが動作するサンプル。 4 | どうしてもコンポーネントにしたい人向け。 5 | Vue(Nuxt)の練習用なので、実用化レベルではありません。 6 | 7 | ## Build Setup 8 | 9 | ``` bash 10 | # install dependencies 11 | $ yarn install # Or npm install 12 | 13 | # serve with hot reload at localhost:3000 14 | $ yarn run dev 15 | 16 | # build for production and launch server 17 | $ yarn run build 18 | $ yarn start 19 | 20 | # generate static project 21 | $ yarn run generate 22 | ``` 23 | 24 | For detailed explanation on how things work, checkout the [Nuxt.js docs](https://github.com/nuxt/nuxt.js). 25 | -------------------------------------------------------------------------------- /assets/README.md: -------------------------------------------------------------------------------- 1 | # ASSETS 2 | 3 | This directory contains your un-compiled assets such as LESS, SASS, or JavaScript. 4 | 5 | More information about the usage of this directory in the documentation: 6 | https://nuxtjs.org/guide/assets#webpacked 7 | 8 | **This directory is not required, you can delete it if you don't want to use it.** 9 | -------------------------------------------------------------------------------- /components/BackgroundCube.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 76 | -------------------------------------------------------------------------------- /components/Logo.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 80 | -------------------------------------------------------------------------------- /components/README.md: -------------------------------------------------------------------------------- 1 | # COMPONENTS 2 | 3 | The components directory contains your Vue.js Components. 4 | Nuxt.js doesn't supercharge these components. 5 | 6 | **This directory is not required, you can delete it if you don't want to use it.** 7 | -------------------------------------------------------------------------------- /components/threeComponents.js: -------------------------------------------------------------------------------- 1 | import WebGLRenderer from './threejs/Renderers/WebGLRenderer' 2 | import PerspectiveCamera from './threejs/Cameras/PerspectiveCamera' 3 | import Scene from './threejs/Scenes/Scene' 4 | import BoxGeometry from './threejs/Geometries/BoxGeometry' 5 | import Mesh from './threejs/Objects/Mesh' 6 | import MeshBasicMaterial from './threejs/Materials/MeshBasicMaterial' 7 | import MeshPhongMaterial from './threejs/Materials/MeshPhongMaterial' 8 | import AmbientLight from './threejs/Lights/AmbientLight' 9 | import DirectionalLight from './threejs/Lights/DirectionalLight' 10 | 11 | export default { 12 | WebglRenderer: WebGLRenderer, 13 | PerspectiveCamera, 14 | Scene, 15 | BoxGeometry, 16 | Mesh, 17 | MeshBasicMaterial, 18 | MeshPhongMaterial, 19 | AmbientLight, 20 | DirectionalLight 21 | } 22 | -------------------------------------------------------------------------------- /components/threejs/Cameras/Camera.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 12 | -------------------------------------------------------------------------------- /components/threejs/Cameras/PerspectiveCamera.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | -------------------------------------------------------------------------------- /components/threejs/Core/Geometry.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 21 | -------------------------------------------------------------------------------- /components/threejs/Core/Object3D.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 79 | -------------------------------------------------------------------------------- /components/threejs/Geometries/BoxGeometry.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 44 | -------------------------------------------------------------------------------- /components/threejs/Lights/AmbientLight.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | -------------------------------------------------------------------------------- /components/threejs/Lights/DirectionalLight.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | -------------------------------------------------------------------------------- /components/threejs/Lights/Light.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | -------------------------------------------------------------------------------- /components/threejs/Materials/Material.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 24 | -------------------------------------------------------------------------------- /components/threejs/Materials/MeshBasicMaterial.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 85 | -------------------------------------------------------------------------------- /components/threejs/Materials/MeshPhongMaterial.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 121 | -------------------------------------------------------------------------------- /components/threejs/Objects/Mesh.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | -------------------------------------------------------------------------------- /components/threejs/Renderers/WebGLRenderer.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 95 | 96 | -------------------------------------------------------------------------------- /components/threejs/Scenes/Scene.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | -------------------------------------------------------------------------------- /layouts/README.md: -------------------------------------------------------------------------------- 1 | # LAYOUTS 2 | 3 | This directory contains your Application Layouts. 4 | 5 | More information about the usage of this directory in the documentation: 6 | https://nuxtjs.org/guide/views#layouts 7 | 8 | **This directory is not required, you can delete it if you don't want to use it.** 9 | -------------------------------------------------------------------------------- /layouts/default.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 53 | -------------------------------------------------------------------------------- /middleware/README.md: -------------------------------------------------------------------------------- 1 | # MIDDLEWARE 2 | 3 | This directory contains your Application Middleware. 4 | The middleware lets you define custom function to be ran before rendering a page or a group of pages (layouts). 5 | 6 | More information about the usage of this directory in the documentation: 7 | https://nuxtjs.org/guide/routing#middleware 8 | 9 | **This directory is not required, you can delete it if you don't want to use it.** 10 | -------------------------------------------------------------------------------- /nuxt.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | mode: 'spa', // 本当はSSRで実装したい。 3 | /* 4 | ** Headers of the page 5 | */ 6 | head: { 7 | title: 'nuxt-threejs', 8 | meta: [ 9 | { charset: 'utf-8' }, 10 | { name: 'viewport', content: 'width=device-width, initial-scale=1' }, 11 | { hid: 'description', name: 'description', content: 'Nuxt.js project' } 12 | ], 13 | link: [ 14 | { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' } 15 | ] 16 | }, 17 | /* 18 | ** Customize the progress bar color 19 | */ 20 | loading: { color: '#3B8070' }, 21 | /* 22 | ** Build configuration 23 | */ 24 | build: { 25 | vendor: ['three', 'vue-three'], 26 | /* 27 | ** Run ESLint on save 28 | */ 29 | extend (config, ctx) { 30 | if (ctx.dev && ctx.isClient) { 31 | config.module.rules.push({ 32 | enforce: 'pre', 33 | test: /\.(js|vue)$/, 34 | loader: 'eslint-loader', 35 | exclude: /(node_modules)/ 36 | }) 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nuxt-threejs", 3 | "version": "1.0.0", 4 | "description": "Nuxt.js project", 5 | "author": "s-fuku ", 6 | "private": true, 7 | "scripts": { 8 | "dev": "nuxt", 9 | "build": "nuxt build", 10 | "start": "nuxt start", 11 | "generate": "nuxt generate", 12 | "lint": "eslint --ext .js,.vue --ignore-path .gitignore .", 13 | "precommit": "npm run lint" 14 | }, 15 | "dependencies": { 16 | "nuxt": "^1.0.0-rc11", 17 | "three": "^0.87.1", 18 | "vue-three": "^0.1.20" 19 | }, 20 | "devDependencies": { 21 | "babel-eslint": "^7.2.3", 22 | "eslint": "^4.3.0", 23 | "eslint-config-standard": "^10.2.1", 24 | "eslint-loader": "^1.9.0", 25 | "eslint-plugin-html": "^3.1.1", 26 | "eslint-plugin-import": "^2.7.0", 27 | "eslint-plugin-node": "^5.1.1", 28 | "eslint-plugin-promise": "^3.5.0", 29 | "eslint-plugin-standard": "^3.0.1" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /pages/README.md: -------------------------------------------------------------------------------- 1 | # PAGES 2 | 3 | This directory contains your Application Views and Routes. 4 | The framework reads all the .vue files inside this directory and create the router of your application. 5 | 6 | More information about the usage of this directory in the documentation: 7 | https://nuxtjs.org/guide/routing 8 | -------------------------------------------------------------------------------- /pages/index.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 31 | 32 | 62 | -------------------------------------------------------------------------------- /plugins/README.md: -------------------------------------------------------------------------------- 1 | # PLUGINS 2 | 3 | This directory contains your Javascript plugins that you want to run before instantiating the root vue.js application. 4 | 5 | More information about the usage of this directory in the documentation: 6 | https://nuxtjs.org/guide/plugins 7 | 8 | **This directory is not required, you can delete it if you don't want to use it.** 9 | -------------------------------------------------------------------------------- /static/README.md: -------------------------------------------------------------------------------- 1 | # STATIC 2 | 3 | This directory contains your static files. 4 | Each file inside this directory is mapped to /. 5 | 6 | Example: /static/robots.txt is mapped as /robots.txt. 7 | 8 | More information about the usage of this directory in the documentation: 9 | https://nuxtjs.org/guide/assets#static 10 | 11 | **This directory is not required, you can delete it if you don't want to use it.** 12 | -------------------------------------------------------------------------------- /static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/s-fukumoto/nuxt-threejs/2e05497b077c7b17d33ae7debb0bd62996c4b327/static/favicon.ico -------------------------------------------------------------------------------- /store/README.md: -------------------------------------------------------------------------------- 1 | # STORE 2 | 3 | This directory contains your Vuex Store files. 4 | Vuex Store option is implemented in the Nuxt.js framework. 5 | Creating a index.js file in this directory activate the option in the framework automatically. 6 | 7 | More information about the usage of this directory in the documentation: 8 | https://nuxtjs.org/guide/vuex-store 9 | 10 | **This directory is not required, you can delete it if you don't want to use it.** 11 | --------------------------------------------------------------------------------