Commit graph

1092 commits

Author SHA1 Message Date
Richard Davey
1cf3aa428a Exposed all the FX pipelines for easier access 2023-02-15 01:15:25 +00:00
Richard Davey
e1391445fe If you add #define SHADER_NAME to the start of your shader then it will be picked up as the WebGLShader name during the setShadersFromConfig process within WebGLPipeline. 2023-02-15 01:15:01 +00:00
Richard Davey
b40cc9b584 Tweaked alpha 2023-02-15 00:50:31 +00:00
Richard Davey
a93a6c75c3 Added working BloomFX 2023-02-15 00:50:26 +00:00
Richard Davey
b615e67a3b Rename LinearGradient to Gradient and use better shader 2023-02-15 00:05:33 +00:00
Richard Davey
03104d0a8c Optimize size of shaders by removing comments and blank lines 2023-02-15 00:05:16 +00:00
Richard Davey
58576252cb Fixed BlurFX and added LinearGradientFX 2023-02-14 23:45:44 +00:00
Richard Davey
65f3d340ec Working through Blur FX 2023-02-14 18:53:52 +00:00
Richard Davey
15f296824c Improved Vignette shader dramatically 2023-02-14 15:49:33 +00:00
Richard Davey
729f446e66 Added Shadow, Vignette, Pixelate and Shine FX 2023-02-14 13:33:07 +00:00
Richard Davey
765afecbea The WebGLPipeline.setTime method has a new optional parameter shader, which allows you to control the shader on which the time value is set. 2023-02-14 13:11:29 +00:00
Richard Davey
28f088184f Expose GlowFXPipeline 2023-02-14 01:30:57 +00:00
Richard Davey
9f53a0460a Added GlowFX by default (testing) 2023-02-14 01:30:47 +00:00
Richard Davey
13e2e15914 New and improved fx handling 2023-02-14 01:30:37 +00:00
Richard Davey
3f428c4295 jsdocs fix 2023-02-14 01:29:57 +00:00
Richard Davey
2589557f4d Don't resize if locked from resizing 2023-02-14 01:29:46 +00:00
Richard Davey
34c3468961 Create GlowFXPipeline.js 2023-02-14 01:29:05 +00:00
Richard Davey
ed1f79e57e Added Vignette and BaseFX class 2023-02-13 21:21:18 +00:00
Richard Davey
532d5a9375 Revised FX pipeline. Added Glow, Shadow and Pixelate. Tested against multi-pass. 2023-02-13 18:50:27 +00:00
Richard Davey
963ff647e6 Testing out a possible FX Pipeline 2023-02-13 01:30:22 +00:00
Richard Davey
cf6b0971cb Renaming SpriteFX to PreFX 2023-02-12 21:08:58 +00:00
Richard Davey
ed205f586b Bloom FX 2023-02-09 18:46:49 +00:00
Richard Davey
a493f51192 Set the Post Pipeline name into the instance correctly, so we can pass by reference to setPostPipeline 2023-02-03 18:26:56 +00:00
Richard Davey
6f678e0825 If mipmapFilter is not set on the config (now the default) it won't create them at all. 2023-01-23 20:59:02 +00:00
Richard Davey
61278d0812 Optionally pass ColorMatrix to ciopySprite method 2023-01-23 17:16:43 +00:00
Richard Davey
468bf7821d Updated copyright year 2023-01-02 17:36:27 +00:00
Richard Davey
7a5d138271 Testing deleting renderbuffer #6311 2022-12-07 18:29:11 +00:00
Richard Davey
a813f9c229 WebGLPipeline.vertexAvailable is a new method that returns the number of vertices that can be added to the current batch before it will trigger a flush. 2022-12-07 18:28:17 +00:00
Richard Davey
1e9bb686d3 When calling PipelineManager.clear and rebind it will now check if the vao extension is available, and if so, it'll bind a null vertex array. This helps clean-up from 3rd party libs that don't do this directly, such as ThreeJS. 2022-11-29 23:38:47 +00:00
Richard Davey
9357b8e609 The RenderTarget class will now create a Framebuffer that includes a Depth Stencil Buffer attachment by default. Previously, it didn't. By attaching a stencil buffer it allows things like Geometry Masks to work in combination with Post FX and other Pipelines. Fix #5802 2022-11-22 18:13:03 +00:00
Richard Davey
e608c2caf1 The CONTEXT_RESTORED Game Event has been removed and the WebGL Renderer no longer listens for the contextrestored DOM event, or has a contextRestoredHandler method. This never actually worked properly, in any version of Phaser 3 - although the WebGLRenderer would be restored, none of the shaders, pipelines or textures were correctly re-created. If a context is now lost, Phaser will display an error in the console and all rendering will halt. It will no longer try to re-create the context, leading to masses of WebGL errors in the console. Instead, it will die gracefully and require a page reload. 2022-11-17 18:04:51 +00:00
Richard Davey
c9d7a76998 The Light fragment shader will now use the outTintEffect attribute meaning the Light Pipeline will now correctly light both tinted and fill-tinted Game Objects. Fix #5452 2022-11-17 17:25:47 +00:00
Richard Davey
8c7c8ee2a4 The batchLine method in the Multi Pipeline will now check to see if the dxdy len is zero, and if so, it will abort drawing the line. This fixes issues on older Android devices, such as the Samsung Galaxy S6 or Kindle 7, where it would draw erroneous lines leading up to the top-left of the canvas under WebGL when rendering a stroked rounded rectangle. Fix #5429 2022-11-17 16:49:10 +00:00
Richard Davey
2f720246ab Reset the buffer and textures on rebind. 2022-11-15 21:54:43 +00:00
Richard Davey
064e8a3ec2 Fixed type issues 2022-11-10 16:05:20 +00:00
Richard Davey
b457e42a2f The Light Pipeline will now check to see if a Light2D enabled Game Object has a parent Container, or not, and factor the rotation and scale of this into the light calculation. Fix #6086 2022-11-09 18:18:35 +00:00
Richard Davey
d7a15e92a6 Added activeBuffer and activeTextures check to avoid gl ops 2022-11-03 22:05:18 +00:00
Richard Davey
2d81a4a50e Reverting to forloop shader 2022-11-03 22:04:58 +00:00
Richard Davey
528e32a18a Reverting to forloop approach 2022-11-03 22:04:44 +00:00
Richard Davey
7d594dd49a Clarify snapshot docs 2022-10-31 22:46:44 +00:00
Richard Davey
22eae26007 WebRenderer.snapshotFramebuffer and by extension, the snapshot methods in Dynamic Textures and Render Textures, has been updated to ensure that the width and height never exceed the framebuffer dimensions, or it'll cause a runtime error. The method snapshotArea has had this limitation removed as a result, allowing you to snapshot areas that are larger than the Canvas. Fix #5707 2022-10-31 22:17:27 +00:00
Richard Davey
ba6af3a920 Conditionally set DEBUG 2022-10-31 16:17:16 +00:00
Richard Davey
4f0029c03c Added captureFrame, captureNextFrame, getFps, startCapture and stopCapture methods 2022-10-28 18:23:24 +01:00
Richard Davey
bd1adbd67e Clear TEXTURE1. Fix #6248 2022-10-13 22:03:33 +01:00
Richard Davey
f3c804805f Update MultiPipeline.js 2022-10-10 17:43:53 +01:00
Richard Davey
a6a83ca592 Testing customSampler 2022-10-10 13:27:33 +01:00
Richard Davey
52f7ec621a Added destroy method back in again 2022-10-09 23:16:48 +01:00
Richard Davey
d0cc5f17d5 Extend the MultiPipeline and use new batch system 2022-10-09 23:16:38 +01:00
Richard Davey
5dd3a40342 Fixed data types 2022-10-09 18:11:00 +01:00
Richard Davey
01150a6efc Removed un-needed method 2022-10-09 17:49:21 +01:00
Richard Davey
6ff216d832 Create WebGLPipelineBatchEntry.js 2022-10-09 17:49:11 +01:00
Richard Davey
7600f2f6b6 Added all new jsdocs 2022-10-09 17:49:08 +01:00
Richard Davey
a2d5f25a55 Added new method 2022-10-09 17:30:36 +01:00
Richard Davey
3c54c852dc Don't forget to update the batch count 2022-10-09 17:30:27 +01:00
Richard Davey
70ef38c03c Fixed rendering 2022-10-09 17:29:37 +01:00
Richard Davey
e44a148882 Store actual WebGLTextures 2022-10-09 17:29:29 +01:00
Richard Davey
57f2f7abd7 Broken for now 2022-10-07 18:03:16 +01:00
Richard Davey
5908eea4ce Use new methods 2022-10-07 16:24:07 +01:00
Richard Davey
496882fbd2 Inc count on batchVert 2022-10-07 16:23:57 +01:00
Richard Davey
c9e37ed373 Remove calls to resetTextures 2022-10-07 16:09:23 +01:00
Richard Davey
080242f928 Due to all of the changes with how WebGL texture batching works a lot of mostly internal methods and properties have been removed. This is the complete list
* The `WebGLRenderer.currentActiveTexture` property has been removed.
* The `WebGLRenderer.startActiveTexture` property has been removed.
* The `WebGLRenderer.tempTextures` property has been removed.
* The `WebGLRenderer.textureZero` property has been removed.
* The `WebGLRenderer.normalTexture` property has been removed.
* The `WebGLRenderer.textueFlush` property has been removed.
* The `WebGLRenderer.isTextureClean` property has been removed.
* The `WebGLRenderer.setBlankTexture` method has been removed.
* The `WebGLRenderer.setTextureSource` method has been removed.
* The `WebGLRenderer.isNewNormalMap` method has been removed.
* The `WebGLRenderer.setTextureZero` method has been removed.
* The `WebGLRenderer.clearTextureZero` method has been removed.
* The `WebGLRenderer.setNormalMap` method has been removed.
* The `WebGLRenderer.clearNormalMap` method has been removed.
* The `WebGLRenderer.unbindTextures` method has been removed.
* The `WebGLRenderer.resetTextures` method has been removed.
* The `WebGLRenderer.setTexture2D` method has been removed.
* The `WebGLRenderer.pushFramebuffer` method has had the `resetTextures` argument removed.
* The `WebGLRenderer.setFramebuffer` method has had the `resetTextures` argument removed.
* The `WebGLRenderer.popFramebuffer` method has had the `resetTextures` argument removed.
* The `WebGLRenderer.deleteTexture` method has had the `reset` argument removed.
2022-10-07 16:08:39 +01:00
Richard Davey
cbc0ac5a7a Create a batch if empty 2022-10-07 12:47:04 +01:00
Richard Davey
f4a248e575 Debugging while testing texture batching 2022-10-07 01:37:37 +01:00
Richard Davey
e2187086ce Merged batch code in 2022-10-07 01:37:17 +01:00
Richard Davey
e18c7fe6c9 New shaders 2022-10-07 01:36:58 +01:00
Richard Davey
3f4ebf5dd7 Update WebGLRenderer.js 2022-10-06 18:35:04 +01:00
Richard Davey
f0d3588f7b Use batch system to avoid bufferSubData spamming - massively improves performance! 2022-10-05 00:59:04 +01:00
Richard Davey
08ee414ad5 Inline array add to stop branching 2022-10-05 00:58:33 +01:00
Richard Davey
010db3f2a3 Updated jsdocs 2022-10-04 18:27:19 +01:00
Richard Davey
ba8d25909f Update PipelineManager.js 2022-10-04 18:27:11 +01:00
Richard Davey
03f09e2c10 Added setDefaultPipeline method 2022-10-04 18:20:17 +01:00
Richard Davey
3d3b675ae8 Pass over the config values 2022-10-04 18:04:26 +01:00
Richard Davey
64972f8456 Added default pipeline and mobile swap 2022-10-04 18:04:18 +01:00
Richard Davey
20485e1aa2 Added MobilePipeline 2022-10-04 17:08:48 +01:00
Richard Davey
554ef91353 Correct docs 2022-10-04 14:49:26 +01:00
Richard Davey
e774987897 Removed unused code 2022-10-04 14:49:19 +01:00
Richard Davey
1316c09d1c Merge branch 'master' of https://github.com/photonstorm/phaser 2022-10-04 13:17:44 +01:00
Richard Davey
d9a30e6c52 Remove unused shaders 2022-10-04 13:17:33 +01:00
arbassic
58cf547d47 fix: use webgl 1 pattern to always use best precision available 2022-10-04 01:11:10 +02:00
Richard Davey
1a23b31947 Remove swap and rename method 2022-10-03 22:07:07 +01:00
Richard Davey
b52a730f9b Rename function 2022-10-03 22:06:58 +01:00
Richard Davey
416aa053da Swap to using RenderTarget, much cleaner 2022-10-03 21:09:15 +01:00
Richard Davey
eba9254e1a The BitmapMaskPipeline now hands over most control of the framebuffers to the WebGLRenderer. 2022-10-03 18:50:48 +01:00
Richard Davey
b327f39c5e Bitmap Mask updates
* The `WebGLRenderer` has 4 new properties: `maskTargetFramebuffer`, `maskSourceFramebuffer`, `maskTargetTexture` and `maskSourceTexture`. These are the new global locations of the mask framebuffers.
* `WebGLRenderer.createBitmapMask` is a new method that internally creates the Bitmap Mask framebuffers.
* `WebGLRenderer.clearBitmapMask` is a new method that internally clears the existing Bitmap Mask framebuffers, called as part of a resize event.
* `WebGLRenderer.enableBitmapMask` is a new method that starts the process of using the mask target framebuffer for drawing. This is called by the `BitmapMaskPipeline`.
* `WebGLRenderer.drawBitmapMask` is a new method that completes the process of rendering using the mask target framebuffer. This is called by the `BitmapMaskPipeline`.
2022-10-03 18:49:55 +01:00
Richard Davey
dcb1c8a9dd Allowing custom resolution for mask shader 2022-09-29 23:35:06 +01:00
Richard Davey
3abea4286f When rendering a Sprite with a Camera set to roundPixels it will now run Math.floor on the Matrix position, preventing you from noticing 'jitters' as much when Camera following sprites in heavily zoomed Camera systems. 2022-09-29 22:11:02 +01:00
Richard Davey
2e870a0a2c Previously, the Multi Tint methods batchSprite, batchTexture, batchTextureFrame and batchFillRect would all make heavy use of the TransformMatrix.getXRound and getYRound methods, which in turn called getX and getY and applied optional rounding to them. This is all now handled by one single function (setQuad) with no branching, meaning rendering one single sprite has cut down 16 function calls and 48 getters to just 1 function. 2022-09-29 17:17:24 +01:00
Richard Davey
ab04cb6c05 Lots of LightPipeline improvements
* The Light Pipeline no longer creates up to `maxLights` copies of the Light shader on boot. Previously it would then pick which shader to use, based on the number of visible lights in the Scene. Now, the number of lights is passed to the shader and branches accordingly. This means rather than compiling _n_ shaders on boot, it now only ever needs to create one.
* You can now have no lights in a Scene, but the Scene will still be impacted by the ambient light. Previously, you always needed at least 1 light to trigger ambient light (thanks jstnldrs)
* The `Light.frag` shader now uses a new `uLightCount` uniform to know when to stop iterating through the max lights.
* The `LightPipeline.LIGHT_COUNT` constant has been removed as it's not used internally.
* The `LightPipeline` previous created a global level temporary vec2 for calculations. This is now part of the class as the new `tempVec2` property.
2022-09-23 00:42:04 +01:00
Richard Davey
a135271f19 Use new uLightCount uniform 2022-09-23 00:41:47 +01:00
Richard Davey
b789742636 Update Utils.js 2022-09-22 14:55:29 +01:00
Richard Davey
9d43583a63 This shader is just better. More crappy iOS testing needed though. 2022-09-21 23:13:04 +01:00
brendo
93eceb7d99 show error code 2022-08-30 07:42:14 +08:00
Richard Davey
4c2d3e3cff setTextureZero will now set isTextureClean to false 2022-08-24 13:56:12 +01:00
Richard Davey
9bc8826684 Specify the canvas is for drawing, not reading 2022-08-18 18:01:45 +01:00
Richard Davey
f09ec762ee Removed Graphics Pipeline
The WebGL Graphics Pipeline has been removed. This pipeline wasn't used in v3.55, as all Graphics rendering is handled by the MultiTint pipeline, for better batching support. No Phaser Game Objects use the Graphics pipeline any longer, so to save space it has been removed and is no longer installed by the Pipeline Manager.
2022-07-12 13:39:51 +01:00
Richard Davey
aa2dda09e2 UtilityPipeline.blitFrame has a new optional boolean parameter flipY which, if set, will invert the source Render Target while drawing it to the destination Render Target. 2022-05-30 18:25:21 +01:00
samme
54d12080eb
Docs: fix the mipmapFilter example code 2022-05-09 09:44:09 -07:00
Richard Davey
59fbcc5ca3 Updated copyright year 2022-02-28 14:29:51 +00:00
Richard Davey
c8d3a20754 Updated Multi Pipeline shader so it no longer smacks Safari's arse. 2022-02-03 23:12:15 +00:00
Andy Mikulski
6108414b75
WebGLSnapshot: Support custom rendering contexts 2022-01-26 15:02:59 -07:00