Skip to content

Commit

Permalink
Updates WorleyNoise to be multi-threaded and faster (#102)
Browse files Browse the repository at this point in the history
Another noise algorithm updated in my streak, this time it's worleynoise, since i didn't know jack shit and i heavily abused Rc<> to acomplish my goals it was really shit. Now it is multi-threaded, blazing fast and really sexy lookin. NOTE: this update changes ABI of worley noise slightly.
  • Loading branch information
Djiq authored Jul 10, 2022
1 parent bb2b515 commit 6c70a09
Show file tree
Hide file tree
Showing 4 changed files with 205 additions and 169 deletions.
8 changes: 1 addition & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ mysql = { version = "20.0", optional = true }
dashmap = { version = "4.0", optional = true }
zip = { version = "0.5.8", optional = true }
rand = {version = "0.8", optional = true}
dmsort = {version = "1.0.0", optional = true }
toml-dep = { version = "0.5.8", package="toml", optional = true }
aho-corasick = { version = "0.7.18", optional = true}
rayon = {version = "1.5.3", optional = true}
dbpnoise = { version = "0.1.2", optional = true}

[features]
Expand All @@ -69,7 +69,7 @@ batchnoise = ["dbpnoise"]
hash = ["base64", "const-random", "md-5", "hex", "sha-1", "sha2", "twox-hash", "serde", "serde_json"]
redis_pubsub = ["flume", "redis", "serde", "serde_json"]
unzip = ["zip", "jobs"]
worleynoise = ["rand","dmsort"]
worleynoise = ["rand","rayon"]

# internal feature-like things
jobs = ["flume"]
Expand Down
16 changes: 16 additions & 0 deletions dmsrc/worleynoise.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* This proc generates a noise grid using worley noise algorithm
*
* Returns a single string that goes row by row, with values of 1 representing an alive cell, and a value of 0 representing a dead cell.
*
* Arguments:
* * region_size: The size of regions
* * threshold: the value that determines wether a cell is dead or alive
* * node_per_region_chance: chance of a node existiing in a region
* * size: size of the returned grid
* * node_min: minimum amount of nodes in a region (after the node_per_region_chance is applied)
* * node_max: maximum amount of nodes in a region
*/
#define rustg_worley_generate(region_size, threshold, node_per_region_chance, size, node_min, node_max) \
call(RUST_G, "worley_generate")(region_size, threshold, node_per_region_chance, size, node_min, node_max)

Loading

0 comments on commit 6c70a09

Please sign in to comment.