Audio volume

This commit is contained in:
MakhamDev 2023-10-08 09:14:35 +07:00
parent 51d8abb01f
commit 98d4a33982
27 changed files with 300 additions and 73 deletions

View file

@ -357,6 +357,7 @@
{"name":"sh_mesh_generation","order":4,"path":"shaders/sh_mesh_generation/sh_mesh_generation.yy",},
{"name":"math_function","order":7,"path":"scripts/math_function/math_function.yy",},
{"name":"panel_preview_snap_setting","order":5,"path":"scripts/panel_preview_snap_setting/panel_preview_snap_setting.yy",},
{"name":"sh_d3d_extrude_extends","order":26,"path":"shaders/sh_d3d_extrude_extends/sh_d3d_extrude_extends.yy",},
{"name":"scrollBox","order":13,"path":"scripts/scrollBox/scrollBox.yy",},
{"name":"o_dialog_exit","order":2,"path":"objects/o_dialog_exit/o_dialog_exit.yy",},
{"name":"node_polygonal_shape","order":10,"path":"scripts/node_polygonal_shape/node_polygonal_shape.yy",},
@ -1268,6 +1269,7 @@
{"name":"o_dialog_l_system","order":1,"path":"objects/o_dialog_l_system/o_dialog_l_system.yy",},
{"name":"node_surface_to_color","order":2,"path":"scripts/node_surface_to_color/node_surface_to_color.yy",},
{"name":"sh_shadow_cast_light_sep","order":1,"path":"shaders/sh_shadow_cast_light_sep/sh_shadow_cast_light_sep.yy",},
{"name":"node_audio_loudness","order":1,"path":"scripts/node_audio_loudness/node_audio_loudness.yy",},
{"name":"node_grid","order":1,"path":"scripts/node_grid/node_grid.yy",},
{"name":"node_edge_detect","order":8,"path":"scripts/node_edge_detect/node_edge_detect.yy",},
{"name":"node_morph_surface","order":5,"path":"scripts/node_morph_surface/node_morph_surface.yy",},
@ -1475,6 +1477,7 @@
{"name":"node_invert","order":6,"path":"scripts/node_invert/node_invert.yy",},
{"name":"draw_background_stretched","order":5,"path":"scripts/draw_background_stretched/draw_background_stretched.yy",},
{"name":"s_biterator_canvas","order":15,"path":"sprites/s_biterator_canvas/s_biterator_canvas.yy",},
{"name":"s_node_audio_volume","order":5,"path":"sprites/s_node_audio_volume/s_node_audio_volume.yy",},
{"name":"node_array_csv_parse","order":15,"path":"scripts/node_array_csv_parse/node_array_csv_parse.yy",},
{"name":"node_tunnel_out","order":7,"path":"scripts/node_tunnel_out/node_tunnel_out.yy",},
{"name":"s_node_array_shuffle","order":10,"path":"sprites/s_node_array_shuffle/s_node_array_shuffle.yy",},

View file

@ -910,6 +910,7 @@
{"id":{"name":"math_function","path":"scripts/math_function/math_function.yy",},},
{"id":{"name":"panel_preview_snap_setting","path":"scripts/panel_preview_snap_setting/panel_preview_snap_setting.yy",},},
{"id":{"name":"node_strand_sim","path":"scripts/node_strand_sim/node_strand_sim.yy",},},
{"id":{"name":"sh_d3d_extrude_extends","path":"shaders/sh_d3d_extrude_extends/sh_d3d_extrude_extends.yy",},},
{"id":{"name":"scrollBox","path":"scripts/scrollBox/scrollBox.yy",},},
{"id":{"name":"o_dialog_exit","path":"objects/o_dialog_exit/o_dialog_exit.yy",},},
{"id":{"name":"node_polygonal_shape","path":"scripts/node_polygonal_shape/node_polygonal_shape.yy",},},
@ -1955,6 +1956,7 @@
{"id":{"name":"GmlLua","path":"scripts/GmlLua/GmlLua.yy",},},
{"id":{"name":"node_surface_to_color","path":"scripts/node_surface_to_color/node_surface_to_color.yy",},},
{"id":{"name":"sh_shadow_cast_light_sep","path":"shaders/sh_shadow_cast_light_sep/sh_shadow_cast_light_sep.yy",},},
{"id":{"name":"node_audio_loudness","path":"scripts/node_audio_loudness/node_audio_loudness.yy",},},
{"id":{"name":"node_grid","path":"scripts/node_grid/node_grid.yy",},},
{"id":{"name":"o_crash_handler","path":"objects/o_crash_handler/o_crash_handler.yy",},},
{"id":{"name":"node_edge_detect","path":"scripts/node_edge_detect/node_edge_detect.yy",},},
@ -2196,6 +2198,7 @@
{"id":{"name":"draw_background_stretched","path":"scripts/draw_background_stretched/draw_background_stretched.yy",},},
{"id":{"name":"s_node_path","path":"sprites/s_node_path/s_node_path.yy",},},
{"id":{"name":"s_biterator_canvas","path":"sprites/s_biterator_canvas/s_biterator_canvas.yy",},},
{"id":{"name":"s_node_audio_volume","path":"sprites/s_node_audio_volume/s_node_audio_volume.yy",},},
{"id":{"name":"node_array_csv_parse","path":"scripts/node_array_csv_parse/node_array_csv_parse.yy",},},
{"id":{"name":"node_tunnel_out","path":"scripts/node_tunnel_out/node_tunnel_out.yy",},},
{"id":{"name":"s_node_array_shuffle","path":"sprites/s_node_array_shuffle/s_node_array_shuffle.yy",},},

View file

@ -1,15 +1,16 @@
function __d3dMaterial(surface = noone) constructor {
self.surface = surface;
self.diffuse = 1;
self.specular = 0;
self.metalic = false;
self.shine = 1;
diffuse = 1;
specular = 0;
metalic = false;
shine = 1;
self.normal = noone;
self.normalStr = 1;
normal = noone;
normalStr = 1;
self.reflective = 0;
reflective = 0;
texFilter = false;
static getTexture = function() {
if(!is_surface(surface)) return -1;
@ -29,5 +30,24 @@ function __d3dMaterial(surface = noone) constructor {
shader_set_i("mat_metalic", metalic );
shader_set_f("mat_reflective", reflective);
gpu_set_tex_filter(texFilter);
}
static clone = function() {
var _mat = new __d3dMaterial();
_mat.surface = surface;
_mat.diffuse = diffuse;
_mat.specular = specular;
_mat.metalic = metalic;
_mat.shine = shine;
_mat.normal = normal;
_mat.normalStr = normalStr;
_mat.reflective = reflective;
return _mat;
}
}

View file

@ -35,11 +35,14 @@ function __3dSurfaceExtrude(surface = noone, height = noone, smooth = false) : _
surface_w = ww;
surface_h = hh;
var tw = 1 / ww;
var th = 1 / hh;
var sw = -ww / 2 * tw;
var sh = hh / 2 * th;
var ap = ww / hh;
var tw = ap / ww;
var th = 1 / hh;
var sw = -ap / 2;
var sh = 0.5;
var useH = is_surface(_height);
var fw = 1 / ww;
var fh = 1 / hh;
#region ---- data prepare ----
if(smooth) {
@ -103,13 +106,13 @@ function __3dSurfaceExtrude(surface = noone, height = noone, smooth = false) : _
for( var j = 0; j < hh; j++ ) {
if(!smooth && ap[i][j] == 0) continue;
var j0 = sh - j * th;
var j1 = j0 - th;
var i0 = sw + i * tw;
var j0 = sh - j * th;
var i1 = i0 + tw;
var j1 = j0 - th;
var tx0 = tw * i, tx1 = tx0 + tw;
var ty0 = th * j, ty1 = ty0 + th;
var tx0 = fw * i, tx1 = tx0 + fw;
var ty0 = fh * j, ty1 = ty0 + fh;
var dep = (useH? getHeight(hei, hgtW, hgtH, i, j) : 1) * 0.5;

View file

@ -20,21 +20,30 @@ function Node_3D_Mesh_Extrude(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y, _gr
static processData = function(_output, _data, _output_index, _array_index = 0) { #region
var _mat = _data[in_mesh + 0];
if(_mat == noone) return noone;
var _hght = _data[in_mesh + 1];
var _smt = _data[in_mesh + 2];
var _updt = _data[in_mesh + 3];
var _surf = _mat == noone? noone : _mat.surface;
var _surf = _mat.surface;
var object = getObject(_array_index);
object.checkParameter({ surface: _surf, height: _hght, smooth: _smt }, _updt);
object.materials = [ _mat ];
var _matN = _mat.clone();
var _nSurf = surface_create(surface_get_width(_surf), surface_get_height(_surf));
surface_set_shader(_nSurf, sh_d3d_extrude_extends);
shader_set_f("dimension", surface_get_width(_surf), surface_get_height(_surf));
draw_surface_safe(_surf);
surface_reset_shader();
_matN.surface = _nSurf;
object.materials = [ _matN ];
setTransform(object, _data);
return object;
} #endregion
static getPreviewValues = function() {
return array_safe_get(all_inputs, in_mesh + 0, noone);
}
static getPreviewValues = function() { return array_safe_get(all_inputs, in_mesh + 0, noone); }
}

View file

@ -0,0 +1,34 @@
function Node_Audio_Loudness(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Audio Loudness";
previewable = false;
w = 96;
h = 72;
min_h = h;
inputs[| 0] = nodeValue("Audio Data", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [])
.setArrayDepth(1)
.setVisible(true, true);
outputs[| 0] = nodeValue("Loudness", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0);
static processData = function(_outSurf, _data, _output_index, _array_index) {
var _dat = _data[0];
var N = array_length(_dat);
var val = 0;
if(N == 0) return 0;
for( var i = 0; i < N; i++ )
val += _dat[i] * _dat[i];
val = sqrt(val / N);
var dec = 10 * log10(val);
return dec;
}
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
var bbox = drawGetBbox(xx, yy, _s);
draw_sprite_fit(s_node_audio_volume, 0, bbox.xc, bbox.yc, bbox.w, bbox.h);
}
}

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "node_audio_loudness",
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "audio",
"path": "folders/nodes/data/value/audio.yy",
},
}

