Commit graph

15575 commits

Author SHA1 Message Date
Richard Davey
b74928b2f8 Added hideCCW, addOBJ, addModel, sortByDepth, rotateX, rotateY, rotateZ, depthSort, addVertex and addFace methods. 2020-09-15 18:09:19 +01:00
Richard Davey
431eb69b42 Much cleaner rendering function, skipping invalid faces 2020-09-15 18:07:51 +01:00
Richard Davey
3e133c900a New method signature order 2020-09-15 18:07:24 +01:00
Richard Davey
a2a199818e Added contains and isCounterClockwise methods and depth property 2020-09-15 18:07:14 +01:00
Richard Davey
229d27dc9e Updated docs and added load method 2020-09-15 18:06:48 +01:00
Richard Davey
dd28a11c93 Loader.OBJFile is a new File Loader type that can load Wavefront OBJ files, which are then parsed and stored in the OBJ Cache. 2020-09-15 18:06:31 +01:00
Richard Davey
a0b47e8c5f Geom.ParseObj is a new function that will parse a Wavefront OBJ file into model data that can be consumed by the Mesh Game Object. 2020-09-15 18:05:47 +01:00
Richard Davey
bd2c56e306 Typo fix 2020-09-15 18:04:26 +01:00
Richard Davey
8ff1c7ca50 Update CHANGELOG-v3.50.md 2020-09-15 12:02:45 +01:00
Richard Davey
d8a8aa8448 Added clearVertices and renamed to addVertices so you can append on more verts post-creation 2020-09-15 11:57:44 +01:00
Richard Davey
b763fa0f18 The Mesh now renders by iterating through the Faces array, not the vertices. This allows you to use Array methods such as BringToTop to reposition a Face, thus changing the drawing order without having to repopulate all of the vertices. 2020-09-15 11:57:22 +01:00
Richard Davey
5e5b8c0938 The WebGLPipeline.shouldFlush method now accepts an optional parameter amount. If given, it will return true if when the amount is added to the vertex count it will exceed the vertex capacity. The Multi Pipeline has been updated to now use this method instead of performing the comparison multiple times itself. 2020-09-15 11:54:12 +01:00
Richard Davey
36e675fa42 Update CHANGELOG-v3.50.md 2020-09-15 10:37:22 +01:00
Richard Davey
08b4597b72 Improved JSDocs 2020-09-15 10:37:19 +01:00
Richard Davey
99c12540f7 Utils.Array.Matrix.Translate is a new function that will translate an Array Matrix by horizontally and vertically by the given amounts. 2020-09-15 10:35:53 +01:00
Richard Davey
ece3043908 Deps update 2020-09-15 09:32:43 +01:00
Richard Davey
92982d810b Added ability to get InCenter. translate and rotate Face 2020-09-14 17:35:06 +01:00
Richard Davey
52d5b00fe5 Added setPosition and translate methods 2020-09-14 17:34:47 +01:00
Richard Davey
f97042193f Beta 7 tag 2020-09-14 15:35:00 +01:00
Richard Davey
99d1c76b84 Update CHANGELOG-v3.50.md 2020-09-14 15:34:01 +01:00
Richard Davey
6a966e3f3b Removed interpolationPercentage parameter from all render methods, as it has never been used. 2020-09-14 15:33:58 +01:00
Richard Davey
83f8f007d1 Now uses GetCalcMatrix 2020-09-14 15:22:16 +01:00
Richard Davey
3dbc547402 Update CHANGELOG-v3.50.md 2020-09-14 15:09:37 +01:00
Richard Davey
1057ead114 Dump all of the old mega arrays and replace with an array of Vertex instances. 2020-09-14 15:09:34 +01:00
Richard Davey
36a33745b6 Expose Vertex and Face 2020-09-14 15:09:12 +01:00
Richard Davey
6a3ce21702 GameObject.Face is a new micro class that consists of references to the three Vertex instances that construct the single Face. 2020-09-14 15:08:36 +01:00
Richard Davey
8fc969088c GameObject.Vertex is a new micro class that encapsulates all of the data required for a single vertex, such as position, uv, color and alpha. This class is now created internally by the Mesh Game Object. 2020-09-14 15:08:25 +01:00
Richard Davey
3fa0070e50 Now uses white texture and tintEffect mode 1 2020-09-14 15:03:04 +01:00
Richard Davey
87c8e75ece Updated JSDocs 2020-09-14 15:02:21 +01:00
Richard Davey
951457c881 As a result of the change to the shader, all uses of the WebGL Util function getTintAppendFloatAlphaAndSwap have been replaced with getTintAppendFloatAlpha instead. 2020-09-14 15:02:13 +01:00
Richard Davey
194257d199 Create GetCalcMatrixResults.js 2020-09-14 15:01:45 +01:00
Richard Davey
8d25510b61 GameObjects.GetCalcMatrix is a new function that is used to calculate the transformed Game Object matrix, based on the given Game Object, Camera and Parent. This function is now used by the following Game Objects: BitmapText (Static and Dynamic), Graphics, Mesh, Rope, Shader, Arc, Curve, Ellipse, Grid, IsoBox, IsoTriangle, Line, Polygon, Rectangle, Star and Triangle. This dramatically reduces the amount of duplicate code across the API. 2020-09-14 15:01:40 +01:00
Richard Davey
4795c56d79 Config.images.white is a new Game Config property that specifies the 4x4 white PNG texture used by Graphics rendering. You can override this via the config, but only do so if needed. 2020-09-14 14:57:08 +01:00
Richard Davey
e368c479a0 The TextureManager now generates a new texture with the key __WHITE durings its boot process. This is a pure white 4x4 texture used by the Graphics pipelines. 2020-09-14 14:54:58 +01:00
Richard Davey
81800e0ce2 WebGLRenderer.whiteTexture is a new property that is a reference to a pure white 4x4 texture that is created during Boot by the Texture Manager. The Multi Pipeline uses this internally for all Graphic, Shape and fill rendering. 2020-09-14 14:44:29 +01:00
Richard Davey
81b63cdf20 The Rope.tintFill property is now a boolean, not an integer, and can no longer take 2 as a value for a complete fill. Instead, you should provide a solid color texture with no alpha. 2020-09-14 11:12:41 +01:00
Richard Davey
f7fb186047 Update CHANGELOG-v3.50.md 2020-09-14 11:06:20 +01:00
Richard Davey
e5ce83aebd New direct tint value 2020-09-14 11:06:16 +01:00
Richard Davey
0f6cc79cd1 The function GetColorFromValue has been removed as it's no longer used internally. 2020-09-14 11:05:32 +01:00
Richard Davey
4ade25fc79 No longer read private values for tint
The `Multi Pipeline`, `Bitmap Text`, `Render Texture`, `Text`, `TileSprite` and `Camera` now all read the tint values from the public properties instead of the private `_tintTL` etc ones. They also now set the `tintEffect` value directly from the `tintFill` property, removing another conditional check.
2020-09-14 11:05:09 +01:00
Richard Davey
75c5f11aee Updated shader source RGB to BGR and removed if-else block
* The `Single.frag`, `Light.frag` and `Multi.frag` shaders have all been updated so they now read the color value as `outTint.bgr` instead of `outTint.rgb`. This allows the colors to remain in RGB order within the Tint component.
* The `Single.frag`, `Light.frag` and `Multi.frag` shaders have all been updated so they no longer have a 3-way check on the `outTintEffect` value.
2020-09-14 11:02:02 +01:00
Richard Davey
6d09f1fe40 Refactored Tint component
* `Tint.tintTopLeft` is now a normal property in RGB order, not a setter, and no longer passes through the `GetColorFromValue` function. This directly replaces the private property `_tintTL` which has now been removed.
* `Tint.tintTopRight` is now a normal property in RGB order, not a setter, and no longer passes through the `GetColorFromValue` function. This directly replaces the private property `_tintTR` which has now been removed.
* `Tint.tintBottomLeft` is now a normal property in RGB order, not a setter, and no longer passes through the `GetColorFromValue` function. This directly replaces the private property `_tintBL` which has now been removed.
* `Tint.tintBottomRight` is now a normal property in RGB order, not a setter, and no longer passes through the `GetColorFromValue` function. This directly replaces the private property `_tintBR` which has now been removed.
* The property `Tint._isTinted` has been removed as it's no longer required.
2020-09-14 10:59:32 +01:00
Richard Davey
ea0abc4f69 Tidy up the formatting 2020-09-14 09:44:17 +01:00
Richard Davey
b7eb869d8c Update CHANGELOG-v3.50.md 2020-09-14 09:24:02 +01:00
Richard Davey
17ed707acb The Loader.path was being added to the File URL even if the URL was absolute. This is now checked for and the path is not applied unless the URL is relative #5301 2020-09-14 09:23:59 +01:00
Richard Davey
ae067861f6 Update CHANGELOG-v3.50.md 2020-09-13 23:11:06 +01:00
Richard Davey
25b5c2d1d1 Loads of new Mesh updates
* `Mesh.setVertices` is a new method that allows you to set the verts of a Mesh Game Object from the given parameters. This allows you to modify a mesh post-creation, or populate it with data at a later stage.
* The Mesh constructor signature has changed to `scene, x, y, vertices, uvs, indicies, colors, alphas, texture, frame`, where `indicies` is the new parameter added to the list. It allows you to provide indexed vertex data to create the Mesh from, where the `indicies` array holds the vertex index information. The final list of vertices is built from this index along with the provided vertices and uvs arrays.
* You can now supply just a single numerical value as the `color` parameter in the constructor, factory method and `setVertices` method. If a number, instead of an array, it will be used as the color for all vertices created.
* You can now supply just a single numerical value as the `alpha` parameter in the constructor, factory method and `setVertices` method. If a number, instead of an array, it will be used as the alpha for all vertices created.
* The `Mesh` Game Object now extends the `SingleAlpha` component and the alpha value is factored into the final alpha value per vertex during rendering. This means you can now set the whole alpha across the Mesh using the standard `setAlpha` methods. But, if you wish to, you can still control the alpha on a per-vertex basis as well.
* The `Mesh` Game Object now has the Animation State Component. This allows you to create and play animations across the texture of a Mesh, something that previously wasn't possible. As a result, the Mesh now adds itself to the Update List when added to a Scene.
* `Mesh.setDebug` is a new method that allows you to render a debug visualisation of the Mesh vertices to a Graphics Game Object. You can provide your own Graphics instance and optionally callback that is invoked during rendering. This allows you to easily visualise the vertices of your Mesh to help debug UV mapping.
* `Mesh.debugGraphic` is a new property that holds the debug Graphics instance reference.
* `Mesh.debugCallback` is a new property that holds the debug render callback.
* `Mesh.renderDebugVerts` is a new method that acts as the default render callback for `setDebug` if none is provided.
* `Mesh.preDestroy` is a new method that will clean-up the Mesh arrays and debug references on destruction.
2020-09-13 23:11:04 +01:00
Richard Davey
3fd52ecdd3 Added debug draw 2020-09-13 17:16:17 +01:00
Richard Davey
c76b084f2e Merge branch 'master' of https://github.com/photonstorm/phaser 2020-09-13 15:17:13 +01:00
Richard Davey
1ba5be5476 Update CHANGELOG-v3.50.md 2020-09-13 15:17:09 +01:00