|
@@ -21,8 +21,6 @@
|
|
|
|
|
|
<script src="../build/three.js"></script>
|
|
|
|
|
|
- <script src="js/controls/VRControls.js"></script>
|
|
|
- <script src="js/effects/VREffect.js"></script>
|
|
|
<script src="js/vr/ViveController.js"></script>
|
|
|
<script src="js/vr/PaintViveController.js"></script>
|
|
|
<script src="js/vr/WebVR.js"></script>
|
|
@@ -41,7 +39,6 @@
|
|
|
|
|
|
var container;
|
|
|
var camera, scene, renderer;
|
|
|
- var effect, controls;
|
|
|
var controller1, controller2;
|
|
|
|
|
|
var line;
|
|
@@ -142,19 +139,19 @@
|
|
|
renderer.gammaOutput = true;
|
|
|
container.appendChild( renderer.domElement );
|
|
|
|
|
|
- controls = new THREE.VRControls( camera );
|
|
|
- controls.standing = true;
|
|
|
+ renderer.vr.enabled = true;
|
|
|
+ renderer.vr.standing = true;
|
|
|
|
|
|
// controllers
|
|
|
|
|
|
controller1 = new THREE.PaintViveController( 0 );
|
|
|
- controller1.standingMatrix = controls.getStandingMatrix();
|
|
|
+ controller1.standingMatrix = renderer.vr.getStandingMatrix();
|
|
|
controller1.userData.points = [ new THREE.Vector3(), new THREE.Vector3() ];
|
|
|
controller1.userData.matrices = [ new THREE.Matrix4(), new THREE.Matrix4() ];
|
|
|
scene.add( controller1 );
|
|
|
|
|
|
controller2 = new THREE.PaintViveController( 1 );
|
|
|
- controller2.standingMatrix = controls.getStandingMatrix();
|
|
|
+ controller2.standingMatrix = renderer.vr.getStandingMatrix();
|
|
|
controller2.userData.points = [ new THREE.Vector3(), new THREE.Vector3() ];
|
|
|
controller2.userData.matrices = [ new THREE.Matrix4(), new THREE.Matrix4() ];
|
|
|
scene.add( controller2 );
|
|
@@ -188,10 +185,10 @@
|
|
|
|
|
|
} );
|
|
|
|
|
|
- effect = new THREE.VREffect( renderer );
|
|
|
-
|
|
|
WEBVR.getVRDisplay( function ( display ) {
|
|
|
|
|
|
+ renderer.vr.setDevice( display );
|
|
|
+
|
|
|
document.body.appendChild( WEBVR.getButton( display, renderer.domElement ) );
|
|
|
|
|
|
} );
|
|
@@ -387,19 +384,12 @@
|
|
|
camera.aspect = window.innerWidth / window.innerHeight;
|
|
|
camera.updateProjectionMatrix();
|
|
|
|
|
|
- effect.setSize( window.innerWidth, window.innerHeight );
|
|
|
+ renderer.setSize( window.innerWidth, window.innerHeight );
|
|
|
|
|
|
}
|
|
|
|
|
|
//
|
|
|
|
|
|
- function animate() {
|
|
|
-
|
|
|
- effect.requestAnimationFrame( animate );
|
|
|
- render();
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
function handleController( controller ) {
|
|
|
|
|
|
controller.update();
|
|
@@ -435,9 +425,13 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
- function render() {
|
|
|
+ function animate() {
|
|
|
+
|
|
|
+ renderer.animate( render );
|
|
|
|
|
|
- controls.update();
|
|
|
+ }
|
|
|
+
|
|
|
+ function render() {
|
|
|
|
|
|
var count = line.geometry.drawRange.count;
|
|
|
|
|
@@ -446,7 +440,7 @@
|
|
|
|
|
|
updateGeometry( count, line.geometry.drawRange.count );
|
|
|
|
|
|
- effect.render( scene, camera );
|
|
|
+ renderer.render( scene, camera );
|
|
|
|
|
|
}
|
|
|
|