Basicly a climate file in L3DT is an xml file that describes how texturing should appear at certain elevation ranges
http://www.bundysoft.com/docs/doku.php?id=l3dt:formats:specs:cli.xml
Now there is also an attribute map in L3DT
http://www.bundysoft.com/docs/doku.php?id=l3dt:formats:specs:amf
This maps landtypes on each pixel in the heightmap. So what I have to do is read all landtypes in the attribute map, create a UI for it in the tool where we would say:
landtype_a = dos_texture_1
landtype_b = dos_texture_2
etc...
Then on processing, I would have to go over each pixel in the attribute map get the landtype and paint the dos texture on that pixel. Now this is what I would do when the heightmap is a 1:1 in size. Our size is half the size of the real map, so I guess I would have to paint the texture twice. I don't have a good solution in mind for that one yet.
The good part is I already wrote the libraries to read the attribute map the resulting data looks like:
AmfFile
=======
public ushort width;
public ushort height;
public List<AmfPixelInfo> pixels = new List<AmfPixelInfo>();
public Dictionary<byte, List<byte>> uniqueLandTypeIdProClimate = new Dictionary<byte, List<byte>>();
AmfPixelInfo
=============
public uint x;
public uint y;
public byte landTypeId;
public byte climateId;
I hope I'm making sense here, since I find it hard to explain without going into code.
update:
Thing is when I did this with NWN2, they had an API with a Brush object, and I just said brush radius is x and then brush go to x,y and apply texture A that is mapped to LandType A and apply x pressure. Then that brush would go over the entire terrain and apply textures accordingly. Now I'm working on the binary file itself and I'm not that versed in 3D data structures yet. I know everything are triangles and such, but how is that then saved in the file ??? My best guess is some kind of two dimensional array with Triplets each Triplet being the points of the triangle. Maybe multiple arrays for each Layer of textures ?
Open sourced it on github
Divine Divinity Original Sin Terrain Importer Tool Source