Damn thing is slow as a slug
This commit is contained in:
@@ -14,10 +14,11 @@ var wfc: Node = get_node("../Generator")
|
||||
func _ready() -> void:
|
||||
var ruleset: PackedInt32Array = read_sample_ruleset("sample1.png")
|
||||
var samples: Array[PackedInt32Array] = parse_samples_from_ruleset(ruleset)
|
||||
var c = wfc.generate_chunk_at(0,0,_chunks,samples)
|
||||
|
||||
#print(ruleset)
|
||||
#print(samples)
|
||||
wfc.generate_chunk_at(0,0,_chunks,samples)
|
||||
print(c.data)
|
||||
|
||||
## Read the png file, and parse it to a useable ruleset
|
||||
func read_sample_ruleset(filename: String) -> PackedInt32Array:
|
||||
@@ -29,10 +30,10 @@ func read_sample_ruleset(filename: String) -> PackedInt32Array:
|
||||
var size: int = (png.size() / 3)
|
||||
hex.resize(size)
|
||||
|
||||
print(png)
|
||||
#print(png)
|
||||
for i in range(size): #the file is assumed to be in RGB format
|
||||
hex[i] = (png[i * 3] << 16) | (png[i * 3 + 1] << 8) | (png[i * 3 + 2] << 0)
|
||||
print(i, "(", hex[i], "): ", png[i * 3], ",", png[i * 3 + 1], ",", png[i * 3 + 2])
|
||||
#print(i, "(", hex[i], "): ", png[i * 3], ",", png[i * 3 + 1], ",", png[i * 3 + 2])
|
||||
return hex
|
||||
|
||||
func parse_samples_from_ruleset(ruleset: PackedInt32Array) -> Array[PackedInt32Array]:
|
||||
|
||||
Reference in New Issue
Block a user