add ambient/sky light value support when loading/saving TileMaps
This commit is contained in:
parent
a801fe5c58
commit
7795b5046c
|
@ -10,6 +10,8 @@ public class JsonTileMap {
|
||||||
public int heightInChunks;
|
public int heightInChunks;
|
||||||
public int depthInChunks;
|
public int depthInChunks;
|
||||||
public String lightingMode;
|
public String lightingMode;
|
||||||
|
public int ambientLightValue;
|
||||||
|
public int skyLightValue;
|
||||||
public String tileMeshes;
|
public String tileMeshes;
|
||||||
public ArrayList<String> chunks;
|
public ArrayList<String> chunks;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,9 @@ public class TileMapJsonLoader {
|
||||||
lighter
|
lighter
|
||||||
);
|
);
|
||||||
|
|
||||||
|
tileMap.ambientLightValue = (byte)definition.ambientLightValue;
|
||||||
|
tileMap.skyLightValue = (byte)definition.skyLightValue;
|
||||||
|
|
||||||
for (int i = 0; i < definition.chunks.size(); ++i) {
|
for (int i = 0; i < definition.chunks.size(); ++i) {
|
||||||
String encodedChunk = definition.chunks.get(i);
|
String encodedChunk = definition.chunks.get(i);
|
||||||
TileChunk outputChunk = tileMap.getChunks()[i];
|
TileChunk outputChunk = tileMap.getChunks()[i];
|
||||||
|
|
|
@ -32,6 +32,9 @@ public class TileMapSaver {
|
||||||
else if (tileMap.lighter instanceof LightSpreadingTileMapLighter)
|
else if (tileMap.lighter instanceof LightSpreadingTileMapLighter)
|
||||||
jsonMap.lightingMode = "skyAndSources";
|
jsonMap.lightingMode = "skyAndSources";
|
||||||
|
|
||||||
|
jsonMap.ambientLightValue = (int)tileMap.ambientLightValue;
|
||||||
|
jsonMap.skyLightValue = (int)tileMap.skyLightValue;
|
||||||
|
|
||||||
// each serialized chunk will be the same size in bytes (same number of tiles in each)
|
// each serialized chunk will be the same size in bytes (same number of tiles in each)
|
||||||
int chunkSizeInBytes = tileMap.getChunks()[0].getData().length * TileDataSerializer.TILE_SIZE_BYTES;
|
int chunkSizeInBytes = tileMap.getChunks()[0].getData().length * TileDataSerializer.TILE_SIZE_BYTES;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue