mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-24 14:06:23 +01:00
1.17.5.005
This commit is contained in:
parent
ec1bbdcd53
commit
1f5cb6578e
11 changed files with 170 additions and 98 deletions
|
@ -179,6 +179,8 @@ event_inherited();
|
|||
|
||||
if(_node.outputNode != noone)
|
||||
_outputs = res[$ _node.outputNode].outputs;
|
||||
|
||||
return;
|
||||
} else {
|
||||
var _new_list = APPEND(_node.path);
|
||||
if(_new_list == noone) return;
|
||||
|
|
|
@ -95,29 +95,32 @@ function draw_sprite_colored(spr, ind, _x, _y, scale = 1, rot = 0, color = COLOR
|
|||
if(num % 2 == 0) draw_sprite_ui(spr, num / 2 + ind, _x, _y, scale, scale, rot, color);
|
||||
} #endregion
|
||||
|
||||
function draw_anchor(_index, _x, _y, _r) { #region
|
||||
function draw_anchor(_index, _x, _y, _r, _type = 0) { #region
|
||||
shader_set(sh_node_widget_scalar);
|
||||
shader_set_color("color", COLORS._main_accent);
|
||||
shader_set_f("index", _index);
|
||||
shader_set_i("type", _type);
|
||||
|
||||
draw_sprite_stretched(s_fx_pixel, 0, _x - _r, _y - _r, _r * 2, _r * 2);
|
||||
shader_reset();
|
||||
} #endregion
|
||||
|
||||
function draw_anchor_cross(_index, _x, _y, _r) { #region
|
||||
function draw_anchor_cross(_index, _x, _y, _r, _type = 0) { #region
|
||||
shader_set(sh_node_widget_scalar_cross);
|
||||
shader_set_color("color", COLORS._main_accent);
|
||||
shader_set_f("index", _index);
|
||||
shader_set_i("type", _type);
|
||||
|
||||
draw_sprite_stretched(s_fx_pixel, 0, _x - _r, _y - _r, _r * 2, _r * 2);
|
||||
shader_reset();
|
||||
} #endregion
|
||||
|
||||
function draw_anchor_line(_index, _x, _y, _r, _a) { #region
|
||||
function draw_anchor_line(_index, _x, _y, _r, _a, _type = 0) { #region
|
||||
shader_set(sh_node_widget_scalar_line);
|
||||
shader_set_color("color", COLORS._main_accent);
|
||||
shader_set_f("index", _index);
|
||||
shader_set_f("angle", degtorad(_a));
|
||||
shader_set_i("type", _type);
|
||||
|
||||
draw_sprite_stretched(s_fx_pixel, 0, _x - _r, _y - _r, _r * 2, _r * 2);
|
||||
shader_reset();
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
LATEST_VERSION = 11700;
|
||||
VERSION = 11750;
|
||||
SAVE_VERSION = 11700;
|
||||
VERSION_STRING = "1.17.5.004";
|
||||
VERSION_STRING = "1.17.5.005";
|
||||
BUILD_NUMBER = 11750;
|
||||
|
||||
globalvar HOTKEYS, HOTKEY_CONTEXT;
|
||||
|
|
|
@ -35,8 +35,8 @@ function Node_3D_Mesh_Obj(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group)
|
|||
inputs[| in_mesh + 2] = nodeValue("Import Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
|
||||
.rejectArray();
|
||||
|
||||
inputs[| in_mesh + 3] = nodeValue("Swap YZ", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
.setDisplay(VALUE_DISPLAY.enum_button, [ "YZ", "Z-Y", "-ZY" ])
|
||||
inputs[| in_mesh + 3] = nodeValue("Axis", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
|
||||
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "XYZ", "XZ-Y", "X-ZY" ])
|
||||
.rejectArray();
|
||||
|
||||
input_display_list = [
|
||||
|
@ -111,9 +111,9 @@ function Node_3D_Mesh_Obj(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group)
|
|||
current_path = _path;
|
||||
|
||||
var _scale = inputs[| in_mesh + 2].getValue();
|
||||
var _yneg = inputs[| in_mesh + 3].getValue();
|
||||
var _axis = inputs[| in_mesh + 3].getValue();
|
||||
|
||||
readObj_init(_scale, _yneg);
|
||||
readObj_init(_scale, _axis);
|
||||
|
||||
obj_read_time = get_timer();
|
||||
obj_read_file = file_text_open_read(current_path);
|
||||
|
@ -156,7 +156,7 @@ function Node_3D_Mesh_Obj(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group)
|
|||
use_normal = obj_raw.use_normal;
|
||||
|
||||
materialNames = [ "Material" ];
|
||||
materialIndex = [ 0 ];
|
||||
materialIndex = obj_raw.material_index;
|
||||
materials = [ new MTLmaterial("Material") ];
|
||||
|
||||
if(obj_raw.use_material) {
|
||||
|
@ -169,12 +169,7 @@ function Node_3D_Mesh_Obj(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group)
|
|||
materialNames = array_create(array_length(materials));
|
||||
for( var i = 0, n = array_length(materials); i < n; i++ )
|
||||
materialNames[i] = materials[i].name;
|
||||
|
||||
for( var i = 0, n = array_length(materials); i < n; i++ ) {
|
||||
var _mat = obj_raw.materials[i];
|
||||
var _ord = array_find(materialNames, _mat);
|
||||
materialIndex[i] = _ord;
|
||||
}
|
||||
|
||||
} else {
|
||||
var _txt = "Load mtl error: Material amount defined in .mtl file not match the .obj file.";
|
||||
logNode(_txt); noti_warning(_txt);
|
||||
|
@ -240,11 +235,12 @@ function Node_3D_Mesh_Obj(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _group)
|
|||
static onDrawNodeOver = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
|
||||
if(!obj_reading) return;
|
||||
|
||||
var cx = xx + w * _s / 2;
|
||||
var cy = yy + h * _s / 2;
|
||||
var rr = min(w - 32, h - 32) * _s / 2;
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
var rr = min(bbox.w - 16, bbox.h - 16) / 2;
|
||||
var ast = current_time / 5;
|
||||
var prg = obj_read_progress / obj_read_prog_tot;
|
||||
|
||||
draw_set_color(COLORS._main_icon);
|
||||
draw_arc(cx, cy, rr, current_time / 5, current_time / 5 + 90, 4 * _s, 90);
|
||||
draw_arc(bbox.xc, bbox.yc, rr, ast, ast + prg * 360, 4 * _s, 90);
|
||||
} #endregion
|
||||
}
|
|
@ -11,13 +11,16 @@ function Node_3D_Mesh_Stack_Slice(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
|
||||
inputs[| 3] = nodeValue("Slices", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4);
|
||||
|
||||
inputs[| 4] = nodeValue("BBOX Padding", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, 0 ])
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
|
||||
outputs[| 0] = nodeValue("Outputs", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, [])
|
||||
.setArrayDepth(1);
|
||||
|
||||
mesh_data = new Inspector_Label("", f_code);
|
||||
|
||||
input_display_list = [
|
||||
["Model", false], 0, mesh_data,
|
||||
["Model", false], 0, 4, mesh_data,
|
||||
["Slices", false], 1, 3,
|
||||
];
|
||||
|
||||
|
@ -36,19 +39,25 @@ function Node_3D_Mesh_Stack_Slice(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
splice_prog_tot = 0;
|
||||
splice_pixel = 0;
|
||||
|
||||
bbox_padding = [ 0, 0, 0 ];
|
||||
|
||||
faces_minx = 99999; faces_maxx = -99999;
|
||||
faces_miny = 99999; faces_maxy = -99999;
|
||||
faces_minz = 99999; faces_maxz = -99999;
|
||||
|
||||
faces_data = [];
|
||||
faces_amo = 1;
|
||||
faces_cull = 0;
|
||||
|
||||
point_size = 14;
|
||||
point_size = 15;
|
||||
|
||||
dimensions = [ 1, 1 ];
|
||||
slicesAmo = 1;
|
||||
surfaces = [];
|
||||
|
||||
start_time = 0;
|
||||
end_time = 0;
|
||||
|
||||
insp1UpdateTooltip = "Splice";
|
||||
insp1UpdateIcon = [ THEME.sequence_control, 1, COLORS._main_value_positive ];
|
||||
|
||||
|
@ -58,9 +67,14 @@ function Node_3D_Mesh_Stack_Slice(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
}
|
||||
|
||||
static meshInit = function() {
|
||||
start_time = get_timer();
|
||||
|
||||
var _mesh = getInputData(0);
|
||||
if(_mesh == params.mesh) return;
|
||||
|
||||
params.mesh = _mesh;
|
||||
if(_mesh == noone) return;
|
||||
|
||||
faces_minx = 99999; faces_maxx = -99999;
|
||||
faces_miny = 99999; faces_maxy = -99999;
|
||||
faces_minz = 99999; faces_maxz = -99999;
|
||||
|
@ -69,6 +83,8 @@ function Node_3D_Mesh_Stack_Slice(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
var _fac = [];
|
||||
var _ind = 0;
|
||||
|
||||
faces_cull = 0;
|
||||
|
||||
for (var i = 0, n = array_length(_vbs); i < n; i++) {
|
||||
var _vb = _vbs[i];
|
||||
|
||||
|
@ -130,19 +146,36 @@ function Node_3D_Mesh_Stack_Slice(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
faces_maxz = max(faces_maxz, _pz);
|
||||
|
||||
if(_pid == 9) {
|
||||
_uu = frac(_uu) < 0? 1 + frac(_uu) : frac(_uu);
|
||||
_vv = frac(_vv) < 0? 1 + frac(_vv) : frac(_vv);
|
||||
var _uvPx = round(_vv * (_surfH - 1)) * _surfW + round(_uu * (_surfW - 1));
|
||||
// print($"{_uvPx} : {_uu}, {_vv}");
|
||||
if(_pnt[2] != _pnt[5] || _pnt[5] != _pnt[8]) {
|
||||
_pnt[9] = c_white;
|
||||
|
||||
if(_useSurf) {
|
||||
_uu = frac(_uu) < 0? 1 + frac(_uu) : frac(_uu);
|
||||
_vv = frac(_vv) < 0? 1 + frac(_vv) : frac(_vv);
|
||||
var _uvPx = round(_vv * (_surfH - 1)) * _surfW + round(_uu * (_surfW - 1));
|
||||
_pnt[9] = buffer_read_at(_surfBuff, _uvPx * 4, buffer_u32);
|
||||
}
|
||||
|
||||
_pnt[10] = max(_pnt[0], _pnt[3], _pnt[6]);
|
||||
_pnt[11] = min(_pnt[0], _pnt[3], _pnt[6]);
|
||||
|
||||
_pnt[12] = (_pnt[0] + _pnt[3] + _pnt[6]) / 3;
|
||||
_pnt[13] = (_pnt[1] + _pnt[4] + _pnt[7]) / 3;
|
||||
_pnt[14] = (_pnt[2] + _pnt[5] + _pnt[8]) / 3;
|
||||
|
||||
// _pnt[15] = _pnt[3] - _pnt[0];
|
||||
// _pnt[16] = _pnt[4] - _pnt[1];
|
||||
// _pnt[17] = _pnt[5] - _pnt[2];
|
||||
|
||||
// _pnt[18] = _pnt[6] - _pnt[0];
|
||||
// _pnt[19] = _pnt[7] - _pnt[1];
|
||||
// _pnt[20] = _pnt[8] - _pnt[2];
|
||||
|
||||
_fac[_ind++] = _pnt;
|
||||
|
||||
} else
|
||||
faces_cull++;
|
||||
|
||||
_pnt[9] = _useSurf? buffer_read_at(_surfBuff, _uvPx * 4, buffer_u32) : c_white;
|
||||
_pnt[10] = max(_pnt[0], _pnt[3], _pnt[6]);
|
||||
|
||||
_pnt[11] = (_pnt[0] + _pnt[3] + _pnt[6]) / 3;
|
||||
_pnt[12] = (_pnt[1] + _pnt[4] + _pnt[7]) / 3;
|
||||
_pnt[13] = (_pnt[2] + _pnt[5] + _pnt[8]) / 3;
|
||||
|
||||
_fac[_ind++] = _pnt;
|
||||
_pnt = [];
|
||||
_pid = 0;
|
||||
|
||||
|
@ -156,12 +189,6 @@ function Node_3D_Mesh_Stack_Slice(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
if(_useSurf) buffer_delete(_surfBuff);
|
||||
}
|
||||
|
||||
var _ranx = faces_maxx - faces_minx;
|
||||
var _rany = faces_maxy - faces_miny;
|
||||
var _ranz = faces_maxz - faces_minz;
|
||||
|
||||
mesh_data.text = $"Faces: {_ind}\nSize: [{_ranx}, {_rany}, {_ranz}]";
|
||||
|
||||
array_sort(_fac, function(a1, a2) { return sign(a2[10] - a1[10]); });
|
||||
|
||||
faces_amo = _ind;
|
||||
|
@ -205,18 +232,20 @@ function Node_3D_Mesh_Stack_Slice(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
static splice = function() {
|
||||
if(!splicing) return;
|
||||
|
||||
preview_index = splice_progress;
|
||||
|
||||
var _faces = faces_amo;
|
||||
var _ranx = faces_maxx - faces_minx;
|
||||
var _rany = faces_maxy - faces_miny;
|
||||
var _ranz = faces_maxz - faces_minz;
|
||||
var _ranx = faces_maxx - faces_minx + bbox_padding[0] * 2;
|
||||
var _rany = faces_maxy - faces_miny + bbox_padding[1] * 2;
|
||||
var _ranz = faces_maxz - faces_minz + bbox_padding[2] * 2;
|
||||
|
||||
var _stpx = _ranx / dimensions[0];
|
||||
var _stpy = _rany / dimensions[1];
|
||||
var _stpz = _ranz / slicesAmo;
|
||||
|
||||
var _strx = faces_minx + _stpx / 2;
|
||||
var _stry = faces_miny + _stpy / 2;
|
||||
var _strz = faces_minz + _stpz / 2;
|
||||
var _strx = faces_minx - bbox_padding[0] + _stpx / 2;
|
||||
var _stry = faces_miny - bbox_padding[1] + _stpy / 2 + _stpy * 0.1;
|
||||
var _strz = faces_minz - bbox_padding[2] + _stpz / 2;
|
||||
|
||||
var _f1x, _f1y, _f1z, _f2x, _f2y, _f2z, _f3x, _f3y, _f3z;
|
||||
var w = dimensions[0];
|
||||
|
@ -228,7 +257,7 @@ function Node_3D_Mesh_Stack_Slice(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
|
||||
var _left = _pxAmo - splice_pixel;
|
||||
var _time = get_timer();
|
||||
|
||||
|
||||
surface_set_target(_surf);
|
||||
|
||||
repeat(_left) {
|
||||
|
@ -239,6 +268,10 @@ function Node_3D_Mesh_Stack_Slice(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
var _px = _strx + _x * _stpx;
|
||||
var _py = _stry + _y * _stpy;
|
||||
|
||||
var _vx = 1;//_px;
|
||||
var _vy = 0;//_py;
|
||||
var _vz = 0;//_pz;
|
||||
|
||||
var _inSide = false;
|
||||
var _fc = c_white;
|
||||
var _dist = 99999;
|
||||
|
@ -262,36 +295,40 @@ function Node_3D_Mesh_Stack_Slice(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
var edge2y = _f3y - _f1y;
|
||||
var edge2z = _f3z - _f1z;
|
||||
|
||||
var pvecx = _py * edge2z - _pz * edge2y;
|
||||
var pvecy = _pz * edge2x - _px * edge2z;
|
||||
var pvecz = _px * edge2y - _py * edge2x;
|
||||
// var rc2e_vecx = _vy * edge2z - _vz * edge2y;
|
||||
// var rc2e_vecy = _vz * edge2x - _vx * edge2z;
|
||||
// var rc2e_vecz = _vx * edge2y - _vy * edge2x;
|
||||
// var det = edge1x * rc2e_vecx + edge1y * rc2e_vecy + edge1z * rc2e_vecz;
|
||||
|
||||
var det = edge1x * pvecx + edge1y * pvecy + edge1z * pvecz;
|
||||
var det = edge1z * edge2y - edge1y * edge2z;
|
||||
|
||||
if (abs(det) < 0.0001) continue;
|
||||
|
||||
var inv_det = 1.0 / det;
|
||||
|
||||
var tvecx = _px - _f1x;
|
||||
var tvecy = _py - _f1y;
|
||||
var tvecz = _pz - _f1z;
|
||||
var s_vecx = _px - _f1x;
|
||||
var s_vecy = _py - _f1y;
|
||||
var s_vecz = _pz - _f1z;
|
||||
|
||||
var u = (tvecx * pvecx + tvecy * pvecy + tvecz * pvecz) * inv_det;
|
||||
// var u = (s_vecx * rc2e_vecx + s_vecy * rc2e_vecy + s_vecz * rc2e_vecz) * inv_det;
|
||||
|
||||
var u = (s_vecz * edge2y - s_vecy * edge2z) * inv_det;
|
||||
if (u < 0.0 || u > 1.0) continue;
|
||||
|
||||
var qvecx = tvecy * edge1z - tvecz * edge1y;
|
||||
var qvecy = tvecz * edge1x - tvecx * edge1z;
|
||||
var qvecz = tvecx * edge1y - tvecy * edge1x;
|
||||
var sc1e_vecx = s_vecy * edge1z - s_vecz * edge1y;
|
||||
|
||||
var v = (_px * qvecx + _py * qvecy + _pz * qvecz) * inv_det;
|
||||
// var v = (_vx * sc1e_vecx + _vy * sc1e_vecy + _vz * sc1e_vecz) * inv_det;
|
||||
var v = sc1e_vecx * inv_det;
|
||||
if (v < 0.0 || u + v > 1.0) continue;
|
||||
|
||||
var t = (edge2x * qvecx + edge2y * qvecy + edge2z * qvecz) * inv_det;
|
||||
var sc1e_vecy = s_vecz * edge1x - s_vecx * edge1z;
|
||||
var sc1e_vecz = s_vecx * edge1y - s_vecy * edge1x;
|
||||
|
||||
var t = (edge2x * sc1e_vecx + edge2y * sc1e_vecy + edge2z * sc1e_vecz) * inv_det;
|
||||
if(t <= 0) continue;
|
||||
|
||||
_inSide = !_inSide;
|
||||
|
||||
var _d = sqr(_px - faces_data[_f + 11]) + sqr(_py - faces_data[_f + 12]) + sqr(_pz - faces_data[_f + 13]);
|
||||
var _d = sqr(_px - faces_data[_f + 12]) + sqr(_py - faces_data[_f + 13]) + sqr(_pz - faces_data[_f + 14]);
|
||||
if(_d < _dist) {
|
||||
_dist = _d;
|
||||
_fc = faces_data[_f + 9];
|
||||
|
@ -313,6 +350,9 @@ function Node_3D_Mesh_Stack_Slice(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
if(splice_progress >= splice_prog_tot) {
|
||||
splicing = false;
|
||||
triggerRender();
|
||||
|
||||
end_time = get_timer();
|
||||
logNode($"Slice completed in {(end_time - start_time) / 1000}ms");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -323,18 +363,27 @@ function Node_3D_Mesh_Stack_Slice(_x, _y, _group = noone) : Node(_x, _y, _group)
|
|||
|
||||
static update = function() {
|
||||
meshInit();
|
||||
|
||||
bbox_padding = getInputData(4);
|
||||
var _ranx = faces_maxx - faces_minx + bbox_padding[0] * 2;
|
||||
var _rany = faces_maxy - faces_miny + bbox_padding[1] * 2;
|
||||
var _ranz = faces_maxz - faces_minz + bbox_padding[2] * 2;
|
||||
|
||||
mesh_data.text = $"Faces: {faces_amo} (culled {faces_cull})\nSize: [{_ranx}, {_rany}, {_ranz}]";
|
||||
|
||||
}
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
||||
if(splicing) {
|
||||
var cx = xx + w * _s / 2;
|
||||
var cy = yy + h * _s / 2;
|
||||
var rr = min(w - 32, h - 32) * _s / 2;
|
||||
|
||||
draw_set_color(COLORS._main_icon);
|
||||
draw_arc(cx, cy, rr, current_time / 5, current_time / 5 + 90, 4 * _s, 90);
|
||||
return;
|
||||
}
|
||||
if(!splicing) return;
|
||||
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
var rr = min(bbox.w - 16, bbox.h - 16) / 2;
|
||||
var ast = current_time / 5;
|
||||
var prg = (splice_progress + splice_pixel / (dimensions[0] * dimensions[1])) / splice_prog_tot;
|
||||
|
||||
draw_set_color(COLORS._main_icon);
|
||||
draw_arc(bbox.xc, bbox.yc, rr, ast, ast + prg * 360, 4 * _s, 90);
|
||||
}
|
||||
|
||||
static getPreviewBoundingBox = function() { return BBOX().fromWH(0, 0, dimensions[0], dimensions[1]); }
|
||||
}
|
|
@ -9,7 +9,7 @@ function Node_Sprite_Stack(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
|
|||
|
||||
inputs[| 2] = nodeValue("Stack amount", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 4);
|
||||
|
||||
inputs[| 3] = nodeValue("Stack shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 1 ] )
|
||||
inputs[| 3] = nodeValue("Stack shift", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ] )
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
|
||||
inputs[| 4] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, [ 0, 0 ] )
|
||||
|
@ -34,7 +34,7 @@ function Node_Sprite_Stack(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
|
|||
inputs[| 11] = nodeValue("Highlight alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
|
||||
.setDisplay(VALUE_DISPLAY.slider);
|
||||
|
||||
inputs[| 12] = nodeValue("Array process", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
|
||||
inputs[| 12] = nodeValue("Array process", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
|
||||
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Individual", "Combined" ]);
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
@ -59,12 +59,19 @@ function Node_Sprite_Stack(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
|
|||
PROCESSOR_OVERLAY_CHECK
|
||||
|
||||
var pos = current_data[4];
|
||||
var sck = current_data[3];
|
||||
|
||||
var px = _x + pos[0] * _s;
|
||||
var py = _y + pos[1] * _s;
|
||||
var sx = px + sck[0] * _s * 4;
|
||||
var sy = py + sck[1] * _s * 4;
|
||||
|
||||
var a = inputs[| 3].drawOverlay(hover, active, px, py, _s * 4, _mx, _my, _snx, _sny, THEME.anchor); active &= a;
|
||||
var a = inputs[| 4].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny); active &= a;
|
||||
var a = inputs[| 5].drawOverlay(hover, active, px, py, _s, _mx, _my, _snx, _sny); active &= a;
|
||||
draw_set_color(COLORS._main_accent);
|
||||
draw_line(px, py, sx, sy);
|
||||
|
||||
var a = inputs[| 3].drawOverlay(hover, active, px, py, _s * 4, _mx, _my, _snx, _sny, 1); active &= a;
|
||||
var a = inputs[| 4].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny); active &= a;
|
||||
var a = inputs[| 5].drawOverlay(hover, active, px, py, _s, _mx, _my, _snx, _sny); active &= a;
|
||||
} #endregion
|
||||
|
||||
static drawPreviewToolOverlay = function(hover, active, _mx, _my, _panel) { #region
|
||||
|
@ -108,7 +115,7 @@ function Node_Sprite_Stack(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
|
|||
|
||||
preview_custom_x_max = max(preview_custom_x_max - _panel.w + ui(64), 0);
|
||||
|
||||
var hov = hover && point_in_rectangle(_mx, _my, 0, sy, _panel.x1, _panel.x1);
|
||||
var hov = hover && point_in_rectangle(_mx, _my, 0, sy, _panel.x1, _panel.y1);
|
||||
|
||||
if(hov) {
|
||||
if(mouse_wheel_down()) preview_custom_x_to -= ui(128);
|
||||
|
|
|
@ -1768,9 +1768,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
return preview_overlay_rotation(value_from == noone, active, _x, _y, _s, _mx, _my, _snx, _sny, _rad);
|
||||
|
||||
case VALUE_DISPLAY.vector :
|
||||
var _spr = argument_count > arc + 0? argument[arc + 0] : THEME.anchor_selector;
|
||||
var _typ = argument_count > arc + 0? argument[arc + 0] : 0;
|
||||
var _sca = argument_count > arc + 1? argument[arc + 1] : 1;
|
||||
return preview_overlay_vector(value_from == noone, active, _x, _y, _s, _mx, _my, _snx, _sny, _spr);
|
||||
return preview_overlay_vector(value_from == noone, active, _x, _y, _s, _mx, _my, _snx, _sny, _typ);
|
||||
|
||||
case VALUE_DISPLAY.gradient_range :
|
||||
var _dim = argument[arc];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function readObj_init(_scale = 1, _yneg = false) {
|
||||
function readObj_init(_scale = 1, _axis = false) {
|
||||
obj_reading = true;
|
||||
obj_read_progress = 0;
|
||||
obj_read_prog_sub = 0;
|
||||
|
@ -6,7 +6,7 @@ function readObj_init(_scale = 1, _yneg = false) {
|
|||
obj_raw = noone;
|
||||
|
||||
obj_reading_scale = _scale;
|
||||
obj_reading_yneg = _yneg;
|
||||
obj_reading_axis = _axis;
|
||||
|
||||
_VB = [];
|
||||
_VBT = [];
|
||||
|
@ -40,7 +40,7 @@ function readObj_file() {
|
|||
|
||||
switch(sep[0]) {
|
||||
case "v" :
|
||||
switch(obj_reading_yneg) {
|
||||
switch(obj_reading_axis) {
|
||||
case 0 :
|
||||
array_push(v, [
|
||||
real(sep[1]) * obj_reading_scale,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function preview_overlay_vector(interact, active, _x, _y, _s, _mx, _my, _snx, _sny, _spr) {
|
||||
function preview_overlay_vector(interact, active, _x, _y, _s, _mx, _my, _snx, _sny, _type = 0) {
|
||||
var _val = array_clone(getValue());
|
||||
var hover = -1;
|
||||
if(!is_array(_val) || array_empty(_val)) return hover;
|
||||
|
@ -65,7 +65,7 @@ function preview_overlay_vector(interact, active, _x, _y, _s, _mx, _my, _snx, _s
|
|||
|
||||
__overlay_hover = array_verify(__overlay_hover, 1);
|
||||
__overlay_hover[0] = lerp_float(__overlay_hover[0], _index, 4);
|
||||
draw_anchor(__overlay_hover[0], _ax, _ay, _r);
|
||||
draw_anchor(__overlay_hover[0], _ax, _ay, _r, _type);
|
||||
|
||||
draw_set_text(_f_p2b, fa_center, fa_bottom, COLORS._main_accent);
|
||||
draw_text_add(round(_ax), round(_ay - 4), name);
|
||||
|
|
|
@ -3,6 +3,7 @@ varying vec4 v_vColour;
|
|||
|
||||
uniform vec4 color;
|
||||
uniform float index;
|
||||
uniform int type;
|
||||
|
||||
void main() {
|
||||
float dist = 1. - length(v_vTexcoord - .5) * 2.;
|
||||
|
@ -11,14 +12,21 @@ void main() {
|
|||
float a;
|
||||
vec4 c = vec4(0.);
|
||||
|
||||
a = smoothstep(.0, .1, dist);
|
||||
c = mix(c, vec4(0., 0., 0., 1.), a);
|
||||
if(type == 0) {
|
||||
a = smoothstep(.0, .1, dist);
|
||||
c = mix(c, vec4(0., 0., 0., 1.), a);
|
||||
|
||||
a = smoothstep(.15, .2, dist);
|
||||
c = mix(c, vec4(1., 1., 1., 1.), a);
|
||||
|
||||
a = smoothstep(.3, .4, dist);
|
||||
c = mix(c, color, a);
|
||||
|
||||
} else if(type == 1) {
|
||||
a = smoothstep(.3, .4, dist);
|
||||
c = mix(c, color, a);
|
||||
}
|
||||
|
||||
a = smoothstep(.15, .2, dist);
|
||||
c = mix(c, vec4(1., 1., 1., 1.), a);
|
||||
|
||||
a = smoothstep(.3, .4, dist);
|
||||
c = mix(c, color, a);
|
||||
|
||||
gl_FragColor = c;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ varying vec4 v_vColour;
|
|||
|
||||
uniform vec4 color;
|
||||
uniform float index;
|
||||
uniform int type;
|
||||
|
||||
float line_segment(in vec2 a, in vec2 b) {
|
||||
vec2 p = v_vTexcoord;
|
||||
|
@ -25,14 +26,20 @@ void main() {
|
|||
|
||||
vec4 c = vec4(0.);
|
||||
|
||||
a = smoothstep(.0, .1, dist);
|
||||
c = mix(c, vec4(0., 0., 0., 1.), a);
|
||||
|
||||
a = smoothstep(.15, .2, dist);
|
||||
c = mix(c, vec4(1., 1., 1., 1.), a);
|
||||
|
||||
a = smoothstep(.3, .4, dist);
|
||||
c = mix(c, color, a);
|
||||
if(type == 0) {
|
||||
a = smoothstep(.0, .1, dist);
|
||||
c = mix(c, vec4(0., 0., 0., 1.), a);
|
||||
|
||||
a = smoothstep(.15, .2, dist);
|
||||
c = mix(c, vec4(1., 1., 1., 1.), a);
|
||||
|
||||
a = smoothstep(.3, .4, dist);
|
||||
c = mix(c, color, a);
|
||||
|
||||
} else if(type == 1) {
|
||||
a = smoothstep(.3, .4, dist);
|
||||
c = mix(c, color, a);
|
||||
}
|
||||
|
||||
gl_FragColor = c;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue