mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-02-05 01:51:23 +01:00
prototype for ice seperation
This commit is contained in:
parent
f30ffd812e
commit
7f99323d22
9 changed files with 322 additions and 106 deletions
37
public/modules/renderers/draw-ice.js
Normal file
37
public/modules/renderers/draw-ice.js
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
"use strict";
|
||||
|
||||
// Ice layer renderer - renders ice from data model to SVG
|
||||
function drawIce() {
|
||||
TIME && console.time("drawIce");
|
||||
|
||||
// Clear existing ice SVG
|
||||
ice.selectAll("*").remove();
|
||||
|
||||
// Draw glaciers
|
||||
pack.ice.glaciers.forEach((glacier, index) => {
|
||||
ice
|
||||
.append("polygon")
|
||||
.attr("points", glacier.points)
|
||||
.attr("type", "iceShield")
|
||||
.attr("data-index", index)
|
||||
.attr("class", "glacier");
|
||||
});
|
||||
|
||||
// Draw icebergs
|
||||
pack.ice.icebergs.forEach((iceberg, index) => {
|
||||
ice
|
||||
.append("polygon")
|
||||
.attr("points", iceberg.points)
|
||||
.attr("cell", iceberg.cellId)
|
||||
.attr("size", iceberg.size)
|
||||
.attr("data-index", index)
|
||||
.attr("class", "iceberg");
|
||||
});
|
||||
|
||||
TIME && console.timeEnd("drawIce");
|
||||
}
|
||||
|
||||
// Re-render ice layer from data model
|
||||
function redrawIce() {
|
||||
drawIce();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue