mirror of
https://github.com/photonstorm/phaser
synced 2024-11-16 01:38:23 +00:00
Testing Light Layer
This commit is contained in:
parent
24c4dee27d
commit
e29626ab2c
3 changed files with 44 additions and 4 deletions
|
@ -7,6 +7,9 @@
|
|||
var Class = require('../../utils/Class');
|
||||
var Layer = require('../layer/Layer');
|
||||
var Render = require('./LightLayerRender');
|
||||
var LightPipeline = require('../../renderer/webgl/pipelines/LightPipeline');
|
||||
var PointLight = require('./PointLight');
|
||||
var Utils = require('../../renderer/webgl/Utils');
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
|
@ -33,6 +36,43 @@ var LightLayer = new Class({
|
|||
function LightLayer (scene, children)
|
||||
{
|
||||
Layer.call(this, scene, children);
|
||||
|
||||
/**
|
||||
* The ambient color.
|
||||
*
|
||||
* @name Phaser.GameObjects.LightsManager#ambientColor
|
||||
* @type {{ r: number, g: number, b: number }}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.ambientColor = { r: 0.1, g: 0.1, b: 0.1 };
|
||||
|
||||
// this.addPostPipeline(LightPipeline);
|
||||
},
|
||||
|
||||
addPointLight: function (x, y, color, radius, intensity, falloff)
|
||||
{
|
||||
return this.add(new PointLight(this.scene, x, y, color, radius, intensity, falloff));
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the ambient light color.
|
||||
*
|
||||
* @method Phaser.GameObjects.LightsManager#setAmbientColor
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {number} rgb - The integer RGB color of the ambient light.
|
||||
*
|
||||
* @return {Phaser.GameObjects.LightsManager} This Lights Manager object.
|
||||
*/
|
||||
setAmbientColor: function (rgb)
|
||||
{
|
||||
var color = Utils.getFloatsFromUintRGB(rgb);
|
||||
|
||||
this.ambientColor.r = color[0];
|
||||
this.ambientColor.g = color[1];
|
||||
this.ambientColor.b = color[2];
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -14,7 +14,7 @@ var GetAdvancedValue = require('../../utils/object/GetAdvancedValue');
|
|||
*
|
||||
* Note: This method will only be available if the Light Layer Game Object has been built into Phaser.
|
||||
*
|
||||
* @method Phaser.GameObjects.GameObjectCreator#lightlayer
|
||||
* @method Phaser.GameObjects.GameObjectCreator#lightLayer
|
||||
* @since 3.50.0
|
||||
*
|
||||
* @param {object} config - The configuration object this Game Object will use to create itself.
|
||||
|
@ -22,7 +22,7 @@ var GetAdvancedValue = require('../../utils/object/GetAdvancedValue');
|
|||
*
|
||||
* @return {Phaser.GameObjects.LightLayer} The Game Object that was created.
|
||||
*/
|
||||
GameObjectCreator.register('lightlayer', function (config, addToScene)
|
||||
GameObjectCreator.register('lightLayer', function (config, addToScene)
|
||||
{
|
||||
if (config === undefined) { config = {}; }
|
||||
|
||||
|
|
|
@ -12,14 +12,14 @@ var GameObjectFactory = require('../GameObjectFactory');
|
|||
*
|
||||
* Note: This method will only be available if the Light Layer Game Object has been built into Phaser.
|
||||
*
|
||||
* @method Phaser.GameObjects.GameObjectFactory#lightlayer
|
||||
* @method Phaser.GameObjects.GameObjectFactory#lightLayer
|
||||
* @since 3.50.0
|
||||
*
|
||||
* @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} [children] - An optional array of Game Objects to add to this Layer.
|
||||
*
|
||||
* @return {Phaser.GameObjects.LightLayer} The Game Object that was created.
|
||||
*/
|
||||
GameObjectFactory.register('lightlayer', function (children)
|
||||
GameObjectFactory.register('lightLayer', function (children)
|
||||
{
|
||||
return this.displayList.add(new LightLayer(this.scene, children));
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue