diff --git a/datafiles/data/Nodes/Internal.zip b/datafiles/data/Nodes/Internal.zip index 7a7f80570..ab61a8b0e 100644 Binary files a/datafiles/data/Nodes/Internal.zip and b/datafiles/data/Nodes/Internal.zip differ diff --git a/scripts/node_line/node_line.gml b/scripts/node_line/node_line.gml index 41d3e97b7..f97206938 100644 --- a/scripts/node_line/node_line.gml +++ b/scripts/node_line/node_line.gml @@ -277,6 +277,7 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons var _ox, _nx, _nx1, _oy, _ny, _ny1; var _ow, _nw, _oa, _na, _oc, _nc, _owg, _nwg; + var _wmin = 0, _wmax = 1; switch(_dtype) { case 0 : @@ -344,6 +345,8 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons lines = array_verify(lines, lineLen); var _lineAmo = 0; + var _wmin = infinity; + var _wmax = -infinity; if(_rtMax > 0) for( var i = 0; i < lineLen; i++ ) { @@ -430,6 +433,9 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons _nx = p.x; _ny = p.y; + _wmin = min(_wmin, wght); + _wmax = max(_wmax, wght); + if(_total < _pathEnd) { //Do not wiggle the last point. var _d = point_direction(_ox, _oy, _nx, _ny); _nx += lengthdir_x(random1D(_sed + _sedIndex, -_wig, _wig), _d + 90); _sedIndex++; @@ -482,6 +488,8 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons array_resize(lines, _lineAmo); array_resize(line_data, _lineAmo); + if(_wmax == _wmin) { _wmin = 0; _wmax = 1; } + if(_pbbox) _surfDim = [ max(1, maxx - minx + _ppadd[0] + _ppadd[2]), max(1, maxy - miny + _ppadd[1] + _ppadd[3]) ]; break; @@ -618,11 +626,12 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons widthMap[? widProg] = eval_curve_x(_widc, widProg, 0.1); _nw *= widthMap[? widProg]; - if(_wg2wid) _nw *= p0.weight / 2; + var _ww = lerp_invert(p0.weight, _wmin, _wmax); + if(_wg2wid) _nw *= _ww / 2; _nc = _col_base; _nc = colorMultiply(_nc, _color.eval(_colP? prog : prgc)); - _nc = colorMultiply(_nc, _wg2clr.eval((p0.weight - _wg2clrR[0]) / _wg2clrRng)); + _nc = colorMultiply(_nc, _wg2clr.eval((_ww - _wg2clrR[0]) / _wg2clrRng)); if(_cap) { if(j == 1) { @@ -747,12 +756,13 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons var _dir = j? point_direction(_ox, _oy, _nx, _ny) : 0; var widProg = value_snap_real(_widap? prog : prgc, 0.01); + var _ww = lerp_invert(p0.weight, _wmin, _wmax); _nw = random_range(_wid[0], _wid[1]); if(!ds_map_exists(widthMap, widProg)) widthMap[? widProg] = eval_curve_x(_widc, widProg, 0.1); _nw *= widthMap[? widProg]; - _nw *= p0.weight; + _nw *= _ww; if(_cap) { if(j == 1) { diff --git a/scripts/node_path_plot/node_path_plot.gml b/scripts/node_path_plot/node_path_plot.gml index d5cad6a0f..46854e355 100644 --- a/scripts/node_path_plot/node_path_plot.gml +++ b/scripts/node_path_plot/node_path_plot.gml @@ -27,12 +27,17 @@ function Node_Path_Plot(_x, _y, _group = noone) : Node(_x, _y, _group) construct newInput(10, nodeValue_Text("w(x)", self, "")); + newInput(11, nodeValue_Text("z(x)", self, "")); + + newInput(12, nodeValue_Bool("3D", self, false)); + newOutput(0, nodeValue_Output("Path", self, VALUE_TYPE.pathnode, self)); input_display_list = [ - [ "Variable", false], 5, 7, 8, 0, - [ "Equation", false], 1, 2, 3, 4, 6, - [ "Weight", false, 9], 10, + [ "Variable", false], 5, 7, 8, 0, + [ "Equation", false], 1, 2, 3, 4, 6, + [ "Weight", false, 9], 10, + [ "3D", false, 12], 11, ] boundary = new BoundingBox( 0, 0, 1, 1 ); @@ -41,18 +46,18 @@ function Node_Path_Plot(_x, _y, _group = noone) : Node(_x, _y, _group) construct curr_sca = 0; curr_coor = 0; curr_eqa = 0; - curr_eq0 = 0; - curr_eq1 = 0; curr_orig = 0; curr_ran = 0; curr_iran = 0; curr_shf = 0; + curr_d3d = 0; curr_usew = 0; curr_wgfn = 0; fn0 = 0; fn1 = 0; + fn2 = 0; _a = new __vec2P(); _param = { x:0, y:0, t:0, r:0, O:0 }; @@ -68,7 +73,8 @@ function Node_Path_Plot(_x, _y, _group = noone) : Node(_x, _y, _group) construct static getBoundary = function() /*=>*/ {return boundary}; static getPointRatio = function(_rat, ind = 0, out = undefined) { - if(out == undefined) out = new __vec2P(); else { out.x = 0; out.y = 0; } + if(out == undefined) out = curr_d3d? new __vec3P() : new __vec2P(); + else { out.x = 0; out.y = 0; out.z = 0; } _rat = curr_ran[0] + (_rat * (curr_ran[1] - curr_ran[0])); @@ -106,6 +112,11 @@ function Node_Path_Plot(_x, _y, _group = noone) : Node(_x, _y, _group) construct _param.t = _rat * curr_iran[1] + curr_shf[1]; out.y = fn1.eval(_param); + if(curr_d3d) { + _param.t = _rat; + out.z = fn2.eval(_param); + } + if(curr_usew) { _param.t = _rat; out.weight = fnw.eval(_param); @@ -149,6 +160,11 @@ function Node_Path_Plot(_x, _y, _group = noone) : Node(_x, _y, _group) construct _param.t = _rat * curr_iran[1] + curr_shf[1]; _ay = fn1.eval(_param); + if(curr_d3d) { + _param.t = _rat; + out.z = fn2.eval(_param); + } + if(curr_usew) { _param.t = _rat; out.weight = fnw.eval(_param); @@ -169,62 +185,6 @@ function Node_Path_Plot(_x, _y, _group = noone) : Node(_x, _y, _group) construct static getPointDistance = function(_dist, ind = 0, out = undefined) { return getPointRatio(_dist / getLength(ind), ind, out); } - static step = function() { - var _coor = getInputData(1); - var _eqa = getInputData(2); - - inputs[2].editWidget.data_list = _coor? eq_type_pol : eq_type_car; - inputs[4].setVisible(_eqa == 2); - - switch(_coor) { - case 0 : - switch(_eqa) { - case 0 : - inputs[ 3].name = "f(x) = "; - inputs[ 6].name = "x range"; - inputs[10].name = "w(x) = "; - break; - - case 1 : - inputs[ 3].name = "f(y) = "; - inputs[ 6].name = "y range"; - inputs[10].name = "w(y) = "; - break; - - case 2 : - inputs[ 3].name = "x(t) = "; - inputs[ 4].name = "y(t) = "; - inputs[ 6].name = "t range"; - inputs[10].name = "w(t) = "; - break; - } - break; - - case 1 : - switch(_eqa) { - case 0 : - inputs[ 3].name = "f(r) = "; - inputs[ 6].name = "r range"; - inputs[10].name = "w(r) = "; - break; - - case 1 : - inputs[ 3].name = "f(O) = "; - inputs[ 6].name = "O range"; - inputs[10].name = "w(O) = "; - break; - - case 2 : - inputs[ 3].name = "r(t) = "; - inputs[ 4].name = "O(t) = "; - inputs[ 6].name = "t range"; - inputs[10].name = "w(t) = "; - break; - } - break; - } - } - static updateBoundary = function() { boundary = new BoundingBox( 0, 0, 1, 1 ); length = 0; @@ -246,22 +206,80 @@ function Node_Path_Plot(_x, _y, _group = noone) : Node(_x, _y, _group) construct curr_sca = getInputData(0); curr_coor = getInputData(1); curr_eqa = getInputData(2); - curr_eq0 = getInputData(3); - curr_eq1 = getInputData(4); curr_orig = getInputData(5); curr_ran = getInputData(6); curr_iran = getInputData(7); curr_shf = getInputData(8); - - curr_usew = getInputData( 9); + curr_usew = getInputData(9); curr_wgfn = getInputData(10); + curr_d3d = getInputData(12); - fn0 = evaluateFunctionList(curr_eq0); - fn1 = evaluateFunctionList(curr_eq1); + var _eq0 = getInputData(3); + var _eq1 = getInputData(4); + var _eq2 = getInputData(11); + + fn0 = evaluateFunctionList(_eq0); + fn1 = evaluateFunctionList(_eq1); + fn2 = evaluateFunctionList(_eq2); fnw = evaluateFunctionList(curr_wgfn); + _a = curr_d3d? new __vec3P() : new __vec2P(); + updateBoundary(); - outputs[0].setValue(self); + outputs[0].setValue(self); + + #region display + inputs[ 2].editWidget.data_list = curr_coor? eq_type_pol : eq_type_car; + inputs[ 4].setVisible(curr_eqa == 2); + + switch(curr_coor) { + case 0 : + switch(curr_eqa) { + case 0 : + inputs[ 3].name = "f(x) = "; + inputs[ 6].name = "x range"; + inputs[10].name = "w(x) = "; + break; + + case 1 : + inputs[ 3].name = "f(y) = "; + inputs[ 6].name = "y range"; + inputs[10].name = "w(y) = "; + break; + + case 2 : + inputs[ 3].name = "x(t) = "; + inputs[ 4].name = "y(t) = "; + inputs[ 6].name = "t range"; + inputs[10].name = "w(t) = "; + break; + } + break; + + case 1 : + switch(_eqa) { + case 0 : + inputs[ 3].name = "f(r) = "; + inputs[ 6].name = "r range"; + inputs[10].name = "w(r) = "; + break; + + case 1 : + inputs[ 3].name = "f(O) = "; + inputs[ 6].name = "O range"; + inputs[10].name = "w(O) = "; + break; + + case 2 : + inputs[ 3].name = "r(t) = "; + inputs[ 4].name = "O(t) = "; + inputs[ 6].name = "t range"; + inputs[10].name = "w(t) = "; + break; + } + break; + } + #endregion } static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {