three.js 源碼注釋(二十九)Cameras/OrthographicCamera.js
來源:程序員人生 發(fā)布時間:2014-12-12 08:25:55 閱讀次數:3831次
商域無疆 (http://blog.csdn.net/omni360/)
本文遵守“署名-非商業(yè)用處-保持1致”創(chuàng)作公用協(xié)議
轉載請保存此句:商域無疆 - 本博客專注于 敏捷開發(fā)及移動和物聯(lián)裝備研究:數據可視化、GOLANG、Html5、WEBGL、THREE.JS,否則,出自本博客的文章謝絕轉載或再轉載,謝謝合作。
俺也是剛開始學,好多地兒肯定不對還請見諒.
以下代碼是THREE.JS 源碼文件中Cameras/OrthographicCamera.js文件的注釋.
更多更新在 : https://github.com/omni360/three.js.sourcecode
/**
* @author alteredq / http://alteredqualia.com/
*/
/*
///OrthographicCamera方法根據 left, right, top, bottom, near, far 生成正交投影相機.OrthographicCamera對象的功能函數采取
/// 定義構造的函數原型對象來實現.
*/
///<summary>OrthographicCamera</summary>
///<param name ="left" type="Number">指明相對垂直平面的左邊坐標位置</param>
///<param name ="right" type="Number">指明相對垂直平面的右邊坐標位置</param>
///<param name ="top" type="Number">指明相對垂直平面的頂部坐標位置</param>
///<param name ="bottom" type="Number">指明相對垂直平面的底部坐標位置</param>
///<param name ="near" type="Number">指明相對深度剪切面的近的距離,必須為正數,可選參數,如果未指定,初始化為0.1</param>
///<param name ="far" type="Number">指明相對深度剪切面的遠的距離,必須為正數,可選參數,如果未指定,初始化為2000</param>
///<returns type="OrthographicCamera">返回OrthographicCamera,正交投影相機.</returns>
THREE.OrthographicCamera = function ( left, right, top, bottom, near, far ) {
THREE.Camera.call( this ); //調用Camera對象的call方法,將本來屬于Camera的方法交給當前對象OrthographicCamera來使用.
this.left = left; //指明相對垂直平面的相機的左邊坐標位置
this.right = right; //指明相對垂直平面的相機的右邊坐標位置
this.top = top; //指明相對垂直平面的相機的頂部坐標位置
this.bottom = bottom; //指明相對垂直平面的相機的底部坐標位置
this.near = ( near !== undefined ) ? near : 0.1; //指明相對深度剪切面的近的距離,必須為正數,可選參數,如果未指定,初始化為0.1
this.far = ( far !== undefined ) ? far : 2000; //指明相對深度剪切面的近的距離,必須為正數,可選參數,如果未指定,初始化為2000
this.updateProjectionMatrix(); //調用updateProjectionMatrix方法,更新相機的投影矩陣.
};
/**************************************************************************************
****下面是OrthographicCamera對象提供的功能函數定義,1部份通過prototype繼承自Camera方法
***************************************************************************************/
THREE.OrthographicCamera.prototype = Object.create( THREE.Camera.prototype );
/*
///updateProjectionMatrix方法返回正交投影相機的可視邊界的矩陣.
*/
///<summary>updateProjectionMatrix</summary>
///<returns type="OrthographicCamera">返回新的OrthographicCamera對象</returns>
THREE.OrthographicCamera.prototype.updateProjectionMatrix = function () {
this.projectionMatrix.makeOrthographic( this.left, this.right, this.top, this.bottom, this.near, this.far ); //調用THREE.Matrix4.makeOrthographic生成正交矩陣
};
/*clone方法
///clone方法克隆OrthographicCamera對象
*/
///<summary>clone</summary>
///<returns type="OrthographicCamera">返回克隆的OrthographicCamera對象</returns>
THREE.OrthographicCamera.prototype.clone = function () {
var camera = new THREE.OrthographicCamera();
THREE.Camera.prototype.clone.call( this, camera ); //調用THREE.Camera.Clone(camera)方法,克隆相機對象
camera.left = this.left; //將正交投影相機的 left 屬性值復制
camera.right = this.right; //將正交投影相機的 right 屬性值復制
camera.top = this.top; //將正交投影相機的 top 屬性值復制
camera.bottom = this.bottom; //將正交投影相機的 bottom 屬性值復制
camera.near = this.near; //將正交投影相機的 near 屬性值復制
camera.far = this.far; //將正交投影相機的 far 屬性值復制
return camera; //返回克隆的OrthographicCamera對象
};
商域無疆 (http://blog.csdn.net/omni360/)
本文遵守“署名-非商業(yè)用處-保持1致”創(chuàng)作公用協(xié)議
轉載請保存此句:商域無疆 - 本博客專注于 敏捷開發(fā)及移動和物聯(lián)裝備研究:數據可視化、GOLANG、Html5、WEBGL、THREE.JS,否則,出自本博客的文章謝絕轉載或再轉載,謝謝合作。
以下代碼是THREE.JS 源碼文件中Cameras/OrthographicCamera.js文件的注釋.
更多更新在 : https://github.com/omni360/three.js.sourcecode
生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