Commit graph

382 commits

Author SHA1 Message Date
Ben Richards
b591c3674a Document usage of WebGLTextureWrapper in place of WebGLTexture. 2024-01-29 11:47:39 +13:00
Ben Richards
216b7564f6 Update systems to use WebGLTextureWrapper and Uint8Array textures.
This is mostly hooking up gl calls to look inside the wrapper.
A few other things have changed.
Spector metadata is set the new way.
`Frame` changed `glTexture` to a getter, simplifying bookkeeping.
`LightPipeline` and `Plane` use standard methods to create textures.
`WebGLRenderer` maintains a list of wrappers, and automatically
manages it through `createTexture2D` and `deleteTexture`. The update
methods `updateCanvasTexture` and `updateVideoTexture` have been
delegated to the wrapper.
2024-01-29 11:45:12 +13:00
Ben Richards
a8dff1f990 Add Uint8Array texture creation methods. 2024-01-29 11:30:54 +13:00
Richard Davey
a26f827650 Optimized setTextureFilter 2023-11-07 18:28:27 +00:00
Richard Davey
b28ad7f3d3 The BitmapMask wouldn't correctly set the gl viewport when binding, which caused the mask to distort in games where the canvas resizes from its default. Fix #6527 2023-10-13 17:53:55 +01:00
Richard Davey
bae26a5205 When a framebuffer is deleted, it now sets its renderTexture property to undefined to ensure the reference is cleared. 2023-10-13 17:15:21 +01:00
Richard Davey
d74e767050 Delete color attachment 2023-10-12 18:49:06 +01:00
Richard Davey
1935119141 Array Remove and unbind before deleting the framebuffer 2023-10-12 15:22:26 +01:00
Richard Davey
e8e57b6b0c The WebGLRenderer.deleteFramebuffer method has been updated so it now tests for the exitennce of a COLOR and DEPTH_STENCIL attachments, and if found, removes the bindings and deletes the stencil buffer. The code that previously deelted the RENDERERBUFFER_BINDING has also been removed to avoid side-effects. 2023-09-05 13:40:45 +01:00
Richard Davey
8e1809688c The WebGLRenderer will now validate that the mipmapFilter property in the Game Config is a valid mipmap before assigning it. 2023-08-01 13:44:58 +01:00
Richard Davey
96ee7679c4 Added Spector method docs 2023-04-12 03:45:19 +01:00
Richard Davey
4fbd7eec82 Rename zero method and remove logs 2023-03-16 21:56:55 +00:00
Richard Davey
b093ece620 Debugging stencil stack 2023-03-16 18:49:43 +00:00
Richard Davey
4c19106c63 Debugging fx stacks 2023-03-16 18:23:30 +00:00
Richard Davey
5b12080cef Added methods zeroStencilMask and restoreStencilMask 2023-03-14 19:45:44 +00:00
Richard Davey
684a2ab35a setFramebuffer accepts texture and clear param 2023-03-03 18:53:36 +00:00
Richard Davey
8b493834dc Log can take any parameters 2023-03-02 18:45:42 +00:00
Richard Davey
eaf6fa7f45 Added log method, depth buffer and missing parameter default 2023-03-02 18:16:59 +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
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
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
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
e44a148882 Store actual WebGLTextures 2022-10-09 17:29:29 +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
f4a248e575 Debugging while testing texture batching 2022-10-07 01:37:37 +01:00
Richard Davey
3f4ebf5dd7 Update WebGLRenderer.js 2022-10-06 18:35:04 +01:00
Richard Davey
3d3b675ae8 Pass over the config values 2022-10-04 18:04:26 +01:00
Richard Davey
1a23b31947 Remove swap and rename method 2022-10-03 22:07:07 +01:00
Richard Davey
416aa053da Swap to using RenderTarget, much cleaner 2022-10-03 21:09:15 +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
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
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
Andy Mikulski
6108414b75
WebGLSnapshot: Support custom rendering contexts 2022-01-26 15:02:59 -07:00
Richard Davey
c37da11d36 pma is essential - to hell with Firefox! 2021-11-08 21:51:08 +00:00
Richard Davey
2efa08d3db Testing pma off 2021-11-08 18:49:48 +00:00
Richard Davey
c1c8e5d12b The WebGLRenderer.createTextureFromSource method has a new optional boolean parameter forceClamp that will for the clamp wrapping mode even if the texture is a power-of-two. 2021-10-14 18:45:28 +01:00
Richard Davey
01beb898b3 The WebGLRenderer.createTextureFromSource method now accepts the CompressedTextureData data objects and creates WebGL textures from them. 2021-10-06 18:47:35 +01:00
Richard Davey
234ba03b35 Update WebGLRenderer.js 2021-10-05 18:36:50 +01:00
Richard Davey
f376958ca1 Added getCompressedTextureName method 2021-10-05 18:30:17 +01:00
Richard Davey
7bdb9d672f Added supportsCompressedTexture method 2021-10-05 17:04:44 +01:00
Richard Davey
573dd3a14d Added getCompressedTextures method 2021-10-05 16:48:42 +01:00
Vladislav Forsh
670a66c697 Improve types for WebGL texture compression support
(cherry picked from commit 5626acffec17c6b4d66c78b8e0aa52e5cfcd8478)
2021-04-13 13:19:24 +03:00
Richard Davey
a95c34ce92 WebGLRenderer.deleteTexture will now run resetTextures(true) first, incase the requested texture to be deleted is currently bound. Previously, it would delete the texture and then reset them. 2021-02-17 13:10:10 +00:00