Three.js Source Note (28) cameras/camera.js

Source: Internet
Author: User

Commercial Territory (http://blog.csdn.net/omni360/)

This article follows "Attribution-non-commercial use-consistent" authoring public agreement

Reprint Please keep this sentence: Business Domain-this blog focuses on Agile development and mobile and IoT device research: Data visualization, Golang, HTML5, WEBGL, three. JS, Otherwise, from this blog article refused to reprint or reprint, thank you for your cooperation.


I was just beginning to learn, a lot of things are definitely wrong and please forgive me.

The following code is a comment for the cameras/camera.js file in the three.js source file.

More updates in: Https://github.com/omni360/three.js.sourcecode


/** * @author mrdoob/http://mrdoob.com/* @author Mikael emtinger/http://gomo.se/* @author Westlangley/http://githu B.com/westlangley*//*///camera is the abstract base class for camera objects, which are inherited from this class when the camera is created. The function functions of the Camera object are implemented by using the function prototype object that defines the construct. *////<summary>camera</summary>three. Camera = function () {three. Object3d.call (this);//Call method of the Object3d object is called, the method that originally belongs to Object3d is handed to the current object camera for use. This.matrixworldinverse = new three. MATRIX4 ();//Set the property Matrixworldinverse for the camera, which is the inverse matrix of the Matrixworld, Matrixworld contains the camera in the world coordinate system of the transformation matrix This.projectionmatrix = new Three. MATRIX4 ();//Set the property ProjectionMatrix for the camera, including the camera's projection matrix};/***************************************************** The following is the method property definition for the camera object, inherited from Object3d**************************************************/three. Camera.prototype = Object.create (three. Object3d.prototype);//camrea object inherits all property methods from the Three.objec3d prototype/*///lookat method is used to rotate the camera object and to face the point in space (parameter vector) *////< Summary>lookat</summary>///<param name = "vector" type= "vector" >vector3 object </param>///< Returns type= "Camera" > Return to the new camera object </retUrns>three. Camera.prototype.lookAt = function () {//This routine does not support cameras with rotated and/or translated parent (s)// TODO: This program does not support the camera camera rotation and transformation?? English is not good, what do you mean? var m1 = new three. Matrix4 (); return function (vector) {M1.lookat (this.position, Vector, this.up);//Call THREE.Matrix4.lookAt () Method This.quaternion.setFromRotationMatrix (M1);//apply Rotation matrix};} ();/*clone method///clone Method Clone camera object, *////<summary>clone</summary>///<param name = "Camera" type= " Camera >camera Object </param>///<returns type= "Camera" > returns the cloned Camera object </returns>three. Camera.prototype.clone = function (camera) {if (camera = = = undefined) camera = new three. Camera (); Three. Object3D.prototype.clone.call (this, camera);//Call the THREE.Object3D.Clone (camera) method, Clone Camera Object Camera.matrixWorldInverse.copy (this.matrixworldinverse);// Copy the Matrixworldinverse property value of the camera camera.projectionMatrix.copy (This.projectionmatrix);// Copy the camera's ProjectionMatrix property value return camera;//return the cloned camera object};


Commercial Territory (http://blog.csdn.net/omni360/)

This article follows "Attribution-non-commercial use-consistent" authoring public agreement

Reprint Please keep this sentence: Business Domain-this blog focuses on Agile development and mobile and IoT device research: Data visualization, Golang, HTML5, WEBGL, three. JS, Otherwise, from this blog article refused to reprint or reprint, thank you for your cooperation.


The following code is a comment for the cameras/camera.js file in the three.js source file.

More updates in: Https://github.com/omni360/three.js.sourcecode

Three.js Source Note (28) cameras/camera.js

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.