summaryrefslogtreecommitdiff
path: root/src/islandgen.moon
diff options
context:
space:
mode:
Diffstat (limited to 'src/islandgen.moon')
-rw-r--r--src/islandgen.moon17
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