Moving pattern related things to a central patterns.gd.

This commit is contained in:
Relintai 2021-10-02 19:48:45 +02:00
parent 5129cda7f1
commit cb7fd0a873
8 changed files with 250 additions and 224 deletions

View File

@ -1,23 +1,5 @@
extends Reference extends Reference
enum CombinerAxisType {
SINE,
TRIANGLE,
SQUARE,
SAWTOOTH,
CONSTANT,
BOUNCE
}
enum CombinerType {
MULTIPLY,
ADD,
MAX,
MIN,
XOR,
POW
}
static func clampv3(v : Vector3, mi : Vector3, ma : Vector3) -> Vector3: static func clampv3(v : Vector3, mi : Vector3, ma : Vector3) -> Vector3:
v.x = clamp(v.x, mi.x, ma.x) v.x = clamp(v.x, mi.x, ma.x)
v.y = clamp(v.y, mi.y, ma.y) v.y = clamp(v.y, mi.y, ma.y)
@ -206,78 +188,6 @@ static func color_dots(uv : Vector2, size : float, pseed : int) -> Vector3:
var point_pos : Vector2 = floorv2(uv) + Vector2(0.5, 0.5); var point_pos : Vector2 = floorv2(uv) + Vector2(0.5, 0.5);
return rand3(seed2 + point_pos); return rand3(seed2 + point_pos);
static func beehive_dist(p : Vector2) -> float:
var s : Vector2 = Vector2(1.0, 1.73205080757);
p = absv2(p);
return max(p.dot(s*.5), p.x);
static func beehive_center(p : Vector2) -> Color:
var s : Vector2 = Vector2(1.0, 1.73205080757);
var hC : Color = Color(p.x, p.y, p.x - 0.5, p.y - 1) / Color(s.x, s.y, s.x, s.y);
hC = floorc(Color(p.x, p.y, p.x - 0.5, p.y - 1) / Color(s.x, s.y, s.x, s.y)) + Color(0.5, 0.5, 0.5, 0.5);
var v1 : Vector2 = Vector2(p.x - hC.r * s.x, p.y - hC.g * s.y)
var v2 : Vector2 = Vector2(p.x - (hC.b + 0.5) * s.x, p.y - (hC.a + 0.5) * s.y)
var h : Color = Color(v1.x, v1.y, v2.x, v2.y);
if Vector2(h.r, h.g).dot(Vector2(h.r, h.g)) < Vector2(h.b, h.a).dot(Vector2(h.b, h.a)):
return Color(h.r, h.g, hC.r, hC.g)
else:
return Color(h.b, h.a, hC.b + 9.73, hC.a + 9.73)
#return dot(h.xy, h.xy) < dot(h.zw, h.zw) ? Color(h.xy, hC.xy) : Color(h.zw, hC.zw + 9.73);
static func pattern(uv : Vector2, x_scale : float, y_scale : float, ct : int, catx : int, caty : int) -> float:
var x : float = 0
var y : float = 0
#in c++ these ifs should be function pointers or macros in the caller
if catx == CombinerAxisType.SINE:
x = wave_sine(x_scale * uv.x)
elif catx == CombinerAxisType.TRIANGLE:
x = wave_triangle(x_scale * uv.x)
elif catx == CombinerAxisType.SQUARE:
x = wave_square(x_scale * uv.x)
elif catx == CombinerAxisType.SAWTOOTH:
x = wave_sawtooth(x_scale * uv.x)
elif catx == CombinerAxisType.CONSTANT:
x = wave_constant(x_scale * uv.x)
elif catx == CombinerAxisType.BOUNCE:
x = wave_bounce(x_scale * uv.x)
if caty == CombinerAxisType.SINE:
y = wave_sine(y_scale * uv.y)
elif caty == CombinerAxisType.TRIANGLE:
y = wave_triangle(y_scale * uv.y)
elif caty == CombinerAxisType.SQUARE:
y = wave_square(y_scale * uv.y)
elif caty == CombinerAxisType.SAWTOOTH:
y = wave_sawtooth(y_scale * uv.y)
elif caty == CombinerAxisType.CONSTANT:
y = wave_constant(y_scale * uv.y)
elif caty == CombinerAxisType.BOUNCE:
y = wave_bounce(y_scale * uv.y)
if ct == CombinerType.MULTIPLY:
return mix_mul(x, y)
elif ct == CombinerType.ADD:
return mix_add(x, y);
elif ct == CombinerType.MAX:
return mix_max(x, y);
elif ct == CombinerType.MIN:
return mix_min(x, y);
elif ct == CombinerType.XOR:
return mix_xor(x, y);
elif ct == CombinerType.POW:
return mix_pow(x, y);
return 0.0
static func wave_constant(x : float) -> float: static func wave_constant(x : float) -> float:
return 1.0; return 1.0;
@ -336,84 +246,6 @@ static func ThickLine(uv : Vector2, posA : Vector2, posB : Vector2, radiusInv :
return finalGray; return finalGray;
# makes a rune in the 0..1 uv space. Seed is which rune to draw.
# passes back gray in x and derivates for lighting in yz
static func Rune(uv : Vector2) -> float:
var finalLine : float = 0.0;
var pseed : Vector2 = floorv2(uv) - Vector2(0.41, 0.41);
uv = fractv2(uv);
for i in range(4):# (int i = 0; i < 4; i++): # // number of strokes
var posA : Vector2 = rand2(floorv2(pseed + Vector2(0.5, 0.5)));
var posB : Vector2 = rand2(floorv2(pseed + Vector2(1.5, 1.5)));
pseed.x += 2.0;
pseed.y += 2.0;
# expand the range and mod it to get a nicely distributed random number - hopefully. :)
posA = fractv2(posA * 128.0);
posB = fractv2(posB * 128.0);
# each rune touches the edge of its box on all 4 sides
if (i == 0):
posA.y = 0.0;
if (i == 1):
posA.x = 0.999;
if (i == 2):
posA.x = 0.0;
if (i == 3):
posA.y = 0.999;
# snap the random line endpoints to a grid 2x3
var snaps : Vector2 = Vector2(2.0, 3.0);
posA = (floorv2(posA * snaps) + Vector2(0.5, 0.5)) / snaps; # + 0.5 to center it in a grid cell
posB = (floorv2(posB * snaps) + Vector2(0.5, 0.5)) / snaps;
#if (distance(posA, posB) < 0.0001) continue; // eliminate dots.
# Dots (degenerate lines) are not cross-GPU safe without adding 0.001 - divide by 0 error.
finalLine = max(finalLine, ThickLine(uv, posA, posB + Vector2(0.001, 0.001), 20.0));
return finalLine;
static func scratch(uv : Vector2, size : Vector2, waviness : float, angle : float, randomness : float, pseed : Vector2) -> float:
var subdivide : float = floor(1.0/size.x);
var cut : float = size.x*subdivide;
uv *= subdivide;
var r1 : Vector2 = rand2(floorv2(uv) + pseed);
var r2 : Vector2 = rand2(r1);
uv = fractv2(uv);
uv = 2.0 * uv - Vector2(1, 1);
var a : float = 6.28*(angle+(r1.x-0.5)*randomness);
var c : float = cos(a);
var s : float = sin(a);
uv = Vector2(c*uv.x+s*uv.y, s*uv.x-c*uv.y);
uv.y += 2.0*r1.y-1.0;
uv.y += 0.5*waviness*cos(2.0*uv.x+6.28*r2.y);
uv.x /= cut;
uv.y /= subdivide*size.y;
return (1.0-uv.x*uv.x)*max(0.0, 1.0-1000.0*uv.y*uv.y);
static func scratches(uv : Vector2, layers : int, size : Vector2, waviness : float, angle : float, randomness : float, pseed : Vector2) -> float:
var v : float = 0.0;
for i in range(layers):# (int i = 0; i < layers; ++i) {
v = max(v, scratch(fractv2(uv + pseed), size, waviness, angle/360.0, randomness, pseed));
pseed = rand2(pseed);
return v;
static func truchet1(uv : Vector2, pseed : Vector2) -> float: static func truchet1(uv : Vector2, pseed : Vector2) -> float:
var i : Vector2 = floorv2(uv); var i : Vector2 = floorv2(uv);
var f : Vector2 = fractv2(uv) - Vector2(0.5, 0.5); var f : Vector2 = fractv2(uv) - Vector2(0.5, 0.5);

View File

@ -0,0 +1,234 @@
extends Reference
const Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd")
enum CombinerAxisType {
SINE,
TRIANGLE,
SQUARE,
SAWTOOTH,
CONSTANT,
BOUNCE
}
enum CombinerType {
MULTIPLY,
ADD,
MAX,
MIN,
XOR,
POW
}
static func pattern(uv : Vector2, x_scale : float, y_scale : float, ct : int, catx : int, caty : int) -> float:
var x : float = 0
var y : float = 0
#in c++ these ifs should be function pointers or macros in the caller
if catx == CombinerAxisType.SINE:
x = Commons.wave_sine(x_scale * uv.x)
elif catx == CombinerAxisType.TRIANGLE:
x = Commons.wave_triangle(x_scale * uv.x)
elif catx == CombinerAxisType.SQUARE:
x = Commons.wave_square(x_scale * uv.x)
elif catx == CombinerAxisType.SAWTOOTH:
x = Commons.wave_sawtooth(x_scale * uv.x)
elif catx == CombinerAxisType.CONSTANT:
x = Commons.wave_constant(x_scale * uv.x)
elif catx == CombinerAxisType.BOUNCE:
x = Commons.wave_bounce(x_scale * uv.x)
if caty == CombinerAxisType.SINE:
y = Commons.wave_sine(y_scale * uv.y)
elif caty == CombinerAxisType.TRIANGLE:
y = Commons.wave_triangle(y_scale * uv.y)
elif caty == CombinerAxisType.SQUARE:
y = Commons.wave_square(y_scale * uv.y)
elif caty == CombinerAxisType.SAWTOOTH:
y = Commons.wave_sawtooth(y_scale * uv.y)
elif caty == CombinerAxisType.CONSTANT:
y = Commons.wave_constant(y_scale * uv.y)
elif caty == CombinerAxisType.BOUNCE:
y = Commons.wave_bounce(y_scale * uv.y)
if ct == CombinerType.MULTIPLY:
return Commons.mix_mul(x, y)
elif ct == CombinerType.ADD:
return Commons.mix_add(x, y);
elif ct == CombinerType.MAX:
return Commons.mix_max(x, y);
elif ct == CombinerType.MIN:
return Commons.mix_min(x, y);
elif ct == CombinerType.XOR:
return Commons.mix_xor(x, y);
elif ct == CombinerType.POW:
return Commons.mix_pow(x, y);
return 0.0
static func sinewavec(uv : Vector2, amplitude : float, frequency : float, phase : float) -> Color:
var f : float = 1.0- abs(2.0 * (uv.y-0.5) - amplitude * sin((frequency* uv.x + phase) * 6.28318530718));
return Color(f, f, f, 1)
static func sinewavef(uv : Vector2, amplitude : float, frequency : float, phase : float) -> float:
return 1.0- abs(2.0 * (uv.y-0.5) - amplitude * sin((frequency* uv.x + phase) * 6.28318530718));
static func scratch(uv : Vector2, size : Vector2, waviness : float, angle : float, randomness : float, pseed : Vector2) -> float:
var subdivide : float = floor(1.0/size.x);
var cut : float = size.x*subdivide;
uv *= subdivide;
var r1 : Vector2 = Commons.rand2(Commons.floorv2(uv) + pseed);
var r2 : Vector2 = Commons.rand2(r1);
uv = Commons.fractv2(uv);
uv = 2.0 * uv - Vector2(1, 1);
var a : float = 6.28*(angle+(r1.x-0.5)*randomness);
var c : float = cos(a);
var s : float = sin(a);
uv = Vector2(c*uv.x+s*uv.y, s*uv.x-c*uv.y);
uv.y += 2.0*r1.y-1.0;
uv.y += 0.5*waviness*cos(2.0*uv.x+6.28*r2.y);
uv.x /= cut;
uv.y /= subdivide*size.y;
return (1.0-uv.x*uv.x)*max(0.0, 1.0-1000.0*uv.y*uv.y);
static func scratches(uv : Vector2, layers : int, size : Vector2, waviness : float, angle : float, randomness : float, pseed : Vector2) -> float:
var v : float = 0.0;
for i in range(layers):# (int i = 0; i < layers; ++i) {
v = max(v, scratch(Commons.fractv2(uv + pseed), size, waviness, angle/360.0, randomness, pseed));
pseed = Commons.rand2(pseed);
return v;
static func scratchesc(uv : Vector2, layers : int, size : Vector2, waviness : float, angle : float, randomness : float, pseed : Vector2) -> Color:
var f : float = scratches(uv, layers, size, waviness, angle, randomness, pseed)
return Color(f, f, f, 1)
static func runesc(uv : Vector2, col_row : Vector2) -> Color:
var f : float = rune(col_row * uv);
return Color(f, f, f, 1)
static func runesf(uv : Vector2, col_row : Vector2) -> float:
return rune(col_row * uv);
# makes a rune in the 0..1 uv space. Seed is which rune to draw.
# passes back gray in x and derivates for lighting in yz
static func rune(uv : Vector2) -> float:
var finalLine : float = 0.0;
var pseed : Vector2 = Commons.floorv2(uv) - Vector2(0.41, 0.41);
uv = Commons.fractv2(uv);
for i in range(4):# (int i = 0; i < 4; i++): # // number of strokes
var posA : Vector2 = Commons.rand2(Commons.floorv2(pseed + Vector2(0.5, 0.5)));
var posB : Vector2 = Commons.rand2(Commons.floorv2(pseed + Vector2(1.5, 1.5)));
pseed.x += 2.0;
pseed.y += 2.0;
# expand the range and mod it to get a nicely distributed random number - hopefully. :)
posA = Commons.fractv2(posA * 128.0);
posB = Commons.fractv2(posB * 128.0);
# each rune touches the edge of its box on all 4 sides
if (i == 0):
posA.y = 0.0;
if (i == 1):
posA.x = 0.999;
if (i == 2):
posA.x = 0.0;
if (i == 3):
posA.y = 0.999;
# snap the random line endpoints to a grid 2x3
var snaps : Vector2 = Vector2(2.0, 3.0);
posA = (Commons.floorv2(posA * snaps) + Vector2(0.5, 0.5)) / snaps; # + 0.5 to center it in a grid cell
posB = (Commons.floorv2(posB * snaps) + Vector2(0.5, 0.5)) / snaps;
#if (distance(posA, posB) < 0.0001) continue; // eliminate dots.
# Dots (degenerate lines) are not cross-GPU safe without adding 0.001 - divide by 0 error.
finalLine = max(finalLine, Commons.ThickLine(uv, posA, posB + Vector2(0.001, 0.001), 20.0));
return finalLine;
static func IChingc(uv : Vector2, row_col : Vector2, pseed : int) -> Color:
var f : float = IChing(row_col * uv, float(pseed));
return Color(f, f, f, 1)
static func IChing(uv : Vector2, pseed : float) -> float:
var value : int = int(32.0 * Commons.rand(Commons.floorv2(uv) + Vector2(pseed, pseed)));
var base : float = Commons.step(0.5, Commons.fract(Commons.fract(uv.y)*6.5))*Commons.step(0.04, Commons.fract(uv.y+0.02)) * Commons.step(0.2, Commons.fract(uv.x+0.1));
var bit : int = int(Commons.fract(uv.y)*6.5);
return base * Commons.step(0.1*Commons.step(float(bit & value), 0.5), Commons.fract(uv.x+0.55));
static func beehive_1c(uv : Vector2, size : Vector2, pseed : int) -> Color:
var o80035_0_uv : Vector2 = uv * Vector2(size.x, size.y * 1.73205080757);
var center : Color = beehive_center(o80035_0_uv);
var f : float = 1.0 - 2.0 * beehive_dist(Vector2(center.r, center.g));
return Color(f, f, f, 1)
static func beehive_2c(uv : Vector2, size : Vector2, pseed : int) -> Color:
var o80035_0_uv : Vector2 = uv * Vector2(size.x, size.y * 1.73205080757);
var center : Color = beehive_center(o80035_0_uv);
var f : float = 1.0 - 2.0 * beehive_dist(Vector2(center.r, center.g));
var v : Vector3 = Commons.rand3(Commons.fractv2(Vector2(center.b, center.a) / Vector2(size.x, size.y)) + Vector2(float(pseed),float(pseed)));
return Color(v.x, v.y, v.z, 1)
static func beehive_3c(uv : Vector2, size : Vector2, pseed : int) -> Color:
var o80035_0_uv : Vector2 = uv * Vector2(size.x, size.y * 1.73205080757);
var center : Color = beehive_center(o80035_0_uv);
#var f : float = 1.0 - 2.0 * beehive_dist(Vector2(center.r, center.g));
var v1 : Vector2 = Vector2(0.5, 0.5) + Vector2(center.r, center.g)
var ff : float = Commons.rand(Commons.fractv2(Vector2(center.b, center.a) / Vector2(size.x, size.y)) + Vector2(float(pseed), float(pseed)))
var c : Color = Color(v1.x, v1.y, ff, ff);
return c
static func beehive_dist(p : Vector2) -> float:
var s : Vector2 = Vector2(1.0, 1.73205080757);
p = Commons.absv2(p);
return max(p.dot(s*.5), p.x);
static func beehive_center(p : Vector2) -> Color:
var s : Vector2 = Vector2(1.0, 1.73205080757);
var hC : Color = Color(p.x, p.y, p.x - 0.5, p.y - 1) / Color(s.x, s.y, s.x, s.y);
hC = Commons.floorc(Color(p.x, p.y, p.x - 0.5, p.y - 1) / Color(s.x, s.y, s.x, s.y)) + Color(0.5, 0.5, 0.5, 0.5);
var v1 : Vector2 = Vector2(p.x - hC.r * s.x, p.y - hC.g * s.y)
var v2 : Vector2 = Vector2(p.x - (hC.b + 0.5) * s.x, p.y - (hC.a + 0.5) * s.y)
var h : Color = Color(v1.x, v1.y, v2.x, v2.y);
if Vector2(h.r, h.g).dot(Vector2(h.r, h.g)) < Vector2(h.b, h.a).dot(Vector2(h.b, h.a)):
return Color(h.r, h.g, hC.r, hC.g)
else:
return Color(h.b, h.a, hC.b + 9.73, hC.a + 9.73)
#return dot(h.xy, h.xy) < dot(h.zw, h.zw) ? Color(h.xy, hC.xy) : Color(h.zw, hC.zw + 9.73);

View File

@ -1,7 +1,7 @@
tool tool
extends TextureRect extends TextureRect
var Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd") var Patterns = preload("res://addons/mat_maker_gd/nodes/common/patterns.gd")
var image : Image var image : Image
var tex : ImageTexture var tex : ImageTexture
@ -57,36 +57,13 @@ var p_o80035_sx = 4.000000000;
var p_o80035_sy = 4.000000000; var p_o80035_sy = 4.000000000;
func beehive_1_col(uv : Vector2) -> Color: func beehive_1_col(uv : Vector2) -> Color:
var o80035_0_uv : Vector2 = ((uv)) * Vector2(p_o80035_sx, p_o80035_sy * 1.73205080757); return Patterns.beehive_1c(uv, Vector2(p_o80035_sx, p_o80035_sy), seed_o80035)
var center : Color = Commons.beehive_center(o80035_0_uv);
var f : float = 1.0 - 2.0 * Commons.beehive_dist(Vector2(center.r, center.g));
return Color(f, f, f, 1)
func beehive_2_col(uv : Vector2) -> Color: func beehive_2_col(uv : Vector2) -> Color:
var o80035_0_uv : Vector2 = ((uv)) * Vector2(p_o80035_sx, p_o80035_sy * 1.73205080757); return Patterns.beehive_2c(uv, Vector2(p_o80035_sx, p_o80035_sy), seed_o80035)
var center : Color = Commons.beehive_center(o80035_0_uv);
var f : float = 1.0 - 2.0 * Commons.beehive_dist(Vector2(center.r, center.g));
var v : Vector3 = Commons.rand3(Commons.fractv2(Vector2(center.b, center.a) / Vector2(p_o80035_sx, p_o80035_sy)) + Vector2(float(seed_o80035),float(seed_o80035)));
return Color(v.x, v.y, v.z, 1)
func beehive_3_col(uv : Vector2) -> Color: func beehive_3_col(uv : Vector2) -> Color:
var o80035_0_uv : Vector2 = ((uv)) * Vector2(p_o80035_sx, p_o80035_sy * 1.73205080757); return Patterns.beehive_3c(uv, Vector2(p_o80035_sx, p_o80035_sy), seed_o80035)
var center : Color = Commons.beehive_center(o80035_0_uv);
#var f : float = 1.0 - 2.0 * beehive_dist(Vector2(center.r, center.g));
var v1 : Vector2 = Vector2(0.5, 0.5) + Vector2(center.r, center.g)
var ff : float = Commons.rand(Commons.fractv2(Vector2(center.b, center.a) / Vector2(p_o80035_sx, p_o80035_sy)) + Vector2(float(seed_o80035), float(seed_o80035)))
var c : Color = Color(v1.x, v1.y, ff, ff);
return c
func reffg(): func reffg():
return false return false

View File

@ -1,7 +1,7 @@
tool tool
extends TextureRect extends TextureRect
var Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd") var Patterns = preload("res://addons/mat_maker_gd/nodes/common/patterns.gd")
var image : Image var image : Image
var tex : ImageTexture var tex : ImageTexture
@ -37,7 +37,7 @@ func gen() -> void:
for y in range(image.get_height()): for y in range(image.get_height()):
var v : Vector2 = Vector2(x / w, y / h) var v : Vector2 = Vector2(x / w, y / h)
var f : float = Commons.pattern(v, 4, 4, Commons.CombinerType.MULTIPLY, Commons.CombinerAxisType.SINE, Commons.CombinerAxisType.SINE) var f : float = Patterns.pattern(v, 4, 4, Patterns.CombinerType.MULTIPLY, Patterns.CombinerAxisType.SINE, Patterns.CombinerAxisType.SINE)
var col : Color = Color(f, f, f, 1) var col : Color = Color(f, f, f, 1)

View File

@ -1,7 +1,7 @@
tool tool
extends TextureRect extends TextureRect
var Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd") var Patterns = preload("res://addons/mat_maker_gd/nodes/common/patterns.gd")
var image : Image var image : Image
var tex : ImageTexture var tex : ImageTexture
@ -40,7 +40,7 @@ func gen() -> void:
# var f : float = pattern(v, 4, 4, CombinerType.MULTIPLY, CombinerAxisType.SINE, CombinerAxisType.SINE) # var f : float = pattern(v, 4, 4, CombinerType.MULTIPLY, CombinerAxisType.SINE, CombinerAxisType.SINE)
var col : Color = runecol(v) var col : Color = IChingc(v)
image.set_pixel(x, y, col) image.set_pixel(x, y, col)
@ -54,17 +54,8 @@ var seed_o57193 = 16936;
var p_o57193_columns = 2.000000000; var p_o57193_columns = 2.000000000;
var p_o57193_rows = 2.000000000; var p_o57193_rows = 2.000000000;
func runecol(uv : Vector2) -> Color: func IChingc(uv : Vector2) -> Color:
var f : float = IChing(Vector2(p_o57193_columns, p_o57193_rows)*((uv)), float(seed_o57193)); return Patterns.IChingc(uv, Vector2(p_o57193_columns, p_o57193_rows), float(seed_o57193));
return Color(f, f, f, 1)
func IChing(uv : Vector2, pseed : float) -> float:
var value : int = int(32.0 * Commons.rand(Commons.floorv2(uv) + Vector2(pseed, pseed)));
var base : float = Commons.step(0.5, Commons.fract(Commons.fract(uv.y)*6.5))*Commons.step(0.04, Commons.fract(uv.y+0.02)) * Commons.step(0.2, Commons.fract(uv.x+0.1));
var bit : int = int(Commons.fract(uv.y)*6.5);
return base * Commons.step(0.1*Commons.step(float(bit & value), 0.5), Commons.fract(uv.x+0.55));
func reffg(): func reffg():
return false return false

View File

@ -1,7 +1,7 @@
tool tool
extends TextureRect extends TextureRect
var Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd") var Patterns = preload("res://addons/mat_maker_gd/nodes/common/patterns.gd")
var image : Image var image : Image
var tex : ImageTexture var tex : ImageTexture
@ -54,9 +54,7 @@ var p_o49619_columns = 4.000000000;
var p_o49619_rows = 4.000000000; var p_o49619_rows = 4.000000000;
func runecol(uv : Vector2) -> Color: func runecol(uv : Vector2) -> Color:
var f : float = Commons.Rune(Vector2(p_o49619_columns, p_o49619_rows)*((uv))); return Patterns.runesc(uv, Vector2(p_o49619_columns, p_o49619_rows))
return Color(f, f, f, 1)
func reffg(): func reffg():
return false return false

View File

@ -1,7 +1,7 @@
tool tool
extends TextureRect extends TextureRect
var Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd") var Patterns = preload("res://addons/mat_maker_gd/nodes/common/patterns.gd")
var image : Image var image : Image
var tex : ImageTexture var tex : ImageTexture
@ -59,9 +59,7 @@ var p_o74963_angle = -1.000000000;
var p_o74963_randomness = 0.440000000; var p_o74963_randomness = 0.440000000;
func scratchescol(uv : Vector2) -> Color: func scratchescol(uv : Vector2) -> Color:
var f : float = Commons.scratches(((uv)), int(p_o74963_layers), Vector2(p_o74963_length, p_o74963_width), p_o74963_waviness, p_o74963_angle, p_o74963_randomness, Vector2(float(seed_o74963), 0.0)); return Patterns.scratchesc(uv, int(p_o74963_layers), Vector2(p_o74963_length, p_o74963_width), p_o74963_waviness, p_o74963_angle, p_o74963_randomness, Vector2(float(seed_o74963), 0.0));
return Color(f, f, f, 1)
func reffg(): func reffg():
return false return false

View File

@ -1,7 +1,7 @@
tool tool
extends TextureRect extends TextureRect
var Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd") var Patterns = preload("res://addons/mat_maker_gd/nodes/common/patterns.gd")
var image : Image var image : Image
var tex : ImageTexture var tex : ImageTexture
@ -57,11 +57,7 @@ var p_o7136_frequency = 2.000000000;
var p_o7136_phase = 0.000000000; var p_o7136_phase = 0.000000000;
func sinewave(uv : Vector2) -> Color: func sinewave(uv : Vector2) -> Color:
return Patterns.sinewavec(uv, p_o7136_amplitude, p_o7136_frequency, p_o7136_phase)
var f : float = 1.0- abs(2.0 * (uv.y-0.5) - p_o7136_amplitude * sin((p_o7136_frequency* uv.x + p_o7136_phase) * 6.28318530718));
return Color(f, f, f, 1)
func reffg(): func reffg():
return false return false