Pete Baron
550954210e
Clean-up and comments.
2016-07-18 13:24:29 +12:00
Pete Baron
9daf6d0525
Clean-up and comments.
2016-07-18 13:19:15 +12:00
Pete Baron
5f6ea15c58
Clean-up and comments.
2016-07-18 13:09:43 +12:00
Pete Baron
263238ba42
Comments and clean-up.
2016-07-18 12:56:34 +12:00
Pete Baron
83b73f6a77
Update progress.
2016-07-18 12:44:22 +12:00
Pete Baron
fdb80f1a55
Modify Tile Shader to produce scaled layers that look identical to the Canvas renderer scaling (add uCentreOffset, scale the drawing coordinates, subtract uCentreOffset).
2016-07-18 12:43:59 +12:00
Pete Baron
0b392e19a2
Remove unused precalculated u/v scale factor.
2016-07-18 12:41:32 +12:00
Pete Baron
e87fc84527
comment - Tile.scale is currently unused
2016-07-18 12:40:08 +12:00
Pete Baron
2a2c82ee3d
Fixed the alpha blending (copied the approach from the TriangleStrip PIXI shader) for Tilemap layers. The "blank tilemap" example now works properly and blends the background layers when you use the number keys to switch primary layers.
2016-06-28 00:28:28 +12:00
Pete Baron
9e3a7ec537
Modified the batch creation code and the batch drawing code to only insert degenerate triangles at the end of rows or when a row is broken (e.g. by some empty tiles which we won't draw at all). This should speed things up by optimising the draw, and reducing the amount of data required to describe the batch.
...
PIXI.Tilemap - _renderBatch using a local 'degenerate' flag to signal to next iteration that one should be inserted before the next triangle.
Phaser.TilemapLayerGL - add degenerate markers at end of rows and whenever a row has a break in it (e.g. empty tiles)
Phaser.Tileset - new addDegenerate function which prevents double markers in a row
2016-06-27 18:24:56 +12:00
Pete Baron
626d0cf64f
Latest progress notes.
2016-06-27 16:09:22 +12:00
Pete Baron
2a4049d5ef
Pass each Tile.alpha value and store it with the glBatch data.
...
NOTE: if implemented this will have to break the tile batch into separate batches based on the alpha values! Need a chat with Rich...
2016-06-27 16:09:01 +12:00
Pete Baron
d43f29d839
Use the tilemap layer alpha value when batch rendering tiles.
2016-06-27 16:07:24 +12:00
Pete Baron
61635c930e
Added offsets to render large tiles at the correct (according to Tiled editor) positions.
2016-06-27 15:21:55 +12:00
Pete Baron
b8c81c21c9
Removed resolveTileset from TilemapLayerGL, added new task to task list.
2016-06-27 15:14:08 +12:00
Pete Baron
20b3d92b9b
Fixed large tiles vanishing at screen edges by making a clear distinction between the original tilemap tile width and height, and the collision width and height of tiles for each layer. The difference between these two is now applied when calculating the region to be drawn to fill the screen.
2016-06-27 15:02:20 +12:00
Pete Baron
4f1728c62d
First working demo of multiple tileset sources specified in a single Tiled map layer being rendered as separate Batch drawing lists by the webgl renderer.
...
Phaser.Tilemap now creates internal map layers for each tileset except the first one (which will be handled by the createLayer call from the game). It also stores a reference to each tileset where the new map layers can access it.
Phaser.TilemapLayerGL uses the new tileset reference to ensure the correct base image and tile sizes are used for each new layer.
PIXI.Tilemap: added initialisation of glBatch to null in c'tor.
Phaser.TilemapParser was cleaned up to remove the now unnecessary tilemap parameter and the attempt to create layers while parsing.
2016-06-27 14:41:46 +12:00
Pete Baron
8d4733c8a5
Commit current state of development before trying something different (see last note in the progress doc). Will revert to previous commits if this attempt fails.
2016-06-27 11:46:52 +12:00
Pete Baron
835df12274
Notes about failed attempt to hack in the new layers approach quickly (proof of concept). The class relationship is more complex than it first appears and there are some odd connections and label namings which make it hard to manipulate quickly.
2016-06-20 18:25:31 +12:00
Pete Baron
6848c90257
Added remaining task summary.
2016-06-14 01:20:43 +12:00
Pete Baron
04980c8096
Remove hack to force WEBGL mode for testing.
2016-06-14 01:02:02 +12:00
Pete Baron
11c5300591
Remove dubious use of tile.index to reference the tilesets list (it seems unlikely that there would ever be a tilesets value for every tile, and a huge waste of memory if it was ever done that way).
...
TODO: look into putting the tileset index (or a tileset reference) into each Tile structure when building them to avoid resolveTilesets entirely too.
2016-06-14 00:43:46 +12:00
Pete Baron
7533005a62
Fix buffer size bug.
2016-06-14 00:00:18 +12:00
Pete Baron
b406d10d94
Comments, and removed reinitialisation of the glBatch list.
2016-06-13 18:40:51 +12:00
Pete Baron
310b151924
Removed pixiTest flag, using renderType instead.
2016-06-13 18:39:52 +12:00
Pete Baron
a648026fa4
Progress update.
2016-06-13 18:39:16 +12:00
Pete Baron
c7476a6583
Fixed bug where scroll was effectively applied twice.
2016-06-13 18:38:55 +12:00
Pete Baron
446eab60af
Progress update.
2016-06-13 17:47:25 +12:00
Pete Baron
05efcfe36e
Modified my PIXI.Tilemap class to accept the glBatch list of tile source and destination coordinates, convert them into a GL TRIANGLE_STRIP data buffer, then draw them as a single batch WebGL draw.
2016-06-13 17:28:35 +12:00
Pete Baron
a8405bd066
add comment
2016-06-13 17:26:33 +12:00
Pete Baron
57a6245f25
Made a copy of Phaser.TilemapLayer which instead extends PIXI.Tilemap, then added functions to build a batch list of tile source and destination coordinates (instead of drawing them directly onto a Canvas). This maintains all the existing Phaser functionality in regards to tile map decoding and interpretation, and also provides maximum performance from the PIXI component by using a TRIANGLE_STRIP to render everything as a single batch job.
2016-06-13 17:25:50 +12:00
Pete Baron
94d49f1196
Add GL variant of the Tileset.draw function for new approach to WebGL tile drawing (utilising most of the existing Phaser code unchanged)
2016-06-13 17:13:13 +12:00
Pete Baron
9450cecbe3
Progress update.
2016-05-26 14:13:18 +12:00
Pete Baron
0904e386de
Use firstgid (TODO: assumes tileset 0 currently, needs to calculate the correct tileset) to fix the 'out by one' tilemap example errors.
...
Handle empty VBO case, and make sure we only drawArrays the correct number of vertices (to fix the large corrupt block in the top-right corner of many example demos).
2016-05-26 14:13:07 +12:00
Pete Baron
0dd3610ee4
Minor optimisation in TilemapLayerGL to remove unnecessary loop.
2016-05-26 14:10:45 +12:00
Pete Baron
5b6e157a43
Progress update.
2016-05-23 21:22:00 +12:00
Pete Baron
a9bf339efd
Fully working sci-fly demo using a single gl draw to blit all of the tiles at once. Theoretically extremely fast (requires testing). Works here in FireFox and Chrome at 60 fps on an i7 4770 with Nvidia 780 GTX drawing typically 1989 tiles per frame.
2016-05-23 21:09:13 +12:00
Pete Baron
1b7eaadd06
First (nearly) working batch drawing test. Instead of pushing rectangles as pairs of triangles individually, this version creates a vertex buffer object for all visible tile rectangles, with degenerate triangles separating each one from the next. The drawing is done by a single call to gl.drawArrays.
...
Bizarrely, this version still chokes in Firefox, implying that the previous demo's horrible performance was not down to the GPU blocking as the rectangles are sent to it.
The test is not fully working because it does not scroll the drawing position. So instead of the map moving when you hit a scroll boundary, it simply stops drawing the top or left edges as the scroll region moves away from the visible window. It's an easy fix, but I think I'll leave it until I find out exactly why Firefox still chokes on this demo.
Progress text file updated with latest experiments and progress today.
2016-05-23 17:48:54 +12:00
Pete Baron
55870bce8a
Results of retesting for all tilemap examples. Most work with many having an 'out by one' tile issue (I've requested help from Rich on this). I'll investigate the other failures now.
2016-05-13 15:08:53 +12:00
Pete Baron
90dcdbfa98
Log file of progress on Tilemap GL work.
2016-05-13 14:41:24 +12:00
Pete Baron
5c6ad9cbcb
Fix double subtraction error.
2016-05-13 14:34:24 +12:00
Pete Baron
e396c266b8
Use the correctly scaled scrollX, scrollY parameters for the scroll offsets.
...
This makes the layers in "blank tilemap" example work properly (you'll need to click the 3rd tile in the palette before drawing becomes visible - that's next up)
2016-05-13 14:13:51 +12:00
Pete Baron
5be5ddba25
Protect against zero and negative indexes (-1 is used in e.g. "blank tilemap" example).
2016-05-13 14:06:58 +12:00
Pete Baron
49b3d1a57a
Temporary modification to force webgl renderer without needing to edit all the example files.
2016-05-13 14:06:08 +12:00
Pete Baron
e0008793bd
Prepare Phaser.Tilemap for testing other examples/tilemaps with the TilemapLayerGL code.
...
Ensure that TilemapLayerGL is treated as a valid layer the same as TilemapLayer.
TODO: I've hardwired the PIXI TilemapLayerGL test flag (pixiTest) to be 'on' unless otherwise specified... need to turn this off before final commits!
2016-05-13 12:24:55 +12:00
Pete Baron
a98d0e8e70
First pass of 'clean-up': correcting comments, removing unused code
2016-05-13 12:06:18 +12:00
Pete Baron
4cfcb3b7bd
Implemented _renderMode switch and _renderVisibleTiles functionality. This speeds up the sci-fly demo hugely.
2016-05-13 11:37:33 +12:00
Pete Baron
0855e59972
Added _renderMode to switch between full-map redrawing and visible screen redrawing modes.
2016-05-13 11:36:12 +12:00
Pete Baron
5e97f10c86
Remove un-needed mixin components leaving only FixedToCamera (not sure about this one). Move this.fixedToCamera after the Core.init call which creates the underlying core components required. Add temporary instant return from shiftCanvas in case that was being called and contributing to the slow-down (probably not).
2016-05-05 17:00:22 +12:00
Pete Baron
ef4143136e
Use this.x, this.y as scrolling offsets when rendering each tile.
2016-05-05 16:57:55 +12:00