OverviewFilesCommitsIssuesDocsReleasesPeers

proc-nodes / demo / erosion_eval_probe.gd

42 lines · gd ref:
## Emits erosion_node_eval_full reference values from the REAL C++ wrapper.
##
## Same reasoning as erosion_probe.gd: the Blender port is checked against the
## code that ships, not against a transcription of it, because a transcription
## used as a reference can only ever agree with itself.
##
## Each case is a flat array in the order erosion_node_eval_full declares:
##   0,1    p.xy
##   2,3,4  gn.xyz
##   5      height_scale        6  erosion_strength    7  cell_size
##   8      octaves             9  gain               10  peak_height_divisor
##   11     gully_band_scale   12  input_height_amplitude
##   13     octave_lacunarity  14  gully_depth
##   15     fine_gully_slope_restriction
##   16     gully_normalize_threshold
##   17,18  height_offset, height_offset_follows_altitude
##   19..22 crease/ridge/input/per_octave rounding
##   23..26 gully/octave/ridge/ridge_octave onset
##   27,28  assumed_slope, assumed_slope_mix
##   29     max_octaves
extends SceneTree


func _init() -> void:
	var a := OS.get_cmdline_user_args()
	var cs: Array = JSON.parse_string(FileAccess.get_file_as_string(a[0]))
	var out := []
	for c in cs:
		var r: Vector2 = ProcNodeGraph.debug_erosion_node_eval_full(
			Vector2(c[0], c[1]), Vector3(c[2], c[3], c[4]),
			c[5], c[6], c[7], int(c[8]), c[9], c[10], c[11], c[12], c[13],
			c[14], c[15], c[16],
			Vector2(c[17], c[18]),
			Vector4(c[19], c[20], c[21], c[22]),
			Vector4(c[23], c[24], c[25], c[26]),
			Vector2(c[27], c[28]), c[29])
		out.append([r.x, r.y])
	var f := FileAccess.open(a[1], FileAccess.WRITE)
	f.store_string(JSON.stringify(out)); f.close()
	print("EROSION_EVAL_PROBE wrote ", out.size())
	quit()