Skip to content

Commit

Permalink
_
Browse files Browse the repository at this point in the history
  • Loading branch information
zunyiG committed Nov 4, 2019
1 parent 89cf48b commit a59b2ea
Show file tree
Hide file tree
Showing 21 changed files with 76,078 additions and 17 deletions.
3 changes: 3 additions & 0 deletions src/nodeschool/webgl/breakWall/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/dist
/.cache
yarn.lock
19 changes: 19 additions & 0 deletions src/nodeschool/webgl/breakWall/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<style>
body { margin: 0; }
canvas { width: 100%; height: 100% }
</style>
<title>three.js</title>
</head>
<body>
<script src="./src/lib/three.js"></script>
<script type="module" src="./src/lib/OrbitControls.js"></script>
<script type="module" src="./src/lib/Physijs.js"></script>
<script type="module" src="./index.js"></script>
</body>
</html>
37 changes: 37 additions & 0 deletions src/nodeschool/webgl/breakWall/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import camera from './src/camera.js';
import { addOnMouseDown } from './src/events.js';
import { addToList, addScore } from './src/operates.js';
import {createText} from './src/text.js';

window.onload = () => {
Physijs.scripts.worker = './src/lib/physijs_worker.js';
Physijs.scripts.ammo = './ammo.js';

let scene = new Physijs.Scene();
scene.setGravity(new THREE.Vector3( 0, -50, 0 ))

const render = new THREE.WebGLRenderer()
render.setSize(window.innerWidth, window.innerHeight)
document.body.appendChild(render.domElement)

const axesHelper = new THREE.AxesHelper( 1000 );
scene.add( axesHelper );

// createText('score: ').then(scoreLabel => {
// scene.add(scoreLabel)
// scoreLabel.position.set(160, 150, -200)
// })



const controls = new window.THREE.OrbitControls( camera, render.domElement );

const animate = () => {
controls.update();
scene.simulate();
render.render(scene, camera)
requestAnimationFrame(animate);
}

animate()
}
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit a59b2ea

Please sign in to comment.