mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 07:01:20 +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');
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* 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
|
||||
* @private
|
||||
*
|
||||
* @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 {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
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
var getTint = Utils.getTintAppendFloatAlpha;
|
||||
|
||||
this.pipeline.batchTexture(
|
||||
renderTexture,
|
||||
renderTexture.texture,
|
||||
renderTexture.texture.width, renderTexture.texture.height,
|
||||
renderTexture.x, renderTexture.y,
|
||||
renderTexture.width, renderTexture.height,
|
||||
renderTexture.scaleX, renderTexture.scaleY,
|
||||
renderTexture.rotation,
|
||||
renderTexture.flipX, !renderTexture.flipY,
|
||||
renderTexture.scrollFactorX, renderTexture.scrollFactorY,
|
||||
renderTexture.displayOriginX, renderTexture.displayOriginY,
|
||||
0, 0, renderTexture.texture.width, renderTexture.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),
|
||||
src,
|
||||
src.texture,
|
||||
src.texture.width, src.texture.height,
|
||||
src.x, src.y,
|
||||
src.width, src.height,
|
||||
src.scaleX, src.scaleY,
|
||||
src.rotation,
|
||||
src.flipX, !src.flipY,
|
||||
src.scrollFactorX, src.scrollFactorY,
|
||||
src.displayOriginX, src.displayOriginY,
|
||||
0, 0, src.texture.width, src.texture.height,
|
||||
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,
|
||||
camera,
|
||||
parentMatrix
|
||||
|
|
Loading…
Reference in a new issue