Skip to content

Commit

Permalink
Init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
bitsycore committed Mar 4, 2020
0 parents commit a4dc1d2
Show file tree
Hide file tree
Showing 11 changed files with 140 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*/.import
3 changes: 3 additions & 0 deletions .import/1px.png-79405118b3e3e6c40f5892622ac4cad1.md5
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_md5="148b14e0b47878eee50a175f6fa0a5c5"
dest_md5="1540cddbdd93be993dcc8b2c1198617a"

Binary file not shown.
3 changes: 3 additions & 0 deletions .import/1px.png-894ec182c48b4f590b69cc448f917bbd.md5
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_md5="148b14e0b47878eee50a175f6fa0a5c5"
dest_md5="1540cddbdd93be993dcc8b2c1198617a"

Binary file not shown.
3 changes: 3 additions & 0 deletions .import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source_md5="47313fa4c47a9963fddd764e1ec6e4a8"
dest_md5="2ded9e7f9060e2b530aab678b135fc5b"

Binary file added VoronoiShaderGenerator/1px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions VoronoiShaderGenerator/1px.png.import
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions VoronoiShaderGenerator/VoronoiShaderGenerator.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
extends Control


func _ready():
pass
73 changes: 73 additions & 0 deletions VoronoiShaderGenerator/VoronoiShaderGenerator.tscn
Original file line number Diff line number Diff line change
@@ -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
}
18 changes: 18 additions & 0 deletions project.godot
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit a4dc1d2

Please sign in to comment.