View file

@ -0,0 +1,12 @@
{
"isDnD": false,
"isCompatibility": false,
"parent": {
"name": "variable",
"path": "folders/nodes/data/variable.yy",
},
"resourceVersion": "1.0",
"name": "node_counter",
"tags": [],
"resourceType": "GMScript",
}

View file

@ -118,9 +118,9 @@ function Node_Audio_Window(_x, _y, _group = noone) : Node(_x, _y, _group) constr
var dy = bbox.yc - sh * ss / 2;
draw_surface_ext_safe(surf, dx, dy, ss, ss,,, 0.50);
var st = preview_st * sw;
var ed = preview_ed * sw;
var cr = preview_cr * sw;
var st = clamp(preview_st, 0, 1) * sw;
var ed = clamp(preview_ed, 0, 1) * sw;
var cr = clamp(preview_cr, 0, 1) * sw;
draw_surface_part_ext_safe(surf, st, 0, ed - st, sh, dx + st * ss, dy, ss, ss,, COLORS._main_accent);

View file

@ -90,16 +90,17 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
var _type = juncFrom.type;
var _tind = array_find(input.data_type_map, juncFrom.type);
//input.attributes.inherit_name = false;
//input.setDisplayName(juncFrom.name);
input.attributes.inherit_type = false;
if(_tind != -1)
input.inputs[| 2].setValue(_tind);
input.inParent.setFrom(juncFrom);
if(onNewInputFromGraph != noone) onNewInputFromGraph(juncFrom);
}
onNewInputFromGraph = noone;
tool_node = noone;
draw_input_overlay = true;

View file

@ -39,13 +39,13 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
PROJECT.nodeMap[? node_id] = self;
PROJECT.modified = true;
//print($"Adding node {node_id} to {PROJECT.path} [{ds_map_size(PROJECT.nodeMap)}]");
run_in(1, function() {
if(display_name != "") return;
resetInternalName();
display_name = __txt_node_name(instanceof(self), name);
});
RENDER_ALL_REORDER
} #endregion
#region ---- display ----
@ -521,7 +521,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
LOG_IF(global.FLAG.render == 1, $"Trigger render for {INAME}");
setRenderStatus(false);
UPDATE |= RENDER_TYPE.partial;
RENDER_PARTIAL
if(is_instanceof(group, Node_Collection) && group.reset_all_child) {
group.resetRender();

View file

@ -55,14 +55,9 @@ function Node_Fluid_Group(_x, _y, _group = noone) : Node_Collection(_x, _y, _gro
custom_input_index = ds_list_size(inputs);
domain = fd_rectangle_create(PROJECT.attributes.surface_dimension[0], PROJECT.attributes.surface_dimension[1]);
//_dim_old = [0, 0];
if(!LOADING && !APPENDING && !CLONING) {
//var _domain = nodeBuild("Node_Fluid_Domain", -384, -32, self);
var _render = nodeBuild("Node_Fluid_Render_Output", 128, -32, self);
//_output.inputs[| 0].setFrom(_render.outputs[| 0]);
//_render.inputs[| 0].setFrom(_domain.outputs[| 0]);
}
static update = function() {

View file

@ -64,12 +64,14 @@ function Node_Plot_Linear(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
inputs[| 25] = nodeValue("Value range", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 1 ] )
.setDisplay(VALUE_DISPLAY.range);
inputs[| 26] = nodeValue("Absolute", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
input_display_list = [ 0,
["Data", true], 1, 12, 21, 14, 2, 3, 15, 16,
["Plot", false], 11, 4, 10, 20, 5, 22, 23,
["Render", false], 6, 13, 24, 25, 7, 17, 18, 19, 8, 9,
["Render", false], 6, 13, 24, 25, 26, 7, 17, 18, 19, 8, 9,
];
attribute_surface_depth();
@ -135,6 +137,7 @@ function Node_Plot_Linear(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
var _cls = _data[13];
var _clv = _data[24];
var _clv_r = _data[25];
var _clv_a = _data[26];
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1], attrDepth());
@ -196,7 +199,10 @@ function Node_Plot_Linear(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
_ang_nor = _ang + 90;
_val = _smp_data[i] + _off;
_col_sam = _cls.eval(i / amo);
_col_val = _clv.eval((_val - _clv_r[0]) - (_clv_r[1] - _clv_r[0]));
var _val_p = _clv_a? abs(_val) : _val;
var _val_prog = (_val_p - _clv_r[0]) / (_clv_r[1] - _clv_r[0]);
_col_val = _clv.eval(_val_prog);
var _c1 = colorMultiply(_lcl, _col_sam);
var _c2 = _col_val;

View file

@ -649,6 +649,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio
addNodeObject(animation, "FFT", s_node_FFT, "Node_FFT", [1, Node_FFT], ["frequency analysis"], "Perform fourier transform on number array.").setVersion(1144);
addNodeObject(animation, "Bar / Graph", s_node_bar_graph, "Node_Plot_Linear", [1, Node_Plot_Linear], ["graph", "waveform", "bar chart", "plot"], "Plot graph or bar chart from array of number.").setVersion(1144);
addNodeObject(animation, "Audio Window", s_node_audio_trim, "Node_Audio_Window", [1, Node_Audio_Window],, "Take a slice of an audio array based on the current frame.").setVersion(1144);
addNodeObject(animation, "Audio Volume", s_node_audio_volume, "Node_Audio_Loudness", [1, Node_Audio_Loudness]).setVersion(11540);
#endregion
var node = ds_list_create(); #region

View file

@ -67,8 +67,8 @@ function Node_Rigid_Force_Apply(_x, _y, _group = noone) : Node(_x, _y, _group) c
if(_typ == 0 || _typ == 1) {
var _for = getInputData(5);
var fx = px + _for[0] * 10 * _s;
var fy = py + _for[1] * 10 * _s;
var fx = px + _for[0] * 4 * _s;
var fy = py + _for[1] * 4 * _s;
draw_set_color(COLORS._main_accent);
draw_set_alpha(0.5);
@ -76,7 +76,7 @@ function Node_Rigid_Force_Apply(_x, _y, _group = noone) : Node(_x, _y, _group) c
draw_set_alpha(1);
inputs[| 2].drawOverlay(active, _x, _y, _s, _mx, _my, _snx, _sny);
inputs[| 5].drawOverlay(active, px, py, _s * 10, _mx, _my, _snx, _sny, THEME.anchor, 10);
inputs[| 5].drawOverlay(active, px, py, _s * 4, _mx, _my, _snx, _sny, THEME.anchor, 10);
} else if(_typ == 3) {
var _rad = getInputData(8);

View file

@ -627,7 +627,8 @@ function Node_Rigid_Object(_x, _y, _group = noone) : Node(_x, _y, _group) constr
static step = function() { #region
var _shp = getInputData(5);
inputs[| 9].setVisible(_shp == 2);
inputs[| 9].setVisible(_shp == 2);
inputs[| 10].setVisible(_shp == 2);
var _tex = getInputData(6);

View file

@ -6,7 +6,7 @@ function Node_Seperate_Shape(_x, _y, _group = noone) : Node(_x, _y, _group) cons
.rejectArray();
inputs[| 1] = nodeValue("Tolerance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2)
.setDisplay(VALUE_DISPLAY.slider)
.setDisplay(VALUE_DISPLAY.slider, { range: [ 0, 1, 0.01 ], update_stat: SLIDER_UPDATE.release })
.rejectArray();
inputs[| 2] = nodeValue("Override color", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false)

View file

@ -850,6 +850,9 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
} );
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1);
if(struct_has(display_data, "update_stat"))
editWidget.update_stat = display_data.update_stat;
extract_node = "Node_Number";
break; #endregion
case VALUE_DISPLAY.slider_range : #region
@ -1640,7 +1643,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
node.clearCacheForward();
if(fullUpdate) RENDER_ALL
else RENDER_PARTIAL
if(!LOADING) PROJECT.modified = true;

View file

@ -60,16 +60,13 @@ function Node_WAV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const
outputs[| 4] = nodeValue("Duration (s)", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0)
.setVisible(false);
outputs[| 5] = nodeValue("Loudness", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0)
.setVisible(false);
content = noone;
path_current = "";
first_update = false;
input_display_list = [ 0, 1, 2 ];
output_display_list = [ 0, 1, 2, 3, 4, 5 ];
output_display_list = [ 0, 1, 2, 3, 4 ];
preview_audio = -1;
preview_id = noone;
@ -206,23 +203,6 @@ function Node_WAV_File_Read(_x, _y, _group = noone) : Node(_x, _y, _group) const
if(!is_instanceof(content, audioObject)) return;
content.mono = mono;
var len = content.packet;
var amp_ind = round(frame * content.sample / PROJECT.animator.framerate);
var amp_win = content.sample / PROJECT.animator.framerate * 3;
var amp_st = clamp(amp_ind - amp_win, 0, len);
var amp_ed = clamp(amp_ind + amp_win, 0, len);
var val = 0;
if(amp_ed > amp_st) {
for( var i = amp_st; i < amp_ed; i++ )
val += content.sound[0][i] * content.sound[0][i];
val /= amp_ed - amp_st;
val = sqrt(val);
}
var dec = 10 * log10(val);
outputs[| 5].setValue(dec);
} #endregion
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region

View file

@ -80,6 +80,7 @@ function ResetAllNodesRender() { #region
} #endregion
function NodeTopoSort() { #region
LOG_IF(global.FLAG.render == 1, $"+++++++ Topo Sort +++++++");
var _key = ds_map_find_first(PROJECT.nodeMap);
var amo = ds_map_size(PROJECT.nodeMap);
@ -91,6 +92,8 @@ function NodeTopoSort() { #region
ds_list_clear(PROJECT.nodeTopo);
__sortGraph(PROJECT.nodeTopo, PROJECT.nodes);
LOG_IF(global.FLAG.render == 1, $"+++++++ Topo Sort Completed {ds_list_size(PROJECT.nodeTopo)} nodes sorted +++++++");
} #endregion
function __sortGraph(_list, _nodeList) { #region
@ -172,6 +175,7 @@ function Render(partial = false, runAction = false) { #region
}
// get leaf node
LOG_IF(global.FLAG.render == 1, $"----- Finding leaf from {ds_list_size(PROJECT.nodeTopo)} nodes -----");
RENDER_QUEUE.clear();
for( var i = 0, n = ds_list_size(PROJECT.nodeTopo); i < n; i++ ) {
var _node = PROJECT.nodeTopo[| i];

View file

@ -1,8 +1,16 @@
enum SLIDER_UPDATE {
realtime,
release,
none,
}
function slider(_min, _max, _step, _onModify = noone, _onRelease = noone) : widget() constructor {
minn = _min; curr_minn = _min;
maxx = _max; curr_maxx = _max;
stepSize = _step;
current_value = 0;
onModify = _onModify;
onRelease = _onRelease;
onApply = function(val) {
@ -10,6 +18,8 @@ function slider(_min, _max, _step, _onModify = noone, _onRelease = noone) : widg
if(onRelease) onRelease();
}
update_stat = SLIDER_UPDATE.realtime;
dragging = false;
drag_mx = 0;
drag_sx = 0;
@ -45,6 +55,8 @@ function slider(_min, _max, _step, _onModify = noone, _onRelease = noone) : widg
h = _h;
if(!is_real(_data)) return;
if(!dragging) current_value = _data;
switch(halign) {
case fa_left: _x = _x; break;
case fa_center: _x = _x - _w / 2; break;
@ -59,8 +71,8 @@ function slider(_min, _max, _step, _onModify = noone, _onRelease = noone) : widg
var _rang = abs(maxx - minn);
if(!dragging) {
curr_minn = (_data >= minn)? minn : minn - ceil(abs(_data - minn) / _rang) * _rang;
curr_maxx = (_data <= maxx)? maxx : maxx + ceil(abs(_data - maxx) / _rang) * _rang;
curr_minn = (current_value >= minn)? minn : minn - ceil(abs(current_value - minn) / _rang) * _rang;
curr_maxx = (current_value <= maxx)? maxx : maxx + ceil(abs(current_value - maxx) / _rang) * _rang;
}
var sw = _w;
@ -69,7 +81,7 @@ function slider(_min, _max, _step, _onModify = noone, _onRelease = noone) : widg
sw = _w - (tb_w + ui(16));
tb_value.setFocusHover(active, hover);
tb_value.draw(_x + sw + ui(16), _y, tb_w, _h, _data, _m);
tb_value.draw(_x + sw + ui(16), _y, tb_w, _h, current_value, _m);
}
if(THEME_VALUE.slider_type == "full_height")
@ -77,7 +89,7 @@ function slider(_min, _max, _step, _onModify = noone, _onRelease = noone) : widg
else if(THEME_VALUE.slider_type == "stem")
draw_sprite_stretched_ext(spr, 0, _x, _y + _h / 2 - ui(4), sw, ui(8), blend, 1);
var _pg = clamp((_data - curr_minn) / (curr_maxx - curr_minn), 0, 1) * sw;
var _pg = clamp((current_value - curr_minn) / (curr_maxx - curr_minn), 0, 1) * sw;
var _kx = _x + _pg;
if(THEME_VALUE.slider_type == "full_height")
draw_sprite_stretched_ext(spr, 1, _x, _y, _pg, _h, blend, 1);
@ -95,15 +107,16 @@ function slider(_min, _max, _step, _onModify = noone, _onRelease = noone) : widg
if(key_mod_press(CTRL))
val = round(val);
if(onModify != noone) {
if(onModify(val))
UNDO_HOLDING = true;
}
current_value = val;
if(update_stat == SLIDER_UPDATE.realtime && onModify != noone && onModify(val))
UNDO_HOLDING = true;
if(mouse_release(mb_left)) {
if(update_stat == SLIDER_UPDATE.release && onModify != noone)
onModify(val);
dragging = false;
if(onRelease != noone)
onRelease(val);
if(onRelease != noone) onRelease(val);
UNDO_HOLDING = false;
}
} else {

View file

@ -0,0 +1,26 @@
//
// Simple passthrough fragment shader
//
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform vec2 dimension;
void main() {
vec2 tx = 1. / dimension;
vec4 clr = texture2D( gm_BaseTexture, v_vTexcoord );
if(clr.a > 0.) { gl_FragColor = clr; return; }
clr = texture2D( gm_BaseTexture, v_vTexcoord + vec2( tx.x, 0.) );
if(clr.a > 0.) { gl_FragColor = clr; return; }
clr = texture2D( gm_BaseTexture, v_vTexcoord + vec2( 0., tx.y) );
if(clr.a > 0.) { gl_FragColor = clr; return; }
clr = texture2D( gm_BaseTexture, v_vTexcoord + vec2(-tx.x, 0.) );
if(clr.a > 0.) { gl_FragColor = clr; return; }
clr = texture2D( gm_BaseTexture, v_vTexcoord + vec2(0., -tx.y) );
if(clr.a > 0.) { gl_FragColor = clr; return; }
}

View file

@ -0,0 +1,19 @@
//
// Simple passthrough vertex shader
//
attribute vec3 in_Position; // (x,y,z)
//attribute vec3 in_Normal; // (x,y,z) unused in this shader.
attribute vec4 in_Colour; // (r,g,b,a)
attribute vec2 in_TextureCoord; // (u,v)
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
void main()
{
vec4 object_space_pos = vec4( in_Position.x, in_Position.y, in_Position.z, 1.0);
gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;
v_vColour = in_Colour;
v_vTexcoord = in_TextureCoord;
}

View file

@ -0,0 +1,10 @@
{
"resourceType": "GMShader",
"resourceVersion": "1.0",
"name": "sh_d3d_extrude_extends",
"parent": {
"name": "3d",
"path": "folders/shader/3d.yy",
},
"type": 1,
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -0,0 +1,74 @@
{
"resourceType": "GMSprite",
"resourceVersion": "1.0",
"name": "s_node_audio_volume",
"bbox_bottom": 56,
"bbox_left": 1,
"bbox_right": 63,
"bbox_top": 7,
"bboxMode": 0,
"collisionKind": 1,
"collisionTolerance": 0,
"DynamicTexturePage": false,
"edgeFiltering": false,
"For3D": false,
"frames": [
{"resourceType":"GMSpriteFrame","resourceVersion":"1.1","name":"d9b89828-646c-47b7-bc1e-fb49c882d709",},
],
"gridX": 0,
"gridY": 0,
"height": 64,
"HTile": false,
"layers": [
{"resourceType":"GMImageLayer","resourceVersion":"1.0","name":"24d3d34e-6f48-4213-8872-7bad8a648450","blendMode":0,"displayName":"default","isLocked":false,"opacity":100.0,"visible":true,},
],
"nineSlice": null,
"origin": 4,
"parent": {
"name": "animation",
"path": "folders/nodes/icons/animation.yy",
},
"preMultiplyAlpha": false,
"sequence": {
"resourceType": "GMSequence",
"resourceVersion": "1.4",
"name": "s_node_audio_volume",
"autoRecord": true,
"backdropHeight": 768,
"backdropImageOpacity": 0.5,
"backdropImagePath": "",
"backdropWidth": 1366,
"backdropXOffset": 0.0,
"backdropYOffset": 0.0,
"events": {"resourceType":"KeyframeStore<MessageEventKeyframe>","resourceVersion":"1.0","Keyframes":[],},
"eventStubScript": null,
"eventToFunction": {},
"length": 1.0,
"lockOrigin": false,
"moments": {"resourceType":"KeyframeStore<MomentsEventKeyframe>","resourceVersion":"1.0","Keyframes":[],},
"playback": 1,
"playbackSpeed": 30.0,
"playbackSpeedType": 0,
"showBackdrop": true,
"showBackdropImage": false,
"timeUnits": 1,
"tracks": [
{"resourceType":"GMSpriteFramesTrack","resourceVersion":"1.0","name":"frames","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"1.0","Keyframes":[
{"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"1.0","Channels":{"0":{"resourceType":"SpriteFrameKeyframe","resourceVersion":"1.0","Id":{"name":"d9b89828-646c-47b7-bc1e-fb49c882d709","path":"sprites/s_node_audio_volume/s_node_audio_volume.yy",},},},"Disabled":false,"id":"2bf4b22d-6fbc-4ad7-a9c2-fea18f9baa61","IsCreationKey":false,"Key":0.0,"Length":1.0,"Stretch":false,},
],},"modifiers":[],"spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
],
"visibleRange": null,
"volume": 1.0,
"xorigin": 32,
"yorigin": 32,
},
"swatchColours": null,
"swfPrecision": 2.525,
"textureGroupId": {
"name": "Default",
"path": "texturegroups/Default",
},
"type": 0,
"VTile": false,
"width": 64,
}