[solved] Disabling the BlendLocationTerrainJob
Posted: Sun Sep 06, 2020 9:33 am
Hi
In my mod Interesting Terrains, I'm implementing a custom terrain sampler. One of the terrain sampler's features is that it smooths locations based on different factors than the BlendLocationTerrainJob. It all works nicely, except that the BlendLocationTerrainJob displaces the already smoothed out locations after the terrain sampling is done.
Going through the code, the only condition I could find was MapPixelData.hasLocation, so I tried to set that to false during terrain sampling, then back to true using the OnPromoteTerrainData handler, but that completely breaks billboard and tilemap handling for locations (towns are littered with wilderness billboards and uses wilderness tilemapping).
Does anyone know if there's some other, more proper way to prevent the BlendLocationTerrainJob from happening?
Edit:
In fact, the only way I seem to be able to make it work as I want is to modify the DaggerfallTerrain.BeginMapPixelDataUpdate() method like so:
(where the "1 == 2" part, in this scenario, should obviously be replaced by a proper variable, such as a "blendLocations" flag in the TerrainSampler class, or something)
In my mod Interesting Terrains, I'm implementing a custom terrain sampler. One of the terrain sampler's features is that it smooths locations based on different factors than the BlendLocationTerrainJob. It all works nicely, except that the BlendLocationTerrainJob displaces the already smoothed out locations after the terrain sampling is done.
Going through the code, the only condition I could find was MapPixelData.hasLocation, so I tried to set that to false during terrain sampling, then back to true using the OnPromoteTerrainData handler, but that completely breaks billboard and tilemap handling for locations (towns are littered with wilderness billboards and uses wilderness tilemapping).
Does anyone know if there's some other, more proper way to prevent the BlendLocationTerrainJob from happening?
Edit:
In fact, the only way I seem to be able to make it work as I want is to modify the DaggerfallTerrain.BeginMapPixelDataUpdate() method like so:
Code: Select all
if (MapData.hasLocation)
{
// Set location tiles.
TerrainHelper.SetLocationTiles(ref MapData);
if (1 == 2)
{
// Schedule job to calc average & max heights.
JobHandle calcAvgMaxHeightJobHandle = TerrainHelper.ScheduleCalcAvgMaxHeightJob(ref MapData, generateHeightmapSamplesJobHandle);
JobHandle.ScheduleBatchedJobs();
// Schedule job to blend and flatten location heights. (depends on SetLocationTiles being done first)
blendLocationTerrainJobHandle = TerrainHelper.ScheduleBlendLocationTerrainJob(ref MapData, calcAvgMaxHeightJobHandle);
}
else
blendLocationTerrainJobHandle = generateHeightmapSamplesJobHandle;
}
else
blendLocationTerrainJobHandle = generateHeightmapSamplesJobHandle;