- [Pytagorean, Herringbones, Random tiles] Add level property.

This commit is contained in:
Tanasart 2024-06-22 10:29:07 +07:00
parent 3fc1d43953
commit 3fd650d273
6 changed files with 39 additions and 18 deletions

View file

@ -65,10 +65,13 @@ function Node_Herringbone_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y,
inputs[| 20] = nodeValue("Texture angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ])
.setDisplay(VALUE_DISPLAY.rotation_range);
inputs[| 21] = nodeValue("Level", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
.setDisplay(VALUE_DISPLAY.slider_range);
input_display_list = [
["Output", false], 0,
["Pattern", false], 1, 3, 12, 2, 11, 17, 4, 13,
["Render", false], 7, 8, 5, 18, 6, 9, 10,
["Render", false], 7, 8, 5, 18, 6, 9, 10, 21,
["Truchet", true, 14], 15, 16, 20,
];
@ -96,9 +99,10 @@ function Node_Herringbone_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y,
var _col_gap = _data[6];
inputs[| 5].setVisible(_mode == 0);
inputs[| 6].setVisible(_mode != 1);
inputs[| 9].setVisible(_mode == 2 || _mode == 3);
inputs[| 5].setVisible(_mode == 0);
inputs[| 6].setVisible(_mode != 1);
inputs[| 21].setVisible(_mode == 1);
inputs[| 9].setVisible(_mode == 2 || _mode == 3);
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
@ -120,6 +124,7 @@ function Node_Herringbone_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y,
shader_set_f("truchetSeed", _data[15]);
shader_set_f("truchetThres", _data[16]);
shader_set_f("truchetAngle", _data[20]);
shader_set_f("level", _data[21]);
shader_set_gradient(_data[5], _data[18], _data[19], inputs[| 5]);

View file

@ -66,10 +66,13 @@ function Node_Pytagorean_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _
inputs[| 20] = nodeValue("Texture angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ])
.setDisplay(VALUE_DISPLAY.rotation_range);
inputs[| 21] = nodeValue("Level", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
.setDisplay(VALUE_DISPLAY.slider_range);
input_display_list = [
["Output", false], 0,
["Pattern", false], 1, 3, 12, 2, 11, 17, 4, 13,
["Render", false], 7, 8, 5, 18, 6, 9, 10,
["Render", false], 7, 8, 5, 18, 6, 9, 10, 21,
["Truchet", true, 14], 15, 16, 20,
];
@ -98,9 +101,10 @@ function Node_Pytagorean_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _
var _col_gap = _data[6];
var _gra = _data[5];
inputs[| 5].setVisible(_mode == 0);
inputs[| 6].setVisible(_mode != 1);
inputs[| 9].setVisible(_mode == 2 || _mode == 3);
inputs[| 5].setVisible(_mode == 0);
inputs[| 6].setVisible(_mode != 1);
inputs[| 21].setVisible(_mode == 1);
inputs[| 9].setVisible(_mode == 2 || _mode == 3);
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
@ -122,6 +126,7 @@ function Node_Pytagorean_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _
shader_set_f("truchetSeed", _data[15]);
shader_set_f("truchetThres", _data[16]);
shader_set_f("truchetAngle", _data[20]);
shader_set_f("level", _data[21]);
shader_set_gradient(_data[5], _data[18], _data[19], inputs[| 5]);

View file

@ -63,10 +63,13 @@ function Node_Random_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
inputs[| 19] = nodeValue("Texture angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ])
.setDisplay(VALUE_DISPLAY.rotation_range);
inputs[| 20] = nodeValue("Level", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ])
.setDisplay(VALUE_DISPLAY.slider_range);
input_display_list = [
["Output", false], 0,
["Pattern", false], 1, 3, 12, 2, 11, 4, 13,
["Render", false], 7, 8, 5, 17, 6, 9, 10,
["Render", false], 7, 8, 5, 17, 6, 9, 10, 20,
["Truchet", true, 14], 15, 16, 19,
];
@ -94,9 +97,10 @@ function Node_Random_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
var _col_gap = _data[6];
inputs[| 5].setVisible(_mode == 0);
inputs[| 6].setVisible(_mode != 1);
inputs[| 9].setVisible(_mode == 2 || _mode == 3);
inputs[| 5].setVisible(_mode == 0);
inputs[| 6].setVisible(_mode != 1);
inputs[| 20].setVisible(_mode == 1);
inputs[| 9].setVisible(_mode == 2 || _mode == 3);
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
@ -117,6 +121,7 @@ function Node_Random_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
shader_set_f("truchetSeed", _data[15]);
shader_set_f("truchetThres", _data[16]);
shader_set_f("truchetAngle", _data[19]);
shader_set_f("level", _data[20]);
shader_set_gradient(_data[5], _data[17], _data[18], inputs[| 5]);

View file

@ -26,6 +26,7 @@ uniform int textureTruchet;
uniform float truchetSeed;
uniform float truchetThres;
uniform vec2 truchetAngle;
uniform vec2 level;
uniform float tileLength;
@ -230,7 +231,8 @@ void main() { #region
vec4 colr;
if(mode == 1) {
gl_FragColor = vec4(vec3(hc.y), 1.0);
float dist = (hc.y - level.x) / (level.y - level.x);
gl_FragColor = vec4(vec3(dist), 1.0);
return;
}

View file

@ -23,6 +23,7 @@ uniform int textureTruchet;
uniform float truchetSeed;
uniform float truchetThres;
uniform vec2 truchetAngle;
uniform vec2 level;
uniform float phase;
@ -264,7 +265,8 @@ void main() { #region
vec4 colr;
if(mode == 1) {
gl_FragColor = vec4(vec3(hc.y), 1.0);
float dist = (hc.y * 2. - level.x) / (level.y - level.x);
gl_FragColor = vec4(vec3(dist), 1.0);
return;
}

View file

@ -26,6 +26,7 @@ uniform int textureTruchet;
uniform float truchetSeed;
uniform float truchetThres;
uniform vec2 truchetAngle;
uniform vec2 level;
#define PI 3.14159265359
#define TAU 6.28318530718
@ -239,7 +240,8 @@ void main() { #region
vec4 colr;
if(mode == 1) {
gl_FragColor = vec4(vec3(hc.y), 1.0);
float dist = (hc.y - level.x) / (level.y - level.x);
gl_FragColor = vec4(vec3(dist), 1.0);
return;
}