

var Camera = function( properties, scene, poemEmitter ) {
	
	var config = _.extend({
		fov : 50,
		near : 3,
		far : 10000,
		aspectRatio : window.innerWidth / window.innerHeight
	}, properties);
	
	this.object = new THREE.PerspectiveCamera(
		config.fov,
		config.aspect,
		config.near,
		config.far
	);
	
	this.object.position.x = _.isNumber( properties.x ) ? properties.x : 0;
	this.object.position.y = _.isNumber( properties.y ) ? properties.y : 0;
	this.object.position.z = _.isNumber( properties.z ) ? properties.z : 500;
	
	scene.add( this.object );
	
	poemEmitter.on( 'resize', this.resize.bind(this) );
	
};

module.exports = Camera;

Camera.prototype = {
	
	resize : function() {
		this.object.aspect = window.innerWidth / window.innerHeight;
		this.object.updateProjectionMatrix();
	}
};