diff options
| author | Alexander M Pickering <alex@cogarr.net> | 2025-01-26 15:12:19 -0600 |
|---|---|---|
| committer | Alexander M Pickering <alex@cogarr.net> | 2025-01-26 15:12:19 -0600 |
| commit | 5846a4fea8d6a993466a792977128d21a18587bc (patch) | |
| tree | f1c53d194fc11af1f354be91a78472bdf467175c /src/islandgen.moon | |
| parent | c39ff632b46c179709101c5b50a061ebd723689f (diff) | |
| download | ggj25-5846a4fea8d6a993466a792977128d21a18587bc.tar.gz ggj25-5846a4fea8d6a993466a792977128d21a18587bc.tar.bz2 ggj25-5846a4fea8d6a993466a792977128d21a18587bc.zip | |
Actual final commit
Diffstat (limited to 'src/islandgen.moon')
| -rw-r--r-- | src/islandgen.moon | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/islandgen.moon b/src/islandgen.moon index 1e5b83d..dd9473b 100644 --- a/src/islandgen.moon +++ b/src/islandgen.moon @@ -21,12 +21,12 @@ sides = 4 gen.generate = (seed) -> rg = rng.generator(seed) normal = (avg, std) -> - print("normal with", avg, std) + --print("normal with", avg, std) rg1, rg2 = rg(),rg() - print("rgs:",rg1, rg2) + --print("rgs:",rg1, rg2) -- Box-Muller transform bm = math.sqrt(-2 * math.log(rg1)) * math.cos(2 * math.pi * rg2) - print("bm was:",bm) + --print("bm was:",bm) -- Box-Muller gives us std = e^-0.5 , avg = 0 ((bm / math.exp(-1/2)) * std) + avg shoreline = {} @@ -50,15 +50,15 @@ gen.generate = (seed) -> avg_direction = ((i-1)/sides) * (2 * math.pi) std_direction = math.pi / 6 rng_direction = normal(avg_direction, std_direction) - print("rng_direction ended up being:", rng_direction) + --print("rng_direction ended up being:", rng_direction) point = shoreline[#shoreline] + vec2(math.cos(rng_direction) * point_distance, math.sin(rng_direction) * point_distance) shoreline[#shoreline + 1] = point - print("point:", point) - print("prev:",aabb[aabb_sides[i][3]]) + --print("point:", point) + --print("prev:",aabb[aabb_sides[i][3]]) aabb[aabb_sides[i][3]] = aabb_sides[i][2](aabb[aabb_sides[i][3]],point[aabb_sides[i][1]]) - print("Generated shoreline:",shoreline) - print("And aabb box:" ,aabb) + --print("Generated shoreline:",shoreline) + --print("And aabb box:" ,aabb) -- Now that we have the shorline, generate the geometry -- every point after the first needs to generate 2 triangles, 6 vertexes, each vertex is a vec3, 3 floats, 4 bytes per float geom = am.buffer(((n_points * 2) - 4) * 6 * 3 * 4) -- 4 corners only get 1 triangle @@ -189,7 +189,6 @@ class WaterGraphicsComponent extends world.GraphicsComponent normal_view[24] = vec2(uv.s2,uv.t1) setup: (node) => bind = node("bind") - print("Found bind node:",node) for k,v in pairs(color.am_lake_color) bind[k] = v bind.water = 2 |
