This commit is contained in:
Azgaar 2019-09-14 16:21:41 +03:00
parent 57f1bd9695
commit 0d88fd740e
5 changed files with 34 additions and 12 deletions

View file

@ -793,17 +793,20 @@ body button.noicon {
pointer-events: none; pointer-events: none;
} }
#brushesPanel>div, #brushesPanel > div {
#templateEditor>div {
margin: 2px 0; margin: 2px 0;
} }
#templateEditor > div {
margin: 1px 0;
}
#templateEditor #templateTools { #templateEditor #templateTools {
display: inline-block; display: inline-block;
margin-bottom: -.3em; margin-bottom: -.3em;
} }
#templateBody>div { #templateBody > div {
border: 1px solid #a3a3a3; border: 1px solid #a3a3a3;
border-radius: 1px; border-radius: 1px;
background-image: linear-gradient(to right, #ffffff 0%, #fafafa 51%, #ebebeb 100%); background-image: linear-gradient(to right, #ffffff 0%, #fafafa 51%, #ebebeb 100%);
@ -812,7 +815,7 @@ body button.noicon {
height: 1.2em; height: 1.2em;
} }
#templateBody>div:hover { #templateBody > div:hover {
border-color: #808080; border-color: #808080;
background-image: linear-gradient(to right, #fcfcfc 0%, #ededed 51%, #dedede 100%); background-image: linear-gradient(to right, #fcfcfc 0%, #ededed 51%, #dedede 100%);
} }
@ -823,7 +826,7 @@ body button.noicon {
#templateBody > div > span { #templateBody > div > span {
float: right; float: right;
margin: 0 1px 0 .5m; margin: 0 1px 0 .5px;
} }
#templateBody > div > i { #templateBody > div > i {
@ -844,6 +847,7 @@ body button.noicon {
#templateBody select { #templateBody select {
width: 8em; width: 8em;
height: 1.4em;
cursor: pointer; cursor: pointer;
font-size: .9em; font-size: .9em;
} }

View file

@ -1541,6 +1541,7 @@
<option value="Peninsula">Peninsula</option> <option value="Peninsula">Peninsula</option>
<option value="Pangea">Pangea</option> <option value="Pangea">Pangea</option>
<option value="Isthmus">Isthmus</option> <option value="Isthmus">Isthmus</option>
<option value="Shattered">Shattered</option>
</select> </select>
</td> </td>
<td></td> <td></td>
@ -2367,6 +2368,7 @@
<option value="templatePeninsula">Peninsula</option> <option value="templatePeninsula">Peninsula</option>
<option value="templatePangea">Pangea</option> <option value="templatePangea">Pangea</option>
<option value="templateIsthmus">Isthmus</option> <option value="templateIsthmus">Isthmus</option>
<option value="templateShattered">Shattered</option>
</select> </select>
</div> </div>
<div id="templateTools"> <div id="templateTools">
@ -2379,7 +2381,7 @@
<button id="templateMultiply" data-tip="Multiply all heights in range by factor" class="noicon">*</button> <button id="templateMultiply" data-tip="Multiply all heights in range by factor" class="noicon">*</button>
<button id="templateSmooth" data-tip="Smooth the map replacing cell heights by an average values of its neighbors" class="noicon">~</button> <button id="templateSmooth" data-tip="Smooth the map replacing cell heights by an average values of its neighbors" class="noicon">~</button>
</div> </div>
<div id="templateBody" data-changed=0 class="table"> <div id="templateBody" data-changed=0 class="table" style="padding:2px 0">
<div data-type="Hill"> <div data-type="Hill">
<div class="icon-check" data-tip="Click to skip the step"></div> <div class="icon-check" data-tip="Click to skip the step"></div>
<div style="width:4em">Hill</div> <div style="width:4em">Hill</div>

View file

@ -8,8 +8,7 @@
const generate = function() { const generate = function() {
console.time('generateHeightmap'); console.time('generateHeightmap');
cells = grid.cells; cells = grid.cells, p = grid.points;
p = grid.points;
cells.h = new Uint8Array(grid.points.length); cells.h = new Uint8Array(grid.points.length);
const input = document.getElementById("templateInput"); const input = document.getElementById("templateInput");
@ -19,12 +18,13 @@
"High Island": 22, "High Island": 22,
"Low Island": 10, "Low Island": 10,
"Continents": 20, "Continents": 20,
"Archipelago": 32, "Archipelago": 30,
"Mediterranean":3, "Mediterranean":3,
"Peninsula": 3, "Peninsula": 3,
"Pangea": 2, "Pangea": 2,
"Isthmus": 2, "Isthmus": 2,
"Atoll": 1}; "Atoll": 1,
"Shattered": 2};
input.value = rw(templates); input.value = rw(templates);
} }
@ -39,6 +39,7 @@
case "Peninsula": templatePeninsula(); break; case "Peninsula": templatePeninsula(); break;
case "Pangea": templatePangea(); break; case "Pangea": templatePangea(); break;
case "Isthmus": templateIsthmus(); break; case "Isthmus": templateIsthmus(); break;
case "Shattered": templateShattered(); break;
} }
console.timeEnd('generateHeightmap'); console.timeEnd('generateHeightmap');
@ -193,6 +194,14 @@
addStep("Trough", "4-8", "15-30", "70-100", "80-100"); addStep("Trough", "4-8", "15-30", "70-100", "80-100");
} }
// Heighmap Template: Shattered
function templateShattered() {
addStep("Hill", "8", "35-40", "15-85", "30-70");
addStep("Trough", "10-20", "40-50", "5-95", "5-95");
addStep("Range", "5-7", "30-40", "10-90", "20-80");
addStep("Pit", "12-20", "30-40", "15-85", "20-80");
}
function getBlobPower() { function getBlobPower() {
switch (+densityInput.value) { switch (+densityInput.value) {
case 1: return .98; case 1: return .98;

View file

@ -570,7 +570,7 @@ function getHeight(h) {
if (modules.openTemplateEditor) return; if (modules.openTemplateEditor) return;
modules.openTemplateEditor = true; modules.openTemplateEditor = true;
$("#templateBody").sortable({items: "div", handle: ".icon-resize-vertical", containment: "parent", axis: "y"}); $("#templateBody").sortable({items: "> div", handle: ".icon-resize-vertical", containment: "#templateBody", axis: "y"});
// add listeners // add listeners
body.addEventListener("click", function(ev) { body.addEventListener("click", function(ev) {
@ -799,6 +799,13 @@ function getHeight(h) {
addStep("Trough", "4-8", "15-30", "70-100", "80-100"); addStep("Trough", "4-8", "15-30", "70-100", "80-100");
} }
else if (template === "templateShattered") {
addStep("Hill", "8", "35-40", "15-85", "30-70");
addStep("Trough", "10-20", "40-50", "5-95", "5-95");
addStep("Range", "5-7", "30-40", "10-90", "20-80");
addStep("Pit", "12-20", "30-40", "15-85", "20-80");
}
} }
function executeTemplate() { function executeTemplate() {

View file

@ -478,7 +478,7 @@ function analizeNamesbase() {
if (string[i] === string[i-1]) doubleArray[string[i]]++; if (string[i] === string[i-1]) doubleArray[string[i]]++;
} }
for (const l in doubleArray) {if(doubleArray[l] > size/35) double += l;} for (const l in doubleArray) {if(doubleArray[l] > size/35) double += l;}
const multi = rn(d3.mean(d.map(n => (n.match(/ /g)||[]).length)),2); const multi = rn(d3.mean(d.map(n => (n.match(/ /g)||[]).length-1)),2);
result.push({name:b.name, size, min, max, mean, median, common, double, multi}); result.push({name:b.name, size, min, max, mean, median, common, double, multi});
}); });
console.table(result); console.table(result);