Texturierung von Voxel Terrain angepasst
This commit is contained in:
@@ -80,6 +80,22 @@ public final class MapData {
|
||||
/** Splatmap Alpha-Kanal Dritte Gruppe [SPLAT_SIZE²]. */
|
||||
public final byte[] thirdSplatA;
|
||||
|
||||
/** Voxel-Splatmap Kanal 1-4 (AlphaMap für Sculpted-Meshes, unabhängig vom Basis-Terrain) [SPLAT_SIZE²]. */
|
||||
public final byte[] voxelSplatR;
|
||||
public final byte[] voxelSplatG;
|
||||
public final byte[] voxelSplatB;
|
||||
public final byte[] voxelSplatA;
|
||||
/** Voxel-Splatmap Kanal 5-8 (AlphaMap_1) [SPLAT_SIZE²]. */
|
||||
public final byte[] voxelUpperSplatR;
|
||||
public final byte[] voxelUpperSplatG;
|
||||
public final byte[] voxelUpperSplatB;
|
||||
public final byte[] voxelUpperSplatA;
|
||||
/** Voxel-Splatmap Kanal 9-12 (AlphaMap_2) [SPLAT_SIZE²]. */
|
||||
public final byte[] voxelThirdSplatR;
|
||||
public final byte[] voxelThirdSplatG;
|
||||
public final byte[] voxelThirdSplatB;
|
||||
public final byte[] voxelThirdSplatA;
|
||||
|
||||
/** Texturpfade für dritte Gruppe (4 Slots, "" = Standard-Textur). */
|
||||
public final String[] thirdTextures = new String[]{"", "", "", ""};
|
||||
/** Normal-Map-Pfade für dritte Gruppe (4 Slots, "" = keine Normal-Map). */
|
||||
@@ -155,6 +171,18 @@ public final class MapData {
|
||||
thirdSplatG = new byte [SPLAT_SIZE * SPLAT_SIZE];
|
||||
thirdSplatB = new byte [SPLAT_SIZE * SPLAT_SIZE];
|
||||
thirdSplatA = new byte [SPLAT_SIZE * SPLAT_SIZE];
|
||||
voxelSplatR = new byte [SPLAT_SIZE * SPLAT_SIZE];
|
||||
voxelSplatG = new byte [SPLAT_SIZE * SPLAT_SIZE];
|
||||
voxelSplatB = new byte [SPLAT_SIZE * SPLAT_SIZE];
|
||||
voxelSplatA = new byte [SPLAT_SIZE * SPLAT_SIZE];
|
||||
voxelUpperSplatR = new byte [SPLAT_SIZE * SPLAT_SIZE];
|
||||
voxelUpperSplatG = new byte [SPLAT_SIZE * SPLAT_SIZE];
|
||||
voxelUpperSplatB = new byte [SPLAT_SIZE * SPLAT_SIZE];
|
||||
voxelUpperSplatA = new byte [SPLAT_SIZE * SPLAT_SIZE];
|
||||
voxelThirdSplatR = new byte [SPLAT_SIZE * SPLAT_SIZE];
|
||||
voxelThirdSplatG = new byte [SPLAT_SIZE * SPLAT_SIZE];
|
||||
voxelThirdSplatB = new byte [SPLAT_SIZE * SPLAT_SIZE];
|
||||
voxelThirdSplatA = new byte [SPLAT_SIZE * SPLAT_SIZE];
|
||||
grassDensity = new byte [SPLAT_SIZE * SPLAT_SIZE];
|
||||
grassHeightMap = new byte [SPLAT_SIZE * SPLAT_SIZE];
|
||||
grassTextureMap = new byte [SPLAT_SIZE * SPLAT_SIZE];
|
||||
|
||||
@@ -29,6 +29,7 @@ import java.util.zip.*;
|
||||
* Altes Format (v≤9) wird beim Laden bilinear hochskaliert.
|
||||
* 16 – Kartengröße halbiert: TERRAIN_VERTS=8193, SPLAT_SIZE=1025, UPPER_CELLS=256.
|
||||
* Format v10-v15 wird beim Laden bilinear auf neue Größe herunterskaliert.
|
||||
* 17 – Voxel-Splatmaps (12 Kanäle RGBA×3) getrennt von Basis-Terrain-Splatmaps.
|
||||
*/
|
||||
public final class MapIO {
|
||||
|
||||
@@ -65,7 +66,7 @@ public final class MapIO {
|
||||
}
|
||||
|
||||
private static final int MAGIC = 0x424C4947; // "BLIG"
|
||||
private static final int VERSION = 16;
|
||||
private static final int VERSION = 17;
|
||||
|
||||
// Größen alter Saves für Migration
|
||||
private static final int V10_TERRAIN_VERTS = 16385; // v10-v15
|
||||
@@ -172,6 +173,13 @@ public final class MapIO {
|
||||
writeStrings(out, data.upperDisplacementMaps);
|
||||
writeStrings(out, data.thirdDisplacementMaps);
|
||||
writeFloats(out, data.diffuseScales);
|
||||
// v17: voxel-splatmaps (unabhängig vom Basis-Terrain)
|
||||
out.write(data.voxelSplatR); out.write(data.voxelSplatG);
|
||||
out.write(data.voxelSplatB); out.write(data.voxelSplatA);
|
||||
out.write(data.voxelUpperSplatR); out.write(data.voxelUpperSplatG);
|
||||
out.write(data.voxelUpperSplatB); out.write(data.voxelUpperSplatA);
|
||||
out.write(data.voxelThirdSplatR); out.write(data.voxelThirdSplatG);
|
||||
out.write(data.voxelThirdSplatB); out.write(data.voxelThirdSplatA);
|
||||
}
|
||||
// Atomares Umbenennen: erst wenn die Datei vollständig ist ersetzen wir die alte.
|
||||
// ATOMIC_MOVE schlägt auf manchen Systemen cross-device fehl → Fallback auf REPLACE_EXISTING.
|
||||
@@ -377,6 +385,14 @@ public final class MapIO {
|
||||
readStrings(in, data.thirdDisplacementMaps);
|
||||
readFloats(in, data.diffuseScales);
|
||||
}
|
||||
if (version >= 17) {
|
||||
in.readFully(data.voxelSplatR); in.readFully(data.voxelSplatG);
|
||||
in.readFully(data.voxelSplatB); in.readFully(data.voxelSplatA);
|
||||
in.readFully(data.voxelUpperSplatR); in.readFully(data.voxelUpperSplatG);
|
||||
in.readFully(data.voxelUpperSplatB); in.readFully(data.voxelUpperSplatA);
|
||||
in.readFully(data.voxelThirdSplatR); in.readFully(data.voxelThirdSplatG);
|
||||
in.readFully(data.voxelThirdSplatB); in.readFully(data.voxelThirdSplatA);
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user