Commit graph

1205 commits

Author SHA1 Message Date
Zeke Chan
48cd2fc2e0 Update WebGLRenderer.js 2024-06-11 00:05:08 +08:00
Zeke Chan
6014b2d775 Update WebGLRenderer.js
Added `setContextHandlers` method
2024-06-10 23:35:27 +08:00
Zeke Chan
3212f6ff33 Reapply "Update WebGLRenderer.js"
This reverts commit ead539a664.
2024-06-10 14:52:57 +08:00
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
946e82b058 Removed .js from require paths (not needed) 2024-05-15 15:02:31 +01:00
Richard Davey
5d1d379991 Updated version to 3.85.0 2024-05-15 15:02:04 +01:00
Ben Richards
b1806fd721 Remove unsynced flipY from Shader and DynamicTexture textures.
This might be causing some issues with context restore,
and seems entirely unnecessary.
2024-02-27 17:29:49 +13:00
Ben Richards
37ba3510f2 Fix RenderTexture crashing in the presence of a light.
More generally, anything with a default/no normal map should be fixed.
2024-02-26 17:45:52 +13: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
3cd756dbe9 Fix new WebGLTextures remaining bound after creation.
This caused an error when calling `Shader.setRenderToTexture()`
after the game started running.
The leftover texture caused a temporary cyclic reference with the new
Framebuffer. The actual rendering pipeline was not affected.
2024-02-22 19:01:03 +13:00
Ben Richards
198598882e Document non-optional texture update flags correctly. 2024-02-22 09:56:17 +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
a74f99563b Fix spritesheet from atlas from compressed texture. 2024-02-20 21:45:06 +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
21a10b736a
Merge pull request #6728 from moufmouf/fix-postfxpipeline
Fixing the Postfix pipeline without introducing a skip frame
2024-02-19 15:30:34 +00:00
Richard Davey
56213a5f7e Update WebGLRenderer.js 2024-02-19 15:28:21 +00:00
Richard Davey
de0a22964e WebGLPipeline.resizeUniform is a new property that is defined in the WebGLPipelineConfig. This is a string that defines a uResolution property, or similar, within the pipeline shader. If the WebGL Renderer resizes, this uniform will now be updated automatically as part of the pipeline resize method. It has been added to both the Multi and Mobile pipelines as default. This fixes issues where the pipelines were rendering with old resolution values, causing graphical glitches in mostly pixel-art games. Fix #6674 2024-02-19 15:28:18 +00:00
Richard Davey
82b1a3e2aa Added missing copyright block 2024-02-19 15:01:56 +00:00
Ben Richards
89543c9880 Change S3TCRGB to S3TCSRGB. 2024-02-17 20:59:00 +13: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
6d56791568 Fix incorrect type on WebGLAttribLocationWrapper.wegGLAttribLocation.
A uniform uses a `WebGLUniformLocation`, but an attrib uses a `GLint`.
2024-02-09 11:06:47 +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
7ed40fdf7d Allow WebGL wrapper operations during context loss. 2024-02-05 16:40:16 +13:00
Ben Richards
a4e96855fc Correct documentation of LightPipeline.currentNormalMap. 2024-02-05 14:30:24 +13:00
David Négrier
e5454a1203 Fixing the Postfix pipeline without introducing a skip frame
Due to #6681, we introduced a skip frame to wait for the PostFX pipeline to be correctly booted.
While this fixed the display issue, it introduced a "skip" frame.
The pipeline would only be visible one frame after being introduced.

The root issue is a binding issue on currentRenderTarget.

Here, we fix the root issue and remove the skip frame.
2024-02-02 16:05:08 +01:00
Richard Davey
604c34c13b Stop tsgen from crashing! 2024-02-02 13:56:24 +00:00
Richard Davey
e00d12195d Fixed incorrect jsdocs 2024-02-02 13:03:38 +00:00
Richard Davey
7bac75a2f4 Fixed some jsdoc name references and minor lint errors 2024-02-02 13:01:03 +00: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
4fd8fc94c3 Fix WebGLShader recovery from WebGL context loss. 2024-02-02 20:50:39 +13:00
Ben Richards
ade7b57e3d Restore WebGL extensions. 2024-02-02 16:29:24 +13:00
Ben Richards
b66028ec8e Handle more invalidated state on WebGL context restore. 2024-02-02 15:53:03 +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
587b6e7bcd Merge branch 'master' into webgl-wrappers 2024-02-01 11:00:08 +13:00
Richard Davey
51074c4567 The PostFXPipeline.postBatch method will now skip onDraw is the pipeline hasn't booted, introducing an artificial frame skip. This should potentially fix glitch errors on mobile devices where Post FX would appear corrupted for a single frame. Fix #6681 2024-01-31 20:23:43 +00:00
Richard Davey
c6c7fd60a6 The BloomFX and BlurFX and any custom pipeline that relies on using the UtilityPipeline full or half frame targets will now correctly draw even after the renderer size changes. Fix #6677 2024-01-31 19:35:10 +00:00