Commit graph

9288 commits

Author SHA1 Message Date
Richard Davey
214b383fcd Use correct scale and added start of getCharacterAt method 2020-07-30 23:59:06 +01:00
Richard Davey
a39bcfe69a Always return chars 2020-07-30 22:38:06 +01:00
Richard Davey
a678f723c6 Always calculate includeChars 2020-07-30 22:37:34 +01:00
Richard Davey
1579069c50 Pixel accurate character data 2020-07-30 18:24:04 +01:00
Richard Davey
eef67b6c11 Update BitmapTextWebGLRenderer.js 2020-07-30 18:23:50 +01:00
Richard Davey
77feb773fd Fixed descriptions 2020-07-30 18:23:45 +01:00
Richard Davey
bf4c475e85 Floor drawFillRect values 2020-07-30 18:10:23 +01:00
Richard Davey
b108cd03f0 Fix call to GetBitmapTextSize 2020-07-30 15:43:43 +01:00
Richard Davey
408a545aac BitmapTextWord, BitmapTextCharacter and BitmapTextLines are three new type defs that are now part of the BitmapTextSize config object, as returned by getTextBounds. This improves the TypeScript defs and JS Docs for this object. 2020-07-30 15:24:49 +01:00
Richard Davey
286be7df49 The GetBitmapTextSize and BitmapText.getTextBounds functions have a new boolean parameter includeChars. When set to true it will include a characters array in the returned bounds object that contains the scaled position coordinates of each character in the BitmapText, which you could use for tasks such as determining which character of the object was clicked. 2020-07-30 15:14:25 +01:00
Richard Davey
cc3d3f7da3 The GetBitmapTextSize function used Math.round on the values, if the round parameter was true, which didn't create integers. It now uses Math.ceil instead to give integer results. 2020-07-30 14:47:31 +01:00
Richard Davey
841389628e The BitmapText.getTextBounds method was being called every frame, even if the bounds didn't change, potentially costing a lot of CPU depending on the text length and quantity of them. It now only updates the bounds if they change. 2020-07-30 14:46:32 +01:00
Richard Davey
ce9c750175 Geom.Polygon.Translate is a new function that allows you to translate all the points of a polygon by the given values. 2020-07-30 12:58:35 +01:00
samme
f653a51cc0 Docs: generic return for add.existing() 2020-07-29 12:19:09 -07:00
Richard Davey
ee92d1dac9 Geom.Intersects.GetLineToPolygon is a new function that checks for the closest point of intersection between a line segment and an array of polygons. 2020-07-29 18:12:40 +01:00
Richard Davey
771509d6c2 Phaser.Types.Math.Vector4Like is a new data type representing as Vector 4 like object. 2020-07-29 17:42:12 +01:00
Richard Davey
23c00d148d Phaser.Types.Math.Vector3Like is a new data type representing as Vector 3 like object. 2020-07-29 17:41:59 +01:00
Richard Davey
517183fd2e Geom.Intersects.GetLineToLine is a new function that will return a Vector3 containing the point of intersection between 2 line segments, with the z property holding the distance value. 2020-07-29 17:15:57 +01:00
Richard Davey
41c76d88b1 Beta tag 2020-07-24 15:34:00 +01:00
Richard Davey
fb1306e8f2 The MatterAttractors plugin, which enables attractors between bodies, has been fixed. The original plugin only worked if the body with the attractor was _first_ in the world bodies list. It can now attract any body, no matter where in the world list it is. Fix #5160 2020-07-23 18:06:17 +01:00
samme
7685067310
Docs: Phaser.Physics.Arcade.Group#defaults
#4171, #5153
2020-07-23 09:48:53 -07:00
Richard Davey
86f35ef9cf Updated docs 2020-07-23 17:35:47 +01:00
Richard Davey
b6b570fb91
Merge pull request #5233 from samme/patch-3
Docs: protect ScaleManager#onFullScreenChange
2020-07-23 17:10:14 +01:00
Richard Davey
b51a40c1a1 Update RenderTexture.js 2020-07-23 17:01:37 +01:00
Richard Davey
bb3b67c16f Update RenderTextureWebGLRenderer.js 2020-07-23 17:01:25 +01:00
Richard Davey
c31a9ad4e5 WebGLRenderer.unbindTextures is a new method that will activate and then null bind all WebGL textures. 2020-07-23 16:24:44 +01:00
Richard Davey
556b5b05be Update TextureSource.js 2020-07-23 16:23:14 +01:00
Richard Davey
9607ce89c7 Update RenderTextureWebGLRenderer.js 2020-07-23 16:22:46 +01:00
Richard Davey
9b278554d3 RenderTexture.resize (which is called from setSize) wouldn't correctly set the TextureSource.glTexture property, leading to bindTexture: attempt to use a deleted object errors under WebGL. 2020-07-23 16:22:38 +01:00
samme
02f6c51ff5
Docs: protect ScaleManager#onFullScreenChange
#5229
2020-07-22 11:22:43 -07:00
Richard Davey
27426dd0b6 Testing RenderTextures (currently broken, will fix next week) 2020-07-17 18:08:39 +01:00
Richard Davey
0ff08a2994 Update RopeWebGLRenderer.js 2020-07-17 17:07:34 +01:00
Richard Davey
1eb3464f30 Use multi-texturing 2020-07-17 17:05:05 +01:00
Richard Davey
8210700124 Enable the pipelines again 2020-07-17 17:04:49 +01:00
Richard Davey
491ca62373 The TextureTintStripPipeline now extends TextureTintPipeline and just changes the topolgy, vastly reducing the filesize. 2020-07-17 17:04:40 +01:00
Richard Davey
8d976d6ed5 WebGLRenderer.textureFlush is a new property that keeps track of the total texture flushes per frame. 2020-07-17 16:36:18 +01:00
Richard Davey
f3ebada1e0 Tidy up everything after rendering 2020-07-17 15:49:03 +01:00
Richard Davey
9280a73bf9 StaticTilemapLayer now includes the ModelViewProjection mixin, so it doesn't need to modify the pipeline during rendering. 2020-07-17 15:48:53 +01:00
Richard Davey
10c19bd24d StaticTilemapLayer.upload will now set the vertex attributes and buffer the data, and handles internal checks more efficiently. 2020-07-17 13:58:38 +01:00
Richard Davey
6e15f6b77d Refactored to tidy it up and also now works with Light2D pipeline 2020-07-17 13:56:56 +01:00
Richard Davey
8bb49332a9 Always set rotation 2020-07-17 13:55:50 +01:00
Richard Davey
d11a16deaa Added forceZero and setAttribPointers
`WebGLPipeline.forceZero` is a new property that informs Game Objects if the pipeline requires a zero bound texture unit.
* `WebGLPipeline.setAttribPointers` is a new method that will set the vertex attribute pointers for the pipeline.
2020-07-17 13:55:39 +01:00
Richard Davey
dc04949d3d Needs fixing tomorrow 2020-07-16 18:10:40 +01:00
Richard Davey
f89d53ca0d Update DynamicTilemapLayerWebGLRenderer.js 2020-07-16 17:43:14 +01:00
Richard Davey
97f601f378 LightsManager.cull now takes the viewport height from the renderer instead of the game config 2020-07-16 17:42:58 +01:00
Richard Davey
d942e2bd47 Update TextWebGLRenderer.js 2020-07-16 16:59:59 +01:00
Richard Davey
848377b8d8 The TileSprite Game Objects now support rendering with normal maps. 2020-07-16 16:59:53 +01:00
Richard Davey
fea1ade5b7 Update WebGLRenderer.js 2020-07-16 16:59:45 +01:00
Richard Davey
12fc51e2e2 If normal map set, advance the current active texture 2020-07-16 16:17:16 +01:00
Richard Davey
3dd6d8a1a4 Remove forceZero and added textureUnit 2020-07-16 16:16:57 +01:00
Richard Davey
5e8c28d468 Removed batchTexture as it's no longer needed 2020-07-16 16:16:42 +01:00
Richard Davey
68585f1718 The Text Game Object now supports rendering in Light2d, no matter which font, stroke or style it is using. 2020-07-16 16:16:26 +01:00
Richard Davey
76de5c246a Update ForwardDiffuseLightPipeline.js 2020-07-16 15:51:12 +01:00
Richard Davey
6aba9e71b1 All Shape Game Objects (Rectangle, IsoBox, Star, Polygon, etc) now support rendering in Light2d. 2020-07-16 15:51:07 +01:00
Richard Davey
786f78e91d Particle Emitter Game Objects now support rendering in Light2d. 2020-07-16 15:32:06 +01:00
Richard Davey
71d85be0df Mesh and Quad Game Objects now support rendering with normal maps. 2020-07-16 15:25:06 +01:00
Richard Davey
e7957b9380 Added getNormalMap and setGameObject 2020-07-16 15:18:02 +01:00
Richard Davey
f7e6847027 Added setGameObject method and currentUnit property 2020-07-16 15:16:17 +01:00
Richard Davey
5986f8f080 Tidying 2020-07-16 15:16:01 +01:00
Richard Davey
6c9a5f62a6 Uses setGameObject to support Light2D 2020-07-16 15:15:48 +01:00
Richard Davey
b4f0c9fde2 Uses setGameObject to support Light2D 2020-07-16 15:15:33 +01:00
Richard Davey
0c411e9e7e Removed currentUnit and batchSprite forceZero 2020-07-16 15:13:47 +01:00
Richard Davey
85f63c4a19 WebGLRenderer.isNewNormalMap is a new method that returns a boolean if the given parameters are not currently used. 2020-07-16 15:11:43 +01:00
Richard Davey
5db55a85d7 The Graphics Game Objects now support rendering in Light2d. You can even use normal map textures for the texture fills. 2020-07-16 15:10:45 +01:00
Richard Davey
38e7495b61 Fixed default normal map so all Game Objects will now render
* The pipeline now works with Game Objects that do not have a normal map. They will be rendered using the new default normal map, which allows for a flat light effect to pass over them and merge with their diffuse map colors.
2020-07-16 11:04:10 +01:00
Richard Davey
93d0378143 Added missing jsdocs 2020-07-16 11:03:49 +01:00
Richard Davey
c973f41fcc Added setters and dirty check
* `Light.dirty` is a new property that controls if the light is dirty, or not, and needs its uniforms updating.
* `Light` has been recoded so that all of its properties are now setters that activate its `dirty` flag.
2020-07-16 03:26:32 +01:00
Richard Davey
1146e6f7a3 LightsManager.destroy will now clear the lightPool array when destroyed, where-as previously it didn't. 2020-07-16 03:25:25 +01:00
Richard Davey
84968f502f Update ForwardDiffuseLightPipeline.js
* The pipeline will no longer look-up and set all of the light uniforms unless the `Light` is dirty.
* The pipeline will no longer reset all of the lights unless the quantity of lights has changed.
2020-07-16 03:24:19 +01:00
Richard Davey
3b9d115d0c Reset just units 0 and 1 2020-07-16 03:13:47 +01:00
Richard Davey
d7cf9da819 Added location cache 2020-07-16 03:13:10 +01:00
Richard Davey
5059045c76 Cache attribute location
* `WebGLPipeline.boot` will now check all of the attributes and store the pointer location within the attribute entry.
* `WebGLPipeline.bind` no longer looks-up and enables every attribute, every frame. Instead it uses the cached pointer location stored in the attribute entry, cutting down on redundant WebGL operations.
2020-07-16 03:12:53 +01:00
Richard Davey
4ab9604102 Lots of updates to this pipeline
* The `ForwardDiffuseLightPipeline.defaultNormalMap` property has been removed as it's no longer required.
* The `ForwardDiffuseLightPipeline.boot` method has been removed as it's no longer required.
* The `ForwardDiffuseLightPipeline.onBind` method has been removed as it's no longer required.
* The `ForwardDiffuseLightPipeline.setNormalMap` method has been removed as it's no longer required.
* The `ForwardDiffuseLightPipeline.bind` is a new method that handles setting-up the shader uniforms.
* The `ForwardDiffuseLightPipeline.batchTexture` method has been rewritten to use the Texture Tint Pipeline function instead.
* The `ForwardDiffuseLightPipeline.batchSprite` method has been rewritten to use the Texture Tint Pipeline function instead.
2020-07-16 02:15:53 +01:00
Richard Davey
1f3b79cf11 Normal map additions
* `WebGLRenderer.normalTexture` is a new property that holds the currently bound normal map (texture unit one).
* `WebGLRenderer.setNormalMap` is a new method that sets the current normal map texture.
* `WebGLRenderer.clearNormalMap` is a new method that clears the current normal map texture.
* `WebGLRenderer.resetTextures` is a new method that flushes the pipeline, resets all textures back to the temporary ones and resets the active texture counter.
2020-07-16 02:15:01 +01:00
Richard Davey
c6ffa0620e TextureTintPipeline.batchSprite and batchTexture has new parameters forceZero which forces use of texture unit zero. 2020-07-16 02:13:08 +01:00
Richard Davey
0b3f125ee0 Removed the Deferred Diffuse fragment and vertex shaders from the project, as they're not used. 2020-07-16 00:21:44 +01:00
Richard Davey
94d333ee1e Use new texture unit 2020-07-16 00:00:49 +01:00
Richard Davey
d34d52550d Renders using setTextureZero 2020-07-15 18:03:57 +01:00
Richard Davey
99af20aa68 The Particle Emitter Game Object WebGL Renderer function has been updated to support multi-texture units. 2020-07-15 18:03:36 +01:00
Richard Davey
9e9e45261f Added setTextureZero and clearTextureZero
* `WebGLRenderer.setTextureZero` is a new method that activates texture zero and binds the given texture to it. Useful for fbo backed game objects.
* `WebGLRenderer.clearTextureZero` is a new method that clears the texture tha was bound to unit zero.
* `WebGLRenderer.textureZero` is a new property that holds the currently bound unit zero texture.
2020-07-15 18:03:03 +01:00
Richard Davey
216d7cb1fa Updated WebGLRenderer to support new texture assignment
* The property `WebGLRenderer.currentActiveTextureUnit` has been renamed to `currentActiveTexture`.
* `WebGLRenderer.startActiveTexture` is a new read-only property contains the current starting active texture unit.
* `WebGLRenderer.maxTextures` is a new read-only property that contains the maximum number of texture units WebGL can use.
* `WebGLRenderer.textureIndexes` is a new read-only array that contains all of the available WebGL texture units.
* `WebGLRenderer.tempTextures` is a new read-only array that contains temporary WebGL textures.
* The `WebGLRenderer.currentTextures` property has been removed, as it's no longer used.
* `WebGLRenderer.currentTextures` has been removed, as it's no longer used internally.
* `WebGLRenderer.setBlankTexture` no longer has a `force` parameter, as it's set by default.
* `WebGLRenderer.setTextureSource` is a new method, used by pipelines and Game Objects, that will assign a texture unit to the given Texture Source.
* The `WebGLRenderer.setTexture2D` method has been updated to use the new texture unit assignment. It no longer takes the `textureUnit` or `flush` parameters and these have been removed from its method signature.
2020-07-15 17:11:01 +01:00
Richard Davey
9c76ec0389 Large TextureTintPipeline refactor
* The Texture Tint vertex and fragment shaders have been updated to support the `inTexId` float attribute and dynamic generation.
* The Texture Tint Pipeline has a new attribute, `inTexId` which is a `gl.FLOAT`.
* `TextureTintPipeline.bind` is a new method that sets the `uMainSampler` uniform.
* The `TextureTintPipeline.requireTextureBatch` method has been removed, as it's no longer required.
* The `TextureTintPipeline.pushBatch` method has been removed, as it's no longer required.
* The `TextureTintPipeline.maxQuads` property has been removed, as it's no longer required.
* The `TextureTintPipeline.batches` property has been removed, as it's no longer required.
* `TextureTintPipeline.flush` has been rewritten to support multi-textures.
* `TextureTintPipeline.flush` no longer creates a sub-array if the batch is full, but instead uses `bufferData` for speed.
* `TextureTintPipeline.currentUnit` is a new property that holds the most recently assigned texture unit. Treat as read-only.
2020-07-15 17:05:55 +01:00
Richard Davey
3ede28230b Update WebGLPipeline.js 2020-07-15 16:54:18 +01:00
Richard Davey
a21641e19b The Dynamic Bitmap Text Game Object WebGL Renderer function has been updated to support multi-texture units. 2020-07-15 16:54:04 +01:00
Richard Davey
50f10b3d4b The Bitmap Text Game Object WebGL Renderer function has been updated to support multi-texture units. 2020-07-15 16:53:48 +01:00
Richard Davey
446389bb4d The Blitter Game Object WebGL Renderer function has been updated to support multi-texture units. 2020-07-15 16:53:25 +01:00
Richard Davey
ec0914cd0f The Mesh Game Object WebGL Renderer function has been updated to support multi-texture units. 2020-07-15 16:53:09 +01:00
Richard Davey
c0504e4fc1 WebGL.Utils.checkShaderMax is a new function, used internally by the renderer, to determine the maximum number of texture units the GPU + browser supports. 2020-07-15 16:52:26 +01:00
Richard Davey
fd305591ec Added glIndex and glIndexCounter properties 2020-07-15 16:52:01 +01:00
Richard Davey
477b847f13 Config.render.maxTextures is a new game config setting that allows you to control how many texture units will be used in WebGL. 2020-07-15 16:51:40 +01:00
Richard Davey
7c742f95d2 Generate multi-texture shader source 2020-07-14 17:44:26 +01:00
Richard Davey
9a45517efd Pass max textures to pipeline (disable other pipelines for now) 2020-07-14 17:44:17 +01:00
Richard Davey
587c23ec3c Added maxGPUTextures property 2020-07-14 17:43:56 +01:00
Richard Davey
76689942c0 Add texture ID to shaders 2020-07-14 17:43:29 +01:00
Richard Davey
43beca7bab Create CheckShaderMax.js 2020-07-14 17:43:05 +01:00
Richard Davey
0003d278fd Updated to use new external MVP functions 2020-07-14 16:49:30 +01:00
Richard Davey
06c1336f41 Removed all functions from MVP except init and update and made them all external 2020-07-14 16:49:16 +01:00
Richard Davey
a8faef6692 Created new Model View Projection functions 2020-07-14 16:48:01 +01:00
Richard Davey
5cc387b7df Preparing for 3.25.0 dev 2020-07-14 16:47:43 +01:00
Richard Davey
dc13060042 Fixed namespace 2020-07-14 09:45:37 +01:00