diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..036dd8f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*/.import \ No newline at end of file diff --git a/.import/1px.png-79405118b3e3e6c40f5892622ac4cad1.md5 b/.import/1px.png-79405118b3e3e6c40f5892622ac4cad1.md5 new file mode 100644 index 0000000..91520c4 --- /dev/null +++ b/.import/1px.png-79405118b3e3e6c40f5892622ac4cad1.md5 @@ -0,0 +1,3 @@ +source_md5="148b14e0b47878eee50a175f6fa0a5c5" +dest_md5="1540cddbdd93be993dcc8b2c1198617a" + diff --git a/.import/1px.png-79405118b3e3e6c40f5892622ac4cad1.stex b/.import/1px.png-79405118b3e3e6c40f5892622ac4cad1.stex new file mode 100644 index 0000000..23fffd2 Binary files /dev/null and b/.import/1px.png-79405118b3e3e6c40f5892622ac4cad1.stex differ diff --git a/.import/1px.png-894ec182c48b4f590b69cc448f917bbd.md5 b/.import/1px.png-894ec182c48b4f590b69cc448f917bbd.md5 new file mode 100644 index 0000000..91520c4 --- /dev/null +++ b/.import/1px.png-894ec182c48b4f590b69cc448f917bbd.md5 @@ -0,0 +1,3 @@ +source_md5="148b14e0b47878eee50a175f6fa0a5c5" +dest_md5="1540cddbdd93be993dcc8b2c1198617a" + diff --git a/.import/1px.png-894ec182c48b4f590b69cc448f917bbd.stex b/.import/1px.png-894ec182c48b4f590b69cc448f917bbd.stex new file mode 100644 index 0000000..23fffd2 Binary files /dev/null and b/.import/1px.png-894ec182c48b4f590b69cc448f917bbd.stex differ diff --git a/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5 b/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5 new file mode 100644 index 0000000..7b61c3e --- /dev/null +++ b/.import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5 @@ -0,0 +1,3 @@ +source_md5="47313fa4c47a9963fddd764e1ec6e4a8" +dest_md5="2ded9e7f9060e2b530aab678b135fc5b" + diff --git a/VoronoiShaderGenerator/1px.png b/VoronoiShaderGenerator/1px.png new file mode 100644 index 0000000..0ec10e9 Binary files /dev/null and b/VoronoiShaderGenerator/1px.png differ diff --git a/VoronoiShaderGenerator/1px.png.import b/VoronoiShaderGenerator/1px.png.import new file mode 100644 index 0000000..1cde5ce --- /dev/null +++ b/VoronoiShaderGenerator/1px.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/1px.png-79405118b3e3e6c40f5892622ac4cad1.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://VoronoiShaderGenerator/1px.png" +dest_files=[ "res://.import/1px.png-79405118b3e3e6c40f5892622ac4cad1.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/VoronoiShaderGenerator/VoronoiShaderGenerator.gd b/VoronoiShaderGenerator/VoronoiShaderGenerator.gd new file mode 100644 index 0000000..79df3d0 --- /dev/null +++ b/VoronoiShaderGenerator/VoronoiShaderGenerator.gd @@ -0,0 +1,5 @@ +extends Control + + +func _ready(): + pass diff --git a/VoronoiShaderGenerator/VoronoiShaderGenerator.tscn b/VoronoiShaderGenerator/VoronoiShaderGenerator.tscn new file mode 100644 index 0000000..2ff793c --- /dev/null +++ b/VoronoiShaderGenerator/VoronoiShaderGenerator.tscn @@ -0,0 +1,73 @@ +[gd_scene load_steps=6 format=2] + +[ext_resource path="res://VoronoiShaderGenerator/1px.png" type="Texture" id=1] +[ext_resource path="res://VoronoiShaderGenerator/VoronoiShaderGenerator.gd" type="Script" id=2] + +[sub_resource type="ViewportTexture" id=1] +viewport_path = NodePath("Viewport") + +[sub_resource type="Shader" id=2] +code = "shader_type canvas_item; + +uniform vec2 u_resolution; +uniform vec2 u_mouse; +uniform float u_time; + +vec2 random2( vec2 p ) +{ + return fract(sin(vec2(dot(p,vec2(127.1,311.7)),dot(p,vec2(269.5,183.3))))*43758.5453); +} + +void fragment() +{ + vec2 st = FRAGCOORD.xy/u_resolution.xy; + st.x *= u_resolution.x/u_resolution.y; + vec3 color = vec3(.0); + st *= 3.; + vec2 i_st = floor(st); + vec2 f_st = fract(st); + + float m_dist = 1.; + + for (int y= -1; y <= 1; y++) { + for (int x= -1; x <= 1; x++) { + vec2 neighbor = vec2(float(x),float(y)); + vec2 point = random2(i_st + neighbor); + point = 0.5 + 0.5*sin(u_time + 6.2831*point); + vec2 diff = neighbor + point - f_st; + float dist = length(diff); + m_dist = min(m_dist, dist); + } + } + color += m_dist; + color += 1.-step(.02, m_dist); + COLOR = vec4(color,1.0); +}" + +[sub_resource type="ShaderMaterial" id=3] +shader = SubResource( 2 ) +shader_param/u_resolution = Vector2( 150, 150 ) +shader_param/u_mouse = null +shader_param/u_time = null + +[node name="VoronoiShaderGenerator" type="Node2D"] +script = ExtResource( 2 ) + +[node name="Renderer" type="Sprite" parent="."] +scale = Vector2( 0.000105832, 0.000106636 ) +texture = SubResource( 1 ) + +[node name="Viewport" type="Viewport" parent="."] +size = Vector2( 1280, 1280 ) +render_target_v_flip = true +render_target_update_mode = 3 + +[node name="Shader" type="TextureRect" parent="Viewport"] +material = SubResource( 3 ) +margin_right = 1280.0 +margin_bottom = 1280.0 +texture = ExtResource( 1 ) +expand = true +__meta__ = { +"_edit_use_anchors_": false +} diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..5b89f12 --- /dev/null +++ b/project.godot @@ -0,0 +1,18 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=4 + +_global_script_classes=[ ] +_global_script_class_icons={ + +} + +[application] + +config/name="VoronoiShaderGenerator"