Richard Davey
aae1cf5ae5
Tidying up
2018-12-13 13:10:31 +00:00
Richard Davey
ffd217dbdd
Fixed size calculation and updated docs
2018-12-13 11:46:17 +00:00
Richard Davey
eef553d4c2
Fixed layer size calculations. Also changed rendering to use tileset tile sizes, as it should do.
2018-12-13 11:07:53 +00:00
Richard Davey
74d5af20c6
Tidying up
2018-12-13 11:07:20 +00:00
Richard Davey
79ee2229ad
Merge pull request #4207 from tfelix/fix/tilemap-layer-typedef-fix
...
fixes the typedef for the layer parameter
2018-12-12 11:28:57 +00:00
Richard Davey
2780babe10
Final Doc Jam merge
2018-12-03 15:16:23 +00:00
Thomas Felix
bd5f2b3bf5
fixes the typedef for the layer parameter
...
The layer parameter is used to call getLayer() so the parameter type for
the parent function should match the on of getLayer().
2018-12-01 20:40:17 +01:00
Richard Davey
6f8759c186
Whenever Camera.roundPixels
was enabled it would use a bitwise operation to truncate the float (x |= 0
) - this has been replaced across all files that used it, with a call to Math.round
instead. This gives far better results when zooming cameras both in and out of a Scene, stopping thin gaps appearing between closely packed Game Objects.
2018-11-30 10:27:25 +00:00
Richard Davey
1e32537276
Merge branch 'master' of https://github.com/photonstorm/phaser
2018-11-20 12:45:52 +00:00
Richard Davey
625955178e
Updated docs
2018-11-20 12:45:47 +00:00
Richard Davey
ee2459652c
Merge pull request #4173 from WaSa42/master
...
Fix: Cannot read property 'index' of undefined at GetTileAt and RemoveTileAt
2018-11-20 12:41:53 +00:00
Richard Davey
5c45b477b3
Fixed lint errors in #4152
2018-11-20 12:33:08 +00:00
Richard Davey
45342229cb
Merge pull request #4152 from quadrupleslap-forks-things/master
...
Fix Tile.tileset to return just the containing tileset instead of all…
2018-11-20 12:28:53 +00:00
Richard Davey
5985e33caf
Merge pull request #4105 from the-realest-stu/master
...
Fix #4104
2018-11-20 11:05:05 +00:00
Nicolas Rouvière
7b9f7f0217
Fix: Cannot read property 'index' of undefined at GetTileAt and RemoveTileAt
2018-11-19 00:08:36 +01:00
Ram Kaniyur
e5ebfe861f
Fix Tile.tileset to return just the containing tileset instead of all of them.
2018-11-08 21:27:16 +11:00
Richard Davey
956a0913b8
Added new jsdocs
2018-10-22 12:12:31 +01:00
Richard Davey
a73249563e
Fixed formatting
2018-10-19 13:51:32 +01:00
Richard Davey
0eafcc0d57
Merge pull request #4119 from nkholski/master
...
Pick up animation data from Tiled 1.2+
2018-10-19 13:49:10 +01:00
Richard Davey
8a58ceeded
Merge pull request #4113 from Siyalatas/culling-fix
...
Simple fix for a reference error when culling tilemaps
2018-10-19 13:36:31 +01:00
Richard Davey
4c4421c47f
Docjam merge
2018-10-19 12:32:43 +01:00
Niklas Berg
206c12d70d
Pick up animation data from Tiled 1.2+
2018-10-17 15:12:41 +02:00
foobar
e481ea4cfd
Fix reference error when culling
2018-10-15 20:31:46 +02:00
Richard Davey
4b1c762296
Updated @memberOf to @memberof
2018-10-10 10:49:13 +01:00
Stuart Lindstrom
526067f7b6
Fix #4104
2018-10-09 14:34:47 -04:00
Richard Davey
a9063604dc
Replace @readOnly with @readonly
2018-10-09 13:40:00 +01:00
Richard Davey
1b85512de2
Fixed a bug in the canvas rendering of both the Static and Dynamic Tilemap Layers where the camera matrix was being multiplied twice with the layer, causing the scale and placement to be off
2018-10-02 12:51:02 +01:00
Richard Davey
e297b3272e
Added hundreds of new jsdoc descriptions
2018-10-01 11:35:01 +01:00
Richard Davey
b687f051e9
Added new jsdocs
2018-09-28 15:00:55 +01:00
Richard Davey
c16ea9b93d
Completed DynamicTilemapLayer jsdocs
2018-09-28 14:46:31 +01:00
Richard Davey
5115847791
Finished all the Tilemap component descriptions
2018-09-28 14:32:36 +01:00
Richard Davey
43067aa30e
Completed Tilemap class docs
2018-09-28 14:02:12 +01:00
Richard Davey
95d4651db8
Dynamic Layers support multiple tilesets now
2018-09-27 13:09:40 +01:00
Richard Davey
0d5b209259
Consolidated gidMap creation
2018-09-27 13:09:23 +01:00
Richard Davey
e05f7c7ed0
Dynamic Tilemap Layers now support multiple tilesets per layer
2018-09-27 13:09:08 +01:00
Richard Davey
d92c7bf5b0
Added setTilesets
method.
2018-09-27 12:12:29 +01:00
Richard Davey
d59f772d66
Tilemap.getTileset
is a new method that will return a Tileset based on its name.
2018-09-27 12:12:16 +01:00
Richard Davey
53b57ccbab
Clear arrays on destroy and updated docs
2018-09-27 11:48:04 +01:00
Richard Davey
07e1f07caf
Added support for Static Tilemap Layers to support multiple Tilesets per layer.
2018-09-27 11:34:37 +01:00
Richard Davey
c1d6e438cc
Removed un-used property.
2018-09-27 11:34:13 +01:00
Richard Davey
39c55ef719
Made warnings shorter.
2018-09-27 11:33:58 +01:00
Richard Davey
bed4abc8ed
Updated ParseTilesets function to handle Tiled 1.2 and 1.1 formats
2018-09-27 00:41:11 +01:00
Richard Davey
32bd01daba
If you used a scaled Dynamic Tilemap Layer and rotated or flipped tiles, the tiles that were rotated or flipped would be positioned incorrectly in WebGL. Fix #3778
2018-09-26 16:49:18 +01:00
Richard Davey
25f8d29659
If you used a RenderTexture as a tileset then Dynamic Tilemap Layers would render the tiles inversed on the y-axis in WebGL. Fix #4017
2018-09-26 16:32:27 +01:00
Richard Davey
b4e59405b4
Calling Tilemap.renderDebug
ignored the layer scale when drawing to the Graphics object. It will now scale the layer before drawing. Fix #4026
2018-09-26 16:18:44 +01:00
Richard Davey
c0e5197f7c
Static Tilemap Layers now support tile rotation and flipping. Previously this was a feature only for Dynamic Tilemap Layers, but now both have it. Close #4037
2018-09-26 16:07:32 +01:00
Richard Davey
94d21da3ca
The Static Tilemap Layer would stop drawing all tiles from that point on, if it encountered a tile which had invalid texture coordinates (such as a tile from another tileset). It now skips invalid tiles properly again. Fix #4002
2018-09-26 15:27:19 +01:00
Richard Davey
13a72f961e
lint fix
2018-09-25 16:23:14 +01:00
Richard Davey
2985a97c56
TileSet.getTileData()
has been updated so it will return tile data from either Tiled 1.1.x or the new Tiled 1.2.x JSON structure. Fix #3998
2018-09-25 16:20:34 +01:00
Richard Davey
df8c0d8673
Calling Tilemap.renderDebug
ignored the layer world position when drawing to the Graphics object. It will now translate to the layer position before drawing. Fix #4061
2018-09-25 15:37:46 +01:00
Richard Davey
41920b07cc
Tilemap.setBaseTileSize
now sets the size into the LayerData baseTileWidth
and baseTileHeight
properties accordingly. Fix #4057
2018-09-25 15:19:57 +01:00
Richard Davey
89b9f42f3e
Adding jsdocs
2018-09-24 23:20:43 +01:00
Richard Davey
502b66bcac
lint fix
2018-08-21 18:13:53 +01:00
Richard Davey
f8b3fcf539
Cull Tiles now needs a render order for the layer data.
2018-08-21 18:02:00 +01:00
Richard Davey
838cdfc418
Added renderOrder property, setRenderOrder method and updated upload to use the setting.
2018-08-21 18:01:47 +01:00
Richard Davey
cc5bf41b25
Added renderOrder property and setRenderOrder method.
2018-08-21 18:01:33 +01:00
Richard Davey
b0888d2762
Added renderOrder property, setRenderOrder and apply them during layer creation.
2018-08-21 17:59:28 +01:00
Richard Davey
a7847e9cb9
Added renderOrder property.
2018-08-21 17:55:40 +01:00
Richard Davey
a462250cd9
Now extracts the renderorder property from the Tiled JSON
2018-08-21 17:54:49 +01:00
Richard Davey
36dd7ae405
Merge pull request #3819 from samme/feature/createFromObjects
...
Copy custom properties in createFromObjects()
2018-08-21 15:38:48 +01:00
rootasjey
e2c505554a
Fix JSDoc in Tilemap
2018-08-20 13:20:23 +02:00
Richard Davey
fcf5d20d7b
Disable culling if layer has non-1 scroll factor #3893
2018-08-06 22:22:32 +01:00
Richard Davey
702e738ffc
When a Static Tilemap Layer is generated in WebGL it will use the Cameras roundPixels
value to clamp the tile coordinates.
2018-08-06 14:16:36 +01:00
Richard Davey
86965c28e4
The Tilemap Culling function now uses the Tilemap tile dimensions for its bounds calculations, instead of the layer tile sizes, as they two don't have to match and it's the underlying grid size that takes precedence when calculating visible tiles. Fix #3893
2018-08-06 13:31:27 +01:00
Richard Davey
4deb8e49ad
eslint fixes
2018-08-03 19:37:42 +01:00
Richard Davey
ae46e11e35
Skip processing if no tiles
2018-08-03 18:56:52 +01:00
Richard Davey
e8e32ecf2c
Swap look-up for direct reference
2018-08-03 18:56:12 +01:00
Richard Davey
70b234952a
Updated the canvas tilemap layer renderers to support parent matrix and tidied up the internal flow
2018-08-03 00:50:45 +01:00
Richard Davey
6ef7033b44
Added in parent matrix support and refactored the drawing
2018-08-03 00:42:27 +01:00
Richard Davey
31421ee00a
The CullTiles
updates from 3.11 didn't factor in the position of the Tilemap Layer to its bounds calculations, causing Static layers displayed out of the Camera viewport to never render in Canvas mode. The method has also been optimized further, with less divisions and less checks if culling is disabled.
2018-08-03 00:40:56 +01:00
Richard Davey
318cc87e59
Use proper matrix for static layer, so we can do fun things with Render Textures
2018-08-02 22:15:08 +01:00
Richard Davey
8135b687fb
Added all the missing cull methods and properties into the Static Tilemap Layer, which is used by the Canvas Renderer
2018-08-02 22:14:51 +01:00
Richard Davey
f1d3412c38
Corrected data types
2018-08-02 22:14:32 +01:00
Richard Davey
0967bfcab4
Should use currentContext, not gameContext
2018-08-02 17:59:30 +01:00
Richard Davey
f540d03346
Removed un-needed checks (willRender
handles it now)
2018-08-01 16:03:58 +01:00
ampled
50c787a9c8
- add typedef for SpriteConfig extends GameObjectConfig
...
- allow update-function signature to be overriden by GameObject subclasses
2018-07-29 12:19:04 +02:00
Skysteed
5cd60b3378
Major Optimization for Tilemap Collision Indexing
...
This update optimizes an existing feature (Tilemap Collision Indexing).
This optimization will apply to [nearly] everyone using procedural generation tilemaps, infinite tilemaps, multiplayer tilemaps, particularly large tilemaps (especially those dyanmic in nature) or who otherwise intend to index collisions before the tiles are loaded.
Benchmarking:
Using the standard approach, indexing collisions for a 500x450 tileset took 2530ms. By pre-building the collision index array in its entirety, I was able to reduce that to 259ms. However, this implementation reduces it to 8 ms. Larger tilemaps would be exponentially affected.
There are some considerations to make here since there are better implementations, but it would require deprecating some existing code. The advantage would be that the standard approach itself would be optimized, (thus avoiding the sort of 2500+ms costs here), rather than fairly obscured as it is with this implementation.
2018-07-19 10:59:35 -05:00
Richard Davey
20f1b37256
eslint fix and log update
2018-07-18 15:06:56 +01:00
Richard Davey
5ada70409e
Modified tile sizes.
2018-07-16 15:20:46 +01:00
Richard Davey
0cc52f6002
Swapped 4 ternaries for a single conditional #3834
2018-07-16 14:55:51 +01:00
tarsupin
ad24a0b8ec
Removed repetative code.
2018-07-14 20:09:36 -05:00
tarsupin
00a38f744a
Switching tabs to spaces
2018-07-14 14:41:13 -05:00
tarsupin
9ac505d5cc
Build is requiring me to pre-declare x, y, tile.
2018-07-14 14:38:19 -05:00
tarsupin
4fa3dc7159
Update CullTiles.js
2018-07-14 14:30:15 -05:00
tarsupin
e3d64c63b3
Major Optimization for Culling Tilemaps
...
Refine the loop to only scan through the drawn boundaries that are being tested against (except when skipping cull). This eliminates a huge bottleneck / lookup time from the original loop each frame.
The update should affect tilemaps exponentially based on their size. It reduced my culling time to 1/70th for 1000x1000 tilemaps, and by about 1/20th on 250x250 tilemaps. It also reduced my requestAnimationFrame time from over 16ms per frame to ~1ms for the larger map.
2018-07-14 14:14:55 -05:00
samme
b7ca32eb40
Copy custom properties in createFromObjects()
...
Closes #3808
2018-07-14 09:43:21 -07:00
Richard Davey
b4ddd44105
Added cullCallback
support - the final step in culling. Don't like ours? Roll your own!
2018-07-12 17:06:36 +01:00
Richard Davey
8981cf4a03
Swapped from vec2 to explicit values for cullPadding
2018-07-12 16:51:54 +01:00
Richard Davey
b03d3ff783
Added support for cull padding
2018-07-12 16:44:36 +01:00
Richard Davey
e66cf4e00b
Adjusted bounds +- 1 tile
2018-07-12 16:32:25 +01:00
Richard Davey
4b607a3cca
Removed cull tests
2018-07-12 16:32:12 +01:00
Richard Davey
12c6736c67
Stats recorded in tilesDrawn
and tilesTotal
.
2018-07-12 16:12:55 +01:00
Richard Davey
89db84377e
Added skipCull
property and setSkipCull
method
2018-07-12 15:31:25 +01:00
Richard Davey
a8fa98e39b
Skip all rendering if alpha <= 0
2018-07-12 15:31:00 +01:00
Richard Davey
a447d85401
CullTiles recoded to use Camera worldView - finally, properly culling, regardless of layer scale or camera zoom! Fix #3818
2018-07-12 15:07:45 +01:00
Richard Davey
869087044b
Starting work on proper tile culling
2018-07-12 01:14:34 +01:00
Richard Davey
d9ac16bcb0
Shorter texture path
2018-07-12 01:14:02 +01:00
Richard Davey
5fdf51ce59
Using direct pipeline calls
2018-07-02 13:32:56 +01:00
Richard Davey
17112ecd20
Tileset.glTexture
is a new property that maps to the WebGL Texture for the Tileset image. It's used internally by the renderer to avoid expensive object look-ups and is set automatically in the Tileset.setImage
method.
2018-07-02 13:32:35 +01:00
Richard Davey
1941d8a494
Removed drawStaticTilemapLayer
method and updated layer vertex code
2018-07-02 12:07:39 +01:00