mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-12-18 01:06:47 +01:00
Simple nodes are using Commons.gd aswell.
This commit is contained in:
parent
f3504fd634
commit
e4eccdc034
@ -1,6 +1,8 @@
|
||||
tool
|
||||
extends TextureRect
|
||||
|
||||
var Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd")
|
||||
|
||||
var image : Image
|
||||
var tex : ImageTexture
|
||||
|
||||
@ -63,7 +65,7 @@ func gen() -> void:
|
||||
# var col : Color = gradient_type_1(fractf(p_o95415_repeat * 0.15915494309 * atan((v.x - 0.5) / (v.y - 0.5))));
|
||||
# var col : Color = gradient_type_2(fractf(p_o95415_repeat * 0.15915494309 * atan((v.x - 0.5) / (v.y - 0.5))));
|
||||
# var col : Color = gradient_type_3(fractf(p_o95415_repeat * 0.15915494309 * atan((v.x - 0.5) / (v.y - 0.5))));
|
||||
var col : Color = gradient_type_4(fractf(p_o95415_repeat * 0.15915494309 * atan((v.x - 0.5) / v.y - 0.5)));
|
||||
var col : Color = gradient_type_4(Commons.fractf(p_o95415_repeat * 0.15915494309 * atan((v.x - 0.5) / v.y - 0.5)));
|
||||
|
||||
image.set_pixel(x, y, col)
|
||||
|
||||
@ -111,64 +113,6 @@ func gradient_type_4(x : float) -> Color:
|
||||
|
||||
return Color(p_o95415_gradient_2_r,p_o95415_gradient_2_g,p_o95415_gradient_2_b,p_o95415_gradient_2_a);
|
||||
|
||||
func modf(x : float, y : float) -> float:
|
||||
return x - y * floor(x / y)
|
||||
|
||||
func fract(v : Vector2) -> Vector2:
|
||||
v.x = v.x - floor(v.x)
|
||||
v.y = v.y - floor(v.y)
|
||||
|
||||
return v
|
||||
|
||||
func fractf(f : float) -> float:
|
||||
return f - floor(f)
|
||||
|
||||
func rand(x : Vector2) -> float:
|
||||
return fractf(cos(x.dot(Vector2(13.9898, 8.141))) * 43758.5453);
|
||||
|
||||
func step(edge : float, x : float) -> float:
|
||||
if x < edge:
|
||||
return 0.0
|
||||
else:
|
||||
return 1.0
|
||||
|
||||
#common -----
|
||||
|
||||
#float rand(vec2 x) {
|
||||
# return fract(cos(dot(x, vec2(13.9898, 8.141))) * 43758.5453);
|
||||
#}
|
||||
#
|
||||
#vec2 rand2(vec2 x) {
|
||||
# return fract(cos(vec2(dot(x, vec2(13.9898, 8.141)),
|
||||
# dot(x, vec2(3.4562, 17.398)))) * 43758.5453);
|
||||
#}
|
||||
#
|
||||
#vec3 rand3(vec2 x) {
|
||||
# return fract(cos(vec3(dot(x, vec2(13.9898, 8.141)),
|
||||
# dot(x, vec2(3.4562, 17.398)),
|
||||
# dot(x, vec2(13.254, 5.867)))) * 43758.5453);
|
||||
#}
|
||||
#
|
||||
#vec3 rgb2hsv(vec3 c) {
|
||||
# vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||||
# vec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy);
|
||||
# vec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx);
|
||||
#
|
||||
# float d = q.x - min(q.w, q.y);
|
||||
# float e = 1.0e-10;
|
||||
# return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
||||
#}
|
||||
#
|
||||
#vec3 hsv2rgb(vec3 c) {
|
||||
# vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||
# vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
||||
# return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
||||
#}
|
||||
|
||||
|
||||
#end common
|
||||
|
||||
|
||||
func reffg():
|
||||
return false
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
tool
|
||||
extends TextureRect
|
||||
|
||||
var Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd")
|
||||
|
||||
var image : Image
|
||||
var tex : ImageTexture
|
||||
|
||||
@ -48,14 +50,14 @@ func gen() -> void:
|
||||
var o147388_0_bezier : Vector2 = sdBezier(v, Vector2(p_o147388_ax+0.5, p_o147388_ay+0.5), Vector2(p_o147388_bx+0.5, p_o147388_by+0.5), Vector2(p_o147388_cx+0.5, p_o147388_cy+0.5));
|
||||
var o147388_0_uv : Vector2 = Vector2(o147388_0_bezier.x, o147388_0_bezier.y/p_o147388_width+0.5);
|
||||
|
||||
var uvt : Vector2 = absv(o147388_0_uv - Vector2(0.5, 0.5))
|
||||
var uvt : Vector2 = Commons.absv(o147388_0_uv - Vector2(0.5, 0.5))
|
||||
|
||||
uvt.x = step(0.5, uvt.x);
|
||||
uvt.y = step(0.5, uvt.y);
|
||||
uvt.x = Commons.step(0.5, uvt.x);
|
||||
uvt.y = Commons.step(0.5, uvt.y);
|
||||
|
||||
o147388_0_uv = lerp(Vector2(fractf(p_o147388_repeat * o147388_0_uv.x), o147388_0_uv.y), Vector2(0, 0), max(uvt.x, uvt.y));
|
||||
o147388_0_uv = lerp(Vector2(Commons.fractf(p_o147388_repeat * o147388_0_uv.x), o147388_0_uv.y), Vector2(0, 0), max(uvt.x, uvt.y));
|
||||
|
||||
var f : float = step(abs(((o147388_0_uv)).y-0.5), 0.4999)
|
||||
var f : float = Commons.step(abs(((o147388_0_uv)).y-0.5), 0.4999)
|
||||
var c : Color = Color(f, f, f, 1.0);
|
||||
|
||||
|
||||
@ -135,70 +137,6 @@ func sdBezier(pos : Vector2, A : Vector2, B : Vector2, C : Vector2) -> Vector2:
|
||||
#
|
||||
return Vector2(rvx, sqrt(res)*sign(sgn));
|
||||
|
||||
func absv(v : Vector2):
|
||||
v.x = abs(v.x)
|
||||
v.y = abs(v.y)
|
||||
|
||||
return v
|
||||
|
||||
func modf(x : float, y : float) -> float:
|
||||
return x - y * floor(x / y)
|
||||
|
||||
func fract(v : Vector2) -> Vector2:
|
||||
v.x = v.x - floor(v.x)
|
||||
v.y = v.y - floor(v.y)
|
||||
|
||||
return v
|
||||
|
||||
func fractf(f : float) -> float:
|
||||
return f - floor(f)
|
||||
|
||||
func rand(x : Vector2) -> float:
|
||||
return fractf(cos(x.dot(Vector2(13.9898, 8.141))) * 43758.5453);
|
||||
|
||||
func step(edge : float, x : float) -> float:
|
||||
if x < edge:
|
||||
return 0.0
|
||||
else:
|
||||
return 1.0
|
||||
|
||||
#common -----
|
||||
|
||||
#float rand(vec2 x) {
|
||||
# return fract(cos(dot(x, vec2(13.9898, 8.141))) * 43758.5453);
|
||||
#}
|
||||
#
|
||||
#vec2 rand2(vec2 x) {
|
||||
# return fract(cos(vec2(dot(x, vec2(13.9898, 8.141)),
|
||||
# dot(x, vec2(3.4562, 17.398)))) * 43758.5453);
|
||||
#}
|
||||
#
|
||||
#vec3 rand3(vec2 x) {
|
||||
# return fract(cos(vec3(dot(x, vec2(13.9898, 8.141)),
|
||||
# dot(x, vec2(3.4562, 17.398)),
|
||||
# dot(x, vec2(13.254, 5.867)))) * 43758.5453);
|
||||
#}
|
||||
#
|
||||
#vec3 rgb2hsv(vec3 c) {
|
||||
# vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||||
# vec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy);
|
||||
# vec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx);
|
||||
#
|
||||
# float d = q.x - min(q.w, q.y);
|
||||
# float e = 1.0e-10;
|
||||
# return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
||||
#}
|
||||
#
|
||||
#vec3 hsv2rgb(vec3 c) {
|
||||
# vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||
# vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
||||
# return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
||||
#}
|
||||
|
||||
|
||||
#end common
|
||||
|
||||
|
||||
func reffg():
|
||||
return false
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
tool
|
||||
extends TextureRect
|
||||
|
||||
var Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd")
|
||||
|
||||
var image : Image
|
||||
var tex : ImageTexture
|
||||
|
||||
@ -69,8 +71,8 @@ func gen() -> void:
|
||||
# var rr : float = 0.5+(cos(p_o71406_rotate*0.01745329251)*(v.x-0.5)+sin(p_o71406_rotate*0.01745329251)*(v.y-0.5))/(cos(abs(modf(p_o71406_rotate, 90.0)-45.0)*0.01745329251)*1.41421356237);
|
||||
# var col : Color = gradient_type_3(fractf(rr * p_o71406_repeat))
|
||||
|
||||
var rr : float = 0.5+(cos(p_o71406_rotate*0.01745329251)*(v.x-0.5)+sin(p_o71406_rotate*0.01745329251)*(v.y-0.5))/(cos(abs(modf(p_o71406_rotate, 90.0)-45.0)*0.01745329251)*1.41421356237);
|
||||
var col : Color = gradient_type_4(fractf(rr * p_o71406_repeat));
|
||||
var rr : float = 0.5+(cos(p_o71406_rotate*0.01745329251)*(v.x-0.5)+sin(p_o71406_rotate*0.01745329251)*(v.y-0.5))/(cos(abs(Commons.modf(p_o71406_rotate, 90.0)-45.0)*0.01745329251)*1.41421356237);
|
||||
var col : Color = gradient_type_4(Commons.fractf(rr * p_o71406_repeat));
|
||||
|
||||
image.set_pixel(x, y, col)
|
||||
|
||||
@ -118,64 +120,6 @@ func gradient_type_4(x : float) -> Color:
|
||||
|
||||
return Color(p_o71406_gradient_2_r,p_o71406_gradient_2_g,p_o71406_gradient_2_b,p_o71406_gradient_2_a);
|
||||
|
||||
func modf(x : float, y : float) -> float:
|
||||
return x - y * floor(x / y)
|
||||
|
||||
func fract(v : Vector2) -> Vector2:
|
||||
v.x = v.x - floor(v.x)
|
||||
v.y = v.y - floor(v.y)
|
||||
|
||||
return v
|
||||
|
||||
func fractf(f : float) -> float:
|
||||
return f - floor(f)
|
||||
|
||||
func rand(x : Vector2) -> float:
|
||||
return fractf(cos(x.dot(Vector2(13.9898, 8.141))) * 43758.5453);
|
||||
|
||||
func step(edge : float, x : float) -> float:
|
||||
if x < edge:
|
||||
return 0.0
|
||||
else:
|
||||
return 1.0
|
||||
|
||||
#common -----
|
||||
|
||||
#float rand(vec2 x) {
|
||||
# return fract(cos(dot(x, vec2(13.9898, 8.141))) * 43758.5453);
|
||||
#}
|
||||
#
|
||||
#vec2 rand2(vec2 x) {
|
||||
# return fract(cos(vec2(dot(x, vec2(13.9898, 8.141)),
|
||||
# dot(x, vec2(3.4562, 17.398)))) * 43758.5453);
|
||||
#}
|
||||
#
|
||||
#vec3 rand3(vec2 x) {
|
||||
# return fract(cos(vec3(dot(x, vec2(13.9898, 8.141)),
|
||||
# dot(x, vec2(3.4562, 17.398)),
|
||||
# dot(x, vec2(13.254, 5.867)))) * 43758.5453);
|
||||
#}
|
||||
#
|
||||
#vec3 rgb2hsv(vec3 c) {
|
||||
# vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||||
# vec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy);
|
||||
# vec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx);
|
||||
#
|
||||
# float d = q.x - min(q.w, q.y);
|
||||
# float e = 1.0e-10;
|
||||
# return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
||||
#}
|
||||
#
|
||||
#vec3 hsv2rgb(vec3 c) {
|
||||
# vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||
# vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
||||
# return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
||||
#}
|
||||
|
||||
|
||||
#end common
|
||||
|
||||
|
||||
func reffg():
|
||||
return false
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
tool
|
||||
extends TextureRect
|
||||
|
||||
var Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd")
|
||||
|
||||
var image : Image
|
||||
var tex : ImageTexture
|
||||
|
||||
@ -68,7 +70,7 @@ func gen() -> void:
|
||||
# var col : Color = radial_gradient_type_1(fractf(p_o28405_repeat*1.41421356237* (fract(v)- Vector2(0.5, 0.5)).length()))
|
||||
# var col : Color = radial_gradient_type_2(fractf(p_o28405_repeat*1.41421356237* (fract(v)- Vector2(0.5, 0.5)).length()))
|
||||
# var col : Color = radial_gradient_type_3(fractf(p_o28405_repeat*1.41421356237* (fract(v)- Vector2(0.5, 0.5)).length()))
|
||||
var col : Color = radial_gradient_type_4(fractf(p_o28405_repeat*1.41421356237* (fract(v)- Vector2(0.5, 0.5)).length()))
|
||||
var col : Color = radial_gradient_type_4(Commons.fractf(p_o28405_repeat*1.41421356237* (Commons.fract(v)- Vector2(0.5, 0.5)).length()))
|
||||
|
||||
image.set_pixel(x, y, col)
|
||||
|
||||
@ -117,64 +119,6 @@ func radial_gradient_type_4(x : float) -> Color:
|
||||
return Color(p_o24141_gradient_2_r,p_o24141_gradient_2_g,p_o24141_gradient_2_b,p_o24141_gradient_2_a);
|
||||
|
||||
|
||||
func modf(x : float, y : float) -> float:
|
||||
return x - y * floor(x / y)
|
||||
|
||||
func fract(v : Vector2) -> Vector2:
|
||||
v.x = v.x - floor(v.x)
|
||||
v.y = v.y - floor(v.y)
|
||||
|
||||
return v
|
||||
|
||||
func fractf(f : float) -> float:
|
||||
return f - floor(f)
|
||||
|
||||
func rand(x : Vector2) -> float:
|
||||
return fractf(cos(x.dot(Vector2(13.9898, 8.141))) * 43758.5453);
|
||||
|
||||
func step(edge : float, x : float) -> float:
|
||||
if x < edge:
|
||||
return 0.0
|
||||
else:
|
||||
return 1.0
|
||||
|
||||
#common -----
|
||||
|
||||
#float rand(vec2 x) {
|
||||
# return fract(cos(dot(x, vec2(13.9898, 8.141))) * 43758.5453);
|
||||
#}
|
||||
#
|
||||
#vec2 rand2(vec2 x) {
|
||||
# return fract(cos(vec2(dot(x, vec2(13.9898, 8.141)),
|
||||
# dot(x, vec2(3.4562, 17.398)))) * 43758.5453);
|
||||
#}
|
||||
#
|
||||
#vec3 rand3(vec2 x) {
|
||||
# return fract(cos(vec3(dot(x, vec2(13.9898, 8.141)),
|
||||
# dot(x, vec2(3.4562, 17.398)),
|
||||
# dot(x, vec2(13.254, 5.867)))) * 43758.5453);
|
||||
#}
|
||||
#
|
||||
#vec3 rgb2hsv(vec3 c) {
|
||||
# vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||||
# vec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy);
|
||||
# vec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx);
|
||||
#
|
||||
# float d = q.x - min(q.w, q.y);
|
||||
# float e = 1.0e-10;
|
||||
# return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
||||
#}
|
||||
#
|
||||
#vec3 hsv2rgb(vec3 c) {
|
||||
# vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||
# vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
||||
# return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
||||
#}
|
||||
|
||||
|
||||
#end common
|
||||
|
||||
|
||||
func reffg():
|
||||
return false
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
tool
|
||||
extends TextureRect
|
||||
|
||||
var Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd")
|
||||
|
||||
var image : Image
|
||||
var tex : ImageTexture
|
||||
|
||||
@ -98,7 +100,7 @@ func shape_star(uv : Vector2, sides : float, size : float, edge : float) -> floa
|
||||
var angle : float = atan(uv.y / uv.x)
|
||||
var slice : float = 6.28318530718 / sides
|
||||
|
||||
return clamp((size - cos(floor(1.5 + angle / slice - 2.0 * step(0.5 * slice, modf(angle, slice))) * slice - angle) * uv.length()) / (edge * size), 0.0, 1.0);
|
||||
return clamp((size - cos(floor(1.5 + angle / slice - 2.0 * Commons.step(0.5 * slice, Commons.modf(angle, slice))) * slice - angle) * uv.length()) / (edge * size), 0.0, 1.0);
|
||||
|
||||
func shape_curved_star(uv : Vector2, sides : float, size : float, edge : float) -> float:
|
||||
uv.x = 2.0 * uv.x - 1.0
|
||||
@ -126,68 +128,10 @@ func shape_rays(uv : Vector2, sides : float, size : float, edge : float) -> floa
|
||||
uv.x += 0.0000001
|
||||
|
||||
var slice : float = 6.28318530718 / sides
|
||||
var angle : float = modf(atan(uv.y / uv.x) + 3.14159265359, slice) / slice
|
||||
var angle : float = Commons.modf(atan(uv.y / uv.x) + 3.14159265359, slice) / slice
|
||||
|
||||
return clamp(min((size - angle) / edge, angle / edge), 0.0, 1.0);
|
||||
|
||||
func modf(x : float, y : float) -> float:
|
||||
return x - y * floor(x / y)
|
||||
|
||||
func fract(v : Vector2) -> Vector2:
|
||||
v.x = v.x - floor(v.x)
|
||||
v.y = v.y - floor(v.y)
|
||||
|
||||
return v
|
||||
|
||||
func fractf(f : float) -> float:
|
||||
return f - floor(f)
|
||||
|
||||
func rand(x : Vector2) -> float:
|
||||
return fractf(cos(x.dot(Vector2(13.9898, 8.141))) * 43758.5453);
|
||||
|
||||
func step(edge : float, x : float) -> float:
|
||||
if x < edge:
|
||||
return 0.0
|
||||
else:
|
||||
return 1.0
|
||||
|
||||
#common -----
|
||||
|
||||
#float rand(vec2 x) {
|
||||
# return fract(cos(dot(x, vec2(13.9898, 8.141))) * 43758.5453);
|
||||
#}
|
||||
#
|
||||
#vec2 rand2(vec2 x) {
|
||||
# return fract(cos(vec2(dot(x, vec2(13.9898, 8.141)),
|
||||
# dot(x, vec2(3.4562, 17.398)))) * 43758.5453);
|
||||
#}
|
||||
#
|
||||
#vec3 rand3(vec2 x) {
|
||||
# return fract(cos(vec3(dot(x, vec2(13.9898, 8.141)),
|
||||
# dot(x, vec2(3.4562, 17.398)),
|
||||
# dot(x, vec2(13.254, 5.867)))) * 43758.5453);
|
||||
#}
|
||||
#
|
||||
#vec3 rgb2hsv(vec3 c) {
|
||||
# vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
|
||||
# vec4 p = c.g < c.b ? vec4(c.bg, K.wz) : vec4(c.gb, K.xy);
|
||||
# vec4 q = c.r < p.x ? vec4(p.xyw, c.r) : vec4(c.r, p.yzx);
|
||||
#
|
||||
# float d = q.x - min(q.w, q.y);
|
||||
# float e = 1.0e-10;
|
||||
# return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
|
||||
#}
|
||||
#
|
||||
#vec3 hsv2rgb(vec3 c) {
|
||||
# vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||
# vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
||||
# return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
||||
#}
|
||||
|
||||
|
||||
#end common
|
||||
|
||||
|
||||
func reffg():
|
||||
return false
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user