2019-02-16 14:49:50 +00:00
|
|
|
import * as THREE from 'three';
|
2016-03-11 14:16:35 +00:00
|
|
|
|
|
|
|
// This can only be accessed from Engine.camera if you want to reference the
|
|
|
|
// same scene in multiple places
|
|
|
|
|
|
|
|
// TODO: Ensure that FOV looks natural on all aspect ratios
|
|
|
|
// http://stackoverflow.com/q/26655930/997339
|
|
|
|
|
|
|
|
export default function(container) {
|
2016-06-16 12:31:22 +00:00
|
|
|
var camera = new THREE.PerspectiveCamera(45, 1, 1, 2000000);
|
2016-06-16 10:52:20 +00:00
|
|
|
camera.position.y = 4000;
|
|
|
|
camera.position.z = 4000;
|
2016-03-11 14:16:35 +00:00
|
|
|
|
|
|
|
var updateSize = function() {
|
|
|
|
camera.aspect = container.clientWidth / container.clientHeight;
|
|
|
|
camera.updateProjectionMatrix();
|
|
|
|
};
|
|
|
|
|
|
|
|
window.addEventListener('resize', updateSize, false);
|
|
|
|
updateSize();
|
|
|
|
|
|
|
|
return camera;
|
|
|
|
};
|