OverviewFilesCommitsIssuesDocsReleasesPeers

hyper-tps / scenes / test / dc_terrain_test.gd

50 lines · gd ref:
@tool
extends Node3D
## Side-by-side comparison: MC terrain (VoxelTerrain) vs DC terrain (DCTerrain GDExtension).
## Both use identical noise parameters so you can compare surface quality.

@export var spacing: float = 70.0

func _ready() -> void:
	_setup_comparison()

func _setup_comparison() -> void:
	var mc := get_node_or_null("MCTerrain") as MCVoxelTerrain
	var dc = get_node_or_null("DCTerrain")  # DCTerrain (GDExtension class)

	if not mc or not dc:
		push_warning("dc_terrain_test: missing MCTerrain or DCTerrain child node")
		return

	# Position side by side
	mc.position.x = -spacing * 0.5
	dc.position.x = spacing * 0.5

	# Copy noise parameters from MC to DC so both generate the same shape
	dc.seed = mc.noise_seed
	dc.terrain_size = mc.terrain_size
	dc.primary_frequency = mc.primary_frequency
	dc.primary_strength = mc.primary_strength
	dc.tunnel_frequency = mc.tunnel_frequency
	dc.tunnel_strength = mc.tunnel_strength
	dc.tunnel_radius = mc.tunnel_radius
	dc.ridge_frequency = mc.ridge_frequency
	dc.ridge_strength = mc.ridge_strength
	dc.warp_frequency = mc.warp_frequency
	dc.warp_strength = mc.warp_strength
	dc.detail_frequency = mc.detail_frequency
	dc.detail_strength = mc.detail_strength
	dc.ground_bias = mc.ground_bias
	dc.solid_floor_depth = mc.solid_floor_depth
	dc.sky_height = mc.sky_height
	dc.flat_center_radius = mc.flat_center_radius
	dc.voronoi_cell_count = mc.voronoi_cell_count
	dc.floor_strength = mc.floor_strength
	dc.floor_height_min = mc.floor_height_min
	dc.floor_height_max = mc.floor_height_max
	dc.room_height = mc.room_height

	dc.rebuild()

	print("DC terrain generated — compare with MC terrain on the left")