mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-21 19:41:23 +01:00
Restored Generation of Temperature
This commit is contained in:
parent
1516b1f11c
commit
f4cae9cd93
3 changed files with 8 additions and 4 deletions
8
main.js
8
main.js
|
|
@ -1010,16 +1010,18 @@ function calculateTemperatures() {
|
|||
cells.temp = new Int8Array(cells.i.length); // temperature array
|
||||
|
||||
const tEq = +temperatureEquatorInput.value;
|
||||
const tPoleN = +temperatureNorthPoleInput.value;
|
||||
const tNPole = +temperatureNorthPoleInput.value;
|
||||
//TODO Find proper delta to calculate
|
||||
const tSPole = +temperatureSouthPoleInput.value;
|
||||
const tDelta = tEq - tPoleN;
|
||||
const tNDelta = tEq - tNPole;
|
||||
const tSDelta = tEq - tSPole;
|
||||
const int = d3.easePolyInOut.exponent(0.5); // interpolation function
|
||||
|
||||
d3.range(0, cells.i.length, grid.cellsX).forEach(function (r) {
|
||||
const y = grid.points[r][1];
|
||||
const lat = Math.abs(mapCoordinates.latN - (y / graphHeight) * mapCoordinates.latT); // [0; 90]
|
||||
const initTemp = tEq - int(lat / 90) * tDelta;
|
||||
const initTemp = tEq - rn(lat / 90, 2) * tNDelta;
|
||||
console.info(+y + "\t|\t" + +lat + "\t|\t" + +initTemp);
|
||||
for (let i = r; i < r + grid.cellsX; i++) {
|
||||
cells.temp[i] = minmax(initTemp - convertToFriendly(cells.h[i]), -128, 127);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -613,7 +613,7 @@ function randomizeOptions() {
|
|||
if (randomize || !locked("temperatureEquator"))
|
||||
temperatureEquatorOutput.value = temperatureEquatorInput.value = rand(tMax - 10, tMax);
|
||||
if (randomize || !locked("temperaturePole"))
|
||||
temperaturePoleOutput.value = temperaturePoleInput.value = rand(tMin, tMin + 30);
|
||||
temperatureNorthPoleOutput.value = temperatureNorthPoleInput.value = temperatureSouthPoleOutput.value = temperatureSouthPoleInput.value = rand(tMin, tMin + 30);
|
||||
|
||||
// 'Units Editor' settings
|
||||
const US = navigator.language === "en-US";
|
||||
|
|
|
|||
|
|
@ -109,6 +109,8 @@ function editWorld() {
|
|||
document.getElementById("temperatureEquatorF").innerHTML = rn((tEq * 9) / 5 + 32);
|
||||
const tNPole = +document.getElementById("temperatureNorthPoleOutput").value;
|
||||
document.getElementById("temperatureNorthPoleF").innerHTML = rn((tNPole * 9) / 5 + 32);
|
||||
const tSPole = +document.getElementById("temperatureSouthPoleOutput").value;
|
||||
document.getElementById("temperatureSouthPoleF").innerHTML = rn((tSPole * 9) / 5 + 32);
|
||||
globe.selectAll(".tempGradient90").attr("stop-color", clr(1 - (tNPole - tMin) / (tMax - tMin)));
|
||||
globe.selectAll(".tempGradient60").attr("stop-color", clr(1 - (tEq - ((tEq - tNPole) * 2) / 3 - tMin) / (tMax - tMin)));
|
||||
globe.selectAll(".tempGradient30").attr("stop-color", clr(1 - (tEq - ((tEq - tNPole) * 1) / 3 - tMin) / (tMax - tMin)));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue