From 7744821c37975e1c83ae905a416c5971195ec8de Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Mon, 6 Jul 2015 17:59:23 +0200 Subject: [PATCH] Doc --- js/l3d/src/cameras/Camera.js | 37 ++++++++++++++++++++++++++++--- js/l3d/src/cameras/FixedCamera.js | 9 ++++++++ 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/js/l3d/src/cameras/Camera.js b/js/l3d/src/cameras/Camera.js index 6500d9d..34c9076 100644 --- a/js/l3d/src/cameras/Camera.js +++ b/js/l3d/src/cameras/Camera.js @@ -1,16 +1,35 @@ +/** + * Reprensents a simple rotating camera + * @constructor + * @memberof L3D + * @extends THREE.PerspectiveCamera + */ L3D.Camera = function() { THREE.PerspectiveCamera.apply(this, arguments); + /** + * @type {Number} + * @description angle of the camera + */ this.theta = 0; + this.position.x = L3D.Camera.DISTANCE_X; this.position.z = L3D.Camera.DISTANCE_Z; this.up = new THREE.Vector3(0,0,1); + + /** + * @type {THREE.Vector3} + * @description Position where the camera is looking at + */ this.target = new THREE.Vector3(); }; L3D.Camera.prototype = Object.create(THREE.PerspectiveCamera.prototype); -// Update function +/** + * Updates the position of the camera + * @param time {Number} time elapsed since the last update in millisec + */ L3D.Camera.prototype.update = function(time) { if (time === undefined) { time = 20; @@ -20,11 +39,23 @@ L3D.Camera.prototype.update = function(time) { this.position.y = L3D.Camera.DISTANCE_X*Math.sin(this.theta); }; -// Look function +/** + * look function. Just like OpenGL gluLookAt + */ L3D.Camera.prototype.look = function() { this.lookAt(this.target); }; -// Static members +/** + * @static + * @type {Number} + * @description radiusof the circle where the camera is rotating + */ L3D.Camera.DISTANCE_X = 1000; + +/** + * @static + * @type {Number} + * @description Altitude of the camera + */ L3D.Camera.DISTANCE_Z = 300; diff --git a/js/l3d/src/cameras/FixedCamera.js b/js/l3d/src/cameras/FixedCamera.js index 495a40b..88452a3 100644 --- a/js/l3d/src/cameras/FixedCamera.js +++ b/js/l3d/src/cameras/FixedCamera.js @@ -1,3 +1,9 @@ +/** + * Represents a fixed camera + * @constructor + * @extends THREE.PerspectiveCamera + * @memberof L3D + */ L3D.FixedCamera = function(arg1, arg2, arg3, arg4, position, target) { THREE.PerspectiveCamera.apply(this, arguments); @@ -23,6 +29,9 @@ L3D.FixedCamera = function(arg1, arg2, arg3, arg4, position, target) { L3D.FixedCamera.prototype = Object.create(THREE.PerspectiveCamera.prototype); L3D.FixedCamera.prototype.constructor = L3D.FixedCamera; +/** + * Look function. Just like OpenGL gluLookAt + */ L3D.FixedCamera.prototype.look = function() { this.lookAt(this.target); };