Browse Source

the first scene

master
blobt 4 years ago
parent
commit
f4ad3b1981
  1. 26
      app/js/index.js
  2. 13
      app/views/index.ejs
  3. 6
      npm-shrinkwrap.json
  4. 1
      package.json
  5. 22
      server/public/js/cp.min.js
  6. 51120
      server/public/js/index.js
  7. 13
      server/views/index.ejs

26
app/js/index.js

@ -0,0 +1,26 @@
import * as THREE from 'three';
var renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
var camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 500 );
camera.position.set( 0, 0, 100 );
camera.lookAt( 0, 0, 0 );
var scene = new THREE.Scene();
var material = new THREE.LineBasicMaterial( { color: 0x0000ff } );
var points = [];
points.push( new THREE.Vector3( - 10, 0, 0 ) );
points.push( new THREE.Vector3( 0, 10, 0 ) );
points.push( new THREE.Vector3( 10, 0, 0 ) );
var geometry = new THREE.BufferGeometry().setFromPoints( points );
var line = new THREE.Line( geometry, material );
scene.add( line );
renderer.render( scene, camera );

13
app/views/index.ejs

@ -1,11 +1,14 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en">
<html>
<head> <head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Three Js</title>
<meta charset="utf-8">
<title>My first three.js app</title>
<style>
body { margin: 0; }
canvas { display: block; }
</style>
</head> </head>
<body> <body>
<h1>Three Js</h1>
<script src="/js/index.js" charset="utf-8"></script>
</body> </body>
</html> </html>

6
npm-shrinkwrap.json

@ -6102,6 +6102,12 @@
"through2": "^2.0.1" "through2": "^2.0.1"
} }
}, },
"three": {
"version": "0.120.0",
"resolved": "https://registry.npmjs.org/three/-/three-0.120.0.tgz",
"integrity": "sha512-Swffpi3EAHWkmqC1MagKEzR5XgwkDiyeWI3M7vkGbBc0xhq2LcQmJj5DqBruLkrgcZQ+fM/+fSQBU1tDvggO4A==",
"dev": true
},
"through": { "through": {
"version": "2.3.8", "version": "2.3.8",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",

1
package.json

@ -34,6 +34,7 @@
"morgan": "^1.10.0", "morgan": "^1.10.0",
"require-dir": "^0.3.2", "require-dir": "^0.3.2",
"serve-favicon": "^2.5.0", "serve-favicon": "^2.5.0",
"three": "^0.120.0",
"vinyl-named": "^1.1.0", "vinyl-named": "^1.1.0",
"webpack": "^2.7.0", "webpack": "^2.7.0",
"webpack-stream": "^3.2.0", "webpack-stream": "^3.2.0",

22
server/public/js/cp.min.js
File diff suppressed because it is too large
View File

51120
server/public/js/index.js
File diff suppressed because it is too large
View File

13
server/views/index.ejs

@ -1,11 +1,14 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en">
<html>
<head> <head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Three Js</title>
<meta charset="utf-8">
<title>My first three.js app</title>
<style>
body { margin: 0; }
canvas { display: block; }
</style>
</head> </head>
<body> <body>
<h1>Three Js</h1>
<script src="/js/index.js" charset="utf-8"></script>
</body> </body>
</html> </html>
Loading…
Cancel
Save