mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-11-10 12:34:06 +01:00
- [Supporter] New Brush effect node.
This commit is contained in:
parent
1f48eefff5
commit
afbd7eab5a
@ -691,6 +691,7 @@
|
||||
{"name":"node_blur_zoom","order":10,"path":"scripts/node_blur_zoom/node_blur_zoom.yy",},
|
||||
{"name":"node_blur","order":2,"path":"scripts/node_blur/node_blur.yy",},
|
||||
{"name":"node_boolean","order":17,"path":"scripts/node_boolean/node_boolean.yy",},
|
||||
{"name":"node_brush_linear","order":24,"path":"scripts/node_brush_linear/node_brush_linear.yy",},
|
||||
{"name":"node_byte_file_read","order":21,"path":"scripts/node_byte_file_read/node_byte_file_read.yy",},
|
||||
{"name":"node_byte_file_write","order":20,"path":"scripts/node_byte_file_write/node_byte_file_write.yy",},
|
||||
{"name":"node_cache_array","order":8,"path":"scripts/node_cache_array/node_cache_array.yy",},
|
||||
@ -1279,6 +1280,7 @@
|
||||
{"name":"sh_blur_simple","order":10,"path":"shaders/sh_blur_simple/sh_blur_simple.yy",},
|
||||
{"name":"sh_blur_slope","order":11,"path":"shaders/sh_blur_slope/sh_blur_slope.yy",},
|
||||
{"name":"sh_blur_zoom","order":12,"path":"shaders/sh_blur_zoom/sh_blur_zoom.yy",},
|
||||
{"name":"sh_brush_linear","order":56,"path":"shaders/sh_brush_linear/sh_brush_linear.yy",},
|
||||
{"name":"sh_brush_outline","order":7,"path":"shaders/sh_brush_outline/sh_brush_outline.yy",},
|
||||
{"name":"sh_bw","order":3,"path":"shaders/sh_bw/sh_bw.yy",},
|
||||
{"name":"sh_canvas_apply_draw","order":3,"path":"shaders/sh_canvas_apply_draw/sh_canvas_apply_draw.yy",},
|
||||
@ -1902,6 +1904,7 @@
|
||||
{"name":"s_node_pin","order":2,"path":"sprites/s_node_pin/s_node_pin.yy",},
|
||||
{"name":"s_node_pixel_cloud","order":40,"path":"sprites/s_node_pixel_cloud/s_node_pixel_cloud.yy",},
|
||||
{"name":"s_node_pixel_find","order":18,"path":"sprites/s_node_pixel_find/s_node_pixel_find.yy",},
|
||||
{"name":"s_node_pixel_sampler","order":54,"path":"sprites/s_node_pixel_sampler/s_node_pixel_sampler.yy",},
|
||||
{"name":"s_node_pixel_sort","order":41,"path":"sprites/s_node_pixel_sort/s_node_pixel_sort.yy",},
|
||||
{"name":"s_node_plot_linear_type","order":10,"path":"sprites/s_node_plot_linear_type/s_node_plot_linear_type.yy",},
|
||||
{"name":"s_node_polar","order":5,"path":"sprites/s_node_polar/s_node_polar.yy",},
|
||||
|
@ -1097,6 +1097,7 @@
|
||||
{"id":{"name":"node_blur_zoom","path":"scripts/node_blur_zoom/node_blur_zoom.yy",},},
|
||||
{"id":{"name":"node_blur","path":"scripts/node_blur/node_blur.yy",},},
|
||||
{"id":{"name":"node_boolean","path":"scripts/node_boolean/node_boolean.yy",},},
|
||||
{"id":{"name":"node_brush_linear","path":"scripts/node_brush_linear/node_brush_linear.yy",},},
|
||||
{"id":{"name":"node_bw","path":"scripts/node_bw/node_bw.yy",},},
|
||||
{"id":{"name":"node_byte_file_read","path":"scripts/node_byte_file_read/node_byte_file_read.yy",},},
|
||||
{"id":{"name":"node_byte_file_write","path":"scripts/node_byte_file_write/node_byte_file_write.yy",},},
|
||||
@ -1778,6 +1779,7 @@
|
||||
{"id":{"name":"sh_blur_simple","path":"shaders/sh_blur_simple/sh_blur_simple.yy",},},
|
||||
{"id":{"name":"sh_blur_slope","path":"shaders/sh_blur_slope/sh_blur_slope.yy",},},
|
||||
{"id":{"name":"sh_blur_zoom","path":"shaders/sh_blur_zoom/sh_blur_zoom.yy",},},
|
||||
{"id":{"name":"sh_brush_linear","path":"shaders/sh_brush_linear/sh_brush_linear.yy",},},
|
||||
{"id":{"name":"sh_brush_outline","path":"shaders/sh_brush_outline/sh_brush_outline.yy",},},
|
||||
{"id":{"name":"sh_bw","path":"shaders/sh_bw/sh_bw.yy",},},
|
||||
{"id":{"name":"sh_camera","path":"shaders/sh_camera/sh_camera.yy",},},
|
||||
@ -2480,6 +2482,7 @@
|
||||
{"id":{"name":"s_node_pixel_builder","path":"sprites/s_node_pixel_builder/s_node_pixel_builder.yy",},},
|
||||
{"id":{"name":"s_node_pixel_cloud","path":"sprites/s_node_pixel_cloud/s_node_pixel_cloud.yy",},},
|
||||
{"id":{"name":"s_node_pixel_find","path":"sprites/s_node_pixel_find/s_node_pixel_find.yy",},},
|
||||
{"id":{"name":"s_node_pixel_sampler","path":"sprites/s_node_pixel_sampler/s_node_pixel_sampler.yy",},},
|
||||
{"id":{"name":"s_node_pixel_sort","path":"sprites/s_node_pixel_sort/s_node_pixel_sort.yy",},},
|
||||
{"id":{"name":"s_node_plot_linear_type","path":"sprites/s_node_plot_linear_type/s_node_plot_linear_type.yy",},},
|
||||
{"id":{"name":"s_node_polar","path":"sprites/s_node_polar/s_node_polar.yy",},},
|
||||
|
12
scripts/node_brush_linear/node_alpha_to_grey.yy
Normal file
12
scripts/node_brush_linear/node_alpha_to_grey.yy
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"isDnD": false,
|
||||
"isCompatibility": false,
|
||||
"parent": {
|
||||
"name": "filter",
|
||||
"path": "folders/nodes/data/filter.yy",
|
||||
},
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_alpha_to_grey",
|
||||
"tags": [],
|
||||
"resourceType": "GMScript",
|
||||
}
|
47
scripts/node_brush_linear/node_brush_linear.gml
Normal file
47
scripts/node_brush_linear/node_brush_linear.gml
Normal file
@ -0,0 +1,47 @@
|
||||
function Node_Brush_Linear(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Brush";
|
||||
|
||||
inputs[| 0] = nodeValue("Surface in", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
|
||||
|
||||
inputs[| 1] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
|
||||
active_index = 1;
|
||||
|
||||
inputs[| 2] = nodeValue("Iteration", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 10)
|
||||
.setValidator(VV_min(1));
|
||||
|
||||
inputs[| 3] = nodeValue("Seed", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, seed_random(6))
|
||||
.setDisplay(VALUE_DISPLAY._default, { side_button : button(function() { randomize(); inputs[| 3].setValue(seed_random(6)); }).setIcon(THEME.icon_random, 0, COLORS._main_icon) })
|
||||
|
||||
inputs[| 4] = nodeValue("Length", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 10);
|
||||
|
||||
inputs[| 5] = nodeValue("Attenuation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.99)
|
||||
.setDisplay(VALUE_DISPLAY.slider);
|
||||
|
||||
inputs[| 6] = nodeValue("Circulation", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.8)
|
||||
.setDisplay(VALUE_DISPLAY.slider);
|
||||
|
||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||
|
||||
input_display_list = [ 1,
|
||||
["Surface", false], 0,
|
||||
["Effect", false], 2, 4, 5, 6,
|
||||
];
|
||||
|
||||
attribute_surface_depth();
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
|
||||
surface_set_shader(_outSurf, sh_brush_linear);
|
||||
shader_set_f("dimension", surface_get_dimension(_data[0]));
|
||||
shader_set_f("seed", _data[3]);
|
||||
shader_set_i("convStepNums", _data[2]);
|
||||
shader_set_f("itrStepPixLen", _data[4]);
|
||||
shader_set_f("distanceAttenuation", _data[5]);
|
||||
shader_set_f("vectorCirculationRate", _data[6]);
|
||||
|
||||
draw_surface_safe(_data[0]);
|
||||
surface_reset_shader();
|
||||
|
||||
return _outSurf;
|
||||
} #endregion
|
||||
}
|
13
scripts/node_brush_linear/node_brush_linear.yy
Normal file
13
scripts/node_brush_linear/node_brush_linear.yy
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"$GMScript":"",
|
||||
"%Name":"node_brush_linear",
|
||||
"isCompatibility":false,
|
||||
"isDnD":false,
|
||||
"name":"node_brush_linear",
|
||||
"parent":{
|
||||
"name":"effects",
|
||||
"path":"folders/nodes/data/filter/effects.yy",
|
||||
},
|
||||
"resourceType":"GMScript",
|
||||
"resourceVersion":"2.0",
|
||||
}
|
12
scripts/node_brush_linear/node_bw.yy
Normal file
12
scripts/node_brush_linear/node_bw.yy
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"isDnD": false,
|
||||
"isCompatibility": false,
|
||||
"parent": {
|
||||
"name": "filter",
|
||||
"path": "folders/nodes/data/filter.yy",
|
||||
},
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_bw",
|
||||
"tags": [],
|
||||
"resourceType": "GMScript",
|
||||
}
|
12
scripts/node_brush_linear/node_color_adjustment.yy
Normal file
12
scripts/node_brush_linear/node_color_adjustment.yy
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"isDnD": false,
|
||||
"isCompatibility": false,
|
||||
"parent": {
|
||||
"name": "filter",
|
||||
"path": "folders/nodes/data/filter.yy",
|
||||
},
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_color_adjustment",
|
||||
"tags": [],
|
||||
"resourceType": "GMScript",
|
||||
}
|
12
scripts/node_brush_linear/node_color_replacement.yy
Normal file
12
scripts/node_brush_linear/node_color_replacement.yy
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"isDnD": false,
|
||||
"isCompatibility": false,
|
||||
"parent": {
|
||||
"name": "process",
|
||||
"path": "folders/nodes/data/process.yy",
|
||||
},
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_color_replacement",
|
||||
"tags": [],
|
||||
"resourceType": "GMScript",
|
||||
}
|
12
scripts/node_brush_linear/node_greyscale.yy
Normal file
12
scripts/node_brush_linear/node_greyscale.yy
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"isDnD": false,
|
||||
"isCompatibility": false,
|
||||
"parent": {
|
||||
"name": "filter",
|
||||
"path": "folders/nodes/data/filter.yy",
|
||||
},
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_greyscale",
|
||||
"tags": [],
|
||||
"resourceType": "GMScript",
|
||||
}
|
12
scripts/node_brush_linear/node_outline.yy
Normal file
12
scripts/node_brush_linear/node_outline.yy
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"isDnD": false,
|
||||
"isCompatibility": false,
|
||||
"parent": {
|
||||
"name": "process",
|
||||
"path": "folders/nodes/data/process.yy",
|
||||
},
|
||||
"resourceVersion": "1.0",
|
||||
"name": "node_outline",
|
||||
"tags": [],
|
||||
"resourceType": "GMScript",
|
||||
}
|
@ -574,6 +574,7 @@ function __initNodes() {
|
||||
addNodeObject(filter, "Average", s_node_average, "Node_Average", [1, Node_Average],, "Average color of every pixels in the image.").setVersion(1110);
|
||||
addNodeObject(filter, "Smear", s_node_smear, "Node_Smear", [1, Node_Smear]).setVersion(11670);
|
||||
addNodeObject(filter, "Kuwahara", s_node_kuwahara, "Node_Kuwahara", [1, Node_Kuwahara]).setVersion(11660);
|
||||
addNodeObject(filter, "Brush", s_node_brush_linear, "Node_Brush_Linear", [1, Node_Brush_Linear]).patreonExtra();
|
||||
|
||||
ds_list_add(filter, "Warps");
|
||||
addNodeObject(filter, "Mirror", s_node_mirror, "Node_Mirror", [1, Node_Mirror],, "Reflect the image along a reflection line.").setVersion(1070);
|
||||
|
45
shaders/sh_brush_linear/sh_brush_linear.fsh
Normal file
45
shaders/sh_brush_linear/sh_brush_linear.fsh
Normal file
@ -0,0 +1,45 @@
|
||||
varying vec2 v_vTexcoord;
|
||||
varying vec4 v_vColour;
|
||||
|
||||
const float PI = 3.14159265;
|
||||
const float ATR = PI / 180.;
|
||||
|
||||
uniform int convStepNums;
|
||||
uniform float itrStepPixLen;
|
||||
uniform float distanceAttenuation;
|
||||
uniform float vectorCirculationRate;
|
||||
|
||||
uniform vec2 dimension;
|
||||
uniform float seed;
|
||||
|
||||
vec4 getCol(vec2 pos) { return texture2D( gm_BaseTexture, pos / dimension); }
|
||||
float getD(vec2 pos) { return length(texture2D( gm_BaseTexture, pos / dimension)); }
|
||||
|
||||
vec2 grad( vec2 pos, float delta) {
|
||||
vec2 e = vec2(1., 0.) * delta;
|
||||
float o = getD(pos);
|
||||
|
||||
return vec2(getD(pos + e.xy) - o,
|
||||
getD(pos + e.yx) - o) / delta;
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 pos = v_vTexcoord * dimension;
|
||||
float r = 1.;
|
||||
float acc = 0.;
|
||||
vec4 res = vec4(0.);
|
||||
|
||||
for(int i = 0; i < convStepNums; i++) {
|
||||
res += getCol(pos) * r;
|
||||
|
||||
vec2 dir = grad(pos, itrStepPixLen) + vec2(1) * 0.001;
|
||||
|
||||
pos += 2. * normalize(mix(dir, dir.yx * vec2(1, -1), vectorCirculationRate));
|
||||
acc += r;
|
||||
r *= distanceAttenuation;
|
||||
}
|
||||
|
||||
res.xyz /= acc;
|
||||
|
||||
gl_FragColor = res;
|
||||
}
|
19
shaders/sh_brush_linear/sh_brush_linear.vsh
Normal file
19
shaders/sh_brush_linear/sh_brush_linear.vsh
Normal 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;
|
||||
}
|
12
shaders/sh_brush_linear/sh_brush_linear.yy
Normal file
12
shaders/sh_brush_linear/sh_brush_linear.yy
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"$GMShader":"",
|
||||
"%Name":"sh_brush_linear",
|
||||
"name":"sh_brush_linear",
|
||||
"parent":{
|
||||
"name":"filter",
|
||||
"path":"folders/shader/filter.yy",
|
||||
},
|
||||
"resourceType":"GMShader",
|
||||
"resourceVersion":"2.0",
|
||||
"type":1,
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
90
sprites/s_node_pixel_sampler/s_node_pixel_sampler.yy
Normal file
90
sprites/s_node_pixel_sampler/s_node_pixel_sampler.yy
Normal file
@ -0,0 +1,90 @@
|
||||
{
|
||||
"$GMSprite":"",
|
||||
"%Name":"s_node_pixel_sampler",
|
||||
"bboxMode":0,
|
||||
"bbox_bottom":63,
|
||||
"bbox_left":0,
|
||||
"bbox_right":63,
|
||||
"bbox_top":0,
|
||||
"collisionKind":1,
|
||||
"collisionTolerance":0,
|
||||
"DynamicTexturePage":false,
|
||||
"edgeFiltering":false,
|
||||
"For3D":false,
|
||||
"frames":[
|
||||
{"$GMSpriteFrame":"","%Name":"5cd79e3a-4e5e-4e0a-bf10-0ef7cf233abb","name":"5cd79e3a-4e5e-4e0a-bf10-0ef7cf233abb","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
|
||||
],
|
||||
"gridX":0,
|
||||
"gridY":0,
|
||||
"height":64,
|
||||
"HTile":false,
|
||||
"layers":[
|
||||
{"$GMImageLayer":"","%Name":"3e59a944-2103-46c1-93d6-8a5bb37a4772","blendMode":0,"displayName":"default","isLocked":false,"name":"3e59a944-2103-46c1-93d6-8a5bb37a4772","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
|
||||
],
|
||||
"name":"s_node_pixel_sampler",
|
||||
"nineSlice":null,
|
||||
"origin":4,
|
||||
"parent":{
|
||||
"name":"generator",
|
||||
"path":"folders/nodes/icons/generator.yy",
|
||||
},
|
||||
"preMultiplyAlpha":false,
|
||||
"resourceType":"GMSprite",
|
||||
"resourceVersion":"2.0",
|
||||
"sequence":{
|
||||
"$GMSequence":"",
|
||||
"%Name":"s_node_pixel_sampler",
|
||||
"autoRecord":true,
|
||||
"backdropHeight":768,
|
||||
"backdropImageOpacity":0.5,
|
||||
"backdropImagePath":"",
|
||||
"backdropWidth":1366,
|
||||
"backdropXOffset":0.0,
|
||||
"backdropYOffset":0.0,
|
||||
"events":{
|
||||
"$KeyframeStore<MessageEventKeyframe>":"",
|
||||
"Keyframes":[],
|
||||
"resourceType":"KeyframeStore<MessageEventKeyframe>",
|
||||
"resourceVersion":"2.0",
|
||||
},
|
||||
"eventStubScript":null,
|
||||
"eventToFunction":{},
|
||||
"length":1.0,
|
||||
"lockOrigin":false,
|
||||
"moments":{
|
||||
"$KeyframeStore<MomentsEventKeyframe>":"",
|
||||
"Keyframes":[],
|
||||
"resourceType":"KeyframeStore<MomentsEventKeyframe>",
|
||||
"resourceVersion":"2.0",
|
||||
},
|
||||
"name":"s_node_pixel_sampler",
|
||||
"playback":1,
|
||||
"playbackSpeed":30.0,
|
||||
"playbackSpeedType":0,
|
||||
"resourceType":"GMSequence",
|
||||
"resourceVersion":"2.0",
|
||||
"showBackdrop":true,
|
||||
"showBackdropImage":false,
|
||||
"timeUnits":1,
|
||||
"tracks":[
|
||||
{"$GMSpriteFramesTrack":"","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"$KeyframeStore<SpriteFrameKeyframe>":"","Keyframes":[
|
||||
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
|
||||
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"5cd79e3a-4e5e-4e0a-bf10-0ef7cf233abb","path":"sprites/s_node_pixel_sampler/s_node_pixel_sampler.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
|
||||
},"Disabled":false,"id":"789f259f-d6e6-4849-84e6-8a586d889f70","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
|
||||
],"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
|
||||
],
|
||||
"visibleRange":null,
|
||||
"volume":1.0,
|
||||
"xorigin":32,
|
||||
"yorigin":32,
|
||||
},
|
||||
"swatchColours":null,
|
||||
"swfPrecision":0.5,
|
||||
"textureGroupId":{
|
||||
"name":"Default",
|
||||
"path":"texturegroups/Default",
|
||||
},
|
||||
"type":0,
|
||||
"VTile":false,
|
||||
"width":64,
|
||||
}
|
Loading…
Reference in New Issue
Block a user