- [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 ]) inputs[| 20] = nodeValue("Texture angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ])
.setDisplay(VALUE_DISPLAY.rotation_range); .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 = [ input_display_list = [
["Output", false], 0, ["Output", false], 0,
["Pattern", false], 1, 3, 12, 2, 11, 17, 4, 13, ["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, ["Truchet", true, 14], 15, 16, 20,
]; ];
@ -98,6 +101,7 @@ function Node_Herringbone_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y,
inputs[| 5].setVisible(_mode == 0); inputs[| 5].setVisible(_mode == 0);
inputs[| 6].setVisible(_mode != 1); inputs[| 6].setVisible(_mode != 1);
inputs[| 21].setVisible(_mode == 1);
inputs[| 9].setVisible(_mode == 2 || _mode == 3); inputs[| 9].setVisible(_mode == 2 || _mode == 3);
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth()); _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("truchetSeed", _data[15]);
shader_set_f("truchetThres", _data[16]); shader_set_f("truchetThres", _data[16]);
shader_set_f("truchetAngle", _data[20]); shader_set_f("truchetAngle", _data[20]);
shader_set_f("level", _data[21]);
shader_set_gradient(_data[5], _data[18], _data[19], inputs[| 5]); 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 ]) inputs[| 20] = nodeValue("Texture angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ])
.setDisplay(VALUE_DISPLAY.rotation_range); .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 = [ input_display_list = [
["Output", false], 0, ["Output", false], 0,
["Pattern", false], 1, 3, 12, 2, 11, 17, 4, 13, ["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, ["Truchet", true, 14], 15, 16, 20,
]; ];
@ -100,6 +103,7 @@ function Node_Pytagorean_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _
inputs[| 5].setVisible(_mode == 0); inputs[| 5].setVisible(_mode == 0);
inputs[| 6].setVisible(_mode != 1); inputs[| 6].setVisible(_mode != 1);
inputs[| 21].setVisible(_mode == 1);
inputs[| 9].setVisible(_mode == 2 || _mode == 3); inputs[| 9].setVisible(_mode == 2 || _mode == 3);
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth()); _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("truchetSeed", _data[15]);
shader_set_f("truchetThres", _data[16]); shader_set_f("truchetThres", _data[16]);
shader_set_f("truchetAngle", _data[20]); shader_set_f("truchetAngle", _data[20]);
shader_set_f("level", _data[21]);
shader_set_gradient(_data[5], _data[18], _data[19], inputs[| 5]); 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 ]) inputs[| 19] = nodeValue("Texture angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ])
.setDisplay(VALUE_DISPLAY.rotation_range); .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 = [ input_display_list = [
["Output", false], 0, ["Output", false], 0,
["Pattern", false], 1, 3, 12, 2, 11, 4, 13, ["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, ["Truchet", true, 14], 15, 16, 19,
]; ];
@ -96,6 +99,7 @@ function Node_Random_Tile(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
inputs[| 5].setVisible(_mode == 0); inputs[| 5].setVisible(_mode == 0);
inputs[| 6].setVisible(_mode != 1); inputs[| 6].setVisible(_mode != 1);
inputs[| 20].setVisible(_mode == 1);
inputs[| 9].setVisible(_mode == 2 || _mode == 3); inputs[| 9].setVisible(_mode == 2 || _mode == 3);
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth()); _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("truchetSeed", _data[15]);
shader_set_f("truchetThres", _data[16]); shader_set_f("truchetThres", _data[16]);
shader_set_f("truchetAngle", _data[19]); shader_set_f("truchetAngle", _data[19]);
shader_set_f("level", _data[20]);
shader_set_gradient(_data[5], _data[17], _data[18], inputs[| 5]); 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 truchetSeed;
uniform float truchetThres; uniform float truchetThres;
uniform vec2 truchetAngle; uniform vec2 truchetAngle;
uniform vec2 level;
uniform float tileLength; uniform float tileLength;
@ -230,7 +231,8 @@ void main() { #region
vec4 colr; vec4 colr;
if(mode == 1) { 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; return;
} }

View file

@ -23,6 +23,7 @@ uniform int textureTruchet;
uniform float truchetSeed; uniform float truchetSeed;
uniform float truchetThres; uniform float truchetThres;
uniform vec2 truchetAngle; uniform vec2 truchetAngle;
uniform vec2 level;
uniform float phase; uniform float phase;
@ -264,7 +265,8 @@ void main() { #region
vec4 colr; vec4 colr;
if(mode == 1) { 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; return;
} }

View file

@ -26,6 +26,7 @@ uniform int textureTruchet;
uniform float truchetSeed; uniform float truchetSeed;
uniform float truchetThres; uniform float truchetThres;
uniform vec2 truchetAngle; uniform vec2 truchetAngle;
uniform vec2 level;
#define PI 3.14159265359 #define PI 3.14159265359
#define TAU 6.28318530718 #define TAU 6.28318530718
@ -239,7 +240,8 @@ void main() { #region
vec4 colr; vec4 colr;
if(mode == 1) { 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; return;
} }