mirror of
https://github.com/photonstorm/phaser
synced 2024-11-30 08:31:01 +00:00
Tidying up function
This commit is contained in:
parent
e2efa469ae
commit
b7edbe755f
1 changed files with 23 additions and 17 deletions
|
@ -8,40 +8,46 @@ var GameObject = require('../GameObject');
|
||||||
var Utils = require('../../renderer/webgl/Utils');
|
var Utils = require('../../renderer/webgl/Utils');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders this Game Object with the Canvas Renderer to the given Camera.
|
* Renders this Game Object with the WebGL Renderer to the given Camera.
|
||||||
* The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera.
|
* The object will not render if any of its renderFlags are set or it is being actively filtered out by the Camera.
|
||||||
* This method should not be called directly. It is a utility function of the Render module.
|
* This method should not be called directly. It is a utility function of the Render module.
|
||||||
*
|
*
|
||||||
* @method Phaser.GameObjects.RenderTexture#renderWebgl
|
* @method Phaser.GameObjects.RenderTexture#renderWebGL
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
* @private
|
* @private
|
||||||
*
|
*
|
||||||
* @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active Canvas renderer.
|
* @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - A reference to the current active Canvas renderer.
|
||||||
* @param {Phaser.GameObjects.RenderTexture} renderTexture - The Game Object being rendered in this call.
|
* @param {Phaser.GameObjects.RenderTexture} src - The Game Object being rendered in this call.
|
||||||
* @param {number} interpolationPercentage - Reserved for future use and custom pipelines.
|
* @param {number} interpolationPercentage - Reserved for future use and custom pipelines.
|
||||||
* @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object.
|
* @param {Phaser.Cameras.Scene2D.Camera} camera - The Camera that is rendering the Game Object.
|
||||||
* @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested
|
* @param {Phaser.GameObjects.Components.TransformMatrix} parentMatrix - This transform matrix is defined if the game object is nested
|
||||||
*/
|
*/
|
||||||
var RenderTextureWebGLRenderer = function (renderer, renderTexture, interpolationPercentage, camera, parentMatrix)
|
var RenderTextureWebGLRenderer = function (renderer, src, interpolationPercentage, camera, parentMatrix)
|
||||||
{
|
{
|
||||||
if (GameObject.RENDER_MASK !== renderTexture.renderFlags || (renderTexture.cameraFilter > 0 && (renderTexture.cameraFilter & camera._id)))
|
if (GameObject.RENDER_MASK !== src.renderFlags || (src.cameraFilter > 0 && (src.cameraFilter & camera._id)))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var getTint = Utils.getTintAppendFloatAlpha;
|
||||||
|
|
||||||
this.pipeline.batchTexture(
|
this.pipeline.batchTexture(
|
||||||
renderTexture,
|
src,
|
||||||
renderTexture.texture,
|
src.texture,
|
||||||
renderTexture.texture.width, renderTexture.texture.height,
|
src.texture.width, src.texture.height,
|
||||||
renderTexture.x, renderTexture.y,
|
src.x, src.y,
|
||||||
renderTexture.width, renderTexture.height,
|
src.width, src.height,
|
||||||
renderTexture.scaleX, renderTexture.scaleY,
|
src.scaleX, src.scaleY,
|
||||||
renderTexture.rotation,
|
src.rotation,
|
||||||
renderTexture.flipX, !renderTexture.flipY,
|
src.flipX, !src.flipY,
|
||||||
renderTexture.scrollFactorX, renderTexture.scrollFactorY,
|
src.scrollFactorX, src.scrollFactorY,
|
||||||
renderTexture.displayOriginX, renderTexture.displayOriginY,
|
src.displayOriginX, src.displayOriginY,
|
||||||
0, 0, renderTexture.texture.width, renderTexture.texture.height,
|
0, 0, src.texture.width, src.texture.height,
|
||||||
Utils.getTintAppendFloatAlpha(renderTexture.tintTopLeft, renderTexture.alphaTopLeft), Utils.getTintAppendFloatAlpha(renderTexture.tintTopRight, renderTexture.alphaTopRight), Utils.getTintAppendFloatAlpha(renderTexture.tintBottomLeft, renderTexture.alphaBottomLeft), Utils.getTintAppendFloatAlpha(renderTexture.tintBottomRight, renderTexture.alphaBottomRight),
|
getTint(src._tintTL, camera.alpha * src._alphaTL),
|
||||||
|
getTint(src._tintTR, camera.alpha * src._alphaTR),
|
||||||
|
getTint(src._tintBL, camera.alpha * src._alphaBL),
|
||||||
|
getTint(src._tintBR, camera.alpha * src._alphaBR),
|
||||||
|
(src._isTinted && src.tintFill),
|
||||||
0, 0,
|
0, 0,
|
||||||
camera,
|
camera,
|
||||||
parentMatrix
|
parentMatrix
|
||||||
|
|
Loading…
Reference in a new issue