update for test
This commit is contained in:
parent
9ad4bc1c69
commit
bfe8d3f98e
4 changed files with 39 additions and 3 deletions
|
|
@ -8,20 +8,41 @@ namespace LandblockExtraction.AtlasMaker;
|
|||
public class TerrainAtlasManager {
|
||||
private PortalEngine portalEngine;
|
||||
private Dictionary<int, DataId> mapTerrain;
|
||||
private TexturesImage texturesImage;
|
||||
|
||||
public Dictionary<int, Vector2> textureCoord;
|
||||
public Dictionary<int, MagickImage> terrainTexture;
|
||||
public Dictionary<int, Terrain> terrains;
|
||||
public Dictionary<DataId, int> texturesIndex;
|
||||
public TerrainAtlasManager(PortalEngine portalEngine) {
|
||||
this.portalEngine = portalEngine;
|
||||
mapTerrain = new();
|
||||
textureCoord = new Dictionary<int, Vector2>();
|
||||
terrainTexture = new Dictionary<int, MagickImage>();
|
||||
terrains = new Dictionary<int, Terrain>();
|
||||
texturesImage = new TexturesImage(portalEngine);
|
||||
texturesIndex = new Dictionary<DataId, int>();
|
||||
|
||||
GenerateDictionaryTexture();
|
||||
foreach(var img in texturesIndex) {
|
||||
var i = texturesImage.GetImage(img.Key);
|
||||
i.Write($"{img.Value}.jpg");
|
||||
}
|
||||
InitialiseTerrainDic();
|
||||
GenerateTerrain();
|
||||
}
|
||||
private void GenerateDictionaryTexture() {
|
||||
int index = 0;
|
||||
foreach (var surfaces in portalEngine.cSurfaceDesc.surfaces) {
|
||||
foreach (var surface in surfaces.terrainMaterials) {
|
||||
var did = surface.baseMaterials.First().materialDid;
|
||||
if (!texturesIndex.ContainsKey(did)) {
|
||||
texturesIndex.Add(did, index);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void ExtractTexture() {
|
||||
using (var atlasBuilder = new AtlasBuilder(portalEngine)) {
|
||||
foreach (var terrain in portalEngine.cTerrainDesc.terrains) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue