2018-02-12 16:01:20 +00:00
|
|
|
/**
|
|
|
|
* @author Richard Davey <rich@photonstorm.com>
|
|
|
|
* @copyright 2018 Photon Storm Ltd.
|
|
|
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
|
|
|
*/
|
|
|
|
|
2018-01-10 20:03:01 +00:00
|
|
|
var Class = require('../../utils/Class');
|
2018-01-22 22:51:15 +00:00
|
|
|
var Utils = require('./Utils');
|
2018-01-09 01:34:45 +00:00
|
|
|
|
2018-02-09 19:19:21 +00:00
|
|
|
/**
|
|
|
|
* @classdesc
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @class WebGLPipeline
|
|
|
|
* @memberOf Phaser.Renderer.WebGL
|
|
|
|
* @constructor
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {object} config - [description]
|
|
|
|
*/
|
2018-01-17 21:25:43 +00:00
|
|
|
var WebGLPipeline = new Class({
|
2018-01-09 01:34:45 +00:00
|
|
|
|
2018-02-09 19:19:21 +00:00
|
|
|
initialize:
|
2018-01-10 20:03:01 +00:00
|
|
|
|
2018-02-09 19:19:21 +00:00
|
|
|
function WebGLPipeline (config)
|
2018-01-10 20:03:01 +00:00
|
|
|
{
|
2018-02-09 19:19:21 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Renderer.WebGL.WebGLPipeline#name
|
|
|
|
* @type {string}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2018-01-30 22:46:43 +00:00
|
|
|
this.name = 'WebGLPipeline';
|
2018-02-09 19:19:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Renderer.WebGL.WebGLPipeline#game
|
|
|
|
* @type {Phaser.Game}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2018-01-10 20:03:01 +00:00
|
|
|
this.game = config.game;
|
2018-02-09 19:19:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Renderer.WebGL.WebGLPipeline#view
|
|
|
|
* @type {HTMLCanvasElement}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2018-01-10 20:03:01 +00:00
|
|
|
this.view = config.game.canvas;
|
2018-02-09 19:19:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Renderer.WebGL.WebGLPipeline#resolution
|
|
|
|
* @type {number}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2018-01-10 20:03:01 +00:00
|
|
|
this.resolution = config.game.config.resolution;
|
2018-02-09 19:19:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Renderer.WebGL.WebGLPipeline#width
|
|
|
|
* @type {number}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2018-01-10 20:03:01 +00:00
|
|
|
this.width = config.game.config.width * this.resolution;
|
2018-02-09 19:19:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Renderer.WebGL.WebGLPipeline#height
|
|
|
|
* @type {number}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2018-01-10 20:03:01 +00:00
|
|
|
this.height = config.game.config.height * this.resolution;
|
2018-02-09 19:19:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Renderer.WebGL.WebGLPipeline#gl
|
2018-02-13 00:12:17 +00:00
|
|
|
* @type {WebGLRenderingContext}
|
2018-02-09 19:19:21 +00:00
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2018-01-10 20:03:01 +00:00
|
|
|
this.gl = config.gl;
|
2018-02-09 19:19:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Renderer.WebGL.WebGLPipeline#vertexCount
|
|
|
|
* @type {number}
|
|
|
|
* @default 0
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2018-01-10 20:03:01 +00:00
|
|
|
this.vertexCount = 0;
|
2018-02-09 19:19:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Renderer.WebGL.WebGLPipeline#vertexCapacity
|
|
|
|
* @type {integer}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2018-01-10 20:03:01 +00:00
|
|
|
this.vertexCapacity = config.vertexCapacity;
|
2018-02-09 19:19:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Renderer.WebGL.WebGLPipeline#renderer
|
|
|
|
* @type {Phaser.Renderer.WebGL.WebGLRenderer}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2018-01-20 04:05:56 +00:00
|
|
|
this.renderer = config.renderer;
|
2018-02-09 19:19:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Renderer.WebGL.WebGLPipeline#vertexData
|
2018-02-13 00:12:17 +00:00
|
|
|
* @type {ArrayBuffer}
|
2018-02-09 19:19:21 +00:00
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2018-01-25 18:43:19 +00:00
|
|
|
this.vertexData = (config.vertices ? config.vertices : new ArrayBuffer(config.vertexCapacity * config.vertexSize));
|
2018-02-09 19:19:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Renderer.WebGL.WebGLPipeline#vertexBuffer
|
2018-02-13 00:12:17 +00:00
|
|
|
* @type {WebGLBuffer}
|
2018-02-09 19:19:21 +00:00
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2018-01-25 18:43:19 +00:00
|
|
|
this.vertexBuffer = this.renderer.createVertexBuffer((config.vertices ? config.vertices : this.vertexData.byteLength), this.gl.STREAM_DRAW);
|
2018-02-09 19:19:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Renderer.WebGL.WebGLPipeline#program
|
2018-02-13 00:12:17 +00:00
|
|
|
* @type {WebGLProgram}
|
2018-02-09 19:19:21 +00:00
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2018-01-22 22:51:15 +00:00
|
|
|
this.program = this.renderer.createProgram(config.vertShader, config.fragShader);
|
2018-02-09 19:19:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Renderer.WebGL.WebGLPipeline#attributes
|
2018-02-13 00:12:17 +00:00
|
|
|
* @type {object}
|
2018-02-09 19:19:21 +00:00
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2018-01-20 04:05:56 +00:00
|
|
|
this.attributes = config.attributes;
|
2018-02-09 19:19:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Renderer.WebGL.WebGLPipeline#vertexSize
|
2018-02-16 18:07:49 +00:00
|
|
|
* @type {integer}
|
2018-02-09 19:19:21 +00:00
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2018-01-10 20:03:01 +00:00
|
|
|
this.vertexSize = config.vertexSize;
|
2018-02-09 19:19:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Renderer.WebGL.WebGLPipeline#topology
|
2018-02-16 18:07:49 +00:00
|
|
|
* @type {integer}
|
2018-02-09 19:19:21 +00:00
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2018-01-10 20:03:01 +00:00
|
|
|
this.topology = config.topology;
|
2018-02-09 19:19:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @name Phaser.Renderer.WebGL.WebGLPipeline#bytes
|
|
|
|
* @type {Uint8Array}
|
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2018-01-22 21:21:47 +00:00
|
|
|
this.bytes = new Uint8Array(this.vertexData);
|
2018-02-09 19:19:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This will store the amount of components of 32 bit length
|
|
|
|
*
|
|
|
|
* @name Phaser.Renderer.WebGL.WebGLPipeline#vertexComponentCount
|
2018-02-16 18:07:49 +00:00
|
|
|
* @type {integer}
|
2018-02-09 19:19:21 +00:00
|
|
|
* @since 3.0.0
|
|
|
|
*/
|
2018-02-19 20:49:17 +00:00
|
|
|
this.vertexComponentCount = Utils.getComponentCount(config.attributes, this.gl);
|
2018-02-14 19:45:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates if the current pipeline is flushing the contents to the GPU.
|
|
|
|
* When the variable is set the flush function will be locked.
|
|
|
|
*
|
|
|
|
* @name Phaser.Renderer.WebGL.WebGLPipeline#flushLocked
|
|
|
|
* @type {boolean}
|
2018-02-15 14:31:15 +00:00
|
|
|
* @since 3.1.0
|
2018-02-14 19:45:22 +00:00
|
|
|
*/
|
|
|
|
this.flushLocked = false;
|
2018-01-10 20:03:01 +00:00
|
|
|
},
|
|
|
|
|
2018-03-05 15:28:59 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Renderer.WebGL.WebGLPipeline#addAttribute
|
|
|
|
* @since 3.2.0
|
|
|
|
*
|
|
|
|
* @param {string} name - [description]
|
|
|
|
* @param {int} size - [description]
|
|
|
|
* @param {int} type - [description]
|
|
|
|
* @param {boolean} normalized - [description]
|
|
|
|
* @param {int} offset - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
|
|
|
|
*/
|
2018-03-05 21:49:08 +00:00
|
|
|
addAttribute: function (name, size, type, normalized, offset)
|
2018-03-05 14:29:48 +00:00
|
|
|
{
|
|
|
|
this.attributes.push({
|
|
|
|
name: name,
|
|
|
|
size: size,
|
|
|
|
type: this.renderer.glFormats[type],
|
|
|
|
normalized: normalized,
|
|
|
|
offset: offset
|
|
|
|
});
|
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-09 19:19:21 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Renderer.WebGL.WebGLPipeline#shouldFlush
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @return {boolean} [description]
|
|
|
|
*/
|
2018-01-10 20:03:01 +00:00
|
|
|
shouldFlush: function ()
|
|
|
|
{
|
2018-02-09 19:19:21 +00:00
|
|
|
return (this.vertexCount >= this.vertexCapacity);
|
2018-01-10 20:03:01 +00:00
|
|
|
},
|
|
|
|
|
2018-02-09 19:19:21 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Renderer.WebGL.WebGLPipeline#resize
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {number} width - [description]
|
|
|
|
* @param {number} height - [description]
|
|
|
|
* @param {number} resolution - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
|
|
|
|
*/
|
2018-01-10 20:03:01 +00:00
|
|
|
resize: function (width, height, resolution)
|
|
|
|
{
|
2018-01-17 21:25:43 +00:00
|
|
|
this.width = width * resolution;
|
|
|
|
this.height = height * resolution;
|
2018-01-10 20:03:01 +00:00
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-09 19:19:21 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Renderer.WebGL.WebGLPipeline#bind
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
|
|
|
|
*/
|
2018-01-30 03:38:31 +00:00
|
|
|
bind: function ()
|
2018-01-10 20:03:01 +00:00
|
|
|
{
|
2018-01-20 04:05:56 +00:00
|
|
|
var gl = this.gl;
|
|
|
|
var vertexBuffer = this.vertexBuffer;
|
|
|
|
var attributes = this.attributes;
|
2018-01-30 03:38:31 +00:00
|
|
|
var program = this.program;
|
2018-01-20 04:05:56 +00:00
|
|
|
var renderer = this.renderer;
|
|
|
|
var vertexSize = this.vertexSize;
|
2018-01-10 20:03:01 +00:00
|
|
|
|
2018-01-20 04:05:56 +00:00
|
|
|
renderer.setProgram(program);
|
|
|
|
renderer.setVertexBuffer(vertexBuffer);
|
|
|
|
|
|
|
|
for (var index = 0; index < attributes.length; ++index)
|
|
|
|
{
|
|
|
|
var element = attributes[index];
|
|
|
|
var location = gl.getAttribLocation(program, element.name);
|
|
|
|
|
|
|
|
if (location >= 0)
|
|
|
|
{
|
|
|
|
gl.enableVertexAttribArray(location);
|
|
|
|
gl.vertexAttribPointer(location, element.size, element.type, element.normalized, vertexSize, element.offset);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gl.disableVertexAttribArray(location);
|
|
|
|
}
|
|
|
|
}
|
2018-01-10 20:03:01 +00:00
|
|
|
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-09 19:19:21 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Renderer.WebGL.WebGLPipeline#onBind
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
|
|
|
|
*/
|
2018-01-25 05:26:14 +00:00
|
|
|
onBind: function ()
|
|
|
|
{
|
|
|
|
// This is for updating uniform data it's called on each bind attempt.
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-09 19:19:21 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Renderer.WebGL.WebGLPipeline#onPreRender
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
|
|
|
|
*/
|
2018-01-26 23:17:11 +00:00
|
|
|
onPreRender: function ()
|
|
|
|
{
|
|
|
|
// called once every frame
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-09 19:19:21 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Renderer.WebGL.WebGLPipeline#onRender
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @param {Phaser.Scene} scene - [description]
|
|
|
|
* @param {Phaser.Cameras.Scene2D.Camera} camera - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
|
|
|
|
*/
|
2018-02-16 18:44:07 +00:00
|
|
|
onRender: function ()
|
2018-01-29 21:46:48 +00:00
|
|
|
{
|
|
|
|
// called for each camera
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-09 19:19:21 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Renderer.WebGL.WebGLPipeline#onPostRender
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
|
|
|
|
*/
|
2018-01-26 23:17:11 +00:00
|
|
|
onPostRender: function ()
|
|
|
|
{
|
|
|
|
// called once every frame
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-09 19:19:21 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Renderer.WebGL.WebGLPipeline#flush
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
|
|
|
|
*/
|
2018-01-10 20:03:01 +00:00
|
|
|
flush: function ()
|
|
|
|
{
|
2018-02-16 18:17:51 +00:00
|
|
|
if (this.flushLocked) { return this; }
|
2018-02-16 18:44:07 +00:00
|
|
|
|
2018-02-14 19:45:22 +00:00
|
|
|
this.flushLocked = true;
|
|
|
|
|
2018-01-10 20:03:01 +00:00
|
|
|
var gl = this.gl;
|
|
|
|
var vertexCount = this.vertexCount;
|
|
|
|
var topology = this.topology;
|
2018-01-22 21:21:47 +00:00
|
|
|
var vertexSize = this.vertexSize;
|
2018-01-10 20:03:01 +00:00
|
|
|
|
2018-02-16 18:17:51 +00:00
|
|
|
if (vertexCount === 0)
|
2018-02-14 19:45:22 +00:00
|
|
|
{
|
|
|
|
this.flushLocked = false;
|
|
|
|
return;
|
|
|
|
}
|
2018-02-16 18:44:07 +00:00
|
|
|
|
2018-01-22 21:21:47 +00:00
|
|
|
gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.bytes.subarray(0, vertexCount * vertexSize));
|
2018-01-10 20:03:01 +00:00
|
|
|
gl.drawArrays(topology, 0, vertexCount);
|
|
|
|
|
|
|
|
this.vertexCount = 0;
|
2018-02-14 19:45:22 +00:00
|
|
|
this.flushLocked = false;
|
2018-01-10 20:03:01 +00:00
|
|
|
|
2018-01-17 21:25:43 +00:00
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-02-09 19:19:21 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Renderer.WebGL.WebGLPipeline#destroy
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
|
|
|
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
|
|
|
|
*/
|
2018-01-17 21:25:43 +00:00
|
|
|
destroy: function ()
|
|
|
|
{
|
2018-01-20 04:05:56 +00:00
|
|
|
var gl = this.gl;
|
2018-01-17 21:25:43 +00:00
|
|
|
|
2018-01-31 17:36:00 +00:00
|
|
|
gl.deleteProgram(this.program);
|
2018-01-20 04:05:56 +00:00
|
|
|
gl.deleteBuffer(this.vertexBuffer);
|
2018-01-17 21:25:43 +00:00
|
|
|
|
2018-01-31 17:36:00 +00:00
|
|
|
delete this.program;
|
|
|
|
delete this.vertexBuffer;
|
|
|
|
delete this.gl;
|
2018-01-10 20:03:01 +00:00
|
|
|
|
2018-03-05 14:29:48 +00:00
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-03-05 15:28:59 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat1
|
|
|
|
* @since 3.2.0
|
|
|
|
*
|
|
|
|
* @param {string} name - [description]
|
|
|
|
* @param {float} x - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
|
|
|
|
*/
|
2018-03-05 14:29:48 +00:00
|
|
|
setFloat1: function (name, x)
|
|
|
|
{
|
|
|
|
this.renderer.setFloat1(this.program, name, x);
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-03-05 15:28:59 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat2
|
|
|
|
* @since 3.2.0
|
|
|
|
*
|
|
|
|
* @param {string} name - [description]
|
|
|
|
* @param {float} x - [description]
|
|
|
|
* @param {float} y - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
|
|
|
|
*/
|
2018-03-05 14:29:48 +00:00
|
|
|
setFloat2: function (name, x, y)
|
|
|
|
{
|
|
|
|
|
|
|
|
this.renderer.setFloat2(this.program, name, x, y);
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-03-05 15:28:59 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat3
|
|
|
|
* @since 3.2.0
|
|
|
|
*
|
|
|
|
* @param {string} name - [description]
|
|
|
|
* @param {float} x - [description]
|
|
|
|
* @param {float} y - [description]
|
|
|
|
* @param {float} z - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
|
|
|
|
*/
|
2018-03-05 14:29:48 +00:00
|
|
|
setFloat3: function (name, x, y, z)
|
|
|
|
{
|
|
|
|
|
|
|
|
this.renderer.setFloat3(this.program, name, x, y, z);
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-03-05 15:28:59 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Renderer.WebGL.WebGLPipeline#setFloat4
|
|
|
|
* @since 3.2.0
|
|
|
|
*
|
|
|
|
* @param {string} name - [description]
|
|
|
|
* @param {float} x - [description]
|
|
|
|
* @param {float} y - [description]
|
|
|
|
* @param {float} z - [description]
|
|
|
|
* @param {float} w - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
|
|
|
|
*/
|
2018-03-05 14:29:48 +00:00
|
|
|
setFloat4: function (name, x, y, z, w)
|
|
|
|
{
|
|
|
|
|
|
|
|
this.renderer.setFloat4(this.program, name, x, y, z, w);
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-03-05 15:28:59 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Renderer.WebGL.WebGLPipeline#setInt1
|
|
|
|
* @since 3.2.0
|
|
|
|
*
|
|
|
|
* @param {string} name - [description]
|
|
|
|
* @param {int} x - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
|
|
|
|
*/
|
2018-03-05 14:29:48 +00:00
|
|
|
setInt1: function (name, x)
|
|
|
|
{
|
|
|
|
this.renderer.setInt1(this.program, name, x);
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-03-05 15:28:59 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Renderer.WebGL.WebGLPipeline#setInt2
|
|
|
|
* @since 3.2.0
|
|
|
|
*
|
|
|
|
* @param {string} name - [description]
|
|
|
|
* @param {int} x - [description]
|
|
|
|
* @param {int} y - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
|
|
|
|
*/
|
2018-03-05 14:29:48 +00:00
|
|
|
setInt2: function (name, x, y)
|
|
|
|
{
|
|
|
|
this.renderer.setInt2(this.program, name, x, y);
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-03-05 15:28:59 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Renderer.WebGL.WebGLPipeline#setInt3
|
|
|
|
* @since 3.2.0
|
|
|
|
*
|
|
|
|
* @param {string} name - [description]
|
|
|
|
* @param {int} x - [description]
|
|
|
|
* @param {int} y - [description]
|
|
|
|
* @param {int} z - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
|
|
|
|
*/
|
2018-03-05 14:29:48 +00:00
|
|
|
setInt3: function (name, x, y, z)
|
|
|
|
{
|
|
|
|
this.renderer.setInt3(this.program, name, x, y, z);
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-03-05 15:28:59 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Renderer.WebGL.WebGLPipeline#setInt4
|
|
|
|
* @since 3.2.0
|
|
|
|
*
|
|
|
|
* @param {string} name - [description]
|
|
|
|
* @param {int} x - [description]
|
|
|
|
* @param {int} y - [description]
|
|
|
|
* @param {int} z - [description]
|
|
|
|
* @param {int} w - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
|
|
|
|
*/
|
2018-03-05 14:29:48 +00:00
|
|
|
setInt4: function (name, x, y, z, w)
|
|
|
|
{
|
|
|
|
this.renderer.setInt4(this.program, name, x, y, z, w);
|
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-03-05 15:28:59 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix2
|
|
|
|
* @since 3.2.0
|
|
|
|
*
|
|
|
|
* @param {string} name - [description]
|
|
|
|
* @param {boolean} transpose - [description]
|
|
|
|
* @param {Float32Array} matrix - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
|
|
|
|
*/
|
2018-03-05 14:29:48 +00:00
|
|
|
setMatrix2: function (name, transpose, matrix)
|
|
|
|
{
|
2018-03-05 21:49:08 +00:00
|
|
|
this.renderer.setMatrix2(this.program, name, transpose, matrix);
|
2018-03-05 14:29:48 +00:00
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-03-05 15:28:59 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix3
|
|
|
|
* @since 3.2.0
|
|
|
|
*
|
|
|
|
* @param {string} name - [description]
|
|
|
|
* @param {boolean} transpose - [description]
|
|
|
|
* @param {Float32Array} matrix - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
|
|
|
|
*/
|
2018-03-05 14:29:48 +00:00
|
|
|
setMatrix3: function (name, transpose, matrix)
|
|
|
|
{
|
2018-03-05 21:49:08 +00:00
|
|
|
this.renderer.setMatrix3(this.program, name, transpose, matrix);
|
2018-03-05 14:29:48 +00:00
|
|
|
return this;
|
|
|
|
},
|
|
|
|
|
2018-03-05 15:28:59 +00:00
|
|
|
/**
|
|
|
|
* [description]
|
|
|
|
*
|
|
|
|
* @method Phaser.Renderer.WebGL.WebGLPipeline#setMatrix4
|
|
|
|
* @since 3.2.0
|
|
|
|
*
|
|
|
|
* @param {string} name - [description]
|
|
|
|
* @param {boolean} transpose - [description]
|
|
|
|
* @param {Float32Array} matrix - [description]
|
|
|
|
*
|
|
|
|
* @return {Phaser.Renderer.WebGL.WebGLPipeline} [description]
|
|
|
|
*/
|
2018-03-05 14:29:48 +00:00
|
|
|
setMatrix4: function (name, transpose, matrix)
|
|
|
|
{
|
2018-03-05 21:49:08 +00:00
|
|
|
this.renderer.setMatrix4(this.program, name, transpose, matrix);
|
2018-01-10 20:03:01 +00:00
|
|
|
return this;
|
|
|
|
}
|
2018-01-09 01:34:45 +00:00
|
|
|
|
|
|
|
});
|
|
|
|
|
2018-01-17 21:25:43 +00:00
|
|
|
module.exports = WebGLPipeline;
|