This commit is contained in:
Tanasart 2024-08-25 15:18:22 +07:00
parent 8cf4801f5e
commit c1b18c3471
40 changed files with 575 additions and 285 deletions

View file

@ -1472,6 +1472,7 @@
{"name":"sh_cross_section","order":25,"path":"shaders/sh_cross_section/sh_cross_section.yy",}, {"name":"sh_cross_section","order":25,"path":"shaders/sh_cross_section/sh_cross_section.yy",},
{"name":"sh_curve_hsv","order":54,"path":"shaders/sh_curve_hsv/sh_curve_hsv.yy",}, {"name":"sh_curve_hsv","order":54,"path":"shaders/sh_curve_hsv/sh_curve_hsv.yy",},
{"name":"sh_curve","order":3,"path":"shaders/sh_curve/sh_curve.yy",}, {"name":"sh_curve","order":3,"path":"shaders/sh_curve/sh_curve.yy",},
{"name":"sh_d3d_3d_transform","order":15,"path":"shaders/sh_d3d_3d_transform/sh_d3d_3d_transform.yy",},
{"name":"sh_d3d_background","order":8,"path":"shaders/sh_d3d_background/sh_d3d_background.yy",}, {"name":"sh_d3d_background","order":8,"path":"shaders/sh_d3d_background/sh_d3d_background.yy",},
{"name":"sh_d3d_extrude_extends","order":11,"path":"shaders/sh_d3d_extrude_extends/sh_d3d_extrude_extends.yy",}, {"name":"sh_d3d_extrude_extends","order":11,"path":"shaders/sh_d3d_extrude_extends/sh_d3d_extrude_extends.yy",},
{"name":"sh_d3d_geometry","order":9,"path":"shaders/sh_d3d_geometry/sh_d3d_geometry.yy",}, {"name":"sh_d3d_geometry","order":9,"path":"shaders/sh_d3d_geometry/sh_d3d_geometry.yy",},

View file

@ -2128,6 +2128,7 @@
{"id":{"name":"sh_cross_section","path":"shaders/sh_cross_section/sh_cross_section.yy",},}, {"id":{"name":"sh_cross_section","path":"shaders/sh_cross_section/sh_cross_section.yy",},},
{"id":{"name":"sh_curve_hsv","path":"shaders/sh_curve_hsv/sh_curve_hsv.yy",},}, {"id":{"name":"sh_curve_hsv","path":"shaders/sh_curve_hsv/sh_curve_hsv.yy",},},
{"id":{"name":"sh_curve","path":"shaders/sh_curve/sh_curve.yy",},}, {"id":{"name":"sh_curve","path":"shaders/sh_curve/sh_curve.yy",},},
{"id":{"name":"sh_d3d_3d_transform","path":"shaders/sh_d3d_3d_transform/sh_d3d_3d_transform.yy",},},
{"id":{"name":"sh_d3d_background","path":"shaders/sh_d3d_background/sh_d3d_background.yy",},}, {"id":{"name":"sh_d3d_background","path":"shaders/sh_d3d_background/sh_d3d_background.yy",},},
{"id":{"name":"sh_d3d_default","path":"shaders/sh_d3d_default/sh_d3d_default.yy",},}, {"id":{"name":"sh_d3d_default","path":"shaders/sh_d3d_default/sh_d3d_default.yy",},},
{"id":{"name":"sh_d3d_extrude_extends","path":"shaders/sh_d3d_extrude_extends/sh_d3d_extrude_extends.yy",},}, {"id":{"name":"sh_d3d_extrude_extends","path":"shaders/sh_d3d_extrude_extends/sh_d3d_extrude_extends.yy",},},

View file

@ -2,8 +2,8 @@
"$GMObject":"", "$GMObject":"",
"%Name":"Obj_FirebaseFirestore_Document_Set", "%Name":"Obj_FirebaseFirestore_Document_Set",
"eventList":[ "eventList":[
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":7,"eventType":6,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":7,"eventType":6,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
], ],
"managed":true, "managed":true,
"name":"Obj_FirebaseFirestore_Document_Set", "name":"Obj_FirebaseFirestore_Document_Set",

View file

@ -2,8 +2,8 @@
"$GMObject":"", "$GMObject":"",
"%Name":"o_dialog_file_name_action", "%Name":"o_dialog_file_name_action",
"eventList":[ "eventList":[
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
], ],
"managed":true, "managed":true,
"name":"o_dialog_file_name_action", "name":"o_dialog_file_name_action",

View file

@ -2,10 +2,10 @@
"$GMObject":"", "$GMObject":"",
"%Name":"o_dialog_menubox", "%Name":"o_dialog_menubox",
"eventList":[ "eventList":[
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":1,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":1,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
], ],
"managed":true, "managed":true,
"name":"o_dialog_menubox", "name":"o_dialog_menubox",

View file

@ -2,25 +2,25 @@
"$GMObject":"", "$GMObject":"",
"%Name":"o_main", "%Name":"o_main",
"eventList":[ "eventList":[
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":2,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":2,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":5,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":5,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":2,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":2,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":3,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":3,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":4,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":4,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":20,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":20,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":60,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":60,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":62,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":62,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":68,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":68,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":69,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":69,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":70,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":70,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":75,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":75,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":75,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":75,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":9,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":9,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"v1","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":10,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":10,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
], ],
"managed":true, "managed":true,
"name":"o_main", "name":"o_main",

View file

@ -1,8 +1,6 @@
function angle_random_eval(range, seed = undefined) { function angle_random_eval(range, seed = random_get_seed()) {
if(is_real(range)) return range; if(is_real(range)) return range;
if(seed != undefined) random_set_seed(seed);
if(array_empty(range)) return 0; if(array_empty(range)) return 0;
var _l = array_length(range); var _l = array_length(range);
@ -10,26 +8,27 @@ function angle_random_eval(range, seed = undefined) {
return range[0] return range[0]
else if(_l == 2) else if(_l == 2)
return irandom_range(range[0], range[1]); return random_range_seed(range[0], range[1], seed);
else if(_l > 2) { else if(_l > 2) {
switch(range[0]) { switch(range[0]) {
case 0 : return irandom_range(range[1], range[2]); case 0 : return random_range_seed(range[1], range[2], seed);
case 1 : return irandom_range(range[1] - range[2], range[1] + range[2]); case 1 : return random_range_seed(range[1] - range[2], range[1] + range[2], seed);
case 2 : return choose(irandom_range(range[1], range[2]), irandom_range(range[3], range[4])); case 2 : return choose(random_range_seed(range[1], range[2], seed), random_range_seed(range[3], range[4], seed));
case 3 : return choose(irandom_range(range[1] - range[3], range[1] + range[3]), irandom_range(range[2] - range[3], range[2] + range[3])); case 3 : return choose(random_range_seed(range[1] - range[3], range[1] + range[3], seed), random_range_seed(range[2] - range[3], range[2] + range[3], seed));
} }
} }
return array_safe_get_fast(range, 0); return array_safe_get_fast(range, 0);
} }
function angle_random_eval_fast(range) { function angle_random_eval_fast(range, seed = random_get_seed()) {
switch(range[0]) { switch(range[0]) {
case 0 : return irandom_range(range[1], range[2]); case 0 : return random_range_seed(range[1], range[2], seed);
case 1 : return irandom_range(range[1] - range[2], range[1] + range[2]); case 1 : return random_range_seed(range[1] - range[2], range[1] + range[2], seed);
case 2 : return choose(irandom_range(range[1], range[2]), irandom_range(range[3], range[4])); case 2 : return choose(random_range_seed(range[1], range[2], seed), random_range_seed(range[3], range[4], seed));
case 3 : return choose(irandom_range(range[1] - range[3], range[1] + range[3]), irandom_range(range[2] - range[3], range[2] + range[3])); case 3 : return choose(random_range_seed(range[1] - range[3], range[1] + range[3], seed), random_range_seed(range[2] - range[3], range[2] + range[3], seed));
} }
return 0; return 0;
} }

View file

@ -10,7 +10,7 @@ function Node_3D_Transform(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _gro
["Transform", false], 0, 1, 2, ["Transform", false], 0, 1, 2,
]; ];
static processData = function(_output, _data, _output_index, _array_index = 0) { #region static processData = function(_output, _data, _output_index, _array_index = 0) {
var _mesh = _data[in_d3d + 0]; var _mesh = _data[in_d3d + 0];
var _scene = new __3dGroup(); var _scene = new __3dGroup();
@ -20,5 +20,5 @@ function Node_3D_Transform(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _gro
_scene.addObject(_mesh); _scene.addObject(_mesh);
return _scene; return _scene;
} #endregion }
} }

View file

@ -20,8 +20,10 @@ function Node_3D_Transform_Image(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y,
newInput(in_mesh + 2, nodeValue_Float("FOV", self, 45)); newInput(in_mesh + 2, nodeValue_Float("FOV", self, 45));
newInput(in_mesh + 3, nodeValue_Vec2("Texture Tiling", self, [ 1, 1 ]));
input_display_list = [ input_display_list = [
["Material", false], in_mesh + 0, ["Material", false], in_mesh + 0, in_mesh + 3,
__d3d_input_list_transform, __d3d_input_list_transform,
["Camera", false], in_mesh + 1, in_mesh + 2, ["Camera", false], in_mesh + 1, in_mesh + 2,
] ]
@ -31,6 +33,8 @@ function Node_3D_Transform_Image(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y,
output_display_list = [ 1 ] output_display_list = [ 1 ]
attribute_interpolation();
static onDrawOverlay3D = function(active, params, _mx, _my, _snx, _sny, _panel) { static onDrawOverlay3D = function(active, params, _mx, _my, _snx, _sny, _panel) {
var _outSurf = outputs[1].getValue(); var _outSurf = outputs[1].getValue();
if(is_array(_outSurf)) _outSurf = array_safe_get_fast(_outSurf, preview_index); if(is_array(_outSurf)) _outSurf = array_safe_get_fast(_outSurf, preview_index);
@ -57,6 +61,7 @@ function Node_3D_Transform_Image(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y,
var _surf = _data[in_mesh + 0]; var _surf = _data[in_mesh + 0];
var _proj = _data[in_mesh + 1]; var _proj = _data[in_mesh + 1];
var _fov = _data[in_mesh + 2]; var _fov = _data[in_mesh + 2];
var _tile = _data[in_mesh + 3];
if(!is_surface(_surf)) return 0; if(!is_surface(_surf)) return 0;
if(_output_index == 0) { if(_output_index == 0) {
@ -78,11 +83,13 @@ function Node_3D_Transform_Image(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y,
1, 0, 0); 1, 0, 0);
_output = surface_verify(_output, _dim[0], _dim[1]); _output = surface_verify(_output, _dim[0], _dim[1]);
surface_set_target(_output); surface_set_shader(_output, sh_d3d_3d_transform);
DRAW_CLEAR shader_set_2("tiling", _tile);
camera_set_view_mat(camera, viewMat); camera_set_view_mat(camera, viewMat);
camera_set_proj_mat(camera, projMat); camera_set_proj_mat(camera, projMat);
camera_apply(camera); camera_apply(camera);
gpu_set_texfilter(attributes.interpolate);
object.transform.submitMatrix(); object.transform.submitMatrix();
matrix_set(matrix_world, matrix_stack_top()); matrix_set(matrix_world, matrix_stack_top());
@ -93,7 +100,8 @@ function Node_3D_Transform_Image(_x, _y, _group = noone) : Node_3D_Mesh(_x, _y,
matrix_set(matrix_world, matrix_build_identity()); matrix_set(matrix_world, matrix_build_identity());
camera_apply(0); camera_apply(0);
surface_reset_target(); gpu_set_texfilter(false);
surface_reset_shader();
return _output; return _output;
} }

View file

@ -32,11 +32,22 @@ function Node_MK_Subpixel(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
newInput(12, nodeValue_Float("Scene Scale", self, 1)); newInput(12, nodeValue_Float("Scene Scale", self, 1));
newInput(13, nodeValue_Bool("Flicker", self, false));
newInput(14, nodeValue_Float("Flicker Intensity", self, .2))
.setDisplay(VALUE_DISPLAY.slider);
newInput(15, nodeValue_Float("Flicker Frequency", self, 4))
newInput(16, nodeValue_Float("Flicker Cut", self, .5))
.setDisplay(VALUE_DISPLAY.slider);
input_display_list = [ new Inspector_Sprite(s_MKFX), 7, input_display_list = [ new Inspector_Sprite(s_MKFX), 7,
["Subpixel", false], 1, 2, 12, ["Subpixel", false], 1, 2, 12,
["Effect", false], 3, 4, 8, ["Effect", false], 3, 4, 8,
["Render", false], 6, 5,
["Ridge", false, 11], 9, 10, ["Ridge", false, 11], 9, 10,
["Render", false], 6, 5,
["Flicker", false, 13], 14, 15, 16,
]; ];
outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone); outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone);
@ -54,6 +65,12 @@ function Node_MK_Subpixel(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
var _rgin = _data[10]; var _rgin = _data[10];
var _ruse = _data[11]; var _ruse = _data[11];
var _scns = _data[12]; var _scns = _data[12];
var _flku = _data[13];
var _flki = _data[14];
var _flkf = _data[15];
var _flkc = _data[16];
update_on_frame = _flku;
var _dim = surface_get_dimension(_surf); var _dim = surface_get_dimension(_surf);
var sh = sh_mk_subpixel_hex_disc; var sh = sh_mk_subpixel_hex_disc;
@ -84,6 +101,11 @@ function Node_MK_Subpixel(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
shader_set_f("ridgeCount", _rgcn); shader_set_f("ridgeCount", _rgcn);
shader_set_f("ridgeIntens", _rgin); shader_set_f("ridgeIntens", _rgin);
shader_set_i("flickerUse", _flku);
shader_set_f("flickerIntens", _flki);
shader_set_f("flickerCut", _flkc);
shader_set_f("flickerTime", (CURRENT_FRAME / TOTAL_FRAMES) * pi * _flkf);
var _cx = _dim[0] / 2; var _cx = _dim[0] / 2;
var _cy = _dim[1] / 2; var _cy = _dim[1] / 2;
var _px = _cx - _dim[0] * _scns / 2; var _px = _cx - _dim[0] * _scns / 2;

View file

@ -167,14 +167,10 @@ function Node_Region_Fill(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
switch(_filt) { switch(_filt) {
case 0 : // Random colors case 0 : // Random colors
var _pal = [];
for( var i = 0, n = array_length(_colr); i < n; i++ )
array_append(_pal, colToVec4(_colr[i]));
shader_set(sh_region_fill_color); shader_set(sh_region_fill_color);
shader_set_f("colors", _pal); shader_set_palette(_colr, "color", "colorAmount");
shader_set_f("seed", _seed); shader_set_f("seed", _seed);
shader_set_f("colorAmount", array_length(_colr));
draw_surface_safe(cmap); draw_surface_safe(cmap);
shader_reset(); shader_reset();

View file

@ -554,6 +554,7 @@ function __initNodes() {
addNodeObject(transform, "Crop Content", s_node_crop_content, "Node_Crop_Content", [1, Node_Crop_Content],, "Crop out empty pixel from the image."); addNodeObject(transform, "Crop Content", s_node_crop_content, "Node_Crop_Content", [1, Node_Crop_Content],, "Crop out empty pixel from the image.");
addNodeObject(transform, "Bend", s_node_bend, "Node_Bend", [1, Node_Bend], ["wrap"], "Warp an image into a predefined shape.").setVersion(11650); addNodeObject(transform, "Bend", s_node_bend, "Node_Bend", [1, Node_Bend], ["wrap"], "Warp an image into a predefined shape.").setVersion(11650);
addNodeObject(transform, "Warp", s_node_warp, "Node_Warp", [1, Node_Warp], ["warp corner"], "Warp image by freely moving the corners."); addNodeObject(transform, "Warp", s_node_warp, "Node_Warp", [1, Node_Warp], ["warp corner"], "Warp image by freely moving the corners.");
// addNodeObject(transform, "Perspective Warp",s_node_warp, "Node_Warp_Perspective",[1, Node_Warp_Perspective], ["warp perspective"], "Warp image by modifying perspective.");
addNodeObject(transform, "Skew", s_node_skew, "Node_Skew", [1, Node_Skew], ["shear"], "Skew image horizontally, or vertically."); addNodeObject(transform, "Skew", s_node_skew, "Node_Skew", [1, Node_Skew], ["shear"], "Skew image horizontally, or vertically.");
addNodeObject(transform, "Mesh Warp", s_node_warp_mesh, "Node_Mesh_Warp", [1, Node_Mesh_Warp], ["mesh wrap"], "Wrap image by converting it to mesh, and using control points."); addNodeObject(transform, "Mesh Warp", s_node_warp_mesh, "Node_Mesh_Warp", [1, Node_Mesh_Warp], ["mesh wrap"], "Wrap image by converting it to mesh, and using control points.");
addNodeObject(transform, "Polar", s_node_polar, "Node_Polar", [1, Node_Polar],, "Convert image to polar coordinate."); addNodeObject(transform, "Polar", s_node_polar, "Node_Polar", [1, Node_Polar],, "Convert image to polar coordinate.");

View file

@ -80,13 +80,13 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
newInput(27, nodeValue_Enum_Scroll("Animated array end", self, 0, [ "Loop", "Ping Pong" ])); newInput(27, nodeValue_Enum_Scroll("Animated array end", self, 0, [ "Loop", "Ping Pong" ]));
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
newInput(28, nodeValueMap("Gradient map", self)); newInput(28, nodeValueMap("Gradient map", self));
newInput(29, nodeValueGradientRange("Gradient map range", self, inputs[11])); newInput(29, nodeValueGradientRange("Gradient map range", self, inputs[11]));
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
newInput(30, nodeValue_Vec2("Uniform amount", self, [ 4, 4 ])); newInput(30, nodeValue_Vec2("Uniform amount", self, [ 4, 4 ]));
@ -106,6 +106,10 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
newInput(38, nodeValue_Enum_Button("Spacing", self, 0, [ "After", "Between", "Around" ])); newInput(38, nodeValue_Enum_Button("Spacing", self, 0, [ "After", "Between", "Around" ]));
newInput(39, nodeValue_Range("Shift radial", self, [ 0, 0 ]));
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone); outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone);
outputs[1] = nodeValue_Output("Atlas data", self, VALUE_TYPE.surface, []) outputs[1] = nodeValue_Output("Atlas data", self, VALUE_TYPE.surface, [])
@ -116,7 +120,7 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
["Surfaces", true], 0, 1, 15, 24, 25, 26, 27, ["Surfaces", true], 0, 1, 15, 24, 25, 26, 27,
["Scatter", false], 6, 5, 13, 14, 17, 9, 31, 2, 30, 35, ["Scatter", false], 6, 5, 13, 14, 17, 9, 31, 2, 30, 35,
["Path", false], 19, 38, 20, 21, 22, ["Path", false], 19, 38, 20, 21, 22,
["Position", false], 33, 36, 37, ["Position", false], 33, 36, 37, 39,
["Rotation", false], 7, 4, 32, ["Rotation", false], 7, 4, 32,
["Scale", false], 3, 8, 34, ["Scale", false], 3, 8, 34,
["Render", false], 18, 11, 28, 12, 16, 23, ["Render", false], 18, 11, 28, 12, 16, 23,
@ -134,7 +138,7 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
scatter_maps = 0; scatter_maps = 0;
scatter_mapp = []; scatter_mapp = [];
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
PROCESSOR_OVERLAY_CHECK PROCESSOR_OVERLAY_CHECK
var _distType = current_data[6]; var _distType = current_data[6];
@ -144,18 +148,18 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
var hv = inputs[29].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny, current_data[1]); active &= !hv; _hov |= hv; var hv = inputs[29].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny, current_data[1]); active &= !hv; _hov |= hv;
return _hov; return _hov;
} #endregion }
static onValueUpdate = function(index) { #region static onValueUpdate = function(index) {
if(index == 15) { if(index == 15) {
var _arr = getInputData(15); var _arr = getInputData(15);
inputs[0].array_depth = _arr; inputs[0].array_depth = _arr;
update(); update();
} }
} #endregion }
static step = function() { #region static step = function() {
var _are = getInputData(5); var _are = getInputData(5);
var _dis = getInputData(6); var _dis = getInputData(6);
var _sct = getInputData(9); var _sct = getInputData(9);
@ -210,11 +214,11 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
} }
inputs[11].mappableStep(); inputs[11].mappableStep();
} #endregion }
////=========== PROCESS =========== ////=========== PROCESS ===========
static processData = function(_outSurf, _data, _output_index, _array_index) { #region static processData = function(_outSurf, _data, _output_index, _array_index) {
if(_output_index == 1) return scatter_data; if(_output_index == 1) return scatter_data;
var _inSurf = _data[0]; var _inSurf = _data[0];
@ -266,6 +270,7 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
var posShf = _data[36]; var posShf = _data[36];
var posExt = _data[37]; var posExt = _data[37];
var pthSpac = _data[38]; var pthSpac = _data[38];
var shfRad = _data[39];
var _in_w, _in_h; var _in_w, _in_h;
@ -359,11 +364,14 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
DRAW_CLEAR DRAW_CLEAR
switch(blend) { switch(blend) {
case 0 : case 0 :
if(mulpA) BLEND_ALPHA_MULP; if(mulpA) BLEND_ALPHA_MULP
else BLEND_ALPHA; else BLEND_ALPHA
break;
case 1 :
BLEND_ADD;
break; break;
case 1 : BLEND_ADD; break;
case 2 : case 2 :
BLEND_ALPHA_MULP BLEND_ALPHA_MULP
gpu_set_blendequation(bm_eq_max); gpu_set_blendequation(bm_eq_max);
@ -377,8 +385,8 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
var sp = noone, _x = 0, _y = 0; var sp = noone, _x = 0, _y = 0;
var _v = noone; var _v = noone;
var _scx = _scaUniX? _scale[0] : random_range(_scale[0], _scale[1]); var _scx = _scaUniX? _scale[0] : random_range_seed(_scale[0], _scale[1], _sed++);
var _scy = _scaUniY? _scale[2] : random_range(_scale[2], _scale[3]); var _scy = _scaUniY? _scale[2] : random_range_seed(_scale[2], _scale[3], _sed++);
switch(_dist) { #region position switch(_dist) { #region position
case NODE_SCATTER_DIST.area : case NODE_SCATTER_DIST.area :
@ -463,13 +471,13 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
} }
} else { } else {
_pathProgress = random(1); _pathProgress = random_seed(1, _sed++);
_pathProgress = frac(_pathProgress + pathShf); _pathProgress = frac(_pathProgress + pathShf);
} }
var pp = path.getPointRatio(_pathProgress, path_line_index); var pp = path.getPointRatio(_pathProgress, path_line_index);
_x = pp.x + random_range(-pathDis, pathDis); _x = pp.x + random_range_seed(-pathDis, pathDis, _sed++);
_y = pp.y + random_range(-pathDis, pathDis); _y = pp.y + random_range_seed(-pathDis, pathDis, _sed++);
break; break;
case NODE_SCATTER_DIST.tile : case NODE_SCATTER_DIST.tile :
@ -481,19 +489,25 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
_y = uniAmo[1] == 1? _dim[1] / 2 : (_arow + 0.5) * _dim[1] / ( uniAmo[1] ); _y = uniAmo[1] == 1? _dim[1] / 2 : (_arow + 0.5) * _dim[1] / ( uniAmo[1] );
} else if(_scat == 1) { } else if(_scat == 1) {
_x = random_range(0, _dim[0]); _x = random_range_seed(0, _dim[0], _sed++);
_y = random_range(0, _dim[1]); _y = random_range_seed(0, _dim[1], _sed++);
} }
break; break;
} #endregion } #endregion
if(_wigX) _x += random_range(posWig[0], posWig[1]); if(_wigX) _x += random_range_seed(posWig[0], posWig[1], _sed++);
if(_wigY) _y += random_range(posWig[2], posWig[3]); if(_wigY) _y += random_range_seed(posWig[2], posWig[3], _sed++);
_x += posShf[0] * i; _x += posShf[0] * i;
_y += posShf[1] * i; _y += posShf[1] * i;
var shrRad = random_range_seed(shfRad[0], shfRad[1], _sed++);
var shrAng = point_direction(_x, _y, _area[0], _area[1]);
_x -= lengthdir_x(shrRad, shrAng);
_y -= lengthdir_y(shrRad, shrAng);
if(_unis) { if(_unis) {
_scy = max(_scx, _scy); _scy = max(_scx, _scy);
_scx = _scy; _scx = _scy;
@ -504,7 +518,7 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
_scy *= _v; _scy *= _v;
} }
var _r = (_pint? point_direction(_area[0], _area[1], _x, _y) : 0) + angle_random_eval_fast(_rota); var _r = (_pint? point_direction(_area[0], _area[1], _x, _y) : 0) + angle_random_eval_fast(_rota, _sed++);
if(vRot && _v != noone) if(vRot && _v != noone)
_r *= _v; _r *= _v;
@ -523,7 +537,7 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
var surf = _inSurf; var surf = _inSurf;
var ind = 0; var ind = 0;
if(surfArray) { #region if(surfArray) {
switch(_arr) { switch(_arr) {
case 1 : ind = safe_mod(i, _arrLen); break; case 1 : ind = safe_mod(i, _arrLen); break;
case 2 : ind = irandom(_arrLen - 1); break; case 2 : ind = irandom(_arrLen - 1); break;
@ -549,7 +563,7 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
} }
surf = array_safe_get_fast(_inSurf, ind, 0); surf = array_safe_get_fast(_inSurf, ind, 0);
} #endregion }
if(surf == 0 || !surface_valid_map[? surf]) continue; if(surf == 0 || !surface_valid_map[? surf]) continue;
@ -566,12 +580,12 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
_y = _p[1]; _y = _p[1];
} }
var grSamp = random(1); var grSamp = random_seed(1, _sed++);
if(vCol && _v != noone) if(vCol && _v != noone)
grSamp *= _v; grSamp *= _v;
var clr = _clrUni? _clrSin : evaluate_gradient_map(grSamp, color, clr_map, clr_rng, inputs[11], true); var clr = _clrUni? _clrSin : evaluate_gradient_map(grSamp, color, clr_map, clr_rng, inputs[11], true);
var alp = _alpUni? alpha[0] : random_range(alpha[0], alpha[1]); var alp = _alpUni? alpha[0] : random_range_seed(alpha[0], alpha[1], _sed++);
var _atl = _sct_len >= _datLen? noone : scatter_data[_sct_len]; var _atl = _sct_len >= _datLen? noone : scatter_data[_sct_len];
if(posExt) { if(posExt) {
@ -646,5 +660,5 @@ function Node_Scatter(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
scatter_data = _sct; scatter_data = _sct;
return _outSurf; return _outSurf;
} #endregion }
} }

View file

@ -1,11 +1,10 @@
#region create global.node_shape_keys = [
global.node_shape_keys = [
"rectangle", "ellipse", "regular polygon", "star", "arc", "teardrop", "cross", "leaf", "crescent", "donut", "rectangle", "ellipse", "regular polygon", "star", "arc", "teardrop", "cross", "leaf", "crescent", "donut",
"square", "circle", "triangle", "pentagon", "hexagon", "ring", "diamond", "trapezoid", "parallelogram", "heart", "square", "circle", "triangle", "pentagon", "hexagon", "ring", "diamond", "trapezoid", "parallelogram", "heart",
"arrow", "gear", "arrow", "gear",
]; ];
function Node_create_Shape(_x, _y, _group = noone, _param = {}) { function Node_create_Shape(_x, _y, _group = noone, _param = {}) {
var query = struct_try_get(_param, "query", ""); var query = struct_try_get(_param, "query", "");
var node = new Node_Shape(_x, _y, _group).skipDefault(); var node = new Node_Shape(_x, _y, _group).skipDefault();
var ind = -1; var ind = -1;
@ -24,9 +23,7 @@
if(ind >= 0) node.inputs[2].setValue(ind); if(ind >= 0) node.inputs[2].setValue(ind);
return node; return node;
} }
#endregion
function Node_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { function Node_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
name = "Draw Shape"; name = "Draw Shape";
@ -117,13 +114,18 @@ function Node_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
newInput(27, nodeValue_Rotation("Teeth Rotation", self, 0)); newInput(27, nodeValue_Rotation("Teeth Rotation", self, 0));
newInput(28, nodeValue_Float("Shape Scale", self, 1))
.setDisplay(VALUE_DISPLAY.slider);
newInput(29, nodeValue_Slider_Range("Curve", self, [ 0, 1 ]));
outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone); outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone);
input_display_list = [ input_display_list = [
["Output", false], 0, 6, ["Output", false], 0, 6,
["Transform", false], 15, 3, 16, 17, 19, ["Transform", false], 15, 3, 16, 17, 19, 28,
["Shape", false], 14, 2, 9, 4, 13, 5, 7, 8, 21, 22, 23, 24, 25, 26, 27, ["Shape", false], 14, 2, 9, 4, 13, 5, 7, 8, 21, 22, 23, 24, 25, 26, 27,
["Render", true], 10, 12, 20, 18, ["Render", true], 10, 12, 20, 29, 18,
["Background", true, 1], 11, ["Background", true, 1], 11,
]; ];
@ -239,6 +241,8 @@ function Node_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
var _tile = _data[18]; var _tile = _data[18];
var _rotat = _data[19]; var _rotat = _data[19];
var _level = _data[20]; var _level = _data[20];
var _levelO = _data[29];
var _shpSca = _data[28];
var _center = [ 0, 0 ]; var _center = [ 0, 0 ];
var _scale = [ 0, 0 ]; var _scale = [ 0, 0 ];
@ -250,6 +254,7 @@ function Node_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
_center = [ _area[0] / _dim[0], _area[1] / _dim[1] ]; _center = [ _area[0] / _dim[0], _area[1] / _dim[1] ];
_scale = [ abs(_area[2] / _dim[0]), abs(_area[3] / _dim[1]) ]; _scale = [ abs(_area[2] / _dim[0]), abs(_area[3] / _dim[1]) ];
break; break;
case 1 : case 1 :
var _posit = _data[16]; var _posit = _data[16];
var _scal = _data[17]; var _scal = _data[17];
@ -257,12 +262,18 @@ function Node_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
_center = [ _posit[0] / _dim[0], _posit[1] / _dim[1] ]; _center = [ _posit[0] / _dim[0], _posit[1] / _dim[1] ];
_scale = [ abs(_scal[0] / _dim[0]), abs(_scal[1] / _dim[1]) ]; _scale = [ abs(_scal[0] / _dim[0]), abs(_scal[1] / _dim[1]) ];
break; break;
case 2 : case 2 :
_center = [ 0.5, 0.5 ]; _center = [ 0.5, 0.5 ];
_scale = [ 0.5, 0.5 ]; _scale = [ 0.5, 0.5 ];
break; break;
} }
_scale[0] *= _shpSca;
_scale[1] *= _shpSca;
_level = [ _level[0] / _shpSca, _level[1] / _shpSca];
inputs[ 3].setVisible(_posTyp == 0); inputs[ 3].setVisible(_posTyp == 0);
inputs[16].setVisible(_posTyp == 1); inputs[16].setVisible(_posTyp == 1);
inputs[17].setVisible(_posTyp == 1); inputs[17].setVisible(_posTyp == 1);
@ -329,8 +340,12 @@ function Node_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
} }
surface_set_shader(_outSurf, sh_shape); surface_set_shader(_outSurf, sh_shape);
if(_bg) draw_clear_alpha(0, 1); if(_bg) {
else DRAW_CLEAR draw_clear_alpha(0, 1);
} else {
DRAW_CLEAR
BLEND_OVERRIDE
}
inputs[ 4].setVisible(false); inputs[ 4].setVisible(false);
inputs[ 5].setVisible(false); inputs[ 5].setVisible(false);
@ -538,13 +553,16 @@ function Node_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
shader_set_f("dimension", _dim); shader_set_f("dimension", _dim);
shader_set_f("bgColor", _bgcol); shader_set_f("bgColor", _bgcol);
shader_set_i("aa", _aa); shader_set_i("aa", _aa);
shader_set_i("drawBG", _bg);
shader_set_i("drawDF", _df); shader_set_i("drawDF", _df);
shader_set_2("dfLevel", _level); shader_set_2("dfLevel", _level);
shader_set_2("dfLevelOut", _levelO);
shader_set_i("tile", _tile); shader_set_i("tile", _tile);
shader_set_f("corner", _corner); shader_set_f("corner", _corner);
shader_set_2("center", _center); shader_set_2("center", _center);
shader_set_2("scale", _scale ); shader_set_2("scale", _scale );
shader_set_f("shapeScale",_shpSca);
shader_set_f("rotation", degtorad(_rotat)); shader_set_f("rotation", degtorad(_rotat));
draw_sprite_stretched_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], _color, _color_get_alpha(_color)); draw_sprite_stretched_ext(s_fx_pixel, 0, 0, 0, _dim[0], _dim[1], _color, _color_get_alpha(_color));

View file

@ -39,9 +39,12 @@ function Node_Smear(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
newInput(14, nodeValue_Bool("Invert", self, false)); newInput(14, nodeValue_Bool("Invert", self, false));
newInput(15, nodeValue_Enum_Scroll("Blend Mode", self, 0, [ "Maximum", "Additive" ]));
input_display_list = [ 5, 6, input_display_list = [ 5, 6,
["Surfaces", true], 0, 3, 4, 7, 8, ["Surfaces", true], 0, 3, 4, 7, 8,
["Smear", false], 11, 14, 1, 9, 2, 10, 13, 12, ["Smear", false], 11, 14, 1, 9, 2, 10, 13, 12,
["Render", false], 15,
] ]
outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone); outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone);
@ -84,6 +87,7 @@ function Node_Smear(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) con
shader_set_i("sampleMode", struct_try_get(attributes, "oversample")); shader_set_i("sampleMode", struct_try_get(attributes, "oversample"));
shader_set_i("alpha", _data[11]); shader_set_i("alpha", _data[11]);
shader_set_i("inv", _data[14]); shader_set_i("inv", _data[14]);
shader_set_i("blend", _data[15]);
shader_set_i("modulateStr", _data[12]); shader_set_i("modulateStr", _data[12]);
shader_set_f("spread", _data[13]); shader_set_f("spread", _data[13]);

View file

@ -639,7 +639,6 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
editWidget = new vectorRangeBox(array_length(val), _txt, function(val, index) { return setValueInspector(val, index); }, unit ); editWidget = new vectorRangeBox(array_length(val), _txt, function(val, index) { return setValueInspector(val, index); }, unit );
if(!struct_has(display_data, "linked")) display_data.linked = false; if(!struct_has(display_data, "linked")) display_data.linked = false;
if(!struct_has(display_data, "ranged")) display_data.ranged = false; if(!struct_has(display_data, "ranged")) display_data.ranged = false;

View file

@ -22,10 +22,12 @@ function Node_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
newInput(7, nodeValue_Dimension(self)); newInput(7, nodeValue_Dimension(self));
newInput(8, nodeValue_Bool("Tile", self, false));
outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone); outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone);
input_display_list = [ 5, input_display_list = [ 5,
["Surfaces", false], 0, 6, 7, ["Surfaces", false], 0, 6, 7, 8,
["Wrap", false], 1, 2, 3, 4 ["Wrap", false], 1, 2, 3, 4
] ]
@ -242,19 +244,22 @@ function Node_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
#endregion #endregion
} }
static warpSurface = function(surf, warp, sw, sh, tl, tr, bl, br, filt = false) { static warpSurface = function(surf, warp, sw, sh, tl, tr, bl, br, tile = false) {
var teq = round(tl[1]) == round(tr[1]); var teq = round(tl[1]) == round(tr[1]);
var beq = round(bl[1]) == round(br[1]); var beq = round(bl[1]) == round(br[1]);
var leq = round(tl[0]) == round(bl[0]); var leq = round(tl[0]) == round(bl[0]);
var req = round(tr[0]) == round(br[0]); var req = round(tr[0]) == round(br[0]);
if(teq && beq && leq && req) { var _wdim = surface_get_dimension(warp);
if(teq && beq && leq && req) { // rectangle
surface_set_shader(surf) surface_set_shader(surf)
shader_set_interpolation(warp); shader_set_interpolation(warp);
if(filt) gpu_set_tex_filter(true); // if(filt) gpu_set_tex_filter(true);
draw_surface_stretched_safe(warp, tl[0], tl[1], tr[0] - tl[0], bl[1] - tl[1]); if(tile) draw_surface_tiled_ext(warp, tl[0], tl[1], (tr[0] - tl[0]) / _wdim[0], (bl[1] - tl[1]) / _wdim[1], c_white, 1);
if(filt) gpu_set_tex_filter(false); else draw_surface_stretched_safe(warp, tl[0], tl[1], tr[0] - tl[0], bl[1] - tl[1]);
// if(filt) gpu_set_tex_filter(false);
surface_reset_shader(); surface_reset_shader();
} else { } else {
@ -266,10 +271,11 @@ function Node_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
shader_set_f("p1", tr[0] / sw, tr[1] / sh); shader_set_f("p1", tr[0] / sw, tr[1] / sh);
shader_set_f("p2", tl[0] / sw, tl[1] / sh); shader_set_f("p2", tl[0] / sw, tl[1] / sh);
shader_set_f("p3", bl[0] / sw, bl[1] / sh); shader_set_f("p3", bl[0] / sw, bl[1] / sh);
shader_set_i("tile", tile);
if(filt) gpu_set_tex_filter(true); // if(filt) gpu_set_tex_filter(true);
draw_surface_stretched(warp, 0, 0, sw, sh); draw_surface_stretched(warp, 0, 0, sw, sh);
if(filt) gpu_set_tex_filter(false); // if(filt) gpu_set_tex_filter(false);
surface_reset_shader(); surface_reset_shader();
} }
} }
@ -279,6 +285,7 @@ function Node_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
var tr = _data[2]; var tr = _data[2];
var bl = _data[3]; var bl = _data[3];
var br = _data[4]; var br = _data[4];
var tile = _data[8];
var _useDim = _data[6]; var _useDim = _data[6];
var _dim = _data[7]; var _dim = _data[7];
@ -288,7 +295,7 @@ function Node_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
var sw = _useDim? _dim[0] : surface_get_width_safe(_data[0]); var sw = _useDim? _dim[0] : surface_get_width_safe(_data[0]);
var sh = _useDim? _dim[1] : surface_get_height_safe(_data[0]); var sh = _useDim? _dim[1] : surface_get_height_safe(_data[0]);
warpSurface(_outSurf, _data[0], sw, sh, tl, tr, bl, br); warpSurface(_outSurf, _data[0], sw, sh, tl, tr, bl, br, tile);
return _outSurf; return _outSurf;
} }

View file

@ -7,34 +7,33 @@ function Node_Warp_Perspective(_x, _y, _group = noone) : Node_Processor(_x, _y,
active_index = 1; active_index = 1;
newInput(2, nodeValue_Vec2("Top left", self, [ 0, 0 ] )) newInput(2, nodeValue_Vec2("Top left", self, [ 0, 0 ] ))
.setUnitRef(function(index) { return getDimension(index); }); .setUnitRef(function(index) /*=>*/ {return getDimension(index)}, VALUE_UNIT.reference);
newInput(3, nodeValue_Vec2("Top right", self, [ DEF_SURF_W, 0 ] )) newInput(3, nodeValue_Vec2("Top right", self, [ 1, 0 ] ))
.setUnitRef(function(index) { return getDimension(index); }); .setUnitRef(function(index) /*=>*/ {return getDimension(index)}, VALUE_UNIT.reference);
newInput(4, nodeValue_Vec2("Bottom left", self, [ 0, DEF_SURF_H ] )) newInput(4, nodeValue_Vec2("Bottom left", self, [ 0, 1 ] ))
.setUnitRef(function(index) { return getDimension(index); }); .setUnitRef(function(index) /*=>*/ {return getDimension(index)}, VALUE_UNIT.reference);
newInput(5, nodeValue_Vec2("Bottom right", self, DEF_SURF )) newInput(5, nodeValue_Vec2("Bottom right", self, [ 1, 1 ] ))
.setUnitRef(function(index) { return getDimension(index); }); .setUnitRef(function(index) /*=>*/ {return getDimension(index)}, VALUE_UNIT.reference);
newInput(6, nodeValue_Vec2("Top left", self, [ 0, 0 ] )) newInput(6, nodeValue_Vec2("Top left", self, [ 0, 0 ] ))
.setUnitRef(function(index) { return getDimension(index); }); .setUnitRef(function(index) /*=>*/ {return getDimension(index)}, VALUE_UNIT.reference);
newInput(7, nodeValue_Vec2("Top right", self, [ DEF_SURF_W, 0 ] )) newInput(7, nodeValue_Vec2("Top right", self, [ 1, 0 ] ))
.setUnitRef(function(index) { return getDimension(index); }); .setUnitRef(function(index) /*=>*/ {return getDimension(index)}, VALUE_UNIT.reference);
newInput(8, nodeValue_Vec2("Bottom left", self, [ 0, DEF_SURF_H ] )) newInput(8, nodeValue_Vec2("Bottom left", self, [ 0, 1 ] ))
.setUnitRef(function(index) { return getDimension(index); }); .setUnitRef(function(index) /*=>*/ {return getDimension(index)}, VALUE_UNIT.reference);
newInput(9, nodeValue_Vec2("Bottom right", self, DEF_SURF )) newInput(9, nodeValue_Vec2("Bottom right", self, [ 1, 1 ] ))
.setUnitRef(function(index) { return getDimension(index); }); .setUnitRef(function(index) /*=>*/ {return getDimension(index)}, VALUE_UNIT.reference);
outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone); outputs[0] = nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone);
input_display_list = [ 1, input_display_list = [ 1,
["Surfaces", false], 0, ["Surfaces", false], 0,
["Origin", false], 2, 3, 4, 5,
["Warp", false], 6, 7, 8, 9, ["Warp", false], 6, 7, 8, 9,
] ]
@ -187,30 +186,20 @@ function Node_Warp_Perspective(_x, _y, _group = noone) : Node_Processor(_x, _y,
} }
static processData = function(_outSurf, _data, _output_index, _array_index) { static processData = function(_outSurf, _data, _output_index, _array_index) {
var Ftl = _data[2]; var tl = _data[6];
var Ftr = _data[3]; var tr = _data[7];
var Fbl = _data[4]; var bl = _data[8];
var Fbr = _data[5]; var br = _data[9];
var Ttl = _data[6];
var Ttr = _data[7];
var Tbl = _data[8];
var Tbr = _data[9];
var sw = surface_get_width_safe(_data[0]); var sw = surface_get_width_safe(_data[0]);
var sh = surface_get_height_safe(_data[0]); var sh = surface_get_height_safe(_data[0]);
surface_set_shader(_outSurf, sh_warp_4points_pers); surface_set_shader(_outSurf, sh_warp_4points_pers);
shader_set_interpolation(_data[0]); shader_set_interpolation(_data[0]);
shader_set_f("f1", Fbr[0] / sw, Fbr[1] / sh); shader_set_f("t1", tl[0] / sw, tl[1] / sh);
shader_set_f("f2", Ftr[0] / sw, Ftr[1] / sh); shader_set_f("t2", tr[0] / sw, tr[1] / sh);
shader_set_f("f3", Ftl[0] / sw, Ftl[1] / sh); shader_set_f("t3", bl[0] / sw, bl[1] / sh);
shader_set_f("f4", Fbl[0] / sw, Fbl[1] / sh); shader_set_f("t4", br[0] / sw, br[1] / sh);
shader_set_f("t1", Tbr[0] / sw, Tbr[1] / sh);
shader_set_f("t2", Ttr[0] / sw, Ttr[1] / sh);
shader_set_f("t3", Ttl[0] / sw, Ttl[1] / sh);
shader_set_f("t4", Tbl[0] / sw, Tbl[1] / sh);
draw_surface_safe(_data[0]); draw_surface_safe(_data[0]);
surface_reset_shader(); surface_reset_shader();

View file

@ -1,10 +1,11 @@
#define PALETTE_LIMIT 1024
// //
// Simple passthrough fragment shader // Simple passthrough fragment shader
// //
varying vec2 v_vTexcoord; varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
uniform vec4 colorFrom[32]; uniform vec4 colorFrom[PALETTE_LIMIT];
uniform int colorFrom_amo; uniform int colorFrom_amo;
uniform int invert; uniform int invert;

View file

@ -1,10 +1,11 @@
#define PALETTE_LIMIT 1024
// //
// Simple passthrough fragment shader // Simple passthrough fragment shader
// //
varying vec2 v_vTexcoord; varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
uniform vec4 colorFrom[32]; uniform vec4 colorFrom[PALETTE_LIMIT];
uniform int colorFrom_amo; uniform int colorFrom_amo;
uniform vec4 colorTo; uniform vec4 colorTo;
uniform int inverted; uniform int inverted;

View file

@ -1,13 +1,14 @@
#define PALETTE_LIMIT 1024
// //
// Simple passthrough fragment shader // Simple passthrough fragment shader
// //
varying vec2 v_vTexcoord; varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
uniform vec4 colorFrom[64]; uniform vec4 colorFrom[PALETTE_LIMIT];
uniform int colorFromAmount; uniform int colorFromAmount;
uniform vec4 colorTo[64]; uniform vec4 colorTo[PALETTE_LIMIT];
uniform int colorToAmount; uniform int colorToAmount;
uniform int useMask; uniform int useMask;

View file

@ -0,0 +1,9 @@
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform vec2 tiling;
void main() {
vec2 px = fract(v_vTexcoord * tiling);
gl_FragColor = texture2D( gm_BaseTexture, px );
}

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,12 @@
{
"$GMShader":"",
"%Name":"sh_d3d_3d_transform",
"name":"sh_d3d_3d_transform",
"parent":{
"name":"3d",
"path":"folders/shader/3d.yy",
},
"resourceType":"GMShader",
"resourceVersion":"2.0",
"type":1,
}

View file

@ -1,6 +1,8 @@
// //
// Simple passthrough fragment shader // Simple passthrough fragment shader
// //
#define PALETTE_LIMIT 1024
varying vec2 v_vTexcoord; varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
@ -15,7 +17,7 @@ uniform int useConMap;
uniform float ditherSize; uniform float ditherSize;
uniform float dither[64]; uniform float dither[64];
uniform vec2 dimension; uniform vec2 dimension;
uniform vec4 palette[1024]; uniform vec4 palette[PALETTE_LIMIT];
uniform int keys; uniform int keys;
uniform float seed; uniform float seed;

View file

@ -1,3 +1,4 @@
#define TAU 6.28318530718
varying vec2 v_vTexcoord; varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
@ -32,6 +33,26 @@ float fnoise(vec2 pos, float siz, float dist) {
return lig; return lig;
} }
////////////////////////////////////////////////////////////////////////////////////////////////
uniform int flickerUse;
uniform float flickerIntens;
uniform float flickerCut;
uniform float flickerTime;
float flick(vec2 id) {
if(flickerUse == 0) return 1.;
float dl = flickerTime + random(id, seed) * TAU;
float ww = .8 * abs(sin(dl)) +
.2 * sin((dl + random(id, seed + 12.41)) * 2.) +
.1 * sin((dl + random(id, seed + 65.35)) * 3.);
ww = smoothstep(flickerCut, 1., ww);
return 1. - ww * flickerIntens;
}
////////////////////////////////////////////////////////////////////////////////////////////////
void main() { void main() {
vec2 scs = vec2(scale) * 2.; vec2 scs = vec2(scale) * 2.;
vec2 pos = v_vTexcoord - .5; vec2 pos = v_vTexcoord - .5;
@ -70,10 +91,11 @@ void main() {
lig = mix(lig, lig * ridge, 1.); lig = mix(lig, lig * ridge, 1.);
} }
float ints = intensity * flick(id);
vec3 clr = vec3(0.); vec3 clr = vec3(0.);
if(indx == 0) clr.r = intensity; if(indx == 0) clr.r = ints;
else if(indx == 1) clr.g = intensity; else if(indx == 1) clr.g = ints;
else if(indx == 2) clr.b = intensity; else if(indx == 2) clr.b = ints;
clr *= lig; clr *= lig;
vec3 baseC = texture2D( gm_BaseTexture, uv ).rgb; vec3 baseC = texture2D( gm_BaseTexture, uv ).rgb;

View file

@ -1,3 +1,4 @@
#define TAU 6.28318530718
#define s3 1. #define s3 1.
varying vec2 v_vTexcoord; varying vec2 v_vTexcoord;
@ -53,6 +54,26 @@ float fnoise(vec2 pos, float siz, float dist) {
return lig; return lig;
} }
////////////////////////////////////////////////////////////////////////////////////////////////
uniform int flickerUse;
uniform float flickerIntens;
uniform float flickerCut;
uniform float flickerTime;
float flick(vec2 id) {
if(flickerUse == 0) return 1.;
float dl = flickerTime + random(id, seed) * TAU;
float ww = .8 * abs(sin(dl)) +
.2 * sin((dl + random(id, seed + 12.41)) * 2.) +
.1 * sin((dl + random(id, seed + 65.35)) * 3.);
ww = smoothstep(flickerCut, 1., ww);
return 1. - ww * flickerIntens;
}
////////////////////////////////////////////////////////////////////////////////////////////////
void main() { void main() {
vec2 scs = scale * vec2(2.); vec2 scs = scale * vec2(2.);
vec2 pos = v_vTexcoord - .5; vec2 pos = v_vTexcoord - .5;
@ -70,11 +91,12 @@ void main() {
id = abs(dimension + id); id = abs(dimension + id);
if(md(id.y, s3) > s3 / 2.) ind += 2.; if(md(id.y, s3) > s3 / 2.) ind += 2.;
float ints = intensity * flick(id);
int indx = int(mod(ind, 3.)); int indx = int(mod(ind, 3.));
vec3 clr = vec3(0.); vec3 clr = vec3(0.);
if(indx == 0) clr.r = intensity; if(indx == 0) clr.r = ints;
else if(indx == 1) clr.g = intensity; else if(indx == 1) clr.g = ints;
else if(indx == 2) clr.b = intensity; else if(indx == 2) clr.b = ints;
clr *= lig; clr *= lig;
vec2 uv = (hex / scs + .5) / vec2(dimension.x / dimension.y, 1.); vec2 uv = (hex / scs + .5) / vec2(dimension.x / dimension.y, 1.);

View file

@ -58,6 +58,26 @@ float fnoise(vec2 pos, float siz, float dist) {
return lig; return lig;
} }
////////////////////////////////////////////////////////////////////////////////////////////////
uniform int flickerUse;
uniform float flickerIntens;
uniform float flickerCut;
uniform float flickerTime;
float flick(vec2 id) {
if(flickerUse == 0) return 1.;
float dl = flickerTime + random(id, seed) * TAU;
float ww = .8 * abs(sin(dl)) +
.2 * sin((dl + random(id, seed + 12.41)) * 2.) +
.1 * sin((dl + random(id, seed + 65.35)) * 3.);
ww = smoothstep(flickerCut, 1., ww);
return 1. - ww * flickerIntens;
}
////////////////////////////////////////////////////////////////////////////////////////////////
void main() { void main() {
vec2 scs = scale * vec2(3., s3 * 2.); vec2 scs = scale * vec2(3., s3 * 2.);
vec2 pos = v_vTexcoord - .5; vec2 pos = v_vTexcoord - .5;
@ -79,11 +99,12 @@ void main() {
id = abs(dimension + id); id = abs(dimension + id);
if(md(id.y, s3) > s3 / 2.) ind += 1.; if(md(id.y, s3) > s3 / 2.) ind += 1.;
float ints = intensity * flick(id);
int indx = int(mod(ind, 3.)); int indx = int(mod(ind, 3.));
vec3 clr = vec3(0.); vec3 clr = vec3(0.);
if(indx == 0) clr.r = intensity; if(indx == 0) clr.r = ints;
else if(indx == 1) clr.g = intensity; else if(indx == 1) clr.g = ints;
else if(indx == 2) clr.b = intensity; else if(indx == 2) clr.b = ints;
clr *= lig; clr *= lig;
vec2 uv = (hex / scs + .5) / vec2(dimension.x / dimension.y, 1.); vec2 uv = (hex / scs + .5) / vec2(dimension.x / dimension.y, 1.);

View file

@ -1,3 +1,4 @@
#define TAU 6.28318530718
varying vec2 v_vTexcoord; varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
@ -32,6 +33,26 @@ float fnoise(vec2 pos, float siz, float dist) {
return lig; return lig;
} }
////////////////////////////////////////////////////////////////////////////////////////////////
uniform int flickerUse;
uniform float flickerIntens;
uniform float flickerCut;
uniform float flickerTime;
float flick(vec2 id) {
if(flickerUse == 0) return 1.;
float dl = flickerTime + random(id, seed) * TAU;
float ww = .8 * abs(sin(dl)) +
.2 * sin((dl + random(id, seed + 12.41)) * 2.) +
.1 * sin((dl + random(id, seed + 65.35)) * 3.);
ww = smoothstep(flickerCut, 1., ww);
return 1. - ww * flickerIntens;
}
////////////////////////////////////////////////////////////////////////////////////////////////
void main() { void main() {
vec2 scs = vec2(scale) * 2.; vec2 scs = vec2(scale) * 2.;
vec2 pos = v_vTexcoord - .5; vec2 pos = v_vTexcoord - .5;
@ -52,11 +73,12 @@ void main() {
lig = mix(lig, lig * ridge, 1.); lig = mix(lig, lig * ridge, 1.);
} }
float ints = intensity * flick(id);
int indx = int(mod(ind, 3.)); int indx = int(mod(ind, 3.));
vec3 clr = vec3(0.); vec3 clr = vec3(0.);
if(indx == 0) clr.r = intensity; if(indx == 0) clr.r = ints;
else if(indx == 1) clr.g = intensity; else if(indx == 1) clr.g = ints;
else if(indx == 2) clr.b = intensity; else if(indx == 2) clr.b = ints;
clr *= lig; clr *= lig;
vec3 baseC = texture2D( gm_BaseTexture, uv ).rgb; vec3 baseC = texture2D( gm_BaseTexture, uv ).rgb;

View file

@ -1,3 +1,4 @@
#define TAU 6.28318530718
varying vec2 v_vTexcoord; varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
@ -32,6 +33,26 @@ float fnoise(vec2 pos, float siz, float dist) {
return lig; return lig;
} }
////////////////////////////////////////////////////////////////////////////////////////////////
uniform int flickerUse;
uniform float flickerIntens;
uniform float flickerCut;
uniform float flickerTime;
float flick(vec2 id) {
if(flickerUse == 0) return 1.;
float dl = flickerTime + random(id, seed) * TAU;
float ww = .8 * abs(sin(dl)) +
.2 * sin((dl + random(id, seed + 12.41)) * 2.) +
.1 * sin((dl + random(id, seed + 65.35)) * 3.);
ww = smoothstep(flickerCut, 1., ww);
return 1. - ww * flickerIntens;
}
////////////////////////////////////////////////////////////////////////////////////////////////
void main() { void main() {
vec2 scs = vec2(scale) * 2.; vec2 scs = vec2(scale) * 2.;
vec2 pos = v_vTexcoord - .5; vec2 pos = v_vTexcoord - .5;
@ -60,10 +81,11 @@ void main() {
lig = mix(lig, lig * ridge, 1.); lig = mix(lig, lig * ridge, 1.);
} }
float ints = intensity * flick(id);
vec3 clr = vec3(0.); vec3 clr = vec3(0.);
if(indx == 0) clr.r = intensity; if(indx == 0) clr.r = ints;
else if(indx == 1) clr.g = intensity; else if(indx == 1) clr.g = ints;
else if(indx == 2) clr.b = intensity; else if(indx == 2) clr.b = ints;
clr *= lig; clr *= lig;
vec3 baseC = texture2D( gm_BaseTexture, uv ).rgb; vec3 baseC = texture2D( gm_BaseTexture, uv ).rgb;

View file

@ -1,3 +1,4 @@
#define TAU 6.28318530718
varying vec2 v_vTexcoord; varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
@ -32,6 +33,26 @@ float fnoise(vec2 pos, float siz, float dist) {
return lig; return lig;
} }
////////////////////////////////////////////////////////////////////////////////////////////////
uniform int flickerUse;
uniform float flickerIntens;
uniform float flickerCut;
uniform float flickerTime;
float flick(vec2 id) {
if(flickerUse == 0) return 1.;
float dl = flickerTime + random(id, seed) * TAU;
float ww = .8 * abs(sin(dl)) +
.2 * sin((dl + random(id, seed + 12.41)) * 2.) +
.1 * sin((dl + random(id, seed + 65.35)) * 3.);
ww = smoothstep(flickerCut, 1., ww);
return 1. - ww * flickerIntens;
}
////////////////////////////////////////////////////////////////////////////////////////////////
void main() { void main() {
vec2 scs = vec2(scale) * 2.; vec2 scs = vec2(scale) * 2.;
vec2 pos = v_vTexcoord - .5; vec2 pos = v_vTexcoord - .5;
@ -64,10 +85,11 @@ void main() {
lig = mix(lig, lig * ridge, 1.); lig = mix(lig, lig * ridge, 1.);
} }
float ints = intensity * flick(id);
vec3 clr = vec3(0.); vec3 clr = vec3(0.);
if(indx == 0) clr.r = intensity; if(indx == 0) clr.r = ints;
else if(indx == 1) clr.g = intensity; else if(indx == 1) clr.g = ints;
else if(indx == 2) clr.b = intensity; else if(indx == 2) clr.b = ints;
clr *= lig; clr *= lig;
vec3 baseC = texture2D( gm_BaseTexture, uv ).rgb; vec3 baseC = texture2D( gm_BaseTexture, uv ).rgb;

View file

@ -1,3 +1,4 @@
#define TAU 6.28318530718
varying vec2 v_vTexcoord; varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
@ -34,6 +35,26 @@ float fnoise(vec2 pos, float siz, float dist) {
return lig; return lig;
} }
////////////////////////////////////////////////////////////////////////////////////////////////
uniform int flickerUse;
uniform float flickerIntens;
uniform float flickerCut;
uniform float flickerTime;
float flick(vec2 id) {
if(flickerUse == 0) return 1.;
float dl = flickerTime + random(id, seed) * TAU;
float ww = .8 * abs(sin(dl)) +
.2 * sin((dl + random(id, seed + 12.41)) * 2.) +
.1 * sin((dl + random(id, seed + 65.35)) * 3.);
ww = smoothstep(flickerCut, 1., ww);
return 1. - ww * flickerIntens;
}
////////////////////////////////////////////////////////////////////////////////////////////////
void main() { void main() {
vec2 scs = vec2(scale) * 2.; vec2 scs = vec2(scale) * 2.;
vec2 pos = v_vTexcoord - .5; vec2 pos = v_vTexcoord - .5;
@ -61,10 +82,11 @@ void main() {
lig = mix(lig, lig * ridge, 1.); lig = mix(lig, lig * ridge, 1.);
} }
float ints = intensity * flick(id);
vec3 clr = vec3(0.); vec3 clr = vec3(0.);
if(indx == 0) clr.r = intensity; if(indx == 0) clr.r = ints;
else if(indx == 1) clr.g = intensity; else if(indx == 1) clr.g = ints;
else if(indx == 2) clr.b = intensity; else if(indx == 2) clr.b = ints;
clr *= lig; clr *= lig;
vec3 baseC = texture2D( gm_BaseTexture, uv ).rgb; vec3 baseC = texture2D( gm_BaseTexture, uv ).rgb;

View file

@ -1,3 +1,4 @@
#define TAU 6.28318530718
varying vec2 v_vTexcoord; varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
@ -34,6 +35,26 @@ float fnoise(vec2 pos, float siz, float dist) {
return lig; return lig;
} }
////////////////////////////////////////////////////////////////////////////////////////////////
uniform int flickerUse;
uniform float flickerIntens;
uniform float flickerCut;
uniform float flickerTime;
float flick(vec2 id) {
if(flickerUse == 0) return 1.;
float dl = flickerTime + random(id, seed) * TAU;
float ww = .8 * abs(sin(dl)) +
.2 * sin((dl + random(id, seed + 12.41)) * 2.) +
.1 * sin((dl + random(id, seed + 65.35)) * 3.);
ww = smoothstep(flickerCut, 1., ww);
return 1. - ww * flickerIntens;
}
////////////////////////////////////////////////////////////////////////////////////////////////
void main() { void main() {
vec2 scs = vec2(scale) * 2.; vec2 scs = vec2(scale) * 2.;
vec2 pos = v_vTexcoord - .5; vec2 pos = v_vTexcoord - .5;
@ -63,10 +84,11 @@ void main() {
lig = mix(lig, lig * ridge, 1.); lig = mix(lig, lig * ridge, 1.);
} }
float ints = intensity * flick(id);
vec3 clr = vec3(0.); vec3 clr = vec3(0.);
if(indx == 0) clr.r = intensity; if(indx == 0) clr.r = ints;
else if(indx == 1) clr.g = intensity; else if(indx == 1) clr.g = ints;
else if(indx == 2) clr.b = intensity; else if(indx == 2) clr.b = ints;
clr *= lig; clr *= lig;
vec3 baseC = texture2D( gm_BaseTexture, uv ).rgb; vec3 baseC = texture2D( gm_BaseTexture, uv ).rgb;

View file

@ -7,9 +7,10 @@ varying vec4 v_vColour;
uniform int useMask; uniform int useMask;
uniform sampler2D mask; uniform sampler2D mask;
uniform vec4 colorFrom[32]; #define PALETTE_LIMIT 1024
uniform vec4 colorFrom[PALETTE_LIMIT];
uniform int colorFrom_amo; uniform int colorFrom_amo;
uniform vec4 colorTo[32]; uniform vec4 colorTo[PALETTE_LIMIT];
uniform int colorTo_amo; uniform int colorTo_amo;
uniform float seed; uniform float seed;

View file

@ -4,7 +4,8 @@
varying vec2 v_vTexcoord; varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
uniform vec4 palette[64]; #define PALETTE_LIMIT 1024
uniform vec4 palette[PALETTE_LIMIT];
uniform float paletteAmount; uniform float paletteAmount;
uniform float shift; uniform float shift;

View file

@ -4,7 +4,8 @@
varying vec2 v_vTexcoord; varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
uniform vec4 colors[32]; #define PALETTE_LIMIT 1024
uniform vec4 colors[PALETTE_LIMIT];
uniform float colorAmount; uniform float colorAmount;
uniform float seed; uniform float seed;

View file

@ -9,8 +9,10 @@ uniform int aa;
uniform int sides; uniform int sides;
uniform int tile; uniform int tile;
uniform int drawBG;
uniform int drawDF; uniform int drawDF;
uniform vec2 dfLevel; uniform vec2 dfLevel;
uniform vec2 dfLevelOut;
uniform float rotation; uniform float rotation;
uniform float angle; uniform float angle;
@ -28,6 +30,7 @@ uniform vec2 dimension;
uniform vec2 center; uniform vec2 center;
uniform vec2 scale; uniform vec2 scale;
uniform vec2 trep; uniform vec2 trep;
uniform float shapeScale;
uniform int teeth; uniform int teeth;
uniform vec2 teethSize; uniform vec2 teethSize;
@ -296,7 +299,6 @@ float sdArrow( in vec2 p, float w1, float w2, float k ) { // The arrow goes from
} }
void main() { void main() {
float color = 0.;
vec2 coord = (v_vTexcoord - center) * mat2(cos(rotation), -sin(rotation), sin(rotation), cos(rotation)) / scale; vec2 coord = (v_vTexcoord - center) * mat2(cos(rotation), -sin(rotation), sin(rotation), cos(rotation)) / scale;
vec2 ratio = dimension / dimension.y; vec2 ratio = dimension / dimension.y;
float d; float d;
@ -318,31 +320,40 @@ void main() {
d = sdStar( coord, 0.9 - corner, sides, 2. + inner * (float(sides) - 2.), angle ); d = sdStar( coord, 0.9 - corner, sides, 2. + inner * (float(sides) - 2.), angle );
d -= corner; d -= corner;
} else if(shape == 4) d = sdArc( coord, vec2(sin(angle), cos(angle)), angle_range, 0.9 - inner, inner ); } else if(shape == 4) { d = sdArc( coord, vec2(sin(angle), cos(angle)), angle_range, 0.9 - inner, inner ); }
else if(shape == 5) d = sdTearDrop( coord + vec2(0., 0.5), stRad, edRad, 1. ); else if(shape == 5) { d = sdTearDrop( coord + vec2(0., 0.5), stRad, edRad, 1. ); }
else if(shape == 6) d = sdCross( coord, vec2(1. + corner, outer), corner ); else if(shape == 6) { d = sdCross( coord, vec2(1. + corner, outer), corner ); }
else if(shape == 7) d = sdVesica( coord, inner, outer ); else if(shape == 7) { d = sdVesica( coord, inner, outer ); }
else if(shape == 8) d = sdCrescent( coord, inner, outer, angle ); else if(shape == 8) { d = sdCrescent( coord, inner, outer, angle ); }
else if(shape == 9) d = sdDonut( coord, inner ); else if(shape == 9) { d = sdDonut( coord, inner ); }
else if(shape == 10) d = sdRhombus( coord, vec2(1. - corner) ) - corner; else if(shape == 10) { d = sdRhombus( coord, vec2(1. - corner) ) - corner; }
else if(shape == 11) d = sdTrapezoid( coord, trep.x - corner, trep.y - corner, 1. - corner ) - corner; else if(shape == 11) { d = sdTrapezoid( coord, trep.x - corner, trep.y - corner, 1. - corner ) - corner; }
else if(shape == 12) d = sdParallelogram( coord, 1. - corner - parall, 1. - corner, parall) - corner; else if(shape == 12) { d = sdParallelogram( coord, 1. - corner - parall, 1. - corner, parall) - corner; }
else if(shape == 13) d = sdHeart( coord ); else if(shape == 13) { d = sdHeart( coord ); }
else if(shape == 14) d = sdCutDisk( coord, 1., inner ); else if(shape == 14) { d = sdCutDisk( coord, 1., inner ); }
else if(shape == 15) d = sdPie( coord, vec2(sin(angle), cos(angle)), 1. ); else if(shape == 15) { d = sdPie( coord, vec2(sin(angle), cos(angle)), 1. ); }
else if(shape == 16) d = sdRoundedCross( coord, 1. - corner ) - corner; else if(shape == 16) { d = sdRoundedCross( coord, 1. - corner ) - corner; }
else if(shape == 17) d = sdArrow( coord, arrow.x, arrow.y, arrow_head); else if(shape == 17) { d = sdArrow( coord, arrow.x, arrow.y, arrow_head); }
else if(shape == 18) d = sdGear( coord, inner, teeth, teethSize, teethAngle); else if(shape == 18) { d = sdGear( coord, inner, teeth, teethSize, teethAngle); }
if(drawDF == 1) { float cc, color = 0.;
color = -d;
color = (color - dfLevel.x) / (dfLevel.y - dfLevel.x); if(aa == 0)
} else if(aa == 0) cc = step(d, 0.0);
color = step(d, 0.0);
else { else {
float _aa = 1. / max(dimension.x, dimension.y); float _aa = 1. / max(dimension.x, dimension.y);
color = smoothstep(_aa, -_aa, d); cc = smoothstep(_aa, -_aa, d);
} }
color = cc;
if(drawDF == 1) {
color = -d;
color = smoothstep(dfLevelOut[0], dfLevelOut[1], clamp((color - dfLevel.x) / (dfLevel.y - dfLevel.x), 0., 1.));
color *= cc;
}
if(drawBG == 0)
gl_FragColor = vec4(v_vColour.rgb, color);
else
gl_FragColor = mix(bgColor, v_vColour, color); gl_FragColor = mix(bgColor, v_vColour, color);
} }

View file

@ -17,6 +17,7 @@ uniform int sampleMode;
uniform int alpha; uniform int alpha;
uniform int modulateStr; uniform int modulateStr;
uniform int inv; uniform int inv;
uniform int blend;
vec4 sampleTexture(vec2 pos) { #region vec4 sampleTexture(vec2 pos) { #region
if(pos.x >= 0. && pos.y >= 0. && pos.x <= 1. && pos.y <= 1.) if(pos.x >= 0. && pos.y >= 0. && pos.x <= 1. && pos.y <= 1.)
@ -113,7 +114,8 @@ void main() {
vec2 dirr = vec2(sin(r), cos(r)) * str; vec2 dirr = vec2(sin(r), cos(r)) * str;
vec4 smr = smear(dirr); vec4 smr = smear(dirr);
col = max(col, smr); if(blend == 0) col = max(col, smr);
else if(blend == 1) col += smr;
} }
gl_FragColor = col; gl_FragColor = col;

View file

@ -6,6 +6,7 @@ uniform vec2 p1;
uniform vec2 p2; uniform vec2 p2;
uniform vec2 p3; uniform vec2 p3;
uniform vec2 dimension; uniform vec2 dimension;
uniform int tile;
#region /////////////// SAMPLING /////////////// #region /////////////// SAMPLING ///////////////
@ -123,6 +124,8 @@ void main() {
} }
#endregion #endregion
if(tile == 1) uv = fract(1. + fract(uv));
if(uv.x >= 0. && uv.y >= 0. && uv.x <= 1. && uv.y <= 1.) if(uv.x >= 0. && uv.y >= 0. && uv.x <= 1. && uv.y <= 1.)
gl_FragColor = texture2Dintp( gm_BaseTexture, uv ); gl_FragColor = texture2Dintp( gm_BaseTexture, uv );
else else

View file

@ -4,10 +4,6 @@
varying vec2 v_vTexcoord; varying vec2 v_vTexcoord;
varying vec4 v_vColour; varying vec4 v_vColour;
uniform vec2 f1;
uniform vec2 f2;
uniform vec2 f3;
uniform vec2 f4;
uniform vec2 t1; uniform vec2 t1;
uniform vec2 t2; uniform vec2 t2;
uniform vec2 t3; uniform vec2 t3;
@ -87,62 +83,58 @@ vec4 texture2Dintp( sampler2D texture, vec2 uv ) {
/////////////// SAMPLING /////////////// /////////////// SAMPLING ///////////////
mat3 m_inverse(mat3 m) { mat3 m_inverse(mat3 m) {
float a11 = m[0][0], a12 = m[0][1], a13 = m[0][2]; float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];
float a21 = m[1][0], a22 = m[1][1], a23 = m[1][2]; float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];
float a31 = m[2][0], a32 = m[2][1], a33 = m[2][2]; float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];
float b11 = a22 * a33 - a23 * a32; float b01 = a22 * a11 - a12 * a21;
float b12 = a13 * a32 - a12 * a33; float b11 = -a22 * a10 + a12 * a20;
float b13 = a12 * a23 - a13 * a22; float b21 = a21 * a10 - a11 * a20;
float b21 = a23 * a31 - a21 * a33;
float b22 = a11 * a33 - a13 * a31;
float b23 = a13 * a21 - a11 * a23;
float b31 = a21 * a32 - a22 * a31;
float b32 = a12 * a31 - a11 * a32;
float b33 = a11 * a22 - a12 * a21;
float det = a11 * b11 + a12 * b21 + a13 * b31; float det = a00 * b01 + a01 * b11 + a02 * b21;
mat3 inverse; return mat3(b01, (-a22 * a01 + a02 * a21), ( a12 * a01 - a02 * a11),
inverse[0][0] = b11 / det; b11, ( a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),
inverse[0][1] = b12 / det; b21, (-a21 * a00 + a01 * a20), ( a11 * a00 - a01 * a10)) / det;
inverse[0][2] = b13 / det; }
inverse[1][0] = b21 / det;
inverse[1][1] = b22 / det;
inverse[1][2] = b23 / det;
inverse[2][0] = b31 / det;
inverse[2][1] = b32 / det;
inverse[2][2] = b33 / det;
return inverse; mat3 computeHomography() {
float x0 = 0., y0 = 0.;
float x1 = 1., y1 = 0.;
float x2 = 0., y2 = 1.;
float x3 = 1., y3 = 1.;
float u0 = t1.x, v0 = t1.y;
float u1 = t2.x, v1 = t2.y;
float u2 = t3.x, v2 = t3.y;
float u3 = t4.x, v3 = t4.y;
mat3 A = mat3(
x0, y0, 1.0,
x1, y1, 1.0,
x2, y2, 1.0
);
vec3 b1 = vec3(u0, u1, u2);
vec3 b2 = vec3(v0, v1, v2);
vec3 h1 = m_inverse(A) * b1;
vec3 h2 = m_inverse(A) * b2;
mat3 H = mat3(
h1.x, h1.y, h1.z,
h2.x, h2.y, h2.z,
0.0, 0.0, 1.0
);
return H;
} }
void main() { void main() {
vec3 p1 = vec3(f1, 1.0); mat3 H = computeHomography();
vec3 p2 = vec3(f2, 1.0);
vec3 p3 = vec3(f3, 1.0);
vec3 p4 = vec3(f4, 1.0);
vec3 q1 = vec3(t1, 1.0);
vec3 q2 = vec3(t2, 1.0);
vec3 q3 = vec3(t3, 1.0);
vec3 q4 = vec3(t4, 1.0);
mat3 A = mat3(p1, p2, p3); vec3 warpedCoord = H * vec3(v_vTexcoord, 1.0);
vec3 b = p4; vec2 finalCoord = warpedCoord.xy / warpedCoord.z;
vec3 x = m_inverse(A) * b;
vec3 h1 = x;
vec3 h2 = vec3(q2 - q1);
vec3 h3 = cross(h1, h2);
vec3 h4 = vec3(q3 - q1);
vec3 h5 = cross(h1, h4);
vec3 h6 = vec3(q4 - q1);
vec3 h7 = cross(h1, h6);
mat3 H = mat3(h2 / h3.x, h4 / h5.x, h6 / h7.x);
H[2][2] = 1.0 / h3.x;
vec3 coord = vec3(v_vTexcoord, 1.0); gl_FragColor = texture2D(gm_BaseTexture, finalCoord);
vec3 newCoord = H * coord;
vec2 texCoord = newCoord.xy / newCoord.z;
gl_FragColor = texture2Dintp(gm_BaseTexture, texCoord);
} }