mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 03:51:23 +01:00
Merge branch 'poles-temperature' of https://github.com/Azgaar/Fantasy-Map-Generator into poles-temperature
This commit is contained in:
commit
0a55a3aab4
9 changed files with 62 additions and 34 deletions
40
index.html
40
index.html
|
|
@ -2363,12 +2363,18 @@
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<i data-locked="0" id="lock_temperaturePole" class="icon-lock-open"></i>
|
|
||||||
<label data-tip="Set temperature near poles">
|
<label data-tip="Set temperature near poles">
|
||||||
<i>Poles:</i>
|
<i data-locked="0" id="lock_temperatureNorthPole" class="icon-lock-open"></i>
|
||||||
<input id="temperaturePoleInput" data-stored="temperaturePole" type="number" min="-50" max="50" />°C =
|
<i>North Pole</i>
|
||||||
<span id="temperaturePoleF"></span>°F
|
<input id="temperatureNorthPoleInput" data-stored="temperatureNorthPole" type="number" min="-50" max="50" />°C =
|
||||||
<input id="temperaturePoleOutput" data-stored="temperaturePole" type="range" min="-50" max="50" />
|
<span id="temperatureNorthPoleF"></span>°F
|
||||||
|
<input id="temperatureNorthPoleOutput" data-stored="temperatureNorthPole" type="range" min="-50" max="50" />
|
||||||
|
<br>
|
||||||
|
<i data-locked="0" id="lock_temperatureSouthPole" class="icon-lock-open"></i>
|
||||||
|
<i>South Pole</i>
|
||||||
|
<input id="temperatureSouthPoleInput" data-stored="temperatureSouthPole" type="number" min="-50" max="50" />°C =
|
||||||
|
<span id="temperatureSouthPoleF"></span>°F
|
||||||
|
<input id="temperatureSouthPoleOutput" data-stored="temperatureSouthPole" type="range" min="-50" max="50" />
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|
@ -2427,13 +2433,13 @@
|
||||||
<svg id="globe" width="22em" height="22em" viewBox="-20 -25 240 240">
|
<svg id="globe" width="22em" height="22em" viewBox="-20 -25 240 240">
|
||||||
<defs>
|
<defs>
|
||||||
<linearGradient id="temperatureGradient" x1="0" x2="0" y1="0" y2="1">
|
<linearGradient id="temperatureGradient" x1="0" x2="0" y1="0" y2="1">
|
||||||
<stop class="tempGradient90" offset="0%" stop-color="blue" />
|
<stop class="tempNorthGradient90" offset="0%" stop-color="blue" />
|
||||||
<stop class="tempGradient60" offset="16.6%" stop-color="green" />
|
<stop class="tempNorthGradient60" offset="16.6%" stop-color="green" />
|
||||||
<stop class="tempGradient30" offset="33.3%" stop-color="yellow" />
|
<stop class="tempNorthGradient30" offset="33.3%" stop-color="yellow" />
|
||||||
<stop class="tempGradient0" offset="50%" stop-color="red" />
|
<stop class="tempGradient0" offset="50%" stop-color="red" />
|
||||||
<stop class="tempGradient30" offset="66.6%" stop-color="yellow" />
|
<stop class="tempSouthGradient30" offset="66.6%" stop-color="yellow" />
|
||||||
<stop class="tempGradient60" offset="83.3%" stop-color="green" />
|
<stop class="tempSouthGradient60" offset="83.3%" stop-color="green" />
|
||||||
<stop class="tempGradient90" offset="100%" stop-color="blue" />
|
<stop class="tempSouthGradient90" offset="100%" stop-color="blue" />
|
||||||
</linearGradient>
|
</linearGradient>
|
||||||
</defs>
|
</defs>
|
||||||
<g id="globeNoteLines">
|
<g id="globeNoteLines">
|
||||||
|
|
@ -7924,14 +7930,14 @@
|
||||||
<script src="modules/ui/stylePresets.js?v=1.89.11"></script>
|
<script src="modules/ui/stylePresets.js?v=1.89.11"></script>
|
||||||
|
|
||||||
<script src="modules/ui/general.js?v=1.87.03"></script>
|
<script src="modules/ui/general.js?v=1.87.03"></script>
|
||||||
<script src="modules/ui/options.js?v=1.89.36"></script>
|
<script src="modules/ui/options.js?v=1.90.00"></script>
|
||||||
<script src="main.js?v=1.89.32"></script>
|
<script src="main.js?v=1.90.00"></script>
|
||||||
|
|
||||||
<script defer src="modules/relief-icons.js"></script>
|
<script defer src="modules/relief-icons.js"></script>
|
||||||
<script defer src="modules/ui/style.js"></script>
|
<script defer src="modules/ui/style.js"></script>
|
||||||
<script defer src="modules/ui/editors.js?v=1.89.35"></script>
|
<script defer src="modules/ui/editors.js?v=1.89.35"></script>
|
||||||
<script defer src="modules/ui/tools.js?v=1.89.38"></script>
|
<script defer src="modules/ui/tools.js?v=1.90.00"></script>
|
||||||
<script defer src="modules/ui/world-configurator.js"></script>
|
<script defer src="modules/ui/world-configurator.js?v=1.90.00"></script>
|
||||||
<script defer src="modules/ui/heightmap-editor.js?v=1.89.06"></script>
|
<script defer src="modules/ui/heightmap-editor.js?v=1.89.06"></script>
|
||||||
<script defer src="modules/ui/provinces-editor.js?v=1.89.00"></script>
|
<script defer src="modules/ui/provinces-editor.js?v=1.89.00"></script>
|
||||||
<script defer src="modules/ui/biomes-editor.js"></script>
|
<script defer src="modules/ui/biomes-editor.js"></script>
|
||||||
|
|
@ -7967,8 +7973,8 @@
|
||||||
<script defer src="libs/rgbquant.min.js"></script>
|
<script defer src="libs/rgbquant.min.js"></script>
|
||||||
<script defer src="libs/jquery.ui.touch-punch.min.js"></script>
|
<script defer src="libs/jquery.ui.touch-punch.min.js"></script>
|
||||||
|
|
||||||
<script defer src="modules/io/save.js?v=1.89.29"></script>
|
<script defer src="modules/io/save.js?v=1.90.00"></script>
|
||||||
<script defer src="modules/io/load.js?v=1.89.30"></script>
|
<script defer src="modules/io/load.js?v=1.90.00"></script>
|
||||||
<script defer src="modules/io/cloud.js"></script>
|
<script defer src="modules/io/cloud.js"></script>
|
||||||
<script defer src="modules/io/export.js?v=1.89.36"></script>
|
<script defer src="modules/io/export.js?v=1.89.36"></script>
|
||||||
<script defer src="modules/io/formats.js"></script>
|
<script defer src="modules/io/formats.js"></script>
|
||||||
|
|
|
||||||
16
main.js
16
main.js
|
|
@ -184,6 +184,8 @@ let options = {
|
||||||
pinNotes: false,
|
pinNotes: false,
|
||||||
showMFCGMap: true,
|
showMFCGMap: true,
|
||||||
winds: [225, 45, 225, 315, 135, 315],
|
winds: [225, 45, 225, 315, 135, 315],
|
||||||
|
tempNorthPole: 0,
|
||||||
|
tempSouthPole: 0,
|
||||||
stateLabelsMode: "auto"
|
stateLabelsMode: "auto"
|
||||||
};
|
};
|
||||||
let mapCoordinates = {}; // map coordinates on globe
|
let mapCoordinates = {}; // map coordinates on globe
|
||||||
|
|
@ -1008,16 +1010,20 @@ function calculateTemperatures() {
|
||||||
TIME && console.time("calculateTemperatures");
|
TIME && console.time("calculateTemperatures");
|
||||||
const cells = grid.cells;
|
const cells = grid.cells;
|
||||||
cells.temp = new Int8Array(cells.i.length); // temperature array
|
cells.temp = new Int8Array(cells.i.length); // temperature array
|
||||||
|
|
||||||
const tEq = +temperatureEquatorInput.value;
|
const tEq = +temperatureEquatorInput.value;
|
||||||
const tPole = +temperaturePoleInput.value;
|
const tNorthPole = +temperatureNorthPoleInput.value;
|
||||||
const tDelta = tEq - tPole;
|
const tSouthPole = +temperatureSouthPoleInput.value;
|
||||||
|
//Update Settings to match the slider(there may be a better solution)
|
||||||
|
options.tempSouthPole = +tSouthPole;
|
||||||
|
options.tempNorthPole = +tNorthPole;
|
||||||
|
const tNDelta = tEq - tNorthPole;
|
||||||
|
const tSDelta = tEq - tSouthPole;
|
||||||
const int = d3.easePolyInOut.exponent(0.5); // interpolation function
|
const int = d3.easePolyInOut.exponent(0.5); // interpolation function
|
||||||
|
|
||||||
d3.range(0, cells.i.length, grid.cellsX).forEach(function (r) {
|
d3.range(0, cells.i.length, grid.cellsX).forEach(function (r) {
|
||||||
const y = grid.points[r][1];
|
const y = grid.points[r][1];
|
||||||
const lat = Math.abs(mapCoordinates.latN - (y / graphHeight) * mapCoordinates.latT); // [0; 90]
|
const lat = (mapCoordinates.latN - (y / graphHeight) * mapCoordinates.latT); // [-90; 90]
|
||||||
const initTemp = tEq - int(lat / 90) * tDelta;
|
const initTemp = tEq - (Math.max(rn(lat / 90, 2), 0) * tNDelta - Math.min(rn(lat / 90, 2), 0) * tSDelta);
|
||||||
for (let i = r; i < r + grid.cellsX; i++) {
|
for (let i = r; i < r + grid.cellsX; i++) {
|
||||||
cells.temp[i] = minmax(initTemp - convertToFriendly(cells.h[i]), -128, 127);
|
cells.temp[i] = minmax(initTemp - convertToFriendly(cells.h[i]), -128, 127);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -636,4 +636,10 @@ export function resolveVersionConflicts(version) {
|
||||||
if (coa?.shield === "state") delete coa.shield;
|
if (coa?.shield === "state") delete coa.shield;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (version < 1.89) {
|
||||||
|
//May need a major bump
|
||||||
|
options.tempNorthPole = +temperatureNorthPoleInput.value;
|
||||||
|
options.tempSouthPole = +temperatureNorthPoleInput.value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ function getSettings() {
|
||||||
mapSize: mapSizeOutput.value,
|
mapSize: mapSizeOutput.value,
|
||||||
latitudeO: latitudeOutput.value,
|
latitudeO: latitudeOutput.value,
|
||||||
temperatureEquator: temperatureEquatorOutput.value,
|
temperatureEquator: temperatureEquatorOutput.value,
|
||||||
temperaturePole: temperaturePoleOutput.value,
|
temperaturePole: 0, //Moved to options
|
||||||
prec: precOutput.value,
|
prec: precOutput.value,
|
||||||
options: options,
|
options: options,
|
||||||
mapName: mapName.value,
|
mapName: mapName.value,
|
||||||
|
|
|
||||||
|
|
@ -219,7 +219,7 @@ async function parseLoadedData(data) {
|
||||||
if (settings[14]) mapSizeInput.value = mapSizeOutput.value = minmax(settings[14], 1, 100);
|
if (settings[14]) mapSizeInput.value = mapSizeOutput.value = minmax(settings[14], 1, 100);
|
||||||
if (settings[15]) latitudeInput.value = latitudeOutput.value = minmax(settings[15], 0, 100);
|
if (settings[15]) latitudeInput.value = latitudeOutput.value = minmax(settings[15], 0, 100);
|
||||||
if (settings[16]) temperatureEquatorInput.value = temperatureEquatorOutput.value = settings[16];
|
if (settings[16]) temperatureEquatorInput.value = temperatureEquatorOutput.value = settings[16];
|
||||||
if (settings[17]) temperaturePoleInput.value = temperaturePoleOutput.value = settings[17];
|
if (settings[17]) temperatureNorthPoleInput.value = temperatureNorthPoleOutput.value = settings[17]; //Not used see options: only for compatibility
|
||||||
if (settings[18]) precInput.value = precOutput.value = settings[18];
|
if (settings[18]) precInput.value = precOutput.value = settings[18];
|
||||||
if (settings[19]) options = JSON.parse(settings[19]);
|
if (settings[19]) options = JSON.parse(settings[19]);
|
||||||
if (settings[20]) mapName.value = settings[20];
|
if (settings[20]) mapName.value = settings[20];
|
||||||
|
|
@ -589,6 +589,8 @@ async function parseLoadedData(data) {
|
||||||
// set options
|
// set options
|
||||||
yearInput.value = options.year;
|
yearInput.value = options.year;
|
||||||
eraInput.value = options.era;
|
eraInput.value = options.era;
|
||||||
|
temperatureNorthPoleOutput.value = temperatureNorthPoleInput.value = options.tempNorthPole;
|
||||||
|
temperatureSouthPoleOutput.value = temperatureSouthPoleInput.value = options.tempSouthPole;
|
||||||
shapeRendering.value = viewbox.attr("shape-rendering") || "geometricPrecision";
|
shapeRendering.value = viewbox.attr("shape-rendering") || "geometricPrecision";
|
||||||
|
|
||||||
if (window.restoreDefaultEvents) restoreDefaultEvents();
|
if (window.restoreDefaultEvents) restoreDefaultEvents();
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ function getMapData() {
|
||||||
mapSizeOutput.value,
|
mapSizeOutput.value,
|
||||||
latitudeOutput.value,
|
latitudeOutput.value,
|
||||||
temperatureEquatorOutput.value,
|
temperatureEquatorOutput.value,
|
||||||
temperaturePoleOutput.value,
|
0, //Dummy for tempNorthOutput.value
|
||||||
precOutput.value,
|
precOutput.value,
|
||||||
JSON.stringify(options),
|
JSON.stringify(options),
|
||||||
mapName.value,
|
mapName.value,
|
||||||
|
|
|
||||||
|
|
@ -612,8 +612,10 @@ function randomizeOptions() {
|
||||||
tMin = -30; // temperature extremes
|
tMin = -30; // temperature extremes
|
||||||
if (randomize || !locked("temperatureEquator"))
|
if (randomize || !locked("temperatureEquator"))
|
||||||
temperatureEquatorOutput.value = temperatureEquatorInput.value = rand(tMax - 10, tMax);
|
temperatureEquatorOutput.value = temperatureEquatorInput.value = rand(tMax - 10, tMax);
|
||||||
if (randomize || !locked("temperaturePole"))
|
if (randomize || !locked("temperatureNorthPole"))
|
||||||
temperaturePoleOutput.value = temperaturePoleInput.value = rand(tMin, tMin + 30);
|
temperatureNorthPoleOutput.value = temperatureNorthPoleInput.value = rand(tMin, tMin + 30);
|
||||||
|
if (randomize || !locked("temperatureSouthPole"))
|
||||||
|
temperatureSouthPoleOutput.value = temperatureSouthPoleInput.value = rand(tMin, tMin + 30);
|
||||||
|
|
||||||
// 'Units Editor' settings
|
// 'Units Editor' settings
|
||||||
const US = navigator.language === "en-US";
|
const US = navigator.language === "en-US";
|
||||||
|
|
|
||||||
|
|
@ -107,12 +107,19 @@ function editWorld() {
|
||||||
function updateGlobeTemperature() {
|
function updateGlobeTemperature() {
|
||||||
const tEq = +document.getElementById("temperatureEquatorOutput").value;
|
const tEq = +document.getElementById("temperatureEquatorOutput").value;
|
||||||
document.getElementById("temperatureEquatorF").innerHTML = rn((tEq * 9) / 5 + 32);
|
document.getElementById("temperatureEquatorF").innerHTML = rn((tEq * 9) / 5 + 32);
|
||||||
const tPole = +document.getElementById("temperaturePoleOutput").value;
|
const tNorthPole = +document.getElementById("temperatureNorthPoleOutput").value;
|
||||||
document.getElementById("temperaturePoleF").innerHTML = rn((tPole * 9) / 5 + 32);
|
document.getElementById("temperatureNorthPoleF").innerHTML = rn((tNorthPole * 9) / 5 + 32);
|
||||||
globe.selectAll(".tempGradient90").attr("stop-color", clr(1 - (tPole - tMin) / (tMax - tMin)));
|
const tSouthPole = +document.getElementById("temperatureSouthPoleOutput").value;
|
||||||
globe.selectAll(".tempGradient60").attr("stop-color", clr(1 - (tEq - ((tEq - tPole) * 2) / 3 - tMin) / (tMax - tMin)));
|
document.getElementById("temperatureSouthPoleF").innerHTML = rn((tSouthPole * 9) / 5 + 32);
|
||||||
globe.selectAll(".tempGradient30").attr("stop-color", clr(1 - (tEq - ((tEq - tPole) * 1) / 3 - tMin) / (tMax - tMin)));
|
|
||||||
|
//North to Equator to South
|
||||||
|
globe.select(".tempNorthGradient90").attr("stop-color", clr(1 - (tNorthPole - tMin) / (tMax - tMin)));
|
||||||
|
globe.select(".tempNorthGradient60").attr("stop-color", clr(1 - (tEq - ((tEq - tNorthPole) * 2) / 3 - tMin) / (tMax - tMin)));
|
||||||
|
globe.select(".tempNorthGradient30").attr("stop-color", clr(1 - (tEq - ((tEq - tNorthPole) * 1) / 3 - tMin) / (tMax - tMin)));
|
||||||
globe.select(".tempGradient0").attr("stop-color", clr(1 - (tEq - tMin) / (tMax - tMin)));
|
globe.select(".tempGradient0").attr("stop-color", clr(1 - (tEq - tMin) / (tMax - tMin)));
|
||||||
|
globe.select(".tempSouthGradient30").attr("stop-color", clr(1 - (tEq - ((tEq - tSouthPole) * 1) / 3 - tMin) / (tMax - tMin)));
|
||||||
|
globe.select(".tempSouthGradient60").attr("stop-color", clr(1 - (tEq - ((tEq - tSouthPole) * 2) / 3 - tMin) / (tMax - tMin)));
|
||||||
|
globe.select(".tempSouthGradient90").attr("stop-color", clr(1 - (tSouthPole - tMin) / (tMax - tMin)));
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateWindDirections() {
|
function updateWindDirections() {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// version and caching control
|
// version and caching control
|
||||||
|
const version = "1.90.00"; // generator version, update each time
|
||||||
const version = "1.89.39"; // generator version, update each time
|
|
||||||
|
|
||||||
{
|
{
|
||||||
document.title += " v" + version;
|
document.title += " v" + version;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue