mirror of
https://github.com/photonstorm/phaser
synced 2024-11-25 22:20:44 +00:00
Completed JSDocs
This commit is contained in:
parent
248d2352b6
commit
820ea7799c
1 changed files with 144 additions and 2 deletions
|
@ -10,7 +10,7 @@ var Vector3 = require('../../math/Vector3');
|
|||
|
||||
/**
|
||||
* @classdesc
|
||||
* A Layer3D Ambient Light.
|
||||
* A Layer3D Light.
|
||||
*
|
||||
* @class Layer3DLight
|
||||
* @memberof Phaser.GameObjects
|
||||
|
@ -23,15 +23,88 @@ var Layer3DLight = new Class({
|
|||
|
||||
function Layer3DLight (x, y, z)
|
||||
{
|
||||
/**
|
||||
* The position of the light in 3D space.
|
||||
*
|
||||
* You can modify this vector directly, or use the `x`, `y` and `z`
|
||||
* properties of this class.
|
||||
*
|
||||
* @name Phaser.GameObjects.Layer3DLight#position
|
||||
* @type {Phaser.Math.Vector3}
|
||||
* @since 3.50.0
|
||||
*/
|
||||
this.position = new Vector3(x, y, z);
|
||||
|
||||
/**
|
||||
* The ambient color of the light.
|
||||
*
|
||||
* The default ambient color is 1, 1, 1.
|
||||
*
|
||||
* You can modify the properties of this RGB object directly, or call
|
||||
* the `setAmbient` method of this class.
|
||||
*
|
||||
* The values in this object are used by the `uLightAmbient` shader uniform.
|
||||
*
|
||||
* @name Phaser.GameObjects.Layer3DLight#ambient
|
||||
* @type {Phaser.Display.RGB}
|
||||
* @since 3.50.0
|
||||
*/
|
||||
this.ambient = new RGB(1, 1, 1);
|
||||
|
||||
/**
|
||||
* The diffuse color of the light.
|
||||
*
|
||||
* The default diffuse color is 1, 1, 1.
|
||||
*
|
||||
* You can modify the properties of this RGB object directly, or call
|
||||
* the `setDiffuse` method of this class.
|
||||
*
|
||||
* The values in this object are used by the `uLightDiffuse` shader uniform.
|
||||
*
|
||||
* @name Phaser.GameObjects.Layer3DLight#diffuse
|
||||
* @type {Phaser.Display.RGB}
|
||||
* @since 3.50.0
|
||||
*/
|
||||
this.diffuse = new RGB(1, 1, 1);
|
||||
|
||||
/**
|
||||
* The specular color of the light.
|
||||
*
|
||||
* The default specular color is 1, 1, 1.
|
||||
*
|
||||
* You can modify the properties of this RGB object directly, or call
|
||||
* the `setSpecular` method of this class.
|
||||
*
|
||||
* The values in this object are used by the `uLightSpecular` shader uniform.
|
||||
*
|
||||
* @name Phaser.GameObjects.Layer3DLight#specular
|
||||
* @type {Phaser.Display.RGB}
|
||||
* @since 3.50.0
|
||||
*/
|
||||
this.specular = new RGB(1, 1, 1);
|
||||
|
||||
// cache structure = position
|
||||
/**
|
||||
* Internal dirty cache array.
|
||||
*
|
||||
* @name Phaser.GameObjects.Layer3DLight#dirtyCache
|
||||
* @type {number[]}
|
||||
* @private
|
||||
* @since 3.50.0
|
||||
*/
|
||||
this.dirtyCache = [ 0, 0, 0 ];
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks if the position of this light is dirty.
|
||||
*
|
||||
* Called internally by the Mesh Pipeline `onBind` method and if dirty
|
||||
* is used to set the `uLightPosition` uniform.
|
||||
*
|
||||
* @method Phaser.GameObjects.Layer3DLight#isDirty
|
||||
* @since 3.50.0
|
||||
*
|
||||
* @return {boolean} `true` if this light is dirty, otherwise `false`.
|
||||
*/
|
||||
isDirty: function ()
|
||||
{
|
||||
var position = this.position;
|
||||
|
@ -52,6 +125,18 @@ var Layer3DLight = new Class({
|
|||
return (xCached !== x || yCached !== y || zCached !== z);
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the position of this light.
|
||||
*
|
||||
* @method Phaser.GameObjects.Layer3DLight#setPosition
|
||||
* @since 3.50.0
|
||||
*
|
||||
* @param {number} x - The x position of this light.
|
||||
* @param {number} y - The y position of this light.
|
||||
* @param {number} z - The z position of this light.
|
||||
*
|
||||
* @return {this} This Layer3DLight instance.
|
||||
*/
|
||||
setPosition: function (x, y, z)
|
||||
{
|
||||
this.position.set(x, y, z);
|
||||
|
@ -59,6 +144,18 @@ var Layer3DLight = new Class({
|
|||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the ambient color of this light.
|
||||
*
|
||||
* @method Phaser.GameObjects.Layer3DLight#setAmbient
|
||||
* @since 3.50.0
|
||||
*
|
||||
* @param {number} r - The red color value. Between 0 and 1.
|
||||
* @param {number} g - The green color value. Between 0 and 1.
|
||||
* @param {number} b - The blue color value. Between 0 and 1.
|
||||
*
|
||||
* @return {this} This Layer3DLight instance.
|
||||
*/
|
||||
setAmbient: function (r, g, b)
|
||||
{
|
||||
this.ambient.set(r, g, b);
|
||||
|
@ -66,6 +163,18 @@ var Layer3DLight = new Class({
|
|||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the diffuse color of this light.
|
||||
*
|
||||
* @method Phaser.GameObjects.Layer3DLight#setDiffuse
|
||||
* @since 3.50.0
|
||||
*
|
||||
* @param {number} r - The red color value. Between 0 and 1.
|
||||
* @param {number} g - The green color value. Between 0 and 1.
|
||||
* @param {number} b - The blue color value. Between 0 and 1.
|
||||
*
|
||||
* @return {this} This Layer3DLight instance.
|
||||
*/
|
||||
setDiffuse: function (r, g, b)
|
||||
{
|
||||
this.diffuse.set(r, g, b);
|
||||
|
@ -73,6 +182,18 @@ var Layer3DLight = new Class({
|
|||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the specular color of this light.
|
||||
*
|
||||
* @method Phaser.GameObjects.Layer3DLight#setSpecular
|
||||
* @since 3.50.0
|
||||
*
|
||||
* @param {number} r - The red color value. Between 0 and 1.
|
||||
* @param {number} g - The green color value. Between 0 and 1.
|
||||
* @param {number} b - The blue color value. Between 0 and 1.
|
||||
*
|
||||
* @return {this} This Layer3DLight instance.
|
||||
*/
|
||||
setSpecular: function (r, g, b)
|
||||
{
|
||||
this.specular.set(r, g, b);
|
||||
|
@ -80,6 +201,13 @@ var Layer3DLight = new Class({
|
|||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* The x position of the light.
|
||||
*
|
||||
* @name Phaser.GameObjects.Layer3DLight#x
|
||||
* @type {number}
|
||||
* @since 3.50.0
|
||||
*/
|
||||
x: {
|
||||
|
||||
get: function ()
|
||||
|
@ -94,6 +222,13 @@ var Layer3DLight = new Class({
|
|||
|
||||
},
|
||||
|
||||
/**
|
||||
* The y position of the light.
|
||||
*
|
||||
* @name Phaser.GameObjects.Layer3DLight#y
|
||||
* @type {number}
|
||||
* @since 3.50.0
|
||||
*/
|
||||
y: {
|
||||
|
||||
get: function ()
|
||||
|
@ -108,6 +243,13 @@ var Layer3DLight = new Class({
|
|||
|
||||
},
|
||||
|
||||
/**
|
||||
* The z position of the light.
|
||||
*
|
||||
* @name Phaser.GameObjects.Layer3DLight#z
|
||||
* @type {number}
|
||||
* @since 3.50.0
|
||||
*/
|
||||
z: {
|
||||
|
||||
get: function ()
|
||||
|
|
Loading…
Reference in a new issue