mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 20:53:39 +00:00
Added isRenderTexture
property.
This commit is contained in:
parent
261cb79d0d
commit
7566236d9b
2 changed files with 18 additions and 3 deletions
|
@ -50,6 +50,7 @@ The process of managing scissors in the WebGLRenderer has been completely rewrit
|
|||
* You can now play animations in reverse! Use the new `Sprite.anims.playReverse` method to play a pre-defined animation in reverse from its starting frame. Or call `Sprite.anims.reverse` to immediately reverse the flow of an already running animation. Animations running in reverse still count towards the repeat total and respect the yoyo flag (thanks @khaleb85)
|
||||
* The `ParticleEmitterManager` now has the Transform component. This means you can now set the position, rotation or scale of the Emitter Manager, and it will influence every Emitter it is rendering. The Managers transform is mixed with that of the Camera. This works in both Canvas and WebGL.
|
||||
* `TextureManager.addRenderTexture` is a new method that will add a Render Texture into the Texture Manager, allowing you to use it as the texture for Game Objects just by using the texture key. Modifying the source Render Texture will immediately modify any Game Objects using it.
|
||||
* TextureSource has a new boolean property `isRenderTexture` which is set automatically when it's created.
|
||||
|
||||
### Updates
|
||||
|
||||
|
|
|
@ -47,16 +47,17 @@ var TextureSource = new Class({
|
|||
* The Texture this TextureSource belongs to.
|
||||
*
|
||||
* @name Phaser.Textures.TextureSource#texture
|
||||
* @type {string}
|
||||
* @type {Phaser.Textures.Texture}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.texture = texture;
|
||||
|
||||
/**
|
||||
* The source image data. This is either an Image Element, or a Canvas Element.
|
||||
* The source image data.
|
||||
* This is either an Image Element, a Canvas Element or a RenderTexture.
|
||||
*
|
||||
* @name Phaser.Textures.TextureSource#image
|
||||
* @type {(HTMLImageElement|HTMLCanvasElement)}
|
||||
* @type {(HTMLImageElement|HTMLCanvasElement|Phaser.GameObjects.RenderTexture)}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.image = source;
|
||||
|
@ -120,6 +121,15 @@ var TextureSource = new Class({
|
|||
*/
|
||||
this.isCanvas = (source instanceof HTMLCanvasElement);
|
||||
|
||||
/**
|
||||
* Is the source image a Render Texture?
|
||||
*
|
||||
* @name Phaser.Textures.TextureSource#isRenderTexture
|
||||
* @type {boolean}
|
||||
* @since 3.12.0
|
||||
*/
|
||||
this.isRenderTexture = (source.type === 'RenderTexture');
|
||||
|
||||
/**
|
||||
* Are the source image dimensions a power of two?
|
||||
*
|
||||
|
@ -158,6 +168,10 @@ var TextureSource = new Class({
|
|||
{
|
||||
this.glTexture = this.renderer.canvasToTexture(this.image);
|
||||
}
|
||||
else if (this.isRenderTexture)
|
||||
{
|
||||
this.glTexture = this.image.texture;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.glTexture = this.renderer.createTextureFromSource(this.image, this.width, this.height, this.scaleMode);
|
||||
|
|
Loading…
Reference in a new issue