I have changed a few bits and pieces but it still takes about 6 seconds for one chunk to process the lighting.
I have tried:
[quote]-Nesting (performance intensive)if statements so that if one fail’s, it wont still call the other method(s).
-Like, above if a ‘test’ fails, i exit out of method/move to next item in loop to skip other ‘tests’
-Created a Vector3i class for integers, because i read that casting values to other types (like: float f = (float)intVal) can reduce performance.
-Made it so only points with at least 1 block (directly) adjacent to it would be added to the ‘process list’ called ‘litPoints’, Unless below is true:
—If a points doesn’t have at least 1 block directly to its up, down, n, e, s, w directions then id it does have a block diagonally to it, then it is processed.
[/quote]
I think that is it.
I will post relevant code below(Also current performance output), if you have any ways i can improve performance/execution time please tell me, Thanks.
updateLightMap(ENTRY POINT): http://pastebin.com/XCkn6KZb
updateLightMap Util Methods: http://pastebin.com/yAW0f0K5
Execution Time Output:
[INFO] [Sat Jan 02 14:52:15 GMT 2016] [org.voxelgame.data.Chunk] Chunk(0, 0, 0) -> getNeighbours(true) -> Execution Time: 72ms
[INFO] [Sat Jan 02 14:52:17 GMT 2016] [org.voxelgame.data.Chunk] Chunk(0, 0, 0) -> hasNonAirNeighbour() -> Execution Time: 2ms
[INFO] [Sat Jan 02 14:52:17 GMT 2016] [org.voxelgame.data.Chunk] Chunk(0, 0, 0) -> getNeighbours(true) -> Execution Time: 3ms
[INFO] [Sat Jan 02 14:52:17 GMT 2016] [org.voxelgame.data.Chunk] Chunk(0, 0, 0) -> getNeighbours(true) -> Execution Time: 1ms
[INFO] [Sat Jan 02 14:52:18 GMT 2016] [org.voxelgame.data.Chunk] Chunk(0, 0, 0) -> getNeighbours(true) -> Execution Time: 141ms
[INFO] [Sat Jan 02 14:52:19 GMT 2016] [org.voxelgame.data.Chunk] Chunk(0, 0, 0) -> updateLightMap -> Loop Points -> Execution Time: 5.921s