Commit graph

167 commits

Author SHA1 Message Date
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
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
tarsupin
6613bc28e9
Fixing removeTileAt, removeTileAtWorldXY docs
The 'tile' parameter was not included in the actual code, so it's removed here from the documentation.
2018-06-30 15:09:41 -05:00
Andre van Tonder
32ff6df5b3 fixed JsDoc for Phaser.Tilemaps.Tilemap#createBlankDynamicLayer
x, y, width, height, tileWidth, tileHeight are all optional params

I also add x, y params to jsdoc  as they were missing
2018-06-27 10:33:35 +08:00
Richard Davey
7aa46657c2 Tidying up jsdocs and changing float to number 2018-06-26 23:19:14 +01:00
Richard Davey
dade336b29
Merge pull request #3782 from Upperfoot/hotfix/tile-culling
Account for position of tilemapLayer when culling tiles
2018-06-25 22:46:36 +01:00
Richard Davey
c6c9b25fdc Camera.alpha (and its related method Camera.setAlpha) allows you to get an alpha level for the entire camera. This impacts everything it is rendering, even if those objects also have their own alpha values too. You can tween the property to make the camera contents fade in / out, or you can set it as needed in your game. 2018-06-25 17:35:36 +01:00
Craig Whiteside
375b1f8f18
Pulled out calculation for tile pixel position amended with tilemapLayer position 2018-06-23 21:20:54 +01:00
Craig Whiteside
ac82e39314
Fix whitespace 2018-06-23 16:40:19 +01:00
Craig Whiteside
86f1cbcabf
Made it more specific to the tile offset. 2018-06-23 16:34:45 +01:00
Craig Whiteside
a73e47e508
Account for position of tilemapLayer when culling tiles 2018-06-23 16:28:45 +01:00
Richard Davey
5a0fe89a7e Swap _id to id 2018-06-23 12:26:39 +01:00
Richard Davey
0b8915520b Added eslint rules. Fixed incorrect ES6 use. 2018-06-11 09:05:52 +01:00
Richard Davey
3d9da060c5 Camera.shake would not effect dynamic tilemap layers. Fix #3669 2018-05-24 23:02:59 +01:00
Mike Kruk
c0ce45cfa3
Update Base64Decode.js
The array length should be 1/4 the size of the raw binary string, otherwise you end up with a bunch of undefined array values at the end.
2018-05-02 19:39:56 -04:00
Richard Davey
cd288b33c2 eslint fixes 2018-04-23 23:52:57 +01:00
Felipe Alfonso
1ce2311465 tile culling and clipping progress 2018-04-23 13:45:42 -03:00
Richard Davey
6299019838 Updated to use typeof DefinePlugin check. 2018-04-20 00:23:24 +01:00
Richard Davey
32ce8d7947 jsdoc fixes and removed un-used ResetKey file. 2018-04-19 12:30:38 +01:00
Richard Davey
ea0bdce26a Updated jsdocs 2018-04-16 16:37:07 +01:00
Richard Davey
28e2764723 More jsdoc fixes 2018-04-16 16:02:27 +01:00
Richard Davey
f02eb5874f Marked all Tilemap components as private 2018-04-16 15:25:22 +01:00
Richard Davey
18585de81d Lots of jsdoc fixes 2018-04-16 14:43:24 +01:00
Richard Davey
112a1eabb5 Typo 2018-04-12 14:25:52 +01:00
Richard Davey
9fb1a72b70 Typo 2018-04-10 15:21:10 +01:00
Richard Davey
cdfe2e0ea2 Fixed references 2018-04-10 04:13:38 +01:00
Richard Davey
e31cae93d2 Tilemap Layers should use the ComputedSize component 2018-04-05 14:43:07 +01:00
Richard Davey
e29de6a9b3 Merge branch 'master' of https://github.com/photonstorm/phaser 2018-04-03 17:30:26 +01:00
Richard Davey
a2535d4597 jsdoc fix 2018-04-03 17:30:15 +01:00
Felipe Alfonso
e50c42e0b8 Fixed issue with static tilemap layer not getting the real texture dimension
issue ref: https://github.com/photonstorm/phaser/issues/3407
2018-04-03 13:24:14 -03:00
Richard Davey
747f09af86 jsdoc fixes 2018-03-28 15:04:09 +01:00
Richard Davey
eebe58f1c9 Removed duplicate parameters 2018-03-21 15:17:40 +00:00
orblazer
9375bb0530 Fix multiple types on Tilemaps 2018-03-20 16:11:33 +01:00
orblazer
30f410d1d3 Fix types in Tilemaps 2018-03-20 12:36:35 +01:00
orblazer
cb708dcc32 Update JSDoc on Textures, Tilemaps and Time 2018-03-19 02:03:17 +01:00
Richard Davey
2ea8489716 Tidying up 2018-03-16 18:08:51 +00:00
Bugi Görtz
077d933bbb Fixed Tile-Culling for Zoomed Camera
The fix from https://github.com/photonstorm/phaser/pull/3354/ leads to some tiles getting culled when camera is zoomed as the camera.scrollX/camera.scrollY-Properties are needed in unscaled Coordinates (World-Coordinates?) in CullTile.js

Error gets bigger with distance from (0|0)
2018-03-15 20:32:09 +01:00
Michael Hadley
d966aaa412
Fixes #3395 2018-03-15 06:22:22 -05:00
Richard Davey
edf1aa7cc1 The onContextRestored callback won't be defined any more unless the WebGL Renderer is in use in the following objects: BitmapMask, Static Tilemap, TileSprite and Text. This should allow those objects to now work in HEADLESS mode. Fix #3368 2018-03-12 13:37:13 +00:00
Felipe Alfonso
6293233488 Implemented static tilemap layer scale and tilemap alpha 2018-02-22 01:16:10 -03:00
Felipe Alfonso
a218cd5f4a Fixed issue with vertex buffer creation on Static Tilemap Layer 2018-02-22 01:07:43 -03:00
Richard Davey
7126f80615 Fixed jsdocs 2018-02-22 01:38:19 +00:00
Richard Davey
e1554c34d6 eslint fixes 2018-02-16 18:07:49 +00:00
Felipe Alfonso
74abb96211 Added alpha and tint to static tilemap layer. Fixed BitmapMask binding resources issue. 2018-02-14 16:45:22 -03:00