Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rotate(ev) {
- let xOffSet = ev.center.x - this._lastX;
- let YOffSet = this._lastY - ev.center.y;
- this._lastX = ev.center.x;
- this._lastY = ev.center.y;
- let sensitivity = 0.005;
- xOffSet *= sensitivity;
- YOffSet *= sensitivity;
- this._yaw += xOffSet;
- this._pitch += YOffSet;
- updateViewProjMatrix() {
- let gl = Core.mGetGL();
- this._frontVector[0] = Math.cos(this._yaw) * Math.cos(this._pitch);
- this._frontVector[1] = Math.sin(this._pitch);
- this._frontVector[2] = Math.sin(this._yaw) * Math.cos(this._pitch);
- vec3.normalize(this._lookAtVector, this._frontVector);
- vec3.add(this._lookAtVector, this._lookAtVector, this._positionVector);
- mat4.lookAt(this._viewMatrix, this._positionVector, this._lookAtVector, this._upVector);
- mat4.perspective(this._projMatrix, this._fov * Math.PI / 180, gl.canvas.clientWidth / gl.canvas.clientHeight, this._nearPlane, this._farPlane);
- mat4.multiply(this._vpMatrix, this._projMatrix, this._viewMatrix);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement