From 6ee067417ad966cb0292c03b80176a6645a5931f Mon Sep 17 00:00:00 2001 From: Vaios Kalpias-Ilias Date: Fri, 3 Jul 2015 13:38:41 +0300 Subject: [PATCH] Documentation fixes --- src/anim/anim_animation.js | 22 ++++++--- src/anim/anim_skeleton.js | 3 +- src/asset/asset_asset.js | 8 ++-- src/asset/asset_registry.js | 3 ++ src/core/core_bind.js | 47 ++++++++++--------- src/core/core_core.js | 1 + .../animation/animation_component.js | 2 +- .../audiosource/audiosource_component.js | 2 +- .../components/camera/camera_system.js | 2 +- .../components/model/model_component.js | 2 +- .../components/model/model_system.js | 2 +- .../particlesystem/particlesystem_system.js | 7 +++ .../physics/collision/collision_component.js | 2 +- .../physics/collision/collision_trigger.js | 2 +- .../components/pick/pick_component.js | 4 +- src/framework/components/pick/pick_system.js | 2 +- .../components/script/script_component.js | 2 +- .../components/script/script_system.js | 3 +- src/input/input_controller.js | 1 + src/input/input_keyboard.js | 2 +- src/input/input_touch.js | 40 ++++++++-------- src/math/math_curve.js | 6 +-- src/math/math_mat3.js | 6 +++ src/math/math_mat4.js | 5 +- 24 files changed, 105 insertions(+), 71 deletions(-) diff --git a/src/anim/anim_animation.js b/src/anim/anim_animation.js index a3e9c98b9f3..96a50ce5e57 100644 --- a/src/anim/anim_animation.js +++ b/src/anim/anim_animation.js @@ -6,6 +6,11 @@ pc.extend(pc, function () { this.scale = scale; }; + /** + * @name pc.Node + * @class A node has a name and contains an array of keyframes. + * @returns {pc.Node} A new pc.Node. + */ var Node = function Node() { this._name = ""; this._keys = []; @@ -15,7 +20,7 @@ pc.extend(pc, function () { * @name pc.Animation * @class An animation is a sequence of keyframe arrays which map to the nodes of a skeletal hierarchy. * It controls how the nodes of the hierarchy are transformed over time. - * @description Returns a new pc.Animation object. + * @returns {pc.Animation} A new pc.Animation object. */ var Animation = function Animation() { this._name = ""; @@ -49,7 +54,9 @@ pc.extend(pc, function () { /** * @function * @name pc.Animation#getNode - * @returns {pc.Node} The node + * @description Gets a pc.Node by name + * @param {string} name The name of the pc.Node + * @returns {pc.Node} The pc.Node with the specified name * @author Will Eastcott */ Animation.prototype.getNode = function (name) { @@ -59,7 +66,8 @@ pc.extend(pc, function () { /** * @function * @name pc.Animation#getNodes - * @returns {Array} The nodes + * @description Gets the pc.Nodes of this pc.Animation + * @returns {[pc.Node]} An array of nodes. * @author Will Eastcott */ Animation.prototype.getNodes = function () { @@ -81,7 +89,7 @@ pc.extend(pc, function () { * @function * @name pc.Animation#setName * @description Sets the human-readable name of the specified animation. - * @param {number} name The new name for the animation. + * @param {string} name The new name for the animation. * @author Will Eastcott */ Animation.prototype.setName = function (name) { @@ -90,9 +98,9 @@ pc.extend(pc, function () { /** * @function - * @name pc.Animation#setNode - * @param {String} name - * @param {pc.Node} node + * @name pc.Animation#addNode + * @description Adds a node the the internal nodes array. + * @param {pc.Node} node The node to add. * @author Will Eastcott */ Animation.prototype.addNode = function (node) { diff --git a/src/anim/anim_skeleton.js b/src/anim/anim_skeleton.js index eebd1f1a822..102acfb1b1d 100644 --- a/src/anim/anim_skeleton.js +++ b/src/anim/anim_skeleton.js @@ -25,7 +25,8 @@ pc.extend(pc, function () { /** * @name pc.Skeleton - * @class A skeleton. + * @class Represents a skeleton used to play animations. + * @param {pc.GraphNode} graph The root pc.GraphNode of the skeleton. */ var Skeleton = function Skeleton(graph) { this._animation = null; diff --git a/src/asset/asset_asset.js b/src/asset/asset_asset.js index 17c6c8ca0e7..1db82bad307 100644 --- a/src/asset/asset_asset.js +++ b/src/asset/asset_asset.js @@ -13,7 +13,8 @@ pc.extend(pc, function () { * * See the {@link pc.AssetRegistry} for details on loading resources from assets. * @property {String} name The name of the asset - * @property {String} type The type of the asset. One of ["animation", "audio", "image", "json", "material", "model", "text", "texture"] + * @property {Number} id The asset id + * @property {String} type The type of the asset. One of ["animation", "audio", "image", "json", "material", "model", "text", "texture", "cubemap"] * @property {Object} file The file details or null if no file * @property {String} [file.url] The URL of the resource file that contains the asset data * @property {String} [file.filename] The filename of the resource file @@ -21,11 +22,12 @@ pc.extend(pc, function () { * @property {String} [file.hash] The MD5 hash of the resource file data and the Asset data field. * @property {Object} data JSON data that contains either the complete resource data (e.g. in the case of a material) or additional data (e.g. in the case of a model it contains mappings from mesh to material) * @property {Object} resource A reference to the resource when the asset is loaded. e.g. a {@link pc.Texture} or a {@link pc.Model} + * @property {Array} resources A reference to the resources of the asset when it's loaded (an asset can hold more runtime resources than one e.g. cubemaps) * @property {Boolean} preload If true the asset will be loaded during the preload phase of application set up. * @property {Boolean} loaded True if the resource is loaded e.g. if asset.resource is not null * @constructor Create a new Asset record. Generally, Assets are created in the loading process and you won't need to create them by hand. * @param {String} name A non-unique but human-readable name which can be later used to retrieve the asset. - * @param {String} type Type of asset. One of ["animation", "audio", "image", "json", "material", "model", "text", "texture"] + * @param {String} type Type of asset. One of ["animation", "audio", "image", "json", "material", "model", "text", "texture", "cubemap"] * @param {Object} file Details about the file the asset is made from. At the least must contain the 'url' field. For assets that don't contain file data use null. * @example * var file = { @@ -110,7 +112,7 @@ pc.extend(pc, function () { /** * @function * @name pc.Asset#unload - * @description Mark asset as unloaded and delte reference to resource + * @description Mark asset as unloaded and delete reference to resource * @example * var asset = app.assets.find("My Asset"); * asset.unloade(); diff --git a/src/asset/asset_registry.js b/src/asset/asset_registry.js index b5c560f1fd0..662f205d0d1 100644 --- a/src/asset/asset_registry.js +++ b/src/asset/asset_registry.js @@ -23,6 +23,7 @@ pc.extend(pc, function () { * @name pc.AssetRegistry#list * @description Create a filtered list of assets from the registry * @param {Object} filters Properties to filter on, currently supports: 'preload: true|false' + * @returns {[pc.Asset]} The filtered list of assets. */ list: function (filters) { filters = filters || {}; @@ -94,6 +95,7 @@ pc.extend(pc, function () { * @name pc.AssetRegistry#get * @description Retrieve an asset from the registry by its id field * @param {int} id the id of the asset to get + * @returns {pc.Asset} The asset * @example * var asset = app.assets.get(100); */ @@ -107,6 +109,7 @@ pc.extend(pc, function () { * @name pc.AssetRegistry#getByUrl * @description Retrieve an asset from the registry by it's file's URL field * @param {string} url The url of the asset to get + * @returns {pc.Asset} The asset * @example * var asset = app.assets.getByUrl("../path/to/image.jpg"); */ diff --git a/src/core/core_bind.js b/src/core/core_bind.js index 50ab9b15769..390bacc7326 100644 --- a/src/core/core_bind.js +++ b/src/core/core_bind.js @@ -1,26 +1,27 @@ /** + * @private * Shim to add the Function.bind() method to the Function type. This may be required for Opera and Safari. - * https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind + * https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind */ -if (!Function.prototype.bind) { - - Function.prototype.bind = function (oThis) { - - if (typeof this !== "function") // closest thing possible to the ECMAScript 5 internal IsCallable function - throw new TypeError("Function.prototype.bind - what is trying to be fBound is not callable"); - - var aArgs = Array.prototype.slice.call(arguments, 1), - fToBind = this, - fNOP = function () {}, - fBound = function () { - return fToBind.apply(this instanceof fNOP ? this : oThis || window, aArgs.concat(Array.prototype.slice.call(arguments))); - }; - - fNOP.prototype = this.prototype; - fBound.prototype = new fNOP(); - - return fBound; - - }; - -} \ No newline at end of file +if (!Function.prototype.bind) { + + Function.prototype.bind = function (oThis) { + + if (typeof this !== "function") // closest thing possible to the ECMAScript 5 internal IsCallable function + throw new TypeError("Function.prototype.bind - what is trying to be fBound is not callable"); + + var aArgs = Array.prototype.slice.call(arguments, 1), + fToBind = this, + fNOP = function () {}, + fBound = function () { + return fToBind.apply(this instanceof fNOP ? this : oThis || window, aArgs.concat(Array.prototype.slice.call(arguments))); + }; + + fNOP.prototype = this.prototype; + fBound.prototype = new fNOP(); + + return fBound; + + }; + +} \ No newline at end of file diff --git a/src/core/core_core.js b/src/core/core_core.js index fbe877e7e73..d2e436432c3 100644 --- a/src/core/core_core.js +++ b/src/core/core_core.js @@ -129,6 +129,7 @@ var pc = { /** * Return true if the Object is not undefined * @param {Object} o The Object to test + * @returns {Boolean} True if the Object is not undefined * @function * @name pc.isDefined */ diff --git a/src/framework/components/animation/animation_component.js b/src/framework/components/animation/animation_component.js index 2e703ed87b8..8c1c97a19f0 100644 --- a/src/framework/components/animation/animation_component.js +++ b/src/framework/components/animation/animation_component.js @@ -11,7 +11,7 @@ pc.extend(pc, function () { * @property {Number} speed Speed multiplier for animation play back speed. 1.0 is playback at normal speed, 0.0 pauses the animation * @property {Boolean} loop If true the animation will restart from the beginning when it reaches the end * @property {Boolean} activate If true the first animation asset will begin playing when the Pack is loaded - * @property {Number[]} assets The array of animation assets + * @property {[pc.Asset]} assets The array of animation assets - can also be an array of asset ids. */ var AnimationComponent = function (system, entity) { // Handle changes to the 'animations' value diff --git a/src/framework/components/audiosource/audiosource_component.js b/src/framework/components/audiosource/audiosource_component.js index cae85d29261..5873ee0f317 100644 --- a/src/framework/components/audiosource/audiosource_component.js +++ b/src/framework/components/audiosource/audiosource_component.js @@ -8,7 +8,7 @@ pc.extend(pc, function () { * @param {pc.Entity} entity The entity that the Component is attached to * @extends pc.Component * @property {Boolean} enabled If false no audio will be played - * @property {Array} assets The list of audio assets + * @property {[pc.Asset]} assets The list of audio assets - can also be an array of asset ids. * @property {Boolean} activate If true the audio will begin playing as soon as the Pack is loaded * @property {Number} volume The volume modifier to play the audio with. In range 0-1. * @property {Number} pitch The pitch modifier to play the audio with. Must be larger than 0.01 diff --git a/src/framework/components/camera/camera_system.js b/src/framework/components/camera/camera_system.js index c892cc1e37a..a48cc20578b 100644 --- a/src/framework/components/camera/camera_system.js +++ b/src/framework/components/camera/camera_system.js @@ -4,7 +4,7 @@ pc.extend(pc, function () { * @class Used to add and remove {@link pc.CameraComponent}s from Entities. It also holds an * array of all active cameras. * @constructor Create a new CameraComponentSystem - * @param {Object} app + * @param {pc.Application} app The Application * @extends pc.ComponentSystem */ var CameraComponentSystem = function (app) { diff --git a/src/framework/components/model/model_component.js b/src/framework/components/model/model_component.js index b2d17a9f534..f790dd39062 100644 --- a/src/framework/components/model/model_component.js +++ b/src/framework/components/model/model_component.js @@ -17,7 +17,7 @@ pc.extend(pc, function () { *
  • sphere: The component will render a sphere
  • * * @property {Boolean} enabled Enable or disable rendering of the Model - * @property {Number} asset The id of the asset for the model (only applies to models of type 'asset') + * @property {pc.Asset} asset The asset for the model (only applies to models of type 'asset') - can also be an asset id. * @property {Boolean} castShadows If true, this model will cast shadows for lights that have shadow casting enabled. * @property {Boolean} receiveShadows If true, shadows will be cast on this model * @property {Number} materialAsset The material {@link pc.Asset} that will be used to render the model (not used on models of type 'asset') diff --git a/src/framework/components/model/model_system.js b/src/framework/components/model/model_system.js index 34dea73d4b9..eb5bba70e8a 100644 --- a/src/framework/components/model/model_system.js +++ b/src/framework/components/model/model_system.js @@ -4,7 +4,7 @@ pc.extend(pc, function () { * @constructor Create a new ModelComponentSystem * @class Allows an Entity to render a model or a primitive shape like a box, * capsule, sphere, cylinder, cone etc. - * @param {Object} app + * @param {pc.Application} app The Application. * @extends pc.ComponentSystem */ var ModelComponentSystem = function ModelComponentSystem (app) { diff --git a/src/framework/components/particlesystem/particlesystem_system.js b/src/framework/components/particlesystem/particlesystem_system.js index 21593c6c2dc..1a5cdf8e38b 100644 --- a/src/framework/components/particlesystem/particlesystem_system.js +++ b/src/framework/components/particlesystem/particlesystem_system.js @@ -1,5 +1,12 @@ pc.extend(pc, function() { + /** + * @name pc.ParticleSystemComponentSystem + * @constructor Create a new ParticleSystemComponentSystem + * @class Allows an Entity to render a particle system + * @param {pc.Application} app The Application. + * @extends pc.ComponentSystem + */ var ParticleSystemComponentSystem = function ParticleSystemComponentSystem(app) { this.id = 'particlesystem'; this.description = "Updates and renders particle system in the scene."; diff --git a/src/framework/components/physics/collision/collision_component.js b/src/framework/components/physics/collision/collision_component.js index 39033e37f5e..9bea432b5f3 100644 --- a/src/framework/components/physics/collision/collision_component.js +++ b/src/framework/components/physics/collision/collision_component.js @@ -62,7 +62,7 @@ pc.extend(pc, function () { * @property {Number} radius The radius of the sphere, capsule or cylinder-shaped collision volumes. Defaults to 0.5 * @property {Number} axis The local space axis with which the capsule or cylinder-shaped collision volume's length is aligned. 0 for X, 1 for Y and 2 for Z. Defaults to 1 (Y-axis). * @property {Number} height The total height of the capsule or cylinder-shaped collision volume from tip to tip. Defaults to 2. - * @property {Number} asset The id of the asset for the model of the mesh collision volume. + * @property {pc.Asset} asset The asset for the model of the mesh collision volume - can also be an asset id. * @property {pc.Model} model The model that is added to the scene graph for the mesh collision volume. * @extends pc.Component */ diff --git a/src/framework/components/physics/collision/collision_trigger.js b/src/framework/components/physics/collision/collision_trigger.js index ad9fcfc9092..3ddb9fdb8e1 100644 --- a/src/framework/components/physics/collision/collision_trigger.js +++ b/src/framework/components/physics/collision/collision_trigger.js @@ -5,7 +5,7 @@ pc.extend(pc, function () { /** * @private * @name pc.Trigger - * @description Creates a trigger object used to create internal physics objects that interact with + * @class Creates a trigger object used to create internal physics objects that interact with * rigid bodies and trigger collision events with no collision response * @param {pc.Application} app The running {pc.Application} * @param {pc.Component} component The component for which the trigger will be created diff --git a/src/framework/components/pick/pick_component.js b/src/framework/components/pick/pick_component.js index c856212315d..dd2b045cd84 100644 --- a/src/framework/components/pick/pick_component.js +++ b/src/framework/components/pick/pick_component.js @@ -4,8 +4,8 @@ pc.extend(pc, function () { * @name pc.PickComponent * @constructor Create a new PickComponent * @class Allows an Entity to be picked from the scene using a pc.picking.Picker Object - * @param {pc.PickComponentSystem} system The ComponentSystem that created this Component - * @param {pc.Entity} entity The Entity that this Component is attached to. + * @param {pc.PickComponentSystem} system The ComponentSystem that created this Component + * @param {pc.Entity} entity The Entity that this Component is attached to. * @extends pc.Component */ var PickComponent = function PickComponent(system, entity) { diff --git a/src/framework/components/pick/pick_system.js b/src/framework/components/pick/pick_system.js index 3456f9e7845..0cd19ea84d0 100644 --- a/src/framework/components/pick/pick_system.js +++ b/src/framework/components/pick/pick_system.js @@ -4,7 +4,7 @@ pc.extend(pc, function () { * @name pc.PickComponentSystem * @constructor Create a new PickComponentSystem * @class Allows an Entity to be picked from the scene using a pc.picking.Picker Object - * @param {Object} app + * @param {pc.Application} app The Application. * @extends pc.ComponentSystem */ var PickComponentSystem = function PickComponentSystem(app) { diff --git a/src/framework/components/script/script_component.js b/src/framework/components/script/script_component.js index 16a1379e19c..45a41c148ac 100644 --- a/src/framework/components/script/script_component.js +++ b/src/framework/components/script/script_component.js @@ -15,7 +15,7 @@ pc.extend(pc, function () { *
  • fixedUpdate
  • *
  • postUpdate
  • * - * @property {Object[]} scripts An array of all the scripts to load. Each script object has this format: + * @property {Array} scripts An array of all the scripts to load. Each script object has this format: * {url: 'url.js', name: 'url', 'attributes': [attribute1, attribute2, ...]} */ diff --git a/src/framework/components/script/script_system.js b/src/framework/components/script/script_system.js index 20ec795abdf..e53b084c252 100644 --- a/src/framework/components/script/script_system.js +++ b/src/framework/components/script/script_system.js @@ -13,7 +13,8 @@ pc.extend(pc, function () { * @name pc.ScriptComponentSystem * @constructor Create a new ScriptComponentSystem * @class Allows scripts to be attached to an Entity and executed - * @param {Object} app + * @param {pc.Application} app The application + * @param {string} [prefix] An optional prefix that will be applied to all script URLs. * @extends pc.ComponentSystem */ var ScriptComponentSystem = function ScriptComponentSystem(app, prefix) { diff --git a/src/input/input_controller.js b/src/input/input_controller.js index 54741dd6c20..bcfb43cfa0c 100644 --- a/src/input/input_controller.js +++ b/src/input/input_controller.js @@ -326,6 +326,7 @@ pc.extend(pc, function () { * @name pc.Controller#wasPressed * @description Returns true if the action was enabled this since the last update * @param {String} action The name of the action + * @returns {Boolean} True if the action was enabled this since the last update */ Controller.prototype.wasPressed = function (actionName) { if (!this._actions[actionName]) { diff --git a/src/input/input_keyboard.js b/src/input/input_keyboard.js index 95272a3d725..cb907fc4f72 100644 --- a/src/input/input_keyboard.js +++ b/src/input/input_keyboard.js @@ -4,7 +4,7 @@ pc.extend(pc, function(){ * @class The KeyboardEvent is passed into all event callbacks from the {@link pc.Keyboard}. It corresponds to a key press or release. * @constructor Create a new KeyboardEvent * @param {pc.Keyboard} keyboard The keyboard object which is firing the event. - * @param {KeyboardEvent} event The original browser event that was fired. + * @param {pc.KeyboardEvent} event The original browser event that was fired. * @property {pc.KEY} key The keyCode of the key that has changed. * @property {DOMElement} element The element that fired the keyboard event. * @property {KeyboardEvent} event The original browser event which was fired. diff --git a/src/input/input_touch.js b/src/input/input_touch.js index 9da818ffd23..4cb97df327a 100644 --- a/src/input/input_touch.js +++ b/src/input/input_touch.js @@ -1,4 +1,4 @@ -pc.extend(pc, function () { +pc.extend(pc, function () { /** * @name pc.TouchEvent * @class A Event corresponding to touchstart, touchend, touchmove or touchcancel. TouchEvent wraps the standard @@ -16,17 +16,17 @@ pc.extend(pc, function () { this.touches = []; this.changedTouches = []; - + if (event) { var i, l = event.touches.length; for (i = 0; i < l; i++) { this.touches.push(new Touch(event.touches[i])); } - + l = event.changedTouches.length; for (i = 0; i < l; i++) { this.changedTouches.push(new Touch(event.changedTouches[i])); - } + } } }; @@ -47,11 +47,11 @@ pc.extend(pc, function () { return list[i]; } } - + return null; } }; - + /** * @name pc.Touch * @class A instance of a single point touch on a {@link pc.TouchDevice} @@ -67,16 +67,16 @@ pc.extend(pc, function () { var coords = pc.getTouchTargetCoords(touch); this.id = touch.identifier; - + this.x = coords.x; this.y = coords.y; - + this.target = touch.target; - - this.touch = touch; + + this.touch = touch; }; - - + + /** * @name pc.TouchDevice * @class Attach a TouchDevice to an element and it will receive and fire events when the element is touched. @@ -90,9 +90,9 @@ pc.extend(pc, function () { this._endHandler = this._handleTouchEnd.bind(this); this._moveHandler = this._handleTouchMove.bind(this); this._cancelHandler = this._handleTouchCancel.bind(this); - + this.attach(element); - + pc.events.attach(this); }; @@ -100,7 +100,7 @@ pc.extend(pc, function () { /** * @function * @name pc.TouchDevice#attach - * @description Attach a device to an element in the DOM. + * @description Attach a device to an element in the DOM. * If the device is already attached to an element this method will detach it first * @param {DOMElement} element The element to attach to */ @@ -129,7 +129,7 @@ pc.extend(pc, function () { this._element.removeEventListener('touchmove', this._moveHandler, false); this._element.removeEventListener('touchcancel', this._cancelHandler, false); } - this._element = null; + this._element = null; }, _handleTouchStart: function (e) { @@ -141,7 +141,7 @@ pc.extend(pc, function () { }, _handleTouchMove: function (e) { - // call preventDefault to avoid issues in Chrome Android: + // call preventDefault to avoid issues in Chrome Android: // http://wilsonpage.co.uk/touch-events-in-chrome-android/ e.preventDefault(); this.fire('touchmove', new TouchEvent(this, e)); @@ -149,7 +149,7 @@ pc.extend(pc, function () { _handleTouchCancel: function (e) { this.fire('touchcancel', new TouchEvent(this, e)); - } + } }; return { @@ -171,13 +171,13 @@ pc.extend(pc, function () { target = target.parentNode; } var currentElement = target; - + do { totalOffsetX += currentElement.offsetLeft - currentElement.scrollLeft; totalOffsetY += currentElement.offsetTop - currentElement.scrollTop; currentElement = currentElement.offsetParent; } while (currentElement); - + return { x: touch.pageX - totalOffsetX, y: touch.pageY - totalOffsetY diff --git a/src/math/math_curve.js b/src/math/math_curve.js index ded688a5c72..bafb0bcbf4e 100644 --- a/src/math/math_curve.js +++ b/src/math/math_curve.js @@ -31,7 +31,7 @@ pc.extend(pc, (function () { * @class A curve is a collection of keys (time/value pairs). The shape of the * curve is defined by its type that specifies an interpolation scheme for the keys. * @constructor Creates a new curve. - * @param {Array} [data] An array of keys (pairs of numbers with the time first and + * @param {[Number]} [data] An array of keys (pairs of numbers with the time first and * value second) * @property {Number} length [Read only] The number of keys in the curve */ @@ -57,7 +57,7 @@ pc.extend(pc, (function () { * @description Add a new key to the curve. * @param {Number} time Time to add new key * @param {Number} value Value of new key - * @returns {Array} [time, value] pair + * @returns {[Number]} [time, value] pair */ add: function (time, value) { var keys = this.keys; @@ -80,7 +80,7 @@ pc.extend(pc, (function () { * @name pc.Curve#get * @description Return a specific key. * @param {Number} index The index of the key to return - * @returns {Array} The key at the specified index + * @returns {[Number]} The key at the specified index */ get: function (index) { return this.keys[index]; diff --git a/src/math/math_mat3.js b/src/math/math_mat3.js index e721e46e9f2..02279d62c56 100644 --- a/src/math/math_mat3.js +++ b/src/math/math_mat3.js @@ -21,6 +21,7 @@ pc.extend(pc, (function () { * @function * @name pc.Mat3#clone * @description Creates a duplicate of the specified matrix. + * @returns {pc.Mat3} A duplicate matrix. * @example * var src = new pc.Mat3().translate(10, 20, 30); * var dst = new pc.Mat3(); @@ -36,6 +37,8 @@ pc.extend(pc, (function () { * @name pc.Mat3#copy * @description Copies the contents of a source 4x4 matrix to a destination 4x4 matrix. * @param {pc.Mat3} src A 4x4 matrix to be copied. + * @returns {pc.Mat3} Self for chaining + * @example * var src = new pc.Mat3().translate(10, 20, 30); * var dst = new pc.Mat3(); * dst.copy(src); @@ -61,8 +64,10 @@ pc.extend(pc, (function () { /** * @function * @name pc.Mat3#equals + * @param {rhs} pc.Mat3 The other matrix. * @description Reports whether two matrices are equal. * @returns {Boolean} true if the matrices are equal and false otherwise. + * @example * var a = new pc.Mat3().translate(10, 20, 30); * var b = new pc.Mat3(); * console.log("The two matrices are " + (a.equals(b) ? "equal" : "different")); @@ -87,6 +92,7 @@ pc.extend(pc, (function () { * @name pc.Mat3#isIdentity * @description Reports whether the specified matrix is the identity matrix. * @returns {Boolean} true if the matrix is identity and false otherwise. + * @example * var m = new pc.Mat3(); * console.log("The matrix is " + (m.isIdentity() ? "identity" : "not identity")); */ diff --git a/src/math/math_mat4.js b/src/math/math_mat4.js index a517c5f2b8c..be84824ca2a 100644 --- a/src/math/math_mat4.js +++ b/src/math/math_mat4.js @@ -78,6 +78,7 @@ pc.extend(pc, (function () { * @function * @name pc.Mat4#clone * @description Creates a duplicate of the specified matrix. + * @returns {pc.Mat4} A duplicate matrix. * @example * var src = new pc.Mat4().setFromEulerAngles(10, 20, 30); * var dst = new pc.Mat4(); @@ -92,7 +93,8 @@ pc.extend(pc, (function () { * @function * @name pc.Mat4#copy * @description Copies the contents of a source 4x4 matrix to a destination 4x4 matrix. - * @param {pc.Mat4} src A 4x4 matrix to be copied. + * @param {pc.Mat4} rhs A 4x4 matrix to be copied. + * @returns {pc.Mat4} Self for chaining. * @example * var src = new pc.Mat4().setFromEulerAngles(10, 20, 30); * var dst = new pc.Mat4(); @@ -127,6 +129,7 @@ pc.extend(pc, (function () { * @function * @name pc.Mat4#equals * @description Reports whether two matrices are equal. + * @param {pc.Mat4} rhs The other matrix. * @returns {Boolean} true if the matrices are equal and false otherwise. * @example * var a = new pc.Mat4().setFromEulerAngles(10, 20, 30);