Commit graph

413 commits

Author SHA1 Message Date
Zeke Chan
ead539a664 Revert "Update WebGLRenderer.js"
This reverts commit 6489106aa8.
2024-06-10 14:50:14 +08:00
Zeke Chan
6489106aa8 Update WebGLRenderer.js
Added `dispatchContextLost`, `dispatchContextRestored` methods
2024-06-10 14:49:38 +08:00
Richard Davey
5d1d379991 Updated version to 3.85.0 2024-05-15 15:02:04 +01:00
Ben Richards
7eede9d236 Standardise texture update in Shader.initSampler2D. 2024-02-26 16:19:24 +13:00
Ben Richards
cab4bab15e Eliminate duplicate code in WebGL video handling.
This involves a new method, `videoToTexture`.
2024-02-23 19:16:18 +13:00
Ben Richards
9a5b51dd27 Eliminate duplicate code in WebGL texture creation/update.
This should make the code lighter and more maintainable.
`UNPACK_FLIP_Y_WEBGL` is now always set, where previously it was allowed
to just remain default (false); this is necessary for the new code path.
`Uint8Array` sources are now allowed to generate MIPMaps.
`WebGLTextureWrapper.update` now checks the type of `pixels`, although
it should only ever be the final case.
2024-02-23 18:43:27 +13:00
Ben Richards
42039a144e Fix failure to restore compressed textures after WebGL context loss. 2024-02-23 17:55:03 +13:00
Ben Richards
a0aa09ff31 Fix WebGL errors when updating video textures. 2024-02-22 09:18:12 +13:00
Richard Davey
c445303ffb Revert define changes as they don't work 2024-02-21 13:23:52 +00:00
Richard Davey
7aaa976a4e Updated webpack config DefinePlugin use and corresponding defs to allow those crazy souls who import source directly on node to have a better life #6644 2024-02-21 12:57:48 +00:00
Ben Richards
13d6defb33 Fix rare text sizes failing to render.
If initialized at a power-of-two resolution, then resized to a
non-power-of-two resolution, some extra parameters must be updated.
2024-02-21 11:48:59 +13:00
Ben Richards
93b4b083f1 Fix setting unnecessarily high texture filters. 2024-02-20 13:10:08 +13:00
Ben Richards
a2178c8466 Fix MIPMaps being disabled for compressed textures. 2024-02-20 13:02:19 +13:00
Richard Davey
1f8276ac76 Updated copyright year, company and author 2024-02-19 17:12:24 +00:00
Richard Davey
56213a5f7e Update WebGLRenderer.js 2024-02-19 15:28:21 +00:00
Ben Richards
878d3d2211 Fix support for BPTC and RGTC texture compression.
They use different WebGL extension name formats.
2024-02-13 17:38:19 +13:00
Ben Richards
2e8a8f8081 Add default normal map texture __NORMAL.
Remove `LightPipeline.defaultNormalMap`, as this universal texture is
now available to use.
2024-02-09 15:51:53 +13:00
Ben Richards
23a672bc48 Improve resize handling.
Although the `resize` function does make GL calls,
they will have no effect during context loss.
2024-02-09 12:28:20 +13:00
Ben Richards
4353a1e175 Improve safety around context loss.
Clarify notes on drawing dynamic textures during context loss.
Allow `Shader` to initialize and operate during context loss.
Improve resize handling on context loss and recovery.
2024-02-08 18:53:10 +13:00
Ben Richards
49e9d45435 Emit LOSE_WEBGL event.
Also rearrange RESTORE_WEBGL event code.
2024-02-02 21:57:28 +13:00
Ben Richards
d57b46e690 Tidy up wrappers on WebGLRenderer destroy. 2024-02-02 20:55:09 +13:00
Ben Richards
ade7b57e3d Restore WebGL extensions. 2024-02-02 16:29:24 +13:00
Ben Richards
4c849cb2f7 Tidy up WebGL Wrappers.
Dispose of all references on destroy.
Properly name WebGLProgramWrapper#initialize.
Remove renderer dependence in WebGLFramebufferWrapper.
2024-02-02 15:30:38 +13:00
Ben Richards
24d739ed72 Emit RESTORE_WEBGL event. 2024-02-02 11:33:27 +13:00
Ben Richards
a0f066c543 Restore WebGL context.
All textures and shaders should automatically recover from WebGL
context loss.
Dynamic textures will lose their contents, unfortunately, as the texture
was stored on the GPU.
Frame buffers still have some bugs to work out.
2024-02-01 16:59:00 +13:00
Ben Richards
b9deef7e61 Destroy location wrappers when they're unused. 2024-01-31 11:53:50 +13:00
Ben Richards
e920b1a961 Create and use wrappers for WebGLUniformLocation and WebGLAttribLocation. 2024-01-30 22:13:51 +13:00
Ben Richards
0f9fb3177d Fix incorrect WebGL calls. 2024-01-30 11:23:27 +13:00
Ben Richards
2382f7c1eb Create and use WebGLProgramWrapper.
This handles shader programs.
Also tweak the documentation in WebGLBufferWrapper and
WebGLFramebufferWrapper to better reflect purpose.
2024-01-29 17:35:57 +13:00
Ben Richards
377221de35 Create and use WebGLBufferWrapper.
This mostly handles VertexBuffers, but there's an IndexBuffer which
is not internally used that uses the same wrapper.
2024-01-29 16:40:18 +13:00
Ben Richards
842d666ebf Use and document WebGLFramebufferWrapper.
Also tweak WebGLTextureWrapper to have more standard destroyers
in itself and WebGLRenderer.
2024-01-29 14:53:23 +13:00
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