diff options
Diffstat (limited to 'world/monuments')
-rw-r--r-- | world/monuments/Dock.tscn | 163 | ||||
-rw-r--r-- | world/monuments/DockMonument.gd | 19 | ||||
-rw-r--r-- | world/monuments/Monument.gd | 21 |
3 files changed, 203 insertions, 0 deletions
diff --git a/world/monuments/Dock.tscn b/world/monuments/Dock.tscn new file mode 100644 index 0000000..5a21576 --- /dev/null +++ b/world/monuments/Dock.tscn @@ -0,0 +1,163 @@ +[gd_scene load_steps=14 format=2] + +[sub_resource type="OpenSimplexNoise" id=1] +period = 128.0 +persistence = 1.0 +lacunarity = 4.0 + +[sub_resource type="NoiseTexture" id=2] +noise = SubResource( 1 ) + +[sub_resource type="NoiseTexture" id=3] +seamless = true +as_normalmap = true +noise = SubResource( 1 ) + +[sub_resource type="SpatialMaterial" id=4] +albedo_color = Color( 0.905882, 0.823529, 0.427451, 1 ) +albedo_texture = SubResource( 2 ) +emission_enabled = true +emission = Color( 0.905882, 0.823529, 0.427451, 1 ) +emission_energy = 0.2 +emission_operator = 0 +emission_on_uv2 = false +normal_enabled = true +normal_scale = 1.0 +normal_texture = SubResource( 3 ) +uv1_triplanar = true + +[sub_resource type="SphereMesh" id=5] +material = SubResource( 4 ) +radius = 50.0 +height = 50.0 + +[sub_resource type="SpatialMaterial" id=6] +emission_enabled = true +emission = Color( 1, 1, 1, 1 ) +emission_energy = 0.25 +emission_operator = 0 +emission_on_uv2 = false + +[sub_resource type="CubeMesh" id=7] +material = SubResource( 6 ) +size = Vector3( 150, 50, 100 ) + +[sub_resource type="Gradient" id=8] +interpolation_mode = 1 +offsets = PoolRealArray( 0.0724138, 0.52069 ) +colors = PoolColorArray( 1, 1, 1, 1, 0, 0, 0, 1 ) + +[sub_resource type="GradientTexture2D" id=9] +gradient = SubResource( 8 ) +width = 5 +height = 5 +fill = 1 +fill_from = Vector2( 0.5, 0.5 ) +repeat = 1 + +[sub_resource type="SpatialMaterial" id=10] +albedo_color = Color( 0.521569, 0.298039, 0.00392157, 1 ) +albedo_texture = SubResource( 9 ) +uv1_triplanar = true + +[sub_resource type="PrismMesh" id=11] +material = SubResource( 10 ) +size = Vector3( 150, 50, 100 ) + +[sub_resource type="CubeMesh" id=12] +material = SubResource( 10 ) +size = Vector3( 5, 50, 150 ) + +[sub_resource type="CubeMesh" id=13] +material = SubResource( 10 ) +size = Vector3( 100, 5, 30 ) + +[node name="Dock" type="Spatial"] + +[node name="Shore" type="Spatial" parent="."] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -15, 0 ) + +[node name="MeshInstance" type="MeshInstance" parent="Shore"] +transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -100, 0, 0 ) +mesh = SubResource( 5 ) +skeleton = NodePath("../..") + +[node name="MeshInstance2" type="MeshInstance" parent="Shore"] +transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 100, 0, 0 ) +mesh = SubResource( 5 ) +skeleton = NodePath("../..") + +[node name="MeshInstance7" type="MeshInstance" parent="Shore"] +transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -100, 0, 70 ) +mesh = SubResource( 5 ) +skeleton = NodePath("../..") + +[node name="MeshInstance8" type="MeshInstance" parent="Shore"] +transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 100, 0, 70 ) +mesh = SubResource( 5 ) +skeleton = NodePath("../..") + +[node name="MeshInstance3" type="MeshInstance" parent="Shore"] +transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -30, 0, -50 ) +mesh = SubResource( 5 ) +skeleton = NodePath("../..") + +[node name="MeshInstance4" type="MeshInstance" parent="Shore"] +transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 30, 0, -50 ) +mesh = SubResource( 5 ) +skeleton = NodePath("../..") + +[node name="MeshInstance5" type="MeshInstance" parent="Shore"] +transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -30, 0, -140 ) +mesh = SubResource( 5 ) +skeleton = NodePath("../..") + +[node name="MeshInstance9" type="MeshInstance" parent="Shore"] +transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -115, 0, -50 ) +mesh = SubResource( 5 ) +skeleton = NodePath("../..") + +[node name="MeshInstance10" type="MeshInstance" parent="Shore"] +transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -115, 0, -140 ) +mesh = SubResource( 5 ) +skeleton = NodePath("../..") + +[node name="MeshInstance6" type="MeshInstance" parent="Shore"] +transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 30, 0, -140 ) +mesh = SubResource( 5 ) +skeleton = NodePath("../..") + +[node name="MeshInstance11" type="MeshInstance" parent="Shore"] +transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 115, 0, -50 ) +mesh = SubResource( 5 ) +skeleton = NodePath("../..") + +[node name="MeshInstance12" type="MeshInstance" parent="Shore"] +transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 115, 0, -140 ) +mesh = SubResource( 5 ) +skeleton = NodePath("../..") + +[node name="House" type="Spatial" parent="."] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 25, -80 ) + +[node name="MeshInstance" type="MeshInstance" parent="House"] +mesh = SubResource( 7 ) + +[node name="MeshInstance2" type="MeshInstance" parent="House"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 50, 0 ) +mesh = SubResource( 11 ) + +[node name="Dock" type="Spatial" parent="."] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -10, 50 ) + +[node name="MeshInstance" type="MeshInstance" parent="Dock"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 50, 0, 0 ) +mesh = SubResource( 12 ) + +[node name="MeshInstance2" type="MeshInstance" parent="Dock"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -50, 0, 0 ) +mesh = SubResource( 12 ) + +[node name="MeshInstance3" type="MeshInstance" parent="Dock"] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 5, -40 ) +mesh = SubResource( 13 ) diff --git a/world/monuments/DockMonument.gd b/world/monuments/DockMonument.gd new file mode 100644 index 0000000..2ac0c71 --- /dev/null +++ b/world/monuments/DockMonument.gd @@ -0,0 +1,19 @@ +extends Monument +class_name DockMonument + +var packed_scene = preload("res://world/monuments/Dock.tscn") + +func _init(xform:Transform).(xform,packed_scene,_chunks(),_origin()): + pass + +func _chunks(): + var chunk_size = ChunkLoader.world.chunk_size + var c = {} + var width = stepify(200.0,chunk_size) + for x in range(-width,width+chunk_size,chunk_size): + for y in range(-width,width+chunk_size,chunk_size): + c[Vector2(x,y)] = true + return c + +func _origin(): + return Vector2(0.0,0.0) diff --git a/world/monuments/Monument.gd b/world/monuments/Monument.gd new file mode 100644 index 0000000..86074f1 --- /dev/null +++ b/world/monuments/Monument.gd @@ -0,0 +1,21 @@ +class_name Monument + +var xform:Transform = Transform(Basis(),Vector3.ZERO) +var scene:PackedScene = null +var chunks = {} +var origin_chunk = Vector2.ZERO +var loaded_chunk = null + +func is_chunk_in_monument(chunk_coords:Vector2): + return self.chunks.has(chunk_coords) + +func _init(transform,scn,member_chunks, origin): + self.xform = transform + self.xform.origin = ChunkLoader.v3_coords(ChunkLoader.chunk_coords(ChunkLoader.v2_coords(self.xform.origin))) + self.scene = scn + var org = ChunkLoader.chunk_coords(ChunkLoader.v2_coords(self.xform.origin)) + for c in member_chunks.keys(): + var c2 = ChunkLoader.v2_coords(self.xform.basis * ChunkLoader.v3_coords(c)) + self.chunks[ChunkLoader.chunk_coords(c2)+org] = member_chunks[c] + origin = ChunkLoader.v2_coords(self.xform.basis * ChunkLoader.v3_coords(origin)) + self.origin_chunk = ChunkLoader.chunk_coords(origin)+org |