| 9 | }; |
| 10 | |
| 11 | var Camera = function Camera(gl) { |
| 12 | |
| 13 | this.gl = gl; |
| 14 | // this.radius = 100; |
| 15 | // this.lon = 0; |
| 16 | // this.lat = 0; |
| 17 | |
| 18 | this.radius = 4000; |
| 19 | this.lon = 90; |
| 20 | this.lat = 45; |
| 21 | |
| 22 | this.transX = 100 * conf.longitudeLatitudeScale; |
| 23 | this.transY = 30 * conf.longitudeLatitudeScale; |
| 24 | |
| 25 | var canvas = gl.canvas; |
| 26 | |
| 27 | gl.viewport(0, 0, canvas.width, canvas.height); |
| 28 | var pMatrix = mat4.create(); |
| 29 | mat4.perspective(pMatrix, 45, canvas.width / canvas.height, 1, 100000.0); |
| 30 | gl.uniformMatrix4fv(gl.uPMatrix, false, pMatrix); |
| 31 | |
| 32 | this.computerXYZ(); |
| 33 | this.render(); |
| 34 | this.init(); |
| 35 | }; |
| 36 | |
| 37 | Camera.prototype.init = function () { |
| 38 | this.drag(); |