Skip to content

Overhaul Map Drawing#460

Open
Azrail09Code wants to merge 19 commits into
KSPModStewards:devfrom
Azrail09Code:simplify_map_drawing
Open

Overhaul Map Drawing#460
Azrail09Code wants to merge 19 commits into
KSPModStewards:devfrom
Azrail09Code:simplify_map_drawing

Conversation

@Azrail09Code

Copy link
Copy Markdown

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.

…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.
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.
Comment thread SCANmechjeb/SCANmechjeb.cs Outdated
Comment thread SCANmechjeb/SCANmechjeb.cs Outdated
Comment thread SCANsat/SCANcontroller.cs Outdated
Comment thread SCANsat/SCANcontroller.cs Outdated
string baseFolder = System.IO.Directory.GetParent(KSPUtil.ApplicationRootPath).FullName;

// Attempt to load heightMap
if (memoryMappedHeightMap == null && node.GetValue("heightMap") != null)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a small code cleanliness suggestion, try node.TryGetValue("heightMap", out var path) instead.

Comment thread SCANmechjeb/SCANmechjeb.cs Outdated
Comment on lines +40 to +41
private static FieldInfo targetField;
private static FieldInfo hiddenField;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because these are only set in the static constructor you can mark them as readonly. In general it's good practice to do so.

@Azrail09Code

Copy link
Copy Markdown
Author

Time to try this on CKAN!

@Azrail09Code Azrail09Code reopened this Jul 9, 2026
@Phantomical

Copy link
Copy Markdown

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants