OverviewFilesCommitsIssuesDocsReleasesPeers

proc-nodes / demo / pc_probe.gd

30 lines · gd ref:
extends SceneTree
func _dump(name: String, g: ProcNodeGraph) -> void:
	var t: String = g.compile_to_glsl_function("proc_density", false, PackedStringArray())
	print("### ", name, " (", t.length(), " chars)")
	var b := t.substr(max(0, t.find("float proc_density")))
	for line in b.split("\n"):
		print("    ", line)
	print("    >>> 'pc.' occurrences in WHOLE text: ", t.count("pc."))
	print("")
func _init() -> void:
	var g1 := ProcNodeGraph.new()
	g1.add_node(DisplaceNode.new())
	_dump("Displace, defaults", g1)

	var g2 := ProcNodeGraph.new()
	var d := DisplaceNode.new()
	g2.add_node(d)
	g2.get_node(0).set_input_default(1, 7.5)   # Strength
	g2.get_node(0).set_input_default(2, 9.0)   # Scale
	_dump("Displace, Strength=7.5 Scale=9.0", g2)

	var g3 := ProcNodeGraph.new()
	g3.add_node(NoiseTextureNode.new())
	_dump("SimplexNoise, defaults", g3)

	var g4 := ProcNodeGraph.new()
	g4.add_node(SetPositionNode.new())
	_dump("SetPosition, defaults", g4)
	quit()