Unfreeze vertex buffer

This commit is contained in:
Tanasart 2023-09-17 13:23:24 +02:00
parent 8f84b61d3f
commit ec4a31d19f
19 changed files with 145 additions and 218 deletions

View file

@ -628,7 +628,7 @@
{"name":"__vertex_function","order":1,"path":"scripts/__vertex_function/__vertex_function.yy",},
{"name":"node_path_anchor","order":13,"path":"scripts/node_path_anchor/node_path_anchor.yy",},
{"name":"s_node_path_wave","order":7,"path":"sprites/s_node_path_wave/s_node_path_wave.yy",},
{"name":"string_function","order":6,"path":"scripts/string_function/string_function.yy",},
{"name":"string_functions","order":6,"path":"scripts/string_functions/string_functions.yy",},
{"name":"o_dialog_palette","order":2,"path":"objects/o_dialog_palette/o_dialog_palette.yy",},
{"name":"sh_blend_hue","order":17,"path":"shaders/sh_blend_hue/sh_blend_hue.yy",},
{"name":"s_node_threshold","order":47,"path":"sprites/s_node_threshold/s_node_threshold.yy",},

View file

@ -1219,7 +1219,7 @@
{"id":{"name":"__vertex_function","path":"scripts/__vertex_function/__vertex_function.yy",},},
{"id":{"name":"node_path_anchor","path":"scripts/node_path_anchor/node_path_anchor.yy",},},
{"id":{"name":"s_node_path_wave","path":"sprites/s_node_path_wave/s_node_path_wave.yy",},},
{"id":{"name":"string_function","path":"scripts/string_function/string_function.yy",},},
{"id":{"name":"string_functions","path":"scripts/string_functions/string_functions.yy",},},
{"id":{"name":"o_dialog_palette","path":"objects/o_dialog_palette/o_dialog_palette.yy",},},
{"id":{"name":"sh_blend_hue","path":"shaders/sh_blend_hue/sh_blend_hue.yy",},},
{"id":{"name":"_f_p0","path":"fonts/_f_p0/_f_p0.yy",},},

Binary file not shown.

View file

@ -21,6 +21,7 @@ event_inherited();
[ "Triangle grid", "Farini" ],
[ "Pixel sort", "Ciphrd" ],
[ "Simplex noise", "Ian McEwan" ],
[ "BBMOD", "BlueBurn" ],
[ "Additional help", "ChatGPT by OpenAI" ],
]

View file

@ -68,6 +68,7 @@ event_inherited();
draw_sprite_ui_uniform(THEME.text_bullet, 0, _x - ui(12), _y + yy + ui(18), 1, COLORS._main_icon);
var _lx = _x;
var _topic = false;
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
for( var j = 1, m = array_length(_stx); j < m; j++ ) {
@ -79,12 +80,14 @@ event_inherited();
}
if(string_char_at(_word, 1) == "[")
draw_set_color(COLORS._main_text_accent);
else
draw_set_color(COLORS._main_text);
draw_text(_x, _y + yy, _word);
_topic = true;
draw_set_color(_topic? COLORS._main_text_accent : COLORS._main_text);
draw_text_add(_x, _y + yy, _word);
_x += string_width(_word);
if(string_char_last(_word) == "]")
_topic = false;
}
yy += line_get_height();

View file

