Commit graph

337 commits

Author SHA1 Message Date
Richard Davey
724ed7ec17 Texture#getFrameBounds is a new method that will return the bounds that all of the frames of a given Texture Source encompass. This is useful for things like calculating the bounds of a Sprite Sheet embedded within a Texture Atlas. 2024-02-20 23:53:26 +00:00
Robert Kowalski
371a8b31a9 Add documentation on crop functionality Fix #6589 2024-02-20 11:21:47 -05:00
Ben Richards
a74f99563b Fix spritesheet from atlas from compressed texture. 2024-02-20 21:45:06 +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
Ben Richards
f8ebbf38ef Verify compressed texture compatibility with WebGL and improve warnings. 2024-02-17 20:43:43 +13:00
Ben Richards
6c8c432fbf Add support for sRGB color in ETC compressed PVR files. 2024-02-17 18:15:56 +13:00
Ben Richards
d70c107fde Add experimental support for BPTC compressed textures in PVR files.
These haven't been verified to work, but PVR format 15
(COMPRESSED_RGBA_BPTC_UNORM_EXT or COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT)
conforms to the specification, and PVR format 14
(COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT or
COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT) is a best guess.
2024-02-16 17:55:44 +13:00
Ben Richards
14bea5a995 Support sRGB compressed textures in PVR files.
ASTC format textures would previously be defaulted to linear RGB.
S3TC format textures would either default to linear RGB,
or not load at all.
2024-02-16 17:48:43 +13:00
Ben Richards
5ac59c1890 Fix headless renderer compatibility. 2024-02-09 18:57:13 +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
587b6e7bcd Merge branch 'master' into webgl-wrappers 2024-02-01 11:00:08 +13:00
Richard Davey
97967288b6 DynamicTexture.setSize will now check to see if the glTexture bound to the current frame is stale, and if so, destroy it before binding the one from the Render Target. This fixes an issue where constantly destroy and creating Dynamic Textures would cause a memory leak in WebGL. Fix #6669 2024-01-31 18:12:51 +00:00
Richard Davey
4ea4e55e0f DynamicTexture will now automatically call setSize(width, height) for both WebGL and Canvas. Previously it only did it for WebGL. This fixes an issue where DynamicTextures in Canvas mode would have a width and height of -1. Fix #6682 2024-01-31 17:36:21 +00: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
8cae5a33e7 Update TextureManager.js 2024-01-12 17:56:30 +00:00
Steven Adams
6a28ccbee1 Added correct parameters for create 2023-11-14 08:38:05 -05:00
Richard Davey
0b32610e56 Updated version to 3.70 2023-11-10 15:04:01 +00:00
Richard Davey
dada2ad181 Now parses Texture Packer 7.1.0 scale9 data and stores it on the Frames 2023-11-09 18:23:44 +00:00
Richard Davey
921ff93ba0 Added setScale9 method and scale9 and is3Slice boolean properties
* `Frame.setScale9` is a new method that allows you to set the scale9 data associated with the given Frame. This is used internally by the Texture Packer parsers, but can also be called directly.
* `Frame.scale9` is a new read-only boolean property that returns `true` if the Frame has scale9 data associated with it.
* `Frame.is3Slice` is a new read-only boolean property that returns `true` if the Frame has scale9 data associated with it that is 3-slice instead of 9-slice.
2023-11-09 18:23:27 +00:00
Richard Davey
a7d7a7d526 The Game instance will now boot the new SYSTEM_READY event, which indicates that the internal Scene System has been created by the Scene Manager and is ready for use. The Texture Manager now listens for this event in order to create the stamp Image. This fixes an issue where the stamp would throw a run-time error if the game didn't feature a preload function. Fix #6616 2023-11-09 13:42:00 +00:00
Richard Davey
6f801eeac7 The TextureSource.setFilter method will now check to see if renderer is defined before accessing its gl property. This avoids Phaser crashing if you're in headless mode and set anti-aliasing to false in the game config. Fix #6663 2023-11-08 18:48:36 +00:00
Richard Davey
5812b4b7a7 Fixed issue with Dynamic Textures and Render Textures not displaying until resized. Fix #6662 2023-11-03 19:02:52 +00:00
Richard Davey
b52221316b Update DynamicTexture.js
See. Never deploy on Friday the 13th.
2023-10-13 18:37:22 +01:00
Richard Davey
3333fa39e7 Fixed DynamicTexture memory leak on WebGL
* The `DynamicTexture` was leaking memory by leaving a WebGLTexture in memory when its `setSize` method was called. This happens automatically on instantiation, meaning that if you created DynamicTextures and then destroyed them frequently, memory would continue to increase (thanks David)
* `DynamicTexture.width` and `height` were missing from the class definition, even though they were set and used internally. They're now exposed as read-only properties.
* `DynamicTexture.setFromRenderTarget` is a new method that syncs the internal Frame and TextureSource GL textures with the Render Target GL textures.
2023-10-13 17:14:22 +01:00
Richard Davey
2d364f08c4 Clear stamp texture if current 2023-10-12 15:22:26 +01:00
Richard Davey
e5b04be760 Reset stamp texture 2023-10-12 15:22:26 +01:00
Richard Davey
aec66eea78 2nd parameter not required 2023-10-12 15:22:26 +01:00
Richard Davey
6fcee8fe8f No need to null the source glTexture 2023-10-12 15:22:26 +01:00
Richard Davey
2ad71909f3 The DynamicTexture.fill method will now correctly draw the fill rectangle if the width and height are provided in WebGL, where-as before it would assume the y axis started from the bottom-left instead of top-left. Fix #6615 2023-09-27 18:44:39 +01:00
Richard Davey
e3c1478867 null the glTexture reference 2023-09-05 14:56:06 +01:00
Richard Davey
c82a6bb466 DynamicTexture.preDestroy was never called, leading to an accumlation of framebuffers in memory. This method has now been renamed to destroy and cleans all references correctly. 2023-09-05 12:55:01 +01:00
Richard Davey
61fa744473 Fixed the methods addAtlasJSONArray, addAtlasJSONHash, addAtlasXML and addUnityAtlas. Fix #6565 2023-08-28 16:21:17 +01:00
Charlie Schwabacher
bb2a156586
avoid TypeError in addSpriteSheet method of TextureManager 2023-05-09 17:10:52 -07:00
Richard Davey
a1e77e9e6b You can now correctly loading a Sprite Sheet with a Normal Map. The TextureManager.addSpriteSheet method has been updated to take an optional dataSource parameter and the SpriteSheetFile.addToCache method has been rewritten to handle normal maps as well. 2023-04-12 06:49:54 +01:00
Richard Davey
91d598bd4f Added getWebGLTexture method 2023-04-11 23:42:17 +01:00
Richard Davey
f895350f3e Fixed lint error. Also we can call batchGameObject directly #6456 2023-04-07 13:31:38 +01:00
Rex
9c439671cc Add skipBatch in config parameter of stamp method 2023-04-06 21:20:23 +08:00
Richard Davey
b8872b79d4 Sets forceClamp to false 2023-03-27 17:48:38 +01:00
Richard Davey
c8acb16fa7 Added { willReadFrequently } to every canvas context, no matter where it comes from 2023-03-09 17:30:04 +00:00
Richard Davey
4914e3ca36 DynamicTexture RenderTarget will autoResize. Fix #6411 2023-03-03 13:09:25 +00:00
Richard Davey
e699fef68b Typo 2023-02-01 18:27:32 +00:00
Bambosh
7cbf56c3ae Fixed SpriteSheetFromAtlas out of range sourceIndex 2023-01-26 16:28:15 +11:00
samme
cc8dcaaded Fix Texture#has() 2023-01-18 17:29:14 -08:00
Richard Davey
2faa1dd824
Merge pull request #6337 from samme/feature/canvastexture-update
Add optional update argument to CanvasTexture methods
2023-01-18 16:27:40 +00:00
Richard Davey
8dccc85208 Updated docs 2023-01-11 17:35:17 +00:00
samme
190c3af510 Add optional update to CanvasTexture methods 2023-01-08 09:25:45 -08:00
Richard Davey
468bf7821d Updated copyright year 2023-01-02 17:36:27 +00:00