diff --git a/world/earth.gdshader b/world/earth.gdshader new file mode 100644 index 0000000..4539078 --- /dev/null +++ b/world/earth.gdshader @@ -0,0 +1,21 @@ +shader_type canvas_item; + +varying vec2 world_position; +uniform vec4 color : source_color; + +void vertex() { + world_position = (MODEL_MATRIX * vec4(VERTEX, 0.0, 1.0)).xy; +} + +void fragment() { + if(length(world_position) <= 3000.) { + COLOR = color; + } else { + discard; + } +} + +//void light() { +// // Called for every pixel for every light affecting the CanvasItem. +// // Uncomment to replace the default light processing function with this one. +//} diff --git a/world/earth.gdshader.uid b/world/earth.gdshader.uid new file mode 100644 index 0000000..2a55864 --- /dev/null +++ b/world/earth.gdshader.uid @@ -0,0 +1 @@ +uid://ptqflyxta2qd diff --git a/world/earth.tscn b/world/earth.tscn index 4e1311b..e1d2498 100644 --- a/world/earth.tscn +++ b/world/earth.tscn @@ -1,8 +1,8 @@ -[gd_scene load_steps=11 format=3 uid="uid://jjoyj1ldafkf"] +[gd_scene load_steps=13 format=3 uid="uid://jjoyj1ldafkf"] [ext_resource type="Script" uid="uid://vgxh2xdevat7" path="res://world/earth.gd" id="1_wxnww"] -[ext_resource type="Script" uid="uid://b5fhsy1xlreco" path="res://world/draw_circle.gd" id="2_2bhor"] [ext_resource type="Script" uid="uid://m3vyyfk8gnma" path="res://world/grid.gd" id="3_2bhor"] +[ext_resource type="Shader" uid="uid://ptqflyxta2qd" path="res://world/earth.gdshader" id="3_640fc"] [ext_resource type="PackedScene" uid="uid://djawvtdwp423v" path="res://buildings/room_temple.tscn" id="3_nihcy"] [ext_resource type="PackedScene" uid="uid://cmofmd0vf3hx3" path="res://buildings/room_haunted_house.tscn" id="4_ml5no"] [ext_resource type="PackedScene" uid="uid://dliwqqmrxldjh" path="res://buildings/room_bear_trap.tscn" id="4_r4pw8"] @@ -13,6 +13,12 @@ [sub_resource type="CircleShape2D" id="CircleShape2D_5i67w"] radius = 3000.0 +[sub_resource type="ShaderMaterial" id="ShaderMaterial_abvrx"] +shader = ExtResource("3_640fc") +shader_parameter/color = Color(0, 0, 0, 1) + +[sub_resource type="QuadMesh" id="QuadMesh_ej0af"] + [node name="Earth" type="Node2D"] script = ExtResource("1_wxnww") @@ -22,9 +28,10 @@ collision_layer = 41 [node name="CollisionShape2D" type="CollisionShape2D" parent="Ground"] shape = SubResource("CircleShape2D_5i67w") -[node name="GroundVisual" type="Node2D" parent="Ground"] -script = ExtResource("2_2bhor") -radius = 3000.0 +[node name="MeshInstance2D" type="MeshInstance2D" parent="Ground"] +material = SubResource("ShaderMaterial_abvrx") +scale = Vector2(6000, 6000) +mesh = SubResource("QuadMesh_ej0af") [node name="Grid" type="Node2D" parent="."] unique_name_in_owner = true