39 lines
692 B
JavaScript
Executable File
39 lines
692 B
JavaScript
Executable File
/*
|
|
* Copyright 2013, kaj dijkstra ,
|
|
* Author, Kaj Dijkstra.
|
|
* All rights reserved.
|
|
*
|
|
*/
|
|
|
|
|
|
/**
|
|
* light
|
|
**/
|
|
kepler.light(){
|
|
this.position = [190.0,20.0,100.0];
|
|
this.target = [0,0,0];
|
|
this.up = [0,1,0];
|
|
|
|
this.projection;
|
|
this.view;
|
|
|
|
this.viewProjection;
|
|
|
|
this.far = 2420;
|
|
this.near = 0.1;
|
|
|
|
this.type = 'directional';
|
|
|
|
this.update();
|
|
}
|
|
|
|
|
|
/**
|
|
* update light
|
|
**/
|
|
kepler.light.prototype.update(){
|
|
var matrix4 = kepler.matrix4;
|
|
this.projection = matrix4.perspective(kepler.math.degToRad(45), kepler.width / kepler.height, this.near, this.far);
|
|
this.view = matrix4.lookAt(this.position, this.target, this.up);
|
|
this.viewProjection = matrix4.mul(this.view, this.projection)
|
|
} |