Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,615 changes: 1,615 additions & 0 deletions projects/shubh/NotMinecraft.html

Large diffs are not rendered by default.

156 changes: 156 additions & 0 deletions projects/shubh/PointerLockControls.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
/**
* @author mrdoob / http://mrdoob.com/
* @author Mugen87 / https://github.com/Mugen87
*/

THREE.PointerLockControls = function ( camera, domElement ) {

if ( domElement === undefined ) {

console.warn( 'THREE.PointerLockControls: The second parameter "domElement" is now mandatory.' );
domElement = document.body;

}

this.domElement = domElement;
this.isLocked = false;

//
// internals
//

var scope = this;

var changeEvent = { type: 'change' };
var lockEvent = { type: 'lock' };
var unlockEvent = { type: 'unlock' };

var euler = new THREE.Euler( 0, 0, 0, 'YXZ' );

var PI_2 = Math.PI / 2;

var vec = new THREE.Vector3();

function onMouseMove( event ) {

if ( scope.isLocked === false ) return;

var movementX = event.movementX || event.mozMovementX || event.webkitMovementX || 0;
var movementY = event.movementY || event.mozMovementY || event.webkitMovementY || 0;

euler.setFromQuaternion( camera.quaternion );

euler.y -= movementX * 0.002;
euler.x -= movementY * 0.002;

euler.x = Math.max( - PI_2, Math.min( PI_2, euler.x ) );

camera.quaternion.setFromEuler( euler );

scope.dispatchEvent( changeEvent );

}

function onPointerlockChange() {

if ( document.pointerLockElement === scope.domElement ) {

scope.dispatchEvent( lockEvent );

scope.isLocked = true;

} else {

scope.dispatchEvent( unlockEvent );

scope.isLocked = false;

}

}

function onPointerlockError() {

console.error( 'THREE.PointerLockControls: Unable to use Pointer Lock API' );

}

this.connect = function () {

document.addEventListener( 'mousemove', onMouseMove, false );
document.addEventListener( 'pointerlockchange', onPointerlockChange, false );
document.addEventListener( 'pointerlockerror', onPointerlockError, false );

};

this.disconnect = function () {

document.removeEventListener( 'mousemove', onMouseMove, false );
document.removeEventListener( 'pointerlockchange', onPointerlockChange, false );
document.removeEventListener( 'pointerlockerror', onPointerlockError, false );

};

this.dispose = function () {

this.disconnect();

};

this.getObject = function () { // retaining this method for backward compatibility

return camera;

};

this.getDirection = function () {

var direction = new THREE.Vector3( 0, 0, - 1 );

return function ( v ) {

return vec.copy( direction ).applyQuaternion( camera.quaternion );

};

}();

this.moveForward = function ( distance ) {

// move forward parallel to the xz-plane
// assumes camera.up is y-up

vec.setFromMatrixColumn( camera.matrix, 0 );

vec.crossVectors( camera.up, vec );

camera.position.addScaledVector( vec, distance );

};

this.moveRight = function ( distance ) {

vec.setFromMatrixColumn( camera.matrix, 0 );

camera.position.addScaledVector( vec, distance );

};

this.lock = function () {

this.domElement.requestPointerLock();

};

this.unlock = function () {

document.exitPointerLock();

};

this.connect();

};

THREE.PointerLockControls.prototype = Object.create( THREE.EventDispatcher.prototype );
THREE.PointerLockControls.prototype.constructor = THREE.PointerLockControls;
Binary file added projects/shubh/images/blockTextures/bottom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added projects/shubh/images/blockTextures/side1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added projects/shubh/images/blockTextures/side2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added projects/shubh/images/blockTextures/side3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added projects/shubh/images/blockTextures/side4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added projects/shubh/images/blockTextures/top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added projects/shubh/images/bottom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added projects/shubh/images/cursor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added projects/shubh/images/side1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added projects/shubh/images/side2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added projects/shubh/images/side3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added projects/shubh/images/side4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added projects/shubh/images/texture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added projects/shubh/images/top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading