Skip to content

Commit

Permalink
Fix camera fov in glTF loading. Add Scene#setMainCamera
Browse files Browse the repository at this point in the history
  • Loading branch information
pissang committed Jan 24, 2018
1 parent 8bd2576 commit 4074131
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/Scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,20 @@ var Scene = Node.extend(function () {
}
},

/**
* Set main camera of the scene.
* @param {claygl.Camera} camera
*/
setMainCamera: function (camera) {
var idx = this._cameraList.indexOf(camera);
if (idx >= 0) {
this._cameraList.splice(idx, 1);
}
this._cameraList.unshift(camera);
},
/**
* Get main camera of the scene.
*/
getMainCamera: function () {
return this._cameraList[0];
},
Expand Down
2 changes: 1 addition & 1 deletion src/loader/GLTF.js
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ function () {
return new PerspectiveCamera({
name: nodeInfo.name,
aspect: perspectiveInfo.aspectRatio,
fov: perspectiveInfo.yfov,
fov: perspectiveInfo.yfov / Math.PI * 180,
far: perspectiveInfo.zfar,
near: perspectiveInfo.znear
});
Expand Down

0 comments on commit 4074131

Please sign in to comment.