prototype for ice seperation

This commit is contained in:
StempunkDev 2026-01-12 20:47:03 +01:00
parent f30ffd812e
commit 7f99323d22
9 changed files with 322 additions and 106 deletions

View 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();
}