added more colors to map and extracted offset math
This commit is contained in:
parent
eeae55bb73
commit
dde93e69b1
4 changed files with 13 additions and 6 deletions
|
@ -54,7 +54,7 @@ async function init() {
|
||||||
console.log(frame);
|
console.log(frame);
|
||||||
instance.exports.frame_entry();
|
instance.exports.frame_entry();
|
||||||
|
|
||||||
//requestAnimationFrame(render);
|
requestAnimationFrame(render);
|
||||||
}
|
}
|
||||||
canvas.onclick = render;
|
canvas.onclick = render;
|
||||||
|
|
||||||
|
|
2
justfile
2
justfile
|
@ -37,7 +37,7 @@ zip: build
|
||||||
|
|
||||||
run: build
|
run: build
|
||||||
python3 -m http.server &
|
python3 -m http.server &
|
||||||
firefox http://0.0.0.0:8080/build/index.html
|
firefox http://0.0.0.0:8000/build/index.html
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
cargo clean --manifest-path pirates/Cargo.toml
|
cargo clean --manifest-path pirates/Cargo.toml
|
||||||
|
|
2
notes.md
2
notes.md
|
@ -4,7 +4,7 @@ https://localhistories.org/a-history-of-pirates/
|
||||||
caravel (1200s) crew simulator with piracy mechanics?
|
caravel (1200s) crew simulator with piracy mechanics?
|
||||||
takes place on the english channel
|
takes place on the english channel
|
||||||
- very small scale, crossings no more than 2 minutes
|
- very small scale, crossings no more than 2 minutes
|
||||||
- model ~15 ports
|
- model ~15 ports https://www.reddit.com/r/MapPorn/comments/8kf22u/new_version_medieval_trade_networks_of/
|
||||||
- map edges could be nasty storms
|
- map edges could be nasty storms
|
||||||
- essentially pioneer but not in space
|
- essentially pioneer but not in space
|
||||||
|
|
||||||
|
|
|
@ -70,9 +70,11 @@ fn render_frame(buffer: &mut [u32; WIDTH*HEIGHT]) {
|
||||||
|
|
||||||
for y in 0..HEIGHT {
|
for y in 0..HEIGHT {
|
||||||
for x in 0..WIDTH {
|
for x in 0..WIDTH {
|
||||||
let point = Vector2::new(((x as usize + (15 as f32 * 64.0 * (12.0 + 3.0)) as usize + 1630) as f32),(y+ 1830) as f32)* 4.0;
|
let point = Vector2::new(x as f32, y as f32)* 4.0;
|
||||||
|
let offset = Vector2::new(64120.0, 7320.0);
|
||||||
|
let point = point + offset;
|
||||||
let mut n = 0.0;
|
let mut n = 0.0;
|
||||||
n += (sample_map_inter(point / 64.0, &MAP)-0.5)* 0.7;
|
n += (sample_map_inter(point / 64.0, &MAP)-0.5)* 0.6;
|
||||||
n += noise::noise(point / 64.0, rand) / 1.0;
|
n += noise::noise(point / 64.0, rand) / 1.0;
|
||||||
n += noise::noise(point / 32.0, rand) / 2.0;
|
n += noise::noise(point / 32.0, rand) / 2.0;
|
||||||
n += noise::noise(point / 16.0, rand) / 4.0;
|
n += noise::noise(point / 16.0, rand) / 4.0;
|
||||||
|
@ -80,8 +82,13 @@ fn render_frame(buffer: &mut [u32; WIDTH*HEIGHT]) {
|
||||||
n += noise::noise(point / 4.0, rand) / 16.0;
|
n += noise::noise(point / 4.0, rand) / 16.0;
|
||||||
n += noise::noise(point / 2.0, rand) / 32.0;
|
n += noise::noise(point / 2.0, rand) / 32.0;
|
||||||
//buffer[y*WIDTH + x] = (((n*0.5+0.5)*256.0) as u32) << 16| 0xFF005000;
|
//buffer[y*WIDTH + x] = (((n*0.5+0.5)*256.0) as u32) << 16| 0xFF005000;
|
||||||
buffer[y*WIDTH + x] = if n > 0.04 {
|
buffer[y*WIDTH + x] =
|
||||||
|
if n > 0.1 {
|
||||||
0xFF00FF00
|
0xFF00FF00
|
||||||
|
} else if n > 0.04 {
|
||||||
|
0xFF44FF44
|
||||||
|
} else if n > -0.03 {
|
||||||
|
0xFFFF1111
|
||||||
} else {
|
} else {
|
||||||
0xFFFF0000
|
0xFFFF0000
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue