mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-25 06:26:42 +01:00
- New Gabor noise node
This commit is contained in:
parent
c009bfa555
commit
4754830665
25 changed files with 324 additions and 44 deletions
|
@ -127,7 +127,7 @@
|
|||
{"name":"for sort","order":5,"path":"folders/nodes/data/iterate/for sort.yy",},
|
||||
{"name":"lua","order":12,"path":"folders/nodes/data/lua.yy",},
|
||||
{"name":"misc","order":10,"path":"folders/nodes/data/misc.yy",},
|
||||
{"name":"PC effects","order":24,"path":"folders/nodes/data/PC effects.yy",},
|
||||
{"name":"MK effects","order":24,"path":"folders/nodes/data/MK effects.yy",},
|
||||
{"name":"PCX","order":15,"path":"folders/nodes/data/PCX.yy",},
|
||||
{"name":"array","order":6,"path":"folders/nodes/data/PCX/array.yy",},
|
||||
{"name":"flow control","order":7,"path":"folders/nodes/data/PCX/flow control.yy",},
|
||||
|
@ -490,6 +490,7 @@
|
|||
{"name":"globals","order":2,"path":"scripts/globals/globals.yy",},
|
||||
{"name":"s_node_noise_perlin","order":11,"path":"sprites/s_node_noise_perlin/s_node_noise_perlin.yy",},
|
||||
{"name":"sh_d3d_default","order":11,"path":"shaders/sh_d3d_default/sh_d3d_default.yy",},
|
||||
{"name":"s_node_gabor","order":32,"path":"sprites/s_node_gabor/s_node_gabor.yy",},
|
||||
{"name":"s_node_dithering","order":21,"path":"sprites/s_node_dithering/s_node_dithering.yy",},
|
||||
{"name":"node_3d_mesh_extrude","order":8,"path":"scripts/node_3d_mesh_extrude/node_3d_mesh_extrude.yy",},
|
||||
{"name":"s_workshop_badge","order":1,"path":"sprites/s_workshop_badge/s_workshop_badge.yy",},
|
||||
|
@ -1094,6 +1095,7 @@
|
|||
{"name":"o_dialog_color_quick_pick","order":5,"path":"objects/o_dialog_color_quick_pick/o_dialog_color_quick_pick.yy",},
|
||||
{"name":"fd_rectangle_update_velocity","order":22,"path":"scripts/fd_rectangle_update_velocity/fd_rectangle_update_velocity.yy",},
|
||||
{"name":"sh_3d_extrude_filler_depth","order":9,"path":"shaders/sh_3d_extrude_filler_depth/sh_3d_extrude_filler_depth.yy",},
|
||||
{"name":"sh_noise_gabor","order":10,"path":"shaders/sh_noise_gabor/sh_noise_gabor.yy",},
|
||||
{"name":"sh_draw_mapping","order":4,"path":"shaders/sh_draw_mapping/sh_draw_mapping.yy",},
|
||||
{"name":"__bbox","order":5,"path":"scripts/__bbox/__bbox.yy",},
|
||||
{"name":"node_shadow","order":14,"path":"scripts/node_shadow/node_shadow.yy",},
|
||||
|
@ -1266,6 +1268,7 @@
|
|||
{"name":"s_biterator_dim_label","order":10,"path":"sprites/s_biterator_dim_label/s_biterator_dim_label.yy",},
|
||||
{"name":"s_node_average","order":50,"path":"sprites/s_node_average/s_node_average.yy",},
|
||||
{"name":"s_node_sprite_sheet","order":1,"path":"sprites/s_node_sprite_sheet/s_node_sprite_sheet.yy",},
|
||||
{"name":"node_noise_gabor","order":11,"path":"scripts/node_noise_gabor/node_noise_gabor.yy",},
|
||||
{"name":"node_pb_box_mirror","order":10,"path":"scripts/node_pb_box_mirror/node_pb_box_mirror.yy",},
|
||||
{"name":"s_node_text_length","order":9,"path":"sprites/s_node_text_length/s_node_text_length.yy",},
|
||||
{"name":"s_node_grid_hex","order":4,"path":"sprites/s_node_grid_hex/s_node_grid_hex.yy",},
|
||||
|
|
|
@ -155,7 +155,7 @@
|
|||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"for","folderPath":"folders/nodes/data/iterate/for.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"lua","folderPath":"folders/nodes/data/lua.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"misc","folderPath":"folders/nodes/data/misc.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"PC effects","folderPath":"folders/nodes/data/PC effects.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"MK effects","folderPath":"folders/nodes/data/MK effects.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"PCX","folderPath":"folders/nodes/data/PCX.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"array","folderPath":"folders/nodes/data/PCX/array.yy",},
|
||||
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"flow control","folderPath":"folders/nodes/data/PCX/flow control.yy",},
|
||||
|
@ -1084,6 +1084,7 @@
|
|||
{"id":{"name":"globals","path":"scripts/globals/globals.yy",},},
|
||||
{"id":{"name":"s_node_noise_perlin","path":"sprites/s_node_noise_perlin/s_node_noise_perlin.yy",},},
|
||||
{"id":{"name":"sh_d3d_default","path":"shaders/sh_d3d_default/sh_d3d_default.yy",},},
|
||||
{"id":{"name":"s_node_gabor","path":"sprites/s_node_gabor/s_node_gabor.yy",},},
|
||||
{"id":{"name":"s_node_dithering","path":"sprites/s_node_dithering/s_node_dithering.yy",},},
|
||||
{"id":{"name":"node_3d_mesh_extrude","path":"scripts/node_3d_mesh_extrude/node_3d_mesh_extrude.yy",},},
|
||||
{"id":{"name":"s_node_boolean","path":"sprites/s_node_boolean/s_node_boolean.yy",},},
|
||||
|
@ -1774,6 +1775,7 @@
|
|||
{"id":{"name":"o_dialog_color_quick_pick","path":"objects/o_dialog_color_quick_pick/o_dialog_color_quick_pick.yy",},},
|
||||
{"id":{"name":"fd_rectangle_update_velocity","path":"scripts/fd_rectangle_update_velocity/fd_rectangle_update_velocity.yy",},},
|
||||
{"id":{"name":"sh_3d_extrude_filler_depth","path":"shaders/sh_3d_extrude_filler_depth/sh_3d_extrude_filler_depth.yy",},},
|
||||
{"id":{"name":"sh_noise_gabor","path":"shaders/sh_noise_gabor/sh_noise_gabor.yy",},},
|
||||
{"id":{"name":"sh_draw_mapping","path":"shaders/sh_draw_mapping/sh_draw_mapping.yy",},},
|
||||
{"id":{"name":"__bbox","path":"scripts/__bbox/__bbox.yy",},},
|
||||
{"id":{"name":"node_shadow","path":"scripts/node_shadow/node_shadow.yy",},},
|
||||
|
@ -1883,7 +1885,7 @@
|
|||
{"id":{"name":"_f_p0b","path":"fonts/_f_p0b/_f_p0b.yy",},},
|
||||
{"id":{"name":"s_node_armature_pose","path":"sprites/s_node_armature_pose/s_node_armature_pose.yy",},},
|
||||
{"id":{"name":"sh_fd_visualize_pressure_glsl","path":"shaders/sh_fd_visualize_pressure_glsl/sh_fd_visualize_pressure_glsl.yy",},},
|
||||
{"id":{"name":"node_pc_balls","path":"scripts/node_pc_balls/node_pc_balls.yy",},},
|
||||
{"id":{"name":"node_mk_balls","path":"scripts/node_mk_balls/node_mk_balls.yy",},},
|
||||
{"id":{"name":"s_node_rigidSim_force","path":"sprites/s_node_rigidSim_force/s_node_rigidSim_force.yy",},},
|
||||
{"id":{"name":"fd_rectangle_set_acceleration","path":"scripts/fd_rectangle_set_acceleration/fd_rectangle_set_acceleration.yy",},},
|
||||
{"id":{"name":"s_node_vec2","path":"sprites/s_node_vec2/s_node_vec2.yy",},},
|
||||
|
@ -1971,6 +1973,7 @@
|
|||
{"id":{"name":"s_biterator_dim_label","path":"sprites/s_biterator_dim_label/s_biterator_dim_label.yy",},},
|
||||
{"id":{"name":"s_node_average","path":"sprites/s_node_average/s_node_average.yy",},},
|
||||
{"id":{"name":"s_node_sprite_sheet","path":"sprites/s_node_sprite_sheet/s_node_sprite_sheet.yy",},},
|
||||
{"id":{"name":"node_noise_gabor","path":"scripts/node_noise_gabor/node_noise_gabor.yy",},},
|
||||
{"id":{"name":"node_pb_box_mirror","path":"scripts/node_pb_box_mirror/node_pb_box_mirror.yy",},},
|
||||
{"id":{"name":"s_node_text_length","path":"sprites/s_node_text_length/s_node_text_length.yy",},},
|
||||
{"id":{"name":"s_node_grid_hex","path":"sprites/s_node_grid_hex/s_node_grid_hex.yy",},},
|
||||
|
|
|
@ -3,6 +3,7 @@ event_inherited();
|
|||
|
||||
#region data
|
||||
project = PROJECT;
|
||||
|
||||
dialog_w = ui(440);
|
||||
dialog_h = ui(140);
|
||||
#endregion
|
|
@ -18,8 +18,7 @@ if !ready exit;
|
|||
|
||||
#region base UI
|
||||
DIALOG_DRAW_BG
|
||||
if(sFOCUS)
|
||||
DIALOG_DRAW_FOCUS
|
||||
if(sFOCUS) DIALOG_DRAW_FOCUS
|
||||
#endregion
|
||||
|
||||
#region text
|
||||
|
@ -31,7 +30,8 @@ if !ready exit;
|
|||
|
||||
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
|
||||
var txt = __txta("Save project '{1}' before exit?", filename_name(project.path));
|
||||
draw_text(dialog_x + ui(24), py, txt);
|
||||
draw_text_ext(dialog_x + ui(24), py, txt, -1, dialog_w - ui(48));
|
||||
_dialog_h = ui(118) + string_height_ext(txt, -1, dialog_w - ui(48));
|
||||
|
||||
var bw = ui(96), bh = BUTTON_HEIGHT;
|
||||
var bx1 = dialog_x + dialog_w - ui(16);
|
||||
|
@ -62,4 +62,6 @@ if !ready exit;
|
|||
close_program();
|
||||
instance_destroy();
|
||||
}
|
||||
|
||||
dialog_h = _dialog_h;
|
||||
#endregion
|
|
@ -106,8 +106,11 @@ event_inherited();
|
|||
_gradient.gradient.draw(ui(16), yy + ui(28), ww, ui(16));
|
||||
|
||||
if(_hover && isHover) {
|
||||
if(mouse_press(mb_left, interactable && sFOCUS))
|
||||
gradient.keys = _gradient.gradient.keys;
|
||||
if(mouse_press(mb_left, interactable && sFOCUS)) {
|
||||
gradient.keys = [];
|
||||
for( var i = 0, n = array_length(_gradient.gradient.keys); i < n; i++ )
|
||||
gradient.keys[i] = _gradient.gradient.keys[i].clone();
|
||||
}
|
||||
|
||||
if(mouse_press(mb_right, interactable && sFOCUS)) {
|
||||
hovering_name = _gradient.path;
|
||||
|
|
|
@ -85,7 +85,7 @@ if !ready exit;
|
|||
var tab_cover = noone;
|
||||
var th = ui(36) + THEME_VALUE.panel_tab_extend;
|
||||
|
||||
for( var i = 0, n = array_length(pages); i < n; i++ ) {
|
||||
for( var i = 0, n = array_length(pages); i < n; i++ ) { #region
|
||||
draw_set_text(f_p0, fa_left, fa_bottom, project_page == i? COLORS._main_text : COLORS._main_text_sub);
|
||||
var txt = pages[i];
|
||||
var dtxt = __txt(txt);
|
||||
|
@ -100,14 +100,15 @@ if !ready exit;
|
|||
var tw = ui(16) + string_width(dtxt);
|
||||
if(amo) tw += ui(8) + string_width(amo) + ui(8);
|
||||
|
||||
if(txt == "Contests")
|
||||
tw += ui(32);
|
||||
if(txt == "Contests") tw += ui(32);
|
||||
var _x1 = min(bx + tw, x1);
|
||||
var _tabW = _x1 - bx;
|
||||
|
||||
if(project_page == i) {
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_tab, 1, bx, y0 - ui(32), tw, th, COLORS.panel_tab, 1);
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_tab, 1, bx, y0 - ui(32), _tabW, th, COLORS.panel_tab, 1);
|
||||
tab_cover = BBOX().fromWH(bx, y0, tw, THEME_VALUE.panel_tab_extend);
|
||||
} else if(point_in_rectangle(mouse_mx, mouse_my, bx, y0 - ui(32), bx + tw, y0)) {
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_tab, 0, bx, y0 - ui(32), tw, th, COLORS.panel_tab_hover, 1);
|
||||
} else if(point_in_rectangle(mouse_mx, mouse_my, bx, y0 - ui(32), bx + _tabW, y0)) {
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_tab, 0, bx, y0 - ui(32), _tabW, th, COLORS.panel_tab_hover, 1);
|
||||
|
||||
if(mouse_click(mb_left, sFOCUS)) {
|
||||
project_page = i;
|
||||
|
@ -118,7 +119,7 @@ if !ready exit;
|
|||
}
|
||||
}
|
||||
} else
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_tab, 0, bx, y0 - ui(32), tw, th, COLORS.panel_tab_inactive, 1);
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_tab, 0, bx, y0 - ui(32), _tabW, th, COLORS.panel_tab_inactive, 1);
|
||||
|
||||
var _btx = bx + ui(8);
|
||||
if(txt == "Contests") {
|
||||
|
@ -130,11 +131,11 @@ if !ready exit;
|
|||
if(project_page == i) cc = txt == "Contests"? CDEF.yellow : COLORS._main_text;
|
||||
|
||||
draw_set_color(cc);
|
||||
draw_text(_btx, y0 - ui(4), dtxt);
|
||||
draw_text_cut(_btx, y0 - ui(4), dtxt, _tabW - ui(16));
|
||||
|
||||
_btx += ui(8) + string_width(dtxt);
|
||||
|
||||
if(amo) {
|
||||
if(amo && _x1 + ui(32) < x1) {
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, _btx, y0 - ui(26), string_width(amo) + ui(8), ui(24), COLORS._main_icon, 1);
|
||||
|
||||
_btx += ui(4);
|
||||
|
@ -144,8 +145,8 @@ if !ready exit;
|
|||
draw_text(_btx, y0 - ui(4), amo);
|
||||
}
|
||||
|
||||
bx += tw;
|
||||
}
|
||||
bx += _tabW;
|
||||
} #endregion
|
||||
|
||||
draw_sprite_stretched(THEME.ui_panel_bg, 0, x0, y0, x1 - x0, y1 - y0);
|
||||
draw_sprite_stretched(THEME.ui_panel_fg, 0, x0, y0, x1 - x0, y1 - y0);
|
||||
|
|
|
@ -316,6 +316,10 @@
|
|||
NODE_COLOR_SHOW_PALETTE = false;
|
||||
#endregion
|
||||
|
||||
#region draw
|
||||
|
||||
#endregion
|
||||
|
||||
#region 3D
|
||||
set3DGlobalPreview();
|
||||
#endregion
|
||||
|
|
|
@ -27,7 +27,11 @@ function _loadColor(theme = "default", replace = false) {
|
|||
|
||||
var clrs = json_load_struct(path);
|
||||
var oclr = file_exists(pathO)? json_load_struct(pathO) : {};
|
||||
print(clrs);
|
||||
|
||||
if(!struct_has(clrs, "values")) {
|
||||
print("Load color error");
|
||||
return;
|
||||
}
|
||||
|
||||
var valkeys = variable_struct_get_names(clrs.values);
|
||||
if(replace) THEME_VALUE = clrs.values;
|
||||
|
|
|
@ -19,6 +19,8 @@ function Node_Crop(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
|
||||
attribute_surface_depth();
|
||||
|
||||
tools = [ new NodeTool("Draw crop area", THEME.crop_tool, "Node_Crop") ]
|
||||
|
||||
drag_side = noone;
|
||||
drag_mx = 0;
|
||||
drag_my = 0;
|
||||
|
@ -27,15 +29,14 @@ function Node_Crop(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
static getPreviewValues = function() { return getInputData(0); }
|
||||
|
||||
static drawOverlay = function(active, _x, _y, _s, _mx, _my, _snx, _sny, params) { #region
|
||||
if(array_length(current_data) < 2) return;
|
||||
var _inSurf = getSingleValue(0);
|
||||
var _spRaw = getSingleValue(1);
|
||||
var _splice;
|
||||
|
||||
var _inSurf = current_data[0];
|
||||
var _splice = current_data[1];
|
||||
_splice = array_clone(_splice);
|
||||
for( var i = 0, n = array_length(_splice); i < n; i++ )
|
||||
_splice[i] = round(_splice[i]);
|
||||
for( var i = 0, n = array_length(_spRaw); i < n; i++ )
|
||||
_splice[i] = round(_spRaw[i]);
|
||||
|
||||
var dim = [ surface_get_width_safe(_inSurf), surface_get_height_safe(_inSurf) ]
|
||||
var dim = [ surface_get_width_safe(_inSurf), surface_get_height_safe(_inSurf) ];
|
||||
|
||||
var sp_r = _x + (dim[0] - _splice[0]) * _s;
|
||||
var sp_l = _x + _splice[2] * _s;
|
||||
|
@ -46,6 +47,58 @@ function Node_Crop(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
var _out = outputs[| 0].getValue();
|
||||
draw_surface_ext_safe(_out, sp_l, sp_t, _s, _s);
|
||||
|
||||
if(isUsingTool(0)) {
|
||||
if(drag_side) {
|
||||
var _mx0 = min(_mx, drag_mx);
|
||||
var _mx1 = max(_mx, drag_mx);
|
||||
var _my0 = min(_my, drag_my);
|
||||
var _my1 = max(_my, drag_my);
|
||||
|
||||
_mx0 = value_snap(round((_mx0 - _x) / _s), _snx);
|
||||
_mx1 = value_snap(round((_mx1 - _x) / _s), _snx);
|
||||
_my0 = value_snap(round((_my0 - _y) / _s), _sny);
|
||||
_my1 = value_snap(round((_my1 - _y) / _s), _sny);
|
||||
|
||||
if(inputs[| 1].setValue([dim[0] - _mx1, _my0, _mx0, dim[1] - _my1]))
|
||||
UNDO_HOLDING = true;
|
||||
|
||||
draw_set_color(COLORS._main_accent);
|
||||
draw_set_alpha(0.50);
|
||||
draw_line(_x + _mx0 * _s, 0, _x + _mx0 * _s, params.h);
|
||||
draw_line(0, _y + _my0 * _s, params.w, _y + _my0 * _s);
|
||||
draw_line(_x + _mx1 * _s, 0, _x + _mx1 * _s, params.h);
|
||||
draw_line(0, _y + _my1 * _s, params.w, _y + _my1 * _s);
|
||||
draw_set_alpha(1);
|
||||
|
||||
if(mouse_release(mb_left, active)) {
|
||||
drag_side = noone;
|
||||
UNDO_HOLDING = false;
|
||||
}
|
||||
} else {
|
||||
var _mxs = _x + value_snap(round((_mx - _x) / _s), _snx) * _s;
|
||||
var _mys = _y + value_snap(round((_my - _y) / _s), _sny) * _s;
|
||||
|
||||
draw_set_color(COLORS._main_accent);
|
||||
draw_set_alpha(0.50);
|
||||
draw_line(_mxs, 0, _mxs, params.h);
|
||||
draw_line(0, _mys, params.w, _mys);
|
||||
draw_set_alpha(1);
|
||||
|
||||
if(mouse_press(mb_left, active)) {
|
||||
drag_side = 1;
|
||||
drag_mx = _mx;
|
||||
drag_my = _my;
|
||||
}
|
||||
}
|
||||
|
||||
draw_set_color(COLORS._main_accent);
|
||||
draw_line_width(sp_r, sp_t - 1, sp_r, sp_b + 1, 2);
|
||||
draw_line_width(sp_l, sp_t - 1, sp_l, sp_b + 1, 2);
|
||||
draw_line_width(sp_l - 1, sp_t, sp_r + 1, sp_t, 2);
|
||||
draw_line_width(sp_l - 1, sp_b, sp_r + 1, sp_b, 2);
|
||||
return;
|
||||
}
|
||||
|
||||
draw_set_color(COLORS._main_accent);
|
||||
draw_set_alpha(0.50);
|
||||
draw_line(sp_r, 0, sp_r, params.h);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function Node_PC_Balls(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
function Node_MK_Balls(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Pixel Cloud";
|
||||
|
||||
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, 0);
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"resourceType": "GMScript",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_pc_balls",
|
||||
"name": "node_mk_balls",
|
||||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "PC effects",
|
||||
"path": "folders/nodes/data/PC effects.yy",
|
||||
"name": "MK effects",
|
||||
"path": "folders/nodes/data/MK effects.yy",
|
||||
},
|
||||
}
|
12
scripts/node_noise_gabor/node_gradient.yy
Normal file
12
scripts/node_noise_gabor/node_gradient.yy
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"isDnD": false,
|
||||
"isCompatibility": false,
|
||||
"parent": {
|
||||
"name": "generator",
|
||||
"path": "folders/nodes/data/generator.yy",
|
||||
},
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_gradient",
|
||||
"tags": [],
|
||||
"resourceType": "GMScript",
|
||||
}
|
21
scripts/node_noise_gabor/node_noise_gabor.gml
Normal file
21
scripts/node_noise_gabor/node_noise_gabor.gml
Normal file
|
@ -0,0 +1,21 @@
|
|||
function Node_Gabor_Noise(_x, _y, _group = noone) : Node_Shader_Generator(_x, _y, _group) constructor {
|
||||
name = "Gabor Noise";
|
||||
shader = sh_noise_gabor;
|
||||
|
||||
inputs[| 1] = nodeValue("Position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ])
|
||||
.setDisplay(VALUE_DISPLAY.vector)
|
||||
.setUnitRef(function(index) { return getDimension(index); });
|
||||
addShaderProp(SHADER_UNIFORM.float, "position");
|
||||
|
||||
inputs[| 2] = nodeValue("Scale", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 4, 4 ])
|
||||
.setDisplay(VALUE_DISPLAY.vector);
|
||||
addShaderProp(SHADER_UNIFORM.float, "scale");
|
||||
|
||||
inputs[| 3] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, irandom(99999));
|
||||
addShaderProp(SHADER_UNIFORM.float, "seed");
|
||||
|
||||
input_display_list = [
|
||||
["Output", true], 0, 3,
|
||||
["Noise", false], 1, 2,
|
||||
];
|
||||
}
|
11
scripts/node_noise_gabor/node_noise_gabor.yy
Normal file
11
scripts/node_noise_gabor/node_noise_gabor.yy
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"resourceType": "GMScript",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_noise_gabor",
|
||||
"isCompatibility": false,
|
||||
"isDnD": false,
|
||||
"parent": {
|
||||
"name": "noise",
|
||||
"path": "folders/nodes/data/generator/noise.yy",
|
||||
},
|
||||
}
|
|
@ -68,8 +68,4 @@ function Node_Perlin_Extra(_x, _y, _group = noone) : Node_Shader_Generator(_x, _
|
|||
inputs[| 11].setVisible(_typ > 0);
|
||||
inputs[| 12].setVisible(false);
|
||||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
return generateShader(_outSurf, _data);
|
||||
} #endregion
|
||||
}
|
|
@ -16,11 +16,14 @@ function Node_Polar(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
|
|||
|
||||
inputs[| 5] = nodeValue("Invert", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false)
|
||||
|
||||
inputs[| 6] = nodeValue("Blend", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
|
||||
.setDisplay(VALUE_DISPLAY.slider);
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
input_display_list = [ 3, 4,
|
||||
["Surfaces", false], 0, 1, 2,
|
||||
["Effect", false], 5,
|
||||
["Effect", false], 5, 6,
|
||||
]
|
||||
|
||||
attribute_surface_depth();
|
||||
|
@ -30,6 +33,7 @@ function Node_Polar(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
|
|||
surface_set_shader(_outSurf, sh_polar);
|
||||
shader_set_interpolation(_data[0]);
|
||||
shader_set_i("invert", _data[5]);
|
||||
shader_set_f("blend", _data[6]);
|
||||
|
||||
draw_surface_safe(_data[0], 0, 0);
|
||||
surface_reset_shader();
|
||||
|
|
|
@ -575,6 +575,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio
|
|||
addNodeObject(generator, "Cellular Noise", s_node_noise_cell, "Node_Cellular", [1, Node_Cellular], ["voronoi", "worley"], "Generate voronoi pattern.");
|
||||
addNodeObject(generator, "Anisotropic Noise", s_node_noise_aniso, "Node_Noise_Aniso", [1, Node_Noise_Aniso],, "Generate anisotropic noise.");
|
||||
addNodeObject(generator, "Extra Perlins", s_node_perlin_extra, "Node_Perlin_Extra", [1, Node_Perlin_Extra], ["noise"], "Random perlin noise made with different algorithms.").patreonExtra();
|
||||
addNodeObject(generator, "Gabor Noise", s_node_gabor, "Node_Gabor_Noise", [1, Node_Gabor_Noise]).patreonExtra();
|
||||
|
||||
ds_list_add(generator, "Patterns");
|
||||
addNodeObject(generator, "Stripe", s_node_stripe, "Node_Stripe", [1, Node_Stripe],, "Generate stripe pattern.");
|
||||
|
|
|
@ -1768,7 +1768,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
|
|||
node.clearCacheForward();
|
||||
}
|
||||
|
||||
if(fullUpdate && !IS_PLAYING) RENDER_ALL
|
||||
if(fullUpdate) RENDER_ALL
|
||||
|
||||
if(!LOADING) PROJECT.modified = true;
|
||||
|
||||
|
|
57
shaders/sh_noise_gabor/sh_noise_gabor.fsh
Normal file
57
shaders/sh_noise_gabor/sh_noise_gabor.fsh
Normal file
|
@ -0,0 +1,57 @@
|
|||
// Gabor noise
|
||||
// By shader god Inigo Quilez (https://iquilezles.org)
|
||||
// MIT License
|
||||
|
||||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
uniform float seed;
|
||||
uniform vec2 u_resolution;
|
||||
uniform vec2 position;
|
||||
uniform vec2 scale;
|
||||
|
||||
vec2 hash(vec2 p) { return fract(sin(vec2(
|
||||
dot(p, vec2(127.1, 311.7)) * (152.6178612 + seed / 10000.),
|
||||
dot(p, vec2(269.5, 183.3)) * (437.5453123 + seed / 10000.)
|
||||
)) * 43758.5453); }
|
||||
|
||||
vec3 gabor_wave(in vec2 p) {
|
||||
vec2 ip = floor(p);
|
||||
vec2 fp = fract(p);
|
||||
|
||||
const float fr = 2.0 * 6.283185;
|
||||
const float fa = 4.0;
|
||||
|
||||
vec3 av = vec3(0.0, 0.0, 0.0);
|
||||
vec3 at = vec3(0.0, 0.0, 0.0);
|
||||
|
||||
for( int j = -2; j <= 2; j++ )
|
||||
for( int i = -2; i <= 2; i++ ) {
|
||||
vec2 o = vec2( i, j );
|
||||
vec2 h = hash(ip + o);
|
||||
vec2 r = fp - (o + h);
|
||||
|
||||
vec2 k = normalize(-1.0 + 2.0 * hash(ip + o + vec2(11., 31.)) );
|
||||
|
||||
float d = dot(r, r);
|
||||
float l = dot(r, k);
|
||||
float w = exp(-fa * d);
|
||||
vec2 cs = vec2( cos(fr * l), sin(fr * l) );
|
||||
|
||||
av += w * vec3(cs.x, -2.0 * fa * r * cs.x - cs.y * fr * k );
|
||||
at += w * vec3(1.0, -2.0 * fa * r);
|
||||
}
|
||||
|
||||
return vec3( av.x, av.yz - av.x * at.yz / at.x ) / at.x;
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 pos = v_vTexcoord;
|
||||
pos.x *= (u_resolution.x / u_resolution.y);
|
||||
pos = (pos + position) * scale;
|
||||
|
||||
vec3 f = gabor_wave(pos);
|
||||
vec3 col = vec3(0.5 + 0.5 * f.x);
|
||||
|
||||
gl_FragColor = vec4( col, 1.0 );
|
||||
}
|
18
shaders/sh_noise_gabor/sh_noise_gabor.vsh
Normal file
18
shaders/sh_noise_gabor/sh_noise_gabor.vsh
Normal file
|
@ -0,0 +1,18 @@
|
|||
//
|
||||
// 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;
|
||||
}
|
10
shaders/sh_noise_gabor/sh_noise_gabor.yy
Normal file
10
shaders/sh_noise_gabor/sh_noise_gabor.yy
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"resourceType": "GMShader",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "sh_noise_gabor",
|
||||
"parent": {
|
||||
"name": "noise",
|
||||
"path": "folders/shader/generator/noise.yy",
|
||||
},
|
||||
"type": 1,
|
||||
}
|
|
@ -1,9 +1,10 @@
|
|||
//
|
||||
// Simple passthrough fragment shader
|
||||
//
|
||||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
uniform int invert;
|
||||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
uniform int invert;
|
||||
uniform float blend;
|
||||
|
||||
#region /////////////// SAMPLING ///////////////
|
||||
|
||||
|
@ -55,19 +56,20 @@ vec4 texture2Dintp( sampler2D texture, vec2 uv ) {
|
|||
|
||||
void main() {
|
||||
vec2 center = vec2(0.5, 0.5);
|
||||
vec2 coord;
|
||||
|
||||
if(invert == 0) {
|
||||
float radius = distance(v_vTexcoord, center) / (sqrt(2.) * .5);
|
||||
vec2 cenPos = v_vTexcoord - center;
|
||||
float angle = (atan(cenPos.y, cenPos.x) / PI + 1.) / 2.;
|
||||
|
||||
vec2 coord = vec2(radius, angle);
|
||||
gl_FragColor = v_vColour * texture2D( gm_BaseTexture, coord );
|
||||
coord = vec2(radius, angle);
|
||||
} else if(invert == 1) {
|
||||
float dist = v_vTexcoord.x * 0.5;
|
||||
float ang = v_vTexcoord.y * PI * 2.;
|
||||
|
||||
vec2 coord = center + vec2(cos(ang), sin(ang)) * dist;
|
||||
gl_FragColor = v_vColour * texture2D( gm_BaseTexture, coord );
|
||||
coord = center + vec2(cos(ang), sin(ang)) * dist;
|
||||
}
|
||||
|
||||
gl_FragColor = texture2D( gm_BaseTexture, mix(v_vTexcoord, coord, blend) );
|
||||
}
|
||||
|
|
BIN
sprites/s_node_gabor/99b0c7b4-3cde-4f66-b0ad-e666633f0476.png
Normal file
BIN
sprites/s_node_gabor/99b0c7b4-3cde-4f66-b0ad-e666633f0476.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 7.3 KiB |
74
sprites/s_node_gabor/s_node_gabor.yy
Normal file
74
sprites/s_node_gabor/s_node_gabor.yy
Normal file
|
@ -0,0 +1,74 @@
|
|||
{
|
||||
"resourceType": "GMSprite",
|
||||
"resourceVersion": "1.0",
|
||||
"name": "s_node_gabor",
|
||||
"bbox_bottom": 63,
|
||||
"bbox_left": 0,
|
||||
"bbox_right": 63,
|
||||
"bbox_top": 0,
|
||||
"bboxMode": 0,
|
||||
"collisionKind": 1,
|
||||
"collisionTolerance": 0,
|
||||
"DynamicTexturePage": false,
|
||||
"edgeFiltering": false,
|
||||
"For3D": false,
|
||||
"frames": [
|
||||
{"resourceType":"GMSpriteFrame","resourceVersion":"1.1","name":"99b0c7b4-3cde-4f66-b0ad-e666633f0476",},
|
||||
],
|
||||
"gridX": 0,
|
||||
"gridY": 0,
|
||||
"height": 64,
|
||||
"HTile": false,
|
||||
"layers": [
|
||||
{"resourceType":"GMImageLayer","resourceVersion":"1.0","name":"d00019f0-346a-4acd-8376-f2a02c62404f","blendMode":0,"displayName":"default","isLocked":false,"opacity":100.0,"visible":true,},
|
||||
],
|
||||
"nineSlice": null,
|
||||
"origin": 4,
|
||||
"parent": {
|
||||
"name": "generator",
|
||||
"path": "folders/nodes/icons/generator.yy",
|
||||
},
|
||||
"preMultiplyAlpha": false,
|
||||
"sequence": {
|
||||
"resourceType": "GMSequence",
|
||||
"resourceVersion": "1.4",
|
||||
"name": "s_node_gabor",
|
||||
"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":"99b0c7b4-3cde-4f66-b0ad-e666633f0476","path":"sprites/s_node_gabor/s_node_gabor.yy",},},},"Disabled":false,"id":"7374e71c-adbf-40f0-a542-2248e43f208e","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,
|
||||
}
|
Loading…
Reference in a new issue