OverviewFilesCommitsIssuesDocsReleasesPeers

hyper-tps / scenes / test / gate_ocean_shader.gd

31 lines · gd ref:
extends SceneTree
## Compile-gate for assets/ocean/shaders/ocean.gdshader.
##
## Separate from tools/shader_gate.sh because this shader needs its `global
## uniform`s registered before it can compile, and a generic probe knows
## nothing about them. MUST RUN WITH A DISPLAY -- headless loads the resource
## without ever compiling it, which is a pass that cannot fail.
##
##   DISPLAY=:0 "$HYPER_TPS_GODOT" --path . --rendering-driver vulkan \
##       --script res://scenes/test/gate_ocean_shader.gd
var _frames := 0
func _initialize() -> void:
	OceanGlobals.ensure()
	var mi := MeshInstance3D.new()
	mi.mesh = PlaneMesh.new()
	var mat := ShaderMaterial.new()
	mat.shader = load("res://assets/ocean/shaders/ocean.gdshader")
	mi.material_override = mat
	root.add_child(mi)
	var cam := Camera3D.new(); cam.position = Vector3(0, 2, 3); cam.current = true
	root.add_child(cam)
	var sun := DirectionalLight3D.new(); sun.rotate_x(-0.9)
	root.add_child(sun)
	print("GATE: compiling ocean.gdshader (globals registered, lit, on a plane)")
func _process(_d: float) -> bool:
	_frames += 1
	if _frames > 30:
		print("GATE: survived 30 lit frames")
		quit(0); return true
	return false