@ -20,19 +20,23 @@ function argumentRenderer(_typeArray = []) {
_jName.editWidget.setFocusHover(_focus, _hover);
_jName.editWidget.draw(tx + ui(128 + 8), ty, _w - ui(128 + 8), _th, _jName.showValue(), _m, _jName.display_type);
_h += _th + ui(6);
_h += _th + ui(8);
draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text_sub);
draw_text_add(tx + ui(8), ty + _th + ui(6) + ui(6), "Value");
draw_text_add(tx + ui(8), ty + _th + ui(8 + 6), "Value");
var _jValue = inputs[| i + 2];
if(_jValue.editWidget != noone) {
var params = new widgetParam(tx + ui(64), ty + _th + ui(6), _w - ui(64), TEXTBOX_HEIGHT, _jValue.showValue(), -1, _m, argument_renderer.rx, argument_renderer.ry);
var params = new widgetParam(tx + ui(64), ty + _th + ui(10), _w - ui(64), TEXTBOX_HEIGHT, _jValue.showValue(), -1, _m, argument_renderer.rx, argument_renderer.ry);
_jValue.editWidget.setFocusHover(_focus, _hover);
_h += _jValue.editWidget.drawParam(params) + ui(8);
_h += _jValue.editWidget.drawParam(params) + ui(10);
}
//var _ly = ty + _h - ui(9);
//draw_set_color(COLORS.panel_separator);
//draw_line_width(_x + ui(16), _ly, _x + _w - ui(16 * 2), _ly, 2);
hh += _h;
ty += _h;
}

View file

@ -82,7 +82,7 @@ function __3dObject() constructor {
}
}
vertex_end(_buffer);
vertex_freeze(_buffer);
//vertex_freeze(_buffer);
return _buffer;
} #endregion

View file

@ -85,7 +85,9 @@ function __3dScene(camera) constructor {
lightPnt_shadowBias = [];
} reset(); #endregion
static _submit = function(callback, object, shader = noone) {
static _submit = function(callback, object = noone, shader = noone) {
if(object == noone) return;
matrix_stack_clear();
if(apply_transform) custom_transform.submitMatrix();
callback(object, shader);

View file

@ -23,7 +23,7 @@ function __3dSurfaceExtrude(surface = noone, height = noone, smooth = false) : _
return h[_i][_j];
}
static initModel = function() {
static initModel = function() {
if(!is_surface(surface)) return;
var _surface = surface;
@ -113,183 +113,60 @@ function __3dSurfaceExtrude(surface = noone, height = noone, smooth = false) : _
var dep = (useH? getHeight(hei, hgtW, hgtH, i, j) : 1) * 0.5;
if(smooth) { #region
var d0, d1, d2, d3;
var d00, d10, d01, d11;
var a, a0, a1, a2, a3;
// d00 | a0 | d10
// a1 | a | a2
// d01 | a3 | d11
if(useH) {
d00 = (i > 0 && j > 0)? getHeight(hei, hgtW, hgtH, i - 1, j - 1) * 0.5 : 0;
d10 = (i < ww - 1 && j > 0)? getHeight(hei, hgtW, hgtH, i + 1, j - 1) * 0.5 : 0;
d01 = (i > 0 && j < hh - 1)? getHeight(hei, hgtW, hgtH, i - 1, j + 1) * 0.5 : 0;
d11 = (i < ww - 1 && j < hh - 1)? getHeight(hei, hgtW, hgtH, i + 1, j + 1) * 0.5 : 0;
d0 = (j > 0)? getHeight(hei, hgtW, hgtH, i, j - 1) * 0.5 : 0;
d1 = (i > 0)? getHeight(hei, hgtW, hgtH, i - 1, j) * 0.5 : 0;
d2 = (i < ww - 1)? getHeight(hei, hgtW, hgtH, i + 1, j) * 0.5 : 0;
d3 = (j < hh - 1)? getHeight(hei, hgtW, hgtH, i, j + 1) * 0.5 : 0;
} else {
d00 = (i > 0 && j > 0)? bool(ap[i - 1][j - 1]) * 0.5 : 0;
d10 = (i < ww - 1 && j > 0)? bool(ap[i + 1][j - 1]) * 0.5 : 0;
d01 = (i > 0 && j < hh - 1)? bool(ap[i - 1][j + 1]) * 0.5 : 0;
d11 = (i < ww - 1 && j < hh - 1)? bool(ap[i + 1][j + 1]) * 0.5 : 0;
d0 = (j > 0)? bool(ap[i][j - 1]) * 0.5 : 0;
d1 = (i > 0)? bool(ap[i - 1][j]) * 0.5 : 0;
d2 = (i < ww - 1)? bool(ap[i + 1][j]) * 0.5 : 0;
d3 = (j < hh - 1)? bool(ap[i][j + 1]) * 0.5 : 0;
}
a = ap[i][j];
a0 = (j > 0)? ap[i][j - 1] : 0;
a1 = (i > 0)? ap[i - 1][j] : 0;
a2 = (i < ww - 1)? ap[i + 1][j] : 0;
a3 = (j < hh - 1)? ap[i][j + 1] : 0;
if(a1 && a0) d00 = (d1 + d0) / 2;
if(a0 && a2) d10 = (d0 + d2) / 2;
if(a2 && a3) d11 = (d2 + d3) / 2;
if(a3 && a1) d01 = (d3 + d1) / 2;
if(a) {
ds_list_add(v, new __vertex(j0, i1, -d10).setNormal(0, 0, -1).setUV(tx1, ty0));
ds_list_add(v, new __vertex(j1, i1, -d11).setNormal(0, 0, -1).setUV(tx1, ty1));
ds_list_add(v, new __vertex(j0, i0, -d00).setNormal(0, 0, -1).setUV(tx0, ty0));
ds_list_add(v, new __vertex(j1, i1, -d11).setNormal(0, 0, -1).setUV(tx1, ty1));
ds_list_add(v, new __vertex(j1, i0, -d01).setNormal(0, 0, -1).setUV(tx0, ty1));
ds_list_add(v, new __vertex(j0, i0, -d00).setNormal(0, 0, -1).setUV(tx0, ty0));
ds_list_add(v, new __vertex(j0, i1, d10).setNormal(0, 0, 1).setUV(tx1, ty0));
ds_list_add(v, new __vertex(j0, i0, d00).setNormal(0, 0, 1).setUV(tx0, ty0));
ds_list_add(v, new __vertex(j1, i1, d11).setNormal(0, 0, 1).setUV(tx1, ty1));
ds_list_add(v, new __vertex(j1, i1, d11).setNormal(0, 0, 1).setUV(tx1, ty1));
ds_list_add(v, new __vertex(j0, i0, d00).setNormal(0, 0, 1).setUV(tx0, ty0));
ds_list_add(v, new __vertex(j1, i0, d01).setNormal(0, 0, 1).setUV(tx0, ty1));
} else if(!a0 && !a1 && a2 && a3) {
//var _tx0 = tw * (i + 1), _tx1 = _tx0 + tw;
//var _ty0 = th * (j + 0), _ty1 = _ty0 + th;
d00 *= d0 * d1;
d10 *= d1 * d2;
d01 *= d1 * d3;
ds_list_add(v, new __vertex(j0, i1, -d10).setNormal(0, 0, -1).setUV(tx1, ty0));
ds_list_add(v, new __vertex(j1, i1, -d11).setNormal(0, 0, -1).setUV(tx1, ty1));
ds_list_add(v, new __vertex(j1, i0, -d01).setNormal(0, 0, -1).setUV(tx0, ty1));
ds_list_add(v, new __vertex(j0, i1, d10).setNormal(0, 0, 1).setUV(tx1, ty0));
ds_list_add(v, new __vertex(j1, i1, d11).setNormal(0, 0, 1).setUV(tx1, ty1));
ds_list_add(v, new __vertex(j1, i0, d01).setNormal(0, 0, 1).setUV(tx0, ty1));
} else if(!a0 && a1 && !a2 && a3) {
//var _tx0 = tw * (i - 1), _tx1 = _tx0 + tw;
//var _ty0 = th * (j + 0), _ty1 = _ty0 + th;
d00 *= d0 * d1;
d10 *= d1 * d2;
d11 *= d2 * d3;
ds_list_add(v, new __vertex(j1, i1, -d11).setNormal(0, 0, -1).setUV(tx1, ty1));
ds_list_add(v, new __vertex(j1, i0, -d01).setNormal(0, 0, -1).setUV(tx0, ty1));
ds_list_add(v, new __vertex(j0, i0, -d00).setNormal(0, 0, -1).setUV(tx0, ty0));
ds_list_add(v, new __vertex(j1, i1, d11).setNormal(0, 0, 1).setUV(tx1, ty1));
ds_list_add(v, new __vertex(j1, i0, d01).setNormal(0, 0, 1).setUV(tx0, ty1));
ds_list_add(v, new __vertex(j0, i0, d00).setNormal(0, 0, 1).setUV(tx0, ty0));
} else if(a0 && a1 && !a2 && !a3) {
//var _tx0 = tw * (i - 1), _tx1 = _tx0 + tw;
//var _ty0 = th * (j + 0), _ty1 = _ty0 + th;
d10 *= d1 * d2;
d01 *= d1 * d3;
d11 *= d2 * d3;
ds_list_add(v, new __vertex(j0, i0, -d00).setNormal(0, 0, -1).setUV(tx0, ty0));
ds_list_add(v, new __vertex(j0, i1, -d10).setNormal(0, 0, -1).setUV(tx1, ty0));
ds_list_add(v, new __vertex(j1, i0, -d01).setNormal(0, 0, -1).setUV(tx0, ty1));
ds_list_add(v, new __vertex(j0, i0, d00).setNormal(0, 0, 1).setUV(tx0, ty0));
ds_list_add(v, new __vertex(j0, i1, d10).setNormal(0, 0, 1).setUV(tx1, ty0));
ds_list_add(v, new __vertex(j1, i0, d01).setNormal(0, 0, 1).setUV(tx0, ty1));
} else if(a0 && !a1 && a2 && !a3) {
//var _tx0 = tw * (i + 1), _tx1 = _tx0 + tw;
//var _ty0 = th * (j + 0), _ty1 = _ty0 + th;
d00 *= d0 * d1;
d01 *= d1 * d3;
d11 *= d2 * d3;
ds_list_add(v, new __vertex(j0, i1, -d10).setNormal(0, 0, -1).setUV(tx1, ty0));
ds_list_add(v, new __vertex(j1, i1, -d11).setNormal(0, 0, -1).setUV(tx1, ty1));
ds_list_add(v, new __vertex(j0, i0, -d00).setNormal(0, 0, -1).setUV(tx0, ty0));
ds_list_add(v, new __vertex(j0, i1, d10).setNormal(0, 0, 1).setUV(tx1, ty0));
ds_list_add(v, new __vertex(j1, i1, d11).setNormal(0, 0, 1).setUV(tx1, ty1));
ds_list_add(v, new __vertex(j0, i0, d00).setNormal(0, 0, 1).setUV(tx0, ty0));
}
#endregion
} else { #region
ds_list_add(v, new __vertex(i1, j0, -dep).setNormal(0, 0, -1).setUV(tx1, ty0));
ds_list_add(v, new __vertex(i0, j0, -dep).setNormal(0, 0, -1).setUV(tx0, ty0));
ds_list_add(v, new __vertex(i1, j1, -dep).setNormal(0, 0, -1).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i1, j0, -dep).setNormal(0, 0, -1).setUV(tx1, ty0));
ds_list_add(v, new __vertex(i0, j0, -dep).setNormal(0, 0, -1).setUV(tx0, ty0));
ds_list_add(v, new __vertex(i1, j1, -dep).setNormal(0, 0, -1).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i1, j1, -dep).setNormal(0, 0, -1).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i0, j0, -dep).setNormal(0, 0, -1).setUV(tx0, ty0));
ds_list_add(v, new __vertex(i0, j1, -dep).setNormal(0, 0, -1).setUV(tx0, ty1));
ds_list_add(v, new __vertex(i1, j1, -dep).setNormal(0, 0, -1).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i0, j0, -dep).setNormal(0, 0, -1).setUV(tx0, ty0));
ds_list_add(v, new __vertex(i0, j1, -dep).setNormal(0, 0, -1).setUV(tx0, ty1));
ds_list_add(v, new __vertex(i1, j0, dep).setNormal(0, 0, 1).setUV(tx1, ty0));
ds_list_add(v, new __vertex(i1, j1, dep).setNormal(0, 0, 1).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i0, j0, dep).setNormal(0, 0, 1).setUV(tx0, ty0));
ds_list_add(v, new __vertex(i1, j0, dep).setNormal(0, 0, 1).setUV(tx1, ty0));
ds_list_add(v, new __vertex(i1, j1, dep).setNormal(0, 0, 1).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i0, j0, dep).setNormal(0, 0, 1).setUV(tx0, ty0));
ds_list_add(v, new __vertex(i1, j1, dep).setNormal(0, 0, 1).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i0, j1, dep).setNormal(0, 0, 1).setUV(tx0, ty1));
ds_list_add(v, new __vertex(i0, j0, dep).setNormal(0, 0, 1).setUV(tx0, ty0));
ds_list_add(v, new __vertex(i1, j1, dep).setNormal(0, 0, 1).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i0, j1, dep).setNormal(0, 0, 1).setUV(tx0, ty1));
ds_list_add(v, new __vertex(i0, j0, dep).setNormal(0, 0, 1).setUV(tx0, ty0));
if((useH && dep * 2 > getHeight(hei, hgtW, hgtH, i, j - 1)) || (j == 0 || ap[i][j - 1] == 0)) { //y side
ds_list_add(v, new __vertex(i0, j0, dep).setNormal(0, 1, 0).setUV(tx1, ty0));
ds_list_add(v, new __vertex(i0, j0, -dep).setNormal(0, 1, 0).setUV(tx0, ty0));
ds_list_add(v, new __vertex(i1, j0, dep).setNormal(0, 1, 0).setUV(tx1, ty1));
if((useH && dep * 2 > getHeight(hei, hgtW, hgtH, i, j - 1)) || (j == 0 || ap[i][j - 1] == 0)) { //y side
ds_list_add(v, new __vertex(i0, j0, dep).setNormal(0, 1, 0).setUV(tx1, ty0));
ds_list_add(v, new __vertex(i0, j0, -dep).setNormal(0, 1, 0).setUV(tx0, ty0));
ds_list_add(v, new __vertex(i1, j0, dep).setNormal(0, 1, 0).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i0, j0, -dep).setNormal(0, 1, 0).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i1, j0, -dep).setNormal(0, 1, 0).setUV(tx0, ty0));
ds_list_add(v, new __vertex(i1, j0, dep).setNormal(0, 1, 0).setUV(tx0, ty1));
}
ds_list_add(v, new __vertex(i0, j0, -dep).setNormal(0, 1, 0).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i1, j0, -dep).setNormal(0, 1, 0).setUV(tx0, ty0));
ds_list_add(v, new __vertex(i1, j0, dep).setNormal(0, 1, 0).setUV(tx0, ty1));
}
if((useH && dep * 2 > getHeight(hei, hgtW, hgtH, i, j + 1)) || (j == hh - 1 || ap[i][j + 1] == 0)) { //y side
ds_list_add(v, new __vertex(i0, j1, dep).setNormal(0, -1, 0).setUV(tx1, ty0));
ds_list_add(v, new __vertex(i1, j1, dep).setNormal(0, -1, 0).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i0, j1, -dep).setNormal(0, -1, 0).setUV(tx0, ty0));
if((useH && dep * 2 > getHeight(hei, hgtW, hgtH, i, j + 1)) || (j == hh - 1 || ap[i][j + 1] == 0)) { //y side
ds_list_add(v, new __vertex(i0, j1, dep).setNormal(0, -1, 0).setUV(tx1, ty0));
ds_list_add(v, new __vertex(i1, j1, dep).setNormal(0, -1, 0).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i0, j1, -dep).setNormal(0, -1, 0).setUV(tx0, ty0));
ds_list_add(v, new __vertex(i0, j1, -dep).setNormal(0, -1, 0).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i1, j1, dep).setNormal(0, -1, 0).setUV(tx0, ty1));
ds_list_add(v, new __vertex(i1, j1, -dep).setNormal(0, -1, 0).setUV(tx0, ty0));
}
ds_list_add(v, new __vertex(i0, j1, -dep).setNormal(0, -1, 0).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i1, j1, dep).setNormal(0, -1, 0).setUV(tx0, ty1));
ds_list_add(v, new __vertex(i1, j1, -dep).setNormal(0, -1, 0).setUV(tx0, ty0));
}
if((useH && dep * 2 > getHeight(hei, hgtW, hgtH, i - 1, j)) || (i == 0 || ap[i - 1][j] == 0)) { //x side
ds_list_add(v, new __vertex(i0, j0, dep).setNormal(-1, 0, 0).setUV(tx1, ty0));
ds_list_add(v, new __vertex(i0, j1, dep).setNormal(-1, 0, 0).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i0, j0, -dep).setNormal(-1, 0, 0).setUV(tx0, ty0));
if((useH && dep * 2 > getHeight(hei, hgtW, hgtH, i - 1, j)) || (i == 0 || ap[i - 1][j] == 0)) { //x side
ds_list_add(v, new __vertex(i0, j0, dep).setNormal(-1, 0, 0).setUV(tx1, ty0));
ds_list_add(v, new __vertex(i0, j1, dep).setNormal(-1, 0, 0).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i0, j0, -dep).setNormal(-1, 0, 0).setUV(tx0, ty0));
ds_list_add(v, new __vertex(i0, j0, -dep).setNormal(-1, 0, 0).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i0, j1, dep).setNormal(-1, 0, 0).setUV(tx0, ty1));
ds_list_add(v, new __vertex(i0, j1, -dep).setNormal(-1, 0, 0).setUV(tx0, ty0));
}
ds_list_add(v, new __vertex(i0, j0, -dep).setNormal(-1, 0, 0).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i0, j1, dep).setNormal(-1, 0, 0).setUV(tx0, ty1));
ds_list_add(v, new __vertex(i0, j1, -dep).setNormal(-1, 0, 0).setUV(tx0, ty0));
}
if((useH && dep * 2 > getHeight(hei, hgtW, hgtH, i + 1, j)) || (i == ww - 1 || ap[i + 1][j] == 0)) { //x side
ds_list_add(v, new __vertex(i1, j0, dep).setNormal(1, 0, 0).setUV(tx1, ty0));
ds_list_add(v, new __vertex(i1, j0, -dep).setNormal(1, 0, 0).setUV(tx0, ty0));
ds_list_add(v, new __vertex(i1, j1, dep).setNormal(1, 0, 0).setUV(tx1, ty1));
if((useH && dep * 2 > getHeight(hei, hgtW, hgtH, i + 1, j)) || (i == ww - 1 || ap[i + 1][j] == 0)) { //x side
ds_list_add(v, new __vertex(i1, j0, dep).setNormal(1, 0, 0).setUV(tx1, ty0));
ds_list_add(v, new __vertex(i1, j0, -dep).setNormal(1, 0, 0).setUV(tx0, ty0));
ds_list_add(v, new __vertex(i1, j1, dep).setNormal(1, 0, 0).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i1, j0, -dep).setNormal(1, 0, 0).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i1, j1, -dep).setNormal(1, 0, 0).setUV(tx0, ty0));
ds_list_add(v, new __vertex(i1, j1, dep).setNormal(1, 0, 0).setUV(tx0, ty1));
}
#endregion
ds_list_add(v, new __vertex(i1, j0, -dep).setNormal(1, 0, 0).setUV(tx1, ty1));
ds_list_add(v, new __vertex(i1, j1, -dep).setNormal(1, 0, 0).setUV(tx0, ty0));
ds_list_add(v, new __vertex(i1, j1, dep).setNormal(1, 0, 0).setUV(tx0, ty1));
}
}

View file

@ -32,7 +32,7 @@ function __vertex(_x = 0, _y = _x, _z = _x, color = c_white, alpha = 1) construc
return self;
}
static toString = function() { return $"[ pos: {position}, nor: {normal}, uv: {uv}, {color}, {alpha} ]"; }
static toString = function() { return $"[ pos: ({x}, {y}, {z}), nor: ({nx}, {ny}, {nz}), uv: ({u}, {v}), {color}, {alpha} ]"; }
static clone = function() {
gml_pragma("forceinline");

View file

@ -15,10 +15,42 @@ var constant = ["MATRIX_VIEW", "MATRIX_PROJECTION", "MATRIX_WORLD", "MATRIX_WORL
for( var i = 0, n = array_length(constant); i < n; i++ )
global.glsl_constant[? constant[i]] = 1;
function draw_code_glsl(_x, _y, str) {
global.HLSL_BREAK_TOKEN = [" ", "(", ")", "[", "]", "{", "}", ".", ",", ";", "+", "-", "*", "/", "^", "="];
function hlsl_token_splice(str) {
var st = [];
var ss = str;
var sp;
var cc;
do {
sp = 999999;
for( var i = 0, n = array_length(global.HLSL_BREAK_TOKEN); i < n; i++ ) {
var _pos = string_pos(global.HLSL_BREAK_TOKEN[i], ss);
if(_pos != 0) sp = min(sp, _pos);
}
if(sp == 999999) { //no delim left
array_push(st, ss);
break;
}
var _ss = string_copy(ss, 1, sp - 1);
array_push(st, _ss);
cc = string_char_at(ss, sp);
array_push(st, cc);
ss = string_copy(ss, sp + 1, string_length(ss) - sp);
} until(sp == 0);
return st;
}
function draw_code_hlsl(_x, _y, str) {
var tx = _x;
var ty = _y;
var words = token_splice(str);
var words = hlsl_token_splice(str);
for( var j = 0; j < array_length(words); j++ ) {
var word = words[j];

View file

@ -10,7 +10,7 @@ for( var i = 0, n = array_length(reserved); i < n; i++ )
global.CODE_BREAK_TOKEN = [" ", "(", ")", "[", "]", "{", "}", ",", ";", "+", "-", "*", "/", "^", "="];
function token_splice(str) {
function lua_token_splice(str) {
var st = [];
var ss = str;
var sp;
@ -65,7 +65,7 @@ function draw_code_lua(_x, _y, str) {
continue;
}
var words = token_splice(_w);
var words = lua_token_splice(_w);
for( var j = 0; j < array_length(words); j++ ) {
word = words[j];

View file

@ -1,4 +1,4 @@
function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #region
name = _name;
spr = _spr;
node = _node;
@ -43,7 +43,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
_node.doUpdate();
return _node;
}
}
} #endregion
#region nodes
globalvar ALL_NODES, ALL_NODE_LIST, NODE_CATEGORY, NODE_PAGE_DEFAULT, NODE_PB_CATEGORY, NODE_PCX_CATEGORY;
@ -53,7 +53,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
NODE_PB_CATEGORY = ds_list_create();
NODE_PCX_CATEGORY = ds_list_create();
function nodeBuild(_name, _x, _y, _group = PANEL_GRAPH.getCurrentContext()) {
function nodeBuild(_name, _x, _y, _group = PANEL_GRAPH.getCurrentContext()) { #region
if(!ds_map_exists(ALL_NODES, _name)) {
log_warning("LOAD", $"Node type {_name} not found");
return noone;
@ -61,9 +61,9 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
var _node = ALL_NODES[? _name];
return _node.build(_x, _y, _group);
}
} #endregion
function addNodeObject(_list, _name, _spr, _node, _fun, _tag = [], tooltip = "") {
function addNodeObject(_list, _name, _spr, _node, _fun, _tag = [], tooltip = "") { #region
var _n;
if(ds_map_exists(ALL_NODES, _node))
@ -78,19 +78,19 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
if(tooltip != "") _n.tooltip = tooltip;
ds_list_add(_list, _n);
return _n;
}
} #endregion
function addNodeCatagory(name, list, filter = []) {
function addNodeCatagory(name, list, filter = []) { #region
ds_list_add(NODE_CATEGORY, { name: name, list: list, filter: filter });
}
} #endregion
function addNodePBCatagory(name, list, filter = []) {
function addNodePBCatagory(name, list, filter = []) { #region
ds_list_add(NODE_PB_CATEGORY, { name: name, list: list, filter: filter });
}
} #endregion
function addNodePCXCatagory(name, list, filter = []) {
function addNodePCXCatagory(name, list, filter = []) { #region
ds_list_add(NODE_PCX_CATEGORY, { name: name, list: list, filter: filter });
}
} #endregion
function __initNodes() {
var favPath = DIRECTORY + "Nodes/fav.json";

View file

@ -1576,7 +1576,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
} #endregion
static setFrom = function(_valueFrom, _update = true, checkRecur = true, log = false) { #region
print($"Connecting {_valueFrom.name} to {name}");
//print($"Connecting {_valueFrom.name} to {name}");
if(_valueFrom == noone)
return removeFrom();

View file

@ -17,7 +17,7 @@ function Panel_Text_Editor(_textArea, _inputFunc, _context) : PanelContent() con
self.inputFunc = method(self, _inputFunc);
self.context = _context;
shift_new_line = false;
shift_new_line = true;
function drawContent(panel) {
draw_clear_alpha(COLORS.panel_bg_clear, 0);

View file

@ -65,18 +65,19 @@ function quarternionBox(_onModify) : widget() constructor {
current_value = _data;
var bs = ui(32);
var bx = _x + _w - bs;
var by = _y + _h / 2 - bs / 2;
tooltip.index = _extra_data.angle_display;
var bs = ui(32);
var bx = _x + _w - bs;
var by = _y + _h / 2 - bs / 2;
var _disp = struct_try_get(_extra_data, "angle_display");
tooltip.index = _disp;
if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, active, hover, tooltip, THEME.unit_angle, _extra_data.angle_display, c_white) == 2) {
if(buttonInstant(THEME.button_hide, bx, by, bs, bs, _m, active, hover, tooltip, THEME.unit_angle, _disp, c_white) == 2) {
clickable = false;
_extra_data.angle_display = (_extra_data.angle_display + 1) % 2;
_extra_data.angle_display = (_disp + 1) % 2;
}
_w -= ui(40);
size = _extra_data.angle_display? 3 : 4;
size = _disp? 3 : 4;
var ww = _w / size;
var bx = _x;
disp_w = disp_w == noone? ww : lerp_float(disp_w, ww, 3);

View file

@ -1,12 +1,12 @@
function string_to_array(str) {
function string_to_array(str) { #region
var amo = string_length(str);
var arr = array_create(amo);
for( var i = 0; i < amo; i++ )
arr[i] = string_char_at(str, i + 1);
return arr;
}
} #endregion
function string_partial_match(str, key) {
function string_partial_match(str, key) { #region
var amo = string_length(str);
var run = 1;
var consec = 0;
@ -29,9 +29,9 @@ function string_partial_match(str, key) {
}
return -9999;
}
} #endregion
function string_real(val, digMax = 999) {
function string_real(val, digMax = 999) { #region
if(is_string(val)) return val;
if(is_struct(val)) return string(val);
@ -53,9 +53,14 @@ function string_real(val, digMax = 999) {
}
return string_format(val, -1, pres);
}
} #endregion
function filename_name_only(name) {
function string_char_last(str, shift = 0) { #region
gml_pragma("forceinline");
return string_char_at(str, string_length(str) - shift);
} #region
function filename_name_only(name) { #region
name = filename_name(name);
return string_replace(name, filename_ext(name), "")
}
} #endregion

View file

@ -1,7 +1,7 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "string_function",
"name": "string_functions",
"isCompatibility": false,
"isDnD": false,
"parent": {

View file

@ -292,8 +292,10 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod
var _txt = _txtLines[i] + (i < array_length(_txtLines)? "\n" : "");
var words;
if(_code)
words = token_splice(_txt);
if(format == TEXT_AREA_FORMAT.codeLUA)
words = lua_token_splice(_txt);
else if(format == TEXT_AREA_FORMAT.codeHLSL)
words = hlsl_token_splice(_txt);
else
words = string_splice(_txt, " ");
@ -576,7 +578,7 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod
break;
case TEXT_AREA_FORMAT.codeHLSL :
if(syntax_highlight)
draw_code_glsl(ch_x, ch_y, _str);
draw_code_hlsl(ch_x, ch_y, _str);
else
draw_text_add(ch_x, ch_y, _str);
break;