131 lines
5.4 KiB
Plaintext
131 lines
5.4 KiB
Plaintext
[gd_scene load_steps=13 format=3 uid="uid://xm383pc5pcnn"]
|
|
|
|
[ext_resource type="PackedScene" uid="uid://cnux2fqne284i" path="res://objects/primitive_nodes/point_primitive_node.tscn" id="1_b1cmn"]
|
|
[ext_resource type="PackedScene" uid="uid://wkqhvjnxs2mx" path="res://objects/terrain_chunk.tscn" id="1_pxqd5"]
|
|
|
|
[sub_resource type="PointPrimitive" id="PointPrimitive_pxqd5"]
|
|
slope = -0.585
|
|
height = 200.0
|
|
|
|
[sub_resource type="FastNoiseLite" id="FastNoiseLite_pxqd5"]
|
|
fractal_octaves = 3
|
|
|
|
[sub_resource type="NoisePrimitive" id="NoisePrimitive_ba0ut"]
|
|
blend_range = 20.0
|
|
noise = SubResource("FastNoiseLite_pxqd5")
|
|
noise_scale = 3.0
|
|
noise_amplitude = 100.0
|
|
|
|
[sub_resource type="FastNoiseLite" id="FastNoiseLite_b1cmn"]
|
|
fractal_type = 2
|
|
fractal_gain = 0.7
|
|
metadata/_preview_in_3d_space_ = true
|
|
|
|
[sub_resource type="NoisePrimitive" id="NoisePrimitive_pxqd5"]
|
|
blend_range = 10.0
|
|
noise = SubResource("FastNoiseLite_b1cmn")
|
|
noise_scale = 5.0
|
|
noise_amplitude = 20.0
|
|
|
|
[sub_resource type="Gradient" id="Gradient_b1cmn"]
|
|
interpolation_mode = 2
|
|
interpolation_color_space = 2
|
|
offsets = PackedFloat32Array(0.0743595, 0.315422, 0.678597, 0.725377)
|
|
colors = PackedColorArray(0.17652, 0.24, 0.0744, 1, 0.129706, 0.117486, 0.129714, 1, 0.216666, 0.201746, 0.216677, 1, 0.786852, 0.768096, 0.786791, 1)
|
|
|
|
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_sldah"]
|
|
sky_top_color = Color(0.22, 0.3575, 0.55, 1)
|
|
sky_horizon_color = Color(0.662243, 0.671743, 0.686743, 1)
|
|
ground_bottom_color = Color(0.167133, 0.2, 0.132, 1)
|
|
ground_horizon_color = Color(0.662243, 0.671743, 0.686743, 1)
|
|
|
|
[sub_resource type="Sky" id="Sky_b1cmn"]
|
|
sky_material = SubResource("ProceduralSkyMaterial_sldah")
|
|
|
|
[sub_resource type="Environment" id="Environment_pxqd5"]
|
|
background_mode = 2
|
|
sky = SubResource("Sky_b1cmn")
|
|
ambient_light_source = 2
|
|
ambient_light_color = Color(0.2546, 0.27132, 0.38, 1)
|
|
tonemap_mode = 2
|
|
glow_enabled = true
|
|
volumetric_fog_density = 0.0
|
|
volumetric_fog_emission_energy = 1024.0
|
|
volumetric_fog_length = 831.81
|
|
volumetric_fog_detail_spread = 0.5
|
|
volumetric_fog_sky_affect = 0.904
|
|
volumetric_fog_temporal_reprojection_amount = 0.99
|
|
|
|
[sub_resource type="GDScript" id="GDScript_b1cmn"]
|
|
script/source = "extends Camera3D
|
|
|
|
var pan_speed = .001
|
|
var rotate_speed := .0015
|
|
var zoom_speed := 30.0
|
|
var rotating := false
|
|
var panning := false
|
|
var distance := 707
|
|
var pivot := Vector3.ZERO
|
|
|
|
func _ready():
|
|
global_position = global_position.normalized() * distance
|
|
|
|
func _unhandled_input(event: InputEvent) -> void:
|
|
if event is InputEventMouseButton and (event as InputEventMouseButton).button_index == MOUSE_BUTTON_RIGHT:
|
|
get_viewport().set_input_as_handled()
|
|
rotating = event.is_pressed()
|
|
elif event is InputEventMouseButton and (event as InputEventMouseButton).button_index == MOUSE_BUTTON_MIDDLE:
|
|
get_viewport().set_input_as_handled()
|
|
panning = event.is_pressed()
|
|
elif event is InputEventMouseMotion and rotating:
|
|
get_viewport().set_input_as_handled()
|
|
var motion := event as InputEventMouseMotion
|
|
global_position += (global_basis.y * motion.screen_relative.y - global_basis.x * motion.screen_relative.x) * rotate_speed * distance
|
|
look_at(pivot)
|
|
global_position = (global_position - pivot).normalized() * distance + pivot
|
|
elif event is InputEventMouseMotion and panning:
|
|
get_viewport().set_input_as_handled()
|
|
var backward := Vector3(global_basis.z.x, 0.0, global_basis.z.z).normalized()
|
|
var right := Vector3(global_basis.x.x, 0.0, global_basis.x.z).normalized()
|
|
var motion := event as InputEventMouseMotion
|
|
var translation = -(backward * motion.screen_relative.y + right * motion.screen_relative.x) * pan_speed * distance
|
|
pivot += translation
|
|
global_position += translation
|
|
elif event is InputEventMouseButton and (event as InputEventMouseButton).button_index == MOUSE_BUTTON_WHEEL_UP:
|
|
get_viewport().set_input_as_handled()
|
|
distance = max(1., distance - zoom_speed)
|
|
global_position = (global_position - pivot).normalized() * distance + pivot
|
|
elif event is InputEventMouseButton and (event as InputEventMouseButton).button_index == MOUSE_BUTTON_WHEEL_DOWN:
|
|
get_viewport().set_input_as_handled()
|
|
distance = min(1000., distance + zoom_speed)
|
|
global_position = (global_position - pivot).normalized() * distance + pivot
|
|
"
|
|
|
|
[node name="Node3D" type="Node3D"]
|
|
|
|
[node name="TerrainMeshEditor" type="TerrainMeshEditor" parent="."]
|
|
primitives = [SubResource("PointPrimitive_pxqd5"), SubResource("NoisePrimitive_ba0ut"), SubResource("NoisePrimitive_pxqd5")]
|
|
vertex_color_gradient = SubResource("Gradient_b1cmn")
|
|
color_gradient_end_height = 200.0
|
|
chunk_count = 5
|
|
chunk_scene = ExtResource("1_pxqd5")
|
|
point_primitive_object = ExtResource("1_b1cmn")
|
|
|
|
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
|
environment = SubResource("Environment_pxqd5")
|
|
|
|
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
|
transform = Transform3D(-0.750999, -0.305988, 0.585126, -1.29815e-08, 0.886147, 0.463404, -0.660305, 0.348015, -0.665494, 0, 0, 0)
|
|
light_color = Color(0.89, 0.82948, 0.7387, 1)
|
|
shadow_enabled = true
|
|
shadow_reverse_cull_face = true
|
|
directional_shadow_max_distance = 300.0
|
|
|
|
[node name="Camera3D" type="Camera3D" parent="."]
|
|
transform = Transform3D(0.707107, -0.377082, 0.598171, 0, 0.845942, 0.533275, -0.707107, -0.377082, 0.598171, 504.544, 443.732, 504.544)
|
|
fov = 57.3
|
|
far = 2000.0
|
|
script = SubResource("GDScript_b1cmn")
|
|
|
|
[connection signal="primitives_changed" from="TerrainMeshEditor" to="TerrainMeshEditor" method="_on_primitives_changed"]
|