Overhaul Map Drawing#460
Conversation
…ng loaded in when using Parallax
…in to reduce RAM usage. Something still goes wrong with altimetry on first load - TerrainConfig isn't correct until map switch.
…d the baked lighting improvements back in now that I know they rely on Y axis normal instead of Z.
SCANUtil palette generation now copies all parameters from existing definitions before overwriting mapColor, preserving display name. All legend entry calls now made with palette references to allow recolouring. Remove duplicate code from getLegend() generation - better optimizing of block splitting required.
…s yet though in stock - will work on this.
Removed all instances of data.TerrainConfig and replaced with SCANUtil getTerrainConfig methods for CelestialBody, SCANdata and string. Change legend numbering to round to the nearest 10m instead of 100m (pesky little asteroids). Want to add dynamic rounding here so we get x significant figures instead.
…NTerrainConfig. Seriously, why define both name AND index, then overwrite the intuitive one if it doesn't match the other. Just let us define off the name.
| string baseFolder = System.IO.Directory.GetParent(KSPUtil.ApplicationRootPath).FullName; | ||
|
|
||
| // Attempt to load heightMap | ||
| if (memoryMappedHeightMap == null && node.GetValue("heightMap") != null) |
There was a problem hiding this comment.
As a small code cleanliness suggestion, try node.TryGetValue("heightMap", out var path) instead.
| private static FieldInfo targetField; | ||
| private static FieldInfo hiddenField; |
There was a problem hiding this comment.
Because these are only set in the static constructor you can mark them as readonly. In general it's good practice to do so.
|
Time to try this on CKAN! |
|
@JonnyOThan could you take a look at this when you get a chance? It looks alright to me, but I'm not that familiar with SCANsat |
|
@Azrail09Code Thanks for pulling all these together! This PR is running fine for me, and the new map code is much easier to follow. If #460 is implemented, #441, #455, #456, #457, and #458, are all ready to be closed with their accompanying issues. Looking forward to seeing this pushed to the community! |
Go through the old map drawing code and try streamlining it - removing duplicate instances of code drawing.
Add KSPTextureLoader support for memory mapping textures to planets based on local texture paths inside KSP (reduces the RAM overhead). Fix RealSolarSystem / Sol rendering issues with manual specified textures. Now actually usable with the high res planet packs!
Add support for DXT5 and BC5 textures (thanks Admiral!). Correctly selects Y axis from these textures if detected for normal map shading. Improved shading code for visual style to always be applies (rather than only on high vis) and remove multiple definitions.
Removed index field from scan color configs - terrain now uses only the name reference instead of the combined mess it was before. TerrainConfigs are generated with better accuracy if not specified, and display to 3sf in game instead of just to the nearest 100m (required for Sol asteroids that were less than 280m across). Also removed redundant assignment of TerrainConfigs (didn't need to be defined in a dict AND scandata. Dict now is sole defined location).
Add auto colouring of greyscale biome maps (once again thanks Admiral!). I only tweaked how these maps were assigned to make sure these wouldn't overwrite existing coloured configs and that colour references were consistent across maps.