Skip to content

Commit

Permalink
Adding some perspective
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Furga committed Dec 22, 2011
1 parent 99543e2 commit 5ea0605
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
25 changes: 14 additions & 11 deletions src/Solari.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ window.requestAnimFrame = (function(callback){

var Solari = Backbone.View.extend({
VIEW_ANGLE: 45,
NEAR: -2000,
FAR: 1000,
NEAR: 1,
FAR: 10000,
initialize: function(){
this.animate = false;
this.flaps = [];
Expand All @@ -35,11 +35,10 @@ var Solari = Backbone.View.extend({
this.aspect = this.width / this.height;
this.renderer = new THREE.WebGLRenderer;
this.renderer.sortObjects = false;
this.camera = new THREE.OrthographicCamera(
window.innerWidth / - 2,
window.innerWidth / 2,
window.innerHeight / 2,
window.innerHeight / - 2,

this.camera = new THREE.PerspectiveCamera(
20.0,
window.innerWidth / innerHeight,
this.NEAR,
this.FAR
);
Expand All @@ -48,14 +47,18 @@ var Solari = Backbone.View.extend({
this.renderer.setSize(this.width, this.height);

this.pointLight = new THREE.PointLight(0xFFFFFF);
this.ambientLight = new THREE.AmbientLight(0x333333);

this.pointLight.position.x = 1000;
this.pointLight.position.y = -800;
this.pointLight.position.z = 300;

this.pointLight.position.x = window.innerWidth / 2;
this.pointLight.position.y = -200;
this.pointLight.position.z = 600;
this.scene.add(this.pointLight);
this.scene.add(this.ambientLight);

// Pull the camera back
this.camera.position.z = 0;
this.camera.position.z = 3200;
this.camera.lookAt(new THREE.Vector3((0,0,0)));

this.el = this.renderer.domElement;
},
Expand Down
6 changes: 3 additions & 3 deletions src/SolariFlap.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var DEG2RAD = Math.PI / 180,
SPEED = 900.0;
SPEED = 1100.0;

var SolariFlap = Backbone.View.extend({
MAX_X: 180 * DEG2RAD,
Expand Down Expand Up @@ -33,10 +33,10 @@ var SolariFlap = Backbone.View.extend({

bottom.position = new THREE.Vector3(x, y, 0);
top.position = new THREE.Vector3(x, y + flapHeight, 0);
flap.position = new THREE.Vector3(0.5, flapHeight/2, 1);
flap.position = new THREE.Vector3(0, flapHeight/2, 0);

this.flapWrapper = new THREE.Object3D;
this.flapWrapper.position = new THREE.Vector3(x, y + flapHeight/2, 1);
this.flapWrapper.position = new THREE.Vector3(x, y + flapHeight/2, 2);
this.flapWrapper.add(flap);

this.objToRender = [top, bottom, this.flapWrapper];
Expand Down

0 comments on commit 5ea0605

Please sign in to comment.