Skip to content

Commit

Permalink
add ortho camera initialization option
Browse files Browse the repository at this point in the history
  • Loading branch information
snagy committed Feb 19, 2013
1 parent 379733e commit dd79ea9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ module.exports = View

function View(opts) {
this.fov = opts.fov || 60
this.width = opts.width || 512;
this.height = opts.height || 512;
this.width = opts.width || 512
this.height = opts.height || 512
this.aspectRatio = opts.aspectRatio || this.width/this.height
this.nearPlane = opts.nearPlane || 1
this.farPlane = opts.farPlane || 10000
this.skyColor = opts.skyColor || 0xBFD1E5
this.camera = new THREE.PerspectiveCamera(this.fov, this.aspectRatio, this.nearPlane, this.farPlane)
this.ortho = opts.ortho
this.camera = this.ortho?(new THREE.OrthographicCamera(this.width/-2, this.width/2, this.height/2, this.height/-2, this.nearPlane, this.farPlane)):(new THREE.PerspectiveCamera(this.fov, this.aspectRatio, this.nearPlane, this.farPlane))
this.camera.lookAt(new THREE.Vector3(0, 0, 0))

this.renderer = new THREE.WebGLRenderer({
Expand Down

0 comments on commit dd79ea9

Please sign in to comment.