Richard Davey
809b8a41d9
The WebGLRenderer.updateCanvasTexture
method will now set gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL
to true, which should stop issues where you update a Text Game Object, having added a Render Texture or Spine Game Object to the Scene after it, which switches the PMA setting. Fix #5064
2020-08-26 00:19:19 +01:00
Richard Davey
791704febe
WebGLRenderer.finalType
is a new boolean property that signifies if the current Game Object being rendered is the final one in the list.
2020-08-25 18:24:42 +01:00
Richard Davey
de0133e3cc
Spine Game Objects can now be rendered to Render Textures. Fix #5184
2020-08-25 14:11:37 +01:00
Richard Davey
ca99c4564f
Added reset
property to Bind to get new vertex attrib locations
2020-08-25 13:24:56 +01:00
Richard Davey
0cd4d0fc54
Update WebGLRenderer.js
2020-08-21 16:23:04 +01:00
Richard Davey
0dd07333af
Updated to use MultiPipeline
2020-08-21 16:14:59 +01:00
Richard Davey
209b39b38c
New pipeline names and single texture flag
2020-08-21 16:03:29 +01:00
Richard Davey
84ef02743b
The WebGL Renderer will now add the pipelines during the boot
method, instead of init
.
2020-08-20 10:48:30 +01:00
Richard Davey
75da5b2f22
Reset all textures on rebind, which is what Externs need when finishing
2020-08-06 17:06:26 +01:00
Richard Davey
4baa0522b9
Bumping to 3.50
2020-07-31 13:41:29 +01:00
Richard Davey
c31a9ad4e5
WebGLRenderer.unbindTextures
is a new method that will activate and then null bind all WebGL textures.
2020-07-23 16:24:44 +01:00
Richard Davey
8210700124
Enable the pipelines again
2020-07-17 17:04:49 +01:00
Richard Davey
8d976d6ed5
WebGLRenderer.textureFlush
is a new property that keeps track of the total texture flushes per frame.
2020-07-17 16:36:18 +01:00
Richard Davey
fea1ade5b7
Update WebGLRenderer.js
2020-07-16 16:59:45 +01:00
Richard Davey
12fc51e2e2
If normal map set, advance the current active texture
2020-07-16 16:17:16 +01:00
Richard Davey
85f63c4a19
WebGLRenderer.isNewNormalMap
is a new method that returns a boolean if the given parameters are not currently used.
2020-07-16 15:11:43 +01:00
Richard Davey
93d0378143
Added missing jsdocs
2020-07-16 11:03:49 +01:00
Richard Davey
3b9d115d0c
Reset just units 0 and 1
2020-07-16 03:13:47 +01:00
Richard Davey
1f3b79cf11
Normal map additions
...
* `WebGLRenderer.normalTexture` is a new property that holds the currently bound normal map (texture unit one).
* `WebGLRenderer.setNormalMap` is a new method that sets the current normal map texture.
* `WebGLRenderer.clearNormalMap` is a new method that clears the current normal map texture.
* `WebGLRenderer.resetTextures` is a new method that flushes the pipeline, resets all textures back to the temporary ones and resets the active texture counter.
2020-07-16 02:15:01 +01:00
Richard Davey
94d333ee1e
Use new texture unit
2020-07-16 00:00:49 +01:00
Richard Davey
9e9e45261f
Added setTextureZero and clearTextureZero
...
* `WebGLRenderer.setTextureZero` is a new method that activates texture zero and binds the given texture to it. Useful for fbo backed game objects.
* `WebGLRenderer.clearTextureZero` is a new method that clears the texture tha was bound to unit zero.
* `WebGLRenderer.textureZero` is a new property that holds the currently bound unit zero texture.
2020-07-15 18:03:03 +01:00
Richard Davey
216d7cb1fa
Updated WebGLRenderer to support new texture assignment
...
* The property `WebGLRenderer.currentActiveTextureUnit` has been renamed to `currentActiveTexture`.
* `WebGLRenderer.startActiveTexture` is a new read-only property contains the current starting active texture unit.
* `WebGLRenderer.maxTextures` is a new read-only property that contains the maximum number of texture units WebGL can use.
* `WebGLRenderer.textureIndexes` is a new read-only array that contains all of the available WebGL texture units.
* `WebGLRenderer.tempTextures` is a new read-only array that contains temporary WebGL textures.
* The `WebGLRenderer.currentTextures` property has been removed, as it's no longer used.
* `WebGLRenderer.currentTextures` has been removed, as it's no longer used internally.
* `WebGLRenderer.setBlankTexture` no longer has a `force` parameter, as it's set by default.
* `WebGLRenderer.setTextureSource` is a new method, used by pipelines and Game Objects, that will assign a texture unit to the given Texture Source.
* The `WebGLRenderer.setTexture2D` method has been updated to use the new texture unit assignment. It no longer takes the `textureUnit` or `flush` parameters and these have been removed from its method signature.
2020-07-15 17:11:01 +01:00
Richard Davey
9a45517efd
Pass max textures to pipeline (disable other pipelines for now)
2020-07-14 17:44:17 +01:00
Richard Davey
0003d278fd
Updated to use new external MVP functions
2020-07-14 16:49:30 +01:00
Volodymyr Linyvyi
8d217d53fa
Set TextureTintPipeline on each 'postRenderCamera' call
2020-04-19 18:44:03 +03:00
Richard Davey
03ee36f9ba
Finished JSDocs
2020-02-04 17:30:27 +00:00
Richard Davey
0eaf0c47b5
Respect Camera.renderToGame property
2020-01-27 23:35:52 +00:00
Richard Davey
0af1303ba2
Added TextureTintStrip pipeline
2020-01-17 17:38:24 +00:00
Richard Davey
ff65e69cd1
Changed copyright date to 2020
2020-01-15 12:07:09 +00:00
Richard Davey
7d53dc3447
Added support for mipmap texture generation and filter levels
2019-11-19 13:00:54 +00:00
Richard Davey
61f5fadddf
Split up canvas and video texture creation and updating.
2019-10-10 12:26:39 +01:00
Richard Davey
5de4641e49
Added jsdocs
2019-10-04 11:13:05 +01:00
Richard Davey
49012d6237
Added createTexture2D.forceSize parameter, videoToTexture method and strengthened empty texture creation
2019-10-03 17:49:58 +01:00
Richard Davey
e3039ffb64
Added antialiasGL
option
2019-08-29 11:46:58 +01:00
Richard Davey
f4002471d7
Updated context lost / restored handlers
2019-07-17 16:38:00 +01:00
Richard Davey
630382e88d
Added Game Object type look ahead and state for custom batching.
2019-07-16 17:41:08 +01:00
Richard Davey
58865f2c34
The WebGL Lost and Restored Context callbacks were never removed, which could cause them to hold onto stale references. Fix #3610
2019-07-15 15:28:46 +01:00
Richard Davey
15d7b9c6ef
Fixed jsdoc typos and added single pixel support
2019-07-14 13:56:44 +01:00
Richard Davey
285babaf8c
Added the new snapshotFramebuffer method
2019-07-13 15:20:57 +01:00
Richard Davey
79b2048ae0
Fixed addBlendMode type. Fix #4625
2019-06-28 14:53:12 +01:00
Richard Davey
3bf3057da0
WebGLRenderer.setScissor
will default the drawingBufferHeight
if no argument is provided, stopping NaN scissor heights.
2019-06-25 23:03:57 +01:00
Richard Davey
254eef9787
Use the event constant instead of a string
2019-06-06 15:56:45 +01:00
Richard Davey
12bcda98a6
Added support for a desynchronized context and alpha support in 2D
2019-06-04 19:13:49 +01:00
Richard Davey
c91ed91ce3
License link update
2019-05-10 16:15:04 +01:00
Richard Davey
a6341a97a8
Fixed Types references
2019-05-09 15:32:53 +01:00
Richard Davey
11d6f2e802
Renderer Types
2019-05-09 12:36:36 +01:00
Richard Davey
3d40a95a00
Added glFuncMap
2019-05-01 12:29:45 +01:00
Richard Davey
84e898fd90
Fixed nested bitmap mask issue
2019-04-29 14:45:54 +01:00
Richard Davey
3efcd1ca49
New cam mask object
2019-04-29 14:28:58 +01:00
Richard Davey
cf878ca553
Better stencil mask checking
2019-04-26 19:13:24 +01:00
Richard Davey
6e70f0e19c
Shaders now work with camera masks and can have their own geometry masks
2019-04-26 01:53:34 +01:00
Richard Davey
2ff76eb4b5
Removed un-needed Quad Pipeline and shaders
2019-04-25 12:13:09 +01:00
Richard Davey
9b4309b38c
Added QuadShader Pipeline to the renderer
2019-04-25 03:16:39 +01:00
Richard Davey
f64d0a935b
Geometry Masks are now batched. Previously, using the same mask on multiple Game Objects would create brand new stencil operations for every single Game Object, causing performance to tank. Now, the mask is only set if it's different from the previously masked object in the display list, allowing you to mask thousands of Game Objects and retain batching through-out.
2019-04-24 16:45:31 +01:00
Richard Davey
12b6041d20
inverseAlpha support added back in and tidied up renderer
2019-04-24 14:51:39 +01:00
Richard Davey
1fc9b15ff1
Fixed Geometry Mask nesting issue.
2019-04-15 16:46:19 +01:00
Richard Davey
974ceb5654
Restore bitmap mask framebuffer
2019-04-12 18:36:47 +01:00
Richard Davey
f69cec7975
Improving support for child masking
2019-04-12 17:47:28 +01:00
Richard Davey
186970bd69
Render the Camera masks
2019-04-11 17:10:03 +01:00
Richard Davey
c188dfde12
Testing mask component on Camera
2019-04-10 18:10:03 +01:00
Richard Davey
42cb39749f
Matter and Snapshot typedefs
2019-02-13 15:22:29 +00:00
Richard Davey
cfe6452924
Don't set if game is being destroyed
2019-02-04 23:29:22 +00:00
Richard Davey
60542a25cc
Numerous jsdoc and TS related fixes
2019-02-04 17:16:08 +00:00
Richard Davey
f5106de6c5
Callback is now invoked in Image.onload to avoid race conditions.
2019-01-25 17:29:31 +00:00
Richard Davey
8f016ef983
Updating snapshot feature
2019-01-25 10:01:53 +00:00
Richard Davey
9142260307
Texture filter mode is now based on game anti-alias setting.
2019-01-24 14:23:24 +00:00
Richard Davey
f8f81a06f0
Merge pull request #4286 from gomachan7/fixup/apply_transparent_bg_on_webgl_renderer
...
Fix WebGLRenderer to apply transparent bg in config
2019-01-23 22:22:08 +00:00
Richard Davey
bc962c25dc
All listeners use the new Events
2019-01-18 13:41:43 +00:00
Richard Davey
e6b74304b5
Added Camera pre and post render events.
2019-01-17 12:02:14 +00:00
Richard Davey
aa341854c7
Happy New Year
2019-01-15 16:20:22 +00:00
Richard Davey
d7e7feed19
Dimensions are now set in the onResize handlers.
2019-01-11 16:44:08 +00:00
Richard Davey
44f69ea7fa
Removed autoResize, tidied up the resize method and init.
2019-01-10 13:43:09 +00:00
Richard Davey
04ea2798e9
Use gameSize
2019-01-10 00:15:20 +00:00
gomachan_7
be562abd83
Fix WebGLRenderer to apply transparent bg in config
2019-01-10 02:17:53 +09:00
Richard Davey
b3aeee0bd1
Use the new size properties
2019-01-09 17:13:22 +00:00
Richard Davey
41286b5170
Make sure we bind the framebuffer and pipeline in the boot step
2018-12-18 14:58:42 +00:00
Richard Davey
8eebe518ad
Added optional drawingBufferHeight argument to scissor methods.
2018-12-18 13:36:05 +00:00
Richard Davey
4b1ea8db9b
WebGLRenderer.preRender
now calls gl.clearColor
in order to restore the background clear color in case something, like a Render Texture, has changed it.
2018-12-18 13:04:26 +00:00
Richard Davey
8f873c87af
Clears the framebuffer at the start of every render.
2018-12-18 11:32:36 +00:00
Richard Davey
7e732452eb
Fixed an issue in WebGLRenderer.setScissor
where it was possible to try and compare the scissor size to a non-current scissor, if called outside of the render loop (i.e. from RenderTexture.fill
)
2018-12-18 10:22:59 +00:00
Richard Davey
83f3f9cdeb
Changed scissor order.
2018-12-13 14:24:49 +00:00
Richard Davey
05ffb5312f
Updated docs
2018-12-12 11:09:00 +00:00
Richard Davey
5683713253
Added flush argument
2018-12-11 14:59:50 +00:00
Richard Davey
8e495da71d
Fixed currentScissor assignment order of operation
2018-12-08 11:37:26 +00:00
Richard Davey
2780babe10
Final Doc Jam merge
2018-12-03 15:16:23 +00:00
Richard Davey
8cd45a72b2
ESLint fixes
2018-11-20 11:02:19 +00:00
Richard Davey
eb5da1f26d
Docs update
2018-11-16 10:56:43 +00:00
Richard Davey
41343e3102
Removed copy paste error
2018-11-16 10:46:22 +00:00
Richard Davey
48686881dc
Removed clearColor. CSS now handles this. Context always transparent.
2018-11-13 15:10:10 +00:00
Richard Davey
76918e76b0
ERASE tests
2018-11-13 10:32:24 +00:00
Richard Davey
06688eedd8
Merge branch 'master' of https://github.com/photonstorm/phaser
2018-11-10 04:22:51 +00:00
Richard Davey
7d1f990ad3
Added ERASE blend mode.
2018-11-10 04:22:13 +00:00
Richard Davey
8ea2bffb9c
Render Textures created larger than the size of the default canvas would be automatically clipped when drawn to in WebGL. They now reset the gl scissor and drawing height property in order to draw to their full size, regardless of the canvas size. Fix #4139
2018-11-07 16:01:21 +00:00
Richard Davey
789713b4b1
Updated the clear and rebind pipeline methods
2018-10-29 23:07:10 +00:00
Richard Davey
bed1141d9a
Added clearPipeline and rebindPipeline and force argument.
2018-10-25 14:13:40 +01:00
Richard Davey
b73d0dd80c
Added jsdocs
2018-10-22 13:47:46 +01:00
Richard Davey
557955e057
Merging Scale Manager and Spine Plugin back into master
2018-10-18 14:59:27 +01:00
Richard Davey
ae9c3b6f56
Tidying up for 3.15 release
2018-10-16 15:10:49 +01:00
Richard Davey
9dc53d1e5a
The WebGLRenderer method canvasToTexture
has a new optional argument noRepeat
which will stop it from using gl.REPEAT
entirely. This is now used by the Text object to avoid it potentially switching between a REPEAT and CLAMP texture, causing texture black-outs
2018-10-12 15:08:53 +01:00
Richard Davey
240914ee03
Fixed some types and removed resize calls
2018-10-11 17:02:14 +01:00
Richard Davey
4b1c762296
Updated @memberOf to @memberof
2018-10-10 10:49:13 +01:00
Richard Davey
a9063604dc
Replace @readOnly with @readonly
2018-10-09 13:40:00 +01:00
Richard Davey
143957d24a
You can now set the maxLights
value in the Game Config, which controls the total number of lights the Light2D shader can render in a single pass. The default is 10. Be careful about pushing this too far. More lights = less performance. Close #4081
2018-10-02 11:09:58 +01:00
Richard Davey
5bdf9aa21b
WebGLRenderer.deleteTexture
will check to see if the texture it is being asked to delete is the currently bound texture or not. If it is, it'll set the blank texture to be bound after deletion. This should stop RENDER WARNING: there is no texture bound to the unit 0
errors if you destroy a Game Object, such as Text or TileSprite, from an async or timed process
2018-10-01 16:32:42 +01:00
Richard Davey
b3f3f6a9b5
If a Game instance is destroyed without using the removeCanvas
argument, it would throw exceptions in the MouseManager
after the destroy process has run, as the event listeners were not unbound. They're not unbound, regardless of if the parent canvas is removed or not. Fix #4015
2018-10-01 12:55:54 +01:00
Richard Davey
e297b3272e
Added hundreds of new jsdoc descriptions
2018-10-01 11:35:01 +01:00
Richard Davey
ec6715ba8b
Fixed a bug where the gl scissor wasn't being reset during a renderer resize, causing it to appear as if the canvas didn't resize properly when autoResize
was set to true
in the game config. Fix #4066
2018-10-01 10:38:39 +01:00
Richard Davey
c237209bb8
Added new jsdocs
2018-09-28 12:19:21 +01:00
Richard Davey
d8fcde46c3
When using CanvasTexture.refresh
or Graphics.generateTexture
it would throw WebGL warnings like 'bindTexture: Attempt to bind a deleted texture'. This was due to the Frames losing sync with the glTexture reference used by their TextureSource. Fix #4050
2018-09-27 14:16:22 +01:00
Richard Davey
5ec26fa62d
Cameras now emit prerender
and postrender
events if they are set to render to textures.
2018-09-14 15:53:06 +01:00
Richard Davey
ef62313bbb
The WebGL Renderer now always enables the SCISSOR_TEST
, this allows Game Objects that use the scissor (such as custom objects, or Bitmap Text) to render properly again.
2018-09-14 12:33:09 +01:00
aaron
b9454eaf7b
Wrong filling rectangle for camera with no transparent background after last scissor changes
2018-09-14 10:53:50 +02:00
Richard Davey
7b0d823415
Resizing canvas backed textures like this is a really bad idea, so remove it.
2018-09-13 13:22:27 +01:00
Matthew Roelle
700509275d
Changed setFloatXv methods to accept a Float32Array rather than instantiate its own
2018-09-12 20:25:15 -07:00
Richard Davey
a418995c15
Fixed jsdoc versions and updated them for #4019
2018-09-12 15:34:48 +01:00
Matthew Roelle
7465717d92
Fixed doccomment for float array uniforms
2018-09-09 18:19:09 -07:00
Matthew Roelle
aeeefb3cf6
Added support for setting float array uniforms in the WebGLRenderer and WebGLPipeline
2018-09-09 18:05:29 -07:00
Richard Davey
55003641d2
Clamp scissor
2018-08-31 18:19:31 +01:00
Richard Davey
0b95ed0478
Fixed scissors when using a small cam with render texture
2018-08-31 16:25:04 +01:00
Richard Davey
79b4f07530
Fixed mask flush and sped-up the render loop slightly (removed 1 duplicate conditional)
2018-08-31 14:40:12 +01:00
James Simpson
1ac7c969ea
Don't set gl.clearColor when no clearBeforeRender
...
Unless I'm missing something, the `gl.clearColor` command is unnecessary when you have `this.config.clearBeforeRender` set to `false`. This simply moves that into the config check to eliminate an unused command in those situations.
2018-08-17 14:03:17 -05:00
Richard Davey
66afe973af
Trying mixins
2018-08-08 01:33:55 +01:00
Richard Davey
3a4bfa679b
Added experimental Camera to Render Texture
2018-08-07 16:27:21 +01:00
Richard Davey
f9e498353d
Fixed lack of TempMatrix for Graphics generateTexture
2018-08-06 16:19:30 +01:00
Richard Davey
8ed749bcb1
Removed old scissor code
2018-08-03 18:57:03 +01:00
Richard Davey
7ebf5766e8
Added docs for blankTexture and setBlankTexture.
2018-08-01 13:23:03 +01:00
Richard Davey
73524df816
The Game boot event flow has changed slightly. The Game will now listen for a texturesready
event, which is dispatched by the Texture Manager when the default textures have finished processing. Upon receiving this, the Game will emit the ready
event, which all the other systems listen for and respond to. The difference is that the Renderer uses the texturesready
event to ensure that it is the first thing to be activated, before any other system.
2018-08-01 13:18:28 +01:00
Richard Davey
a3fc263360
Binding a framebuffer sets the viewport size
2018-07-31 17:09:47 +01:00
Richard Davey
a09c2a4958
Now uses customViewports counter to avoid scissor setting and skips box check
2018-07-26 23:05:25 +01:00
Richard Davey
1777e16227
Sorting out the scissor stack
2018-07-26 17:50:07 +01:00
Richard Davey
90219d46b3
Removed all references to the FlatTintPipeline.
2018-07-26 16:33:29 +01:00
Richard Davey
d3e07b519a
Added setBlankTexture method
2018-07-26 15:04:46 +01:00
Richard Davey
0516fd47f7
The Flat Tint Pipeline is now using the same shader as the Texture Tint
...
Time to make sure no texture swaps happen and we can finally have Graphics mixed with Sprites in the display list with no swapping cost (and soon, no flush cost either when we unify the pipelines)
2018-07-24 17:07:26 +01:00
Richard Davey
521138e9d8
setBlendMode now returns a boolean
2018-07-23 01:39:32 +01:00
Richard Davey
ec5bd1912e
GameObject.willRender
now takes a Camera as its only argument and uses it within the check. This has allowed me to remove 23 duplicate checks spread across the various Game Objects, all of which did the same thing, saving both KB and CPU time as the flags were being checked twice in most cases.
2018-07-19 13:19:02 +01:00
Richard Davey
0db16889e6
Use new Camera viewport values
2018-07-18 14:32:06 +01:00
Richard Davey
1c473afa84
Cameras draw their backgrounds correctly at higher resolutions
2018-07-17 23:26:30 +01:00
Richard Davey
4843d7eefe
Pipelines have a boot handler now.
2018-07-13 11:13:46 +01:00
Richard Davey
072cc0e21b
Added dirty Camera support and updated internal properties to set the flag
2018-07-12 01:13:34 +01:00
Richard Davey
5a5bea1ce5
Allow GO to be passed to onBind
2018-07-11 16:24:20 +01:00
Richard Davey
5128eecbeb
Cached the drawing buffer height
2018-07-10 16:32:28 +01:00
Richard Davey
434c8d1413
Fixed issue with sprite matrix and camera scaling
2018-07-10 13:59:49 +01:00
Richard Davey
fe61cfe2d1
You can now set the WebGL batch size in the Game Config via the property batchSize
. The default is 2000 before the batch will flush, which is a happy average between desktop and mobile. If targeting desktop specifically, you may wish to increase this value to reduce draw calls.
2018-07-02 12:33:46 +01:00
Richard Davey
217779604c
Added tileScaleX and tileScaleY support for Tile Sprites
2018-06-28 12:59:27 +01:00
Richard Davey
8c312090da
Solidified use of pixelArt mode
2018-06-27 15:27:16 +01:00
Richard Davey
7a23378015
Unified use of roundPixels, antialias and pixelArt modes
2018-06-27 15:15:00 +01:00
Richard Davey
7aa46657c2
Tidying up jsdocs and changing float to number
2018-06-26 23:19:14 +01:00
Richard Davey
7a4b29872e
Allow for custom canvas and context game config options. Game.context now set in WebGL mode. Allows WebGL2 contexts to be passed in. Fix #3653
2018-05-10 12:25:33 +01:00
Richard Davey
7df0488100
Fixed dupe config set
2018-05-09 14:32:32 +01:00
Richard Davey
056e74d6dc
Added compression object for future texture compression support.
2018-05-09 13:46:19 +01:00