- [Grids] Add level property.

This commit is contained in:
Tanasart 2024-06-12 12:07:56 +07:00
parent 960004a424
commit 6ec32374bf
10 changed files with 55 additions and 29 deletions

View file

@ -26,23 +26,23 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
inputs[| in_d3d + 2] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF ) inputs[| in_d3d + 2] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF )
.setDisplay(VALUE_DISPLAY.vector); .setDisplay(VALUE_DISPLAY.vector);
inputs[| in_d3d + 3] = nodeValue("Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) inputs[| in_d3d + 3] = nodeValue("Projection", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 1 )
.setDisplay(VALUE_DISPLAY.enum_button, [ "Perspective", "Orthographic" ]); .setDisplay(VALUE_DISPLAY.enum_button, [ "Perspective", "Orthographic" ]);
inputs[| in_d3d + 4] = nodeValue("Scene", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Scene, noone ) inputs[| in_d3d + 4] = nodeValue("Scene", self, JUNCTION_CONNECT.input, VALUE_TYPE.d3Scene, noone )
.setVisible(true, true); .setVisible(true, true);
inputs[| in_d3d + 5] = nodeValue("Ambient Light", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_grey ); inputs[| in_d3d + 5] = nodeValue("Ambient Light", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_dkgrey );
inputs[| in_d3d + 6] = nodeValue("Show Background", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false ); inputs[| in_d3d + 6] = nodeValue("Show Background", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false );
inputs[| in_d3d + 7] = nodeValue("Backface Culling", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 2 ) inputs[| in_d3d + 7] = nodeValue("Backface Culling", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 2 )
.setDisplay(VALUE_DISPLAY.enum_button, [ "None", "CW", "CCW" ]); .setDisplay(VALUE_DISPLAY.enum_button, [ "None", "CW", "CCW" ]);
inputs[| in_d3d + 8] = nodeValue("Orthographic Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1 ) inputs[| in_d3d + 8] = nodeValue("Orthographic Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5 )
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0.01, 4, 0.01 ] }); .setDisplay(VALUE_DISPLAY.slider, { range: [ 0.01, 4, 0.01 ] });
inputs[| in_d3d + 9] = nodeValue("Postioning Mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) inputs[| in_d3d + 9] = nodeValue("Postioning Mode", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 2 )
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Position + Rotation", "Position + Lookat", "Lookat + Rotation" ] ); .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Position + Rotation", "Position + Lookat", "Lookat + Rotation" ] );
inputs[| in_d3d + 10] = nodeValue("Lookat Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ] ) inputs[| in_d3d + 10] = nodeValue("Lookat Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ] )
@ -51,10 +51,10 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
inputs[| in_d3d + 11] = nodeValue("Roll", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ) inputs[| in_d3d + 11] = nodeValue("Roll", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 )
.setDisplay(VALUE_DISPLAY.rotation); .setDisplay(VALUE_DISPLAY.rotation);
inputs[| in_d3d + 12] = nodeValue("Horizontal Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ) inputs[| in_d3d + 12] = nodeValue("Horizontal Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 45 )
.setDisplay(VALUE_DISPLAY.rotation); .setDisplay(VALUE_DISPLAY.rotation);
inputs[| in_d3d + 13] = nodeValue("Vertical Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 45 ) inputs[| in_d3d + 13] = nodeValue("Vertical Angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 30 )
.setDisplay(VALUE_DISPLAY.slider, { range: [0, 90, 0.1] }); .setDisplay(VALUE_DISPLAY.slider, { range: [0, 90, 0.1] });
inputs[| in_d3d + 14] = nodeValue("Distance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 4 ); inputs[| in_d3d + 14] = nodeValue("Distance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 4 );

View file

@ -4,7 +4,7 @@ function Node_3D_Camera_Set(_x, _y, _group = noone) : Node_3D_Camera(_x, _y, _gr
light_key = new __3dLightDirectional(); light_key = new __3dLightDirectional();
light_fill = new __3dLightDirectional(); light_fill = new __3dLightDirectional();
inputs[| in_cam + 0] = nodeValue("L1 H angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 45 ) inputs[| in_cam + 0] = nodeValue("L1 H angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 30 )
.setName("Horizontal angle") .setName("Horizontal angle")
.setDisplay(VALUE_DISPLAY.rotation); .setDisplay(VALUE_DISPLAY.rotation);
@ -30,7 +30,7 @@ function Node_3D_Camera_Set(_x, _y, _group = noone) : Node_3D_Camera(_x, _y, _gr
inputs[| in_cam + 6] = nodeValue("L2 Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white ) inputs[| in_cam + 6] = nodeValue("L2 Color", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_white )
.setName("Color") .setName("Color")
inputs[| in_cam + 7] = nodeValue("L2 Intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.5 ) inputs[| in_cam + 7] = nodeValue("L2 Intensity", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.25 )
.setName("Intensity") .setName("Intensity")
.setDisplay(VALUE_DISPLAY.slider); .setDisplay(VALUE_DISPLAY.slider);

View file

@ -67,12 +67,13 @@ function Node_Grid(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
inputs[| 23] = nodeValue("Texture angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ]) inputs[| 23] = nodeValue("Texture angle", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ])
.setDisplay(VALUE_DISPLAY.rotation_range); .setDisplay(VALUE_DISPLAY.rotation_range);
//inputs[| 24] = nodeValue("Random Rotate", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false); inputs[| 24] = 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, 4, 15, 2, 13, 3, 14, 9, 8, 16, ["Pattern", false], 1, 4, 15, 2, 13, 3, 14, 9, 8, 16,
["Render", false], 10, 11, 5, 20, 6, 7, 12, ["Render", false], 10, 11, 5, 20, 6, 7, 12, 24,
["Truchet", true, 17], 18, 19, 22, 23, ["Truchet", true, 17], 18, 19, 22, 23,
]; ];
@ -103,6 +104,7 @@ function Node_Grid(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
inputs[| 5].setVisible(_mode == 0); inputs[| 5].setVisible(_mode == 0);
inputs[| 6].setVisible(_mode != 1); inputs[| 6].setVisible(_mode != 1);
inputs[| 24].setVisible(_mode == 1);
inputs[| 7].setVisible(_mode == 2 || _mode == 3); inputs[| 7].setVisible(_mode == 2 || _mode == 3);
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth()); _outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
@ -124,6 +126,7 @@ function Node_Grid(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
shader_set_f("truchetThresX", _data[19]); shader_set_f("truchetThresX", _data[19]);
shader_set_f("truchetThresY", _data[22]); shader_set_f("truchetThresY", _data[22]);
shader_set_f("truchetAngle", _data[23]); shader_set_f("truchetAngle", _data[23]);
shader_set_f("level", _data[24]);
shader_set_color("gapCol", _col_gap); shader_set_color("gapCol", _col_gap);

View file

@ -63,10 +63,13 @@ function Node_Grid_Hex(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
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_Grid_Hex(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
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_Grid_Hex(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
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

@ -49,10 +49,13 @@ function Node_Grid_Pentagonal(_x, _y, _group = noone) : Node_Processor(_x, _y, _
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
inputs[| 16] = 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, 4, 13, 2, 11, 3, 12, ["Pattern", false], 1, 4, 13, 2, 11, 3, 12,
["Render", false], 8, 9, 5, 14, 6, 7, 10, ["Render", false], 8, 9, 5, 14, 6, 7, 10, 16,
]; ];
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone); outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
@ -81,6 +84,7 @@ function Node_Grid_Pentagonal(_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[| 16].setVisible(_mode == 1);
inputs[| 7].setVisible(_mode == 2 || _mode == 3); inputs[| 7].setVisible(_mode == 2 || _mode == 3);
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth()); _outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
@ -95,6 +99,7 @@ function Node_Grid_Pentagonal(_x, _y, _group = noone) : Node_Processor(_x, _y, _
shader_set_i("mode", _mode); shader_set_i("mode", _mode);
shader_set_f("seed", _data[ 9]); shader_set_f("seed", _data[ 9]);
shader_set_i("aa", _data[10]); shader_set_i("aa", _data[10]);
shader_set_f("level", _data[16]);
shader_set_color("gapCol", _col_gap); shader_set_color("gapCol", _col_gap);

View file

@ -63,10 +63,13 @@ function Node_Grid_Tri(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
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, 4, 13, 2, 11, 3, 12, ["Pattern", false], 1, 4, 13, 2, 11, 3, 12,
["Render", false], 8, 9, 5, 17, 6, 7, 10, ["Render", false], 8, 9, 5, 17, 6, 7, 10, 20,
["Truchet", true, 14], 15, 16, 19, ["Truchet", true, 14], 15, 16, 19,
]; ];
@ -98,6 +101,7 @@ function Node_Grid_Tri(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
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[| 7].setVisible(_mode == 2 || _mode == 3); inputs[| 7].setVisible(_mode == 2 || _mode == 3);
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth()); _outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
@ -119,6 +123,7 @@ function Node_Grid_Tri(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
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 sampler2D shiftSurf;
uniform vec4 gapCol; uniform vec4 gapCol;
uniform int gradient_use; uniform int gradient_use;
uniform vec2 level;
uniform int textureTruchet; uniform int textureTruchet;
uniform float truchetSeed; uniform float truchetSeed;
@ -227,6 +228,7 @@ void main() { #region
vec4 colr; vec4 colr;
if(mode == 1) { if(mode == 1) {
dist = (dist - level.x) / (level.y - level.x);
gl_FragColor = vec4(vec3(dist), 1.); gl_FragColor = vec4(vec3(dist), 1.);
return; return;
} }

View file

@ -23,6 +23,7 @@ uniform sampler2D thickSurf;
uniform vec4 gapCol; uniform vec4 gapCol;
uniform int gradient_use; uniform int gradient_use;
uniform vec2 level;
uniform int textureTruchet; uniform int textureTruchet;
uniform float truchetSeed; uniform float truchetSeed;
@ -223,7 +224,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

@ -27,6 +27,7 @@ uniform sampler2D widthSurf;
uniform vec4 gapCol; uniform vec4 gapCol;
uniform int gradient_use; uniform int gradient_use;
uniform vec2 level;
float random (in vec2 st) { return fract(sin(dot(st.xy + vec2(85.456034, 64.54065), vec2(12.9898, 78.233))) * (43758.5453123 + seed) ); } float random (in vec2 st) { return fract(sin(dot(st.xy + vec2(85.456034, 64.54065), vec2(12.9898, 78.233))) * (43758.5453123 + seed) ); }
@ -279,6 +280,7 @@ void main() {
colr = gradientEval(random(coord)); colr = gradientEval(random(coord));
} else if(mode == 1) { } else if(mode == 1) {
dist = (dist - level.x) / (level.y - level.x);
colr = vec4(vec3(dist), 1.); colr = vec4(vec3(dist), 1.);
} else if(mode == 2) { } else if(mode == 2) {

View file

@ -24,6 +24,7 @@ uniform sampler2D widthSurf;
uniform vec4 gapCol; uniform vec4 gapCol;
uniform int gradient_use; uniform int gradient_use;
uniform vec2 level;
uniform int textureTruchet; uniform int textureTruchet;
uniform float truchetSeed; uniform float truchetSeed;
@ -216,6 +217,7 @@ void main() { #region
vec4 colr; vec4 colr;
if(mode == 1) { if(mode == 1) {
dist = (dist - level.x) / (level.y - level.x);
gl_FragColor = vec4(vec3(dist), 1.); gl_FragColor = vec4(vec3(dist), 1.);
return; return;
} }