mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2025-02-23 10:25:42 +01:00
New Vector normalize node.
This commit is contained in:
parent
a3fc6c57e6
commit
2f6dd9ebc1
18 changed files with 230 additions and 43 deletions
|
@ -1230,6 +1230,7 @@
|
|||
{"name":"node_vector_cross_3D","order":1,"path":"scripts/node_vector_cross_3D/node_vector_cross_3D.yy",},
|
||||
{"name":"node_vector_dot","order":2,"path":"scripts/node_vector_dot/node_vector_dot.yy",},
|
||||
{"name":"node_vector_magnitude","order":7,"path":"scripts/node_vector_magnitude/node_vector_magnitude.yy",},
|
||||
{"name":"node_vector_normalize","order":9,"path":"scripts/node_vector_normalize/node_vector_normalize.yy",},
|
||||
{"name":"node_vector_split","order":3,"path":"scripts/node_vector_split/node_vector_split.yy",},
|
||||
{"name":"node_vector_swizzle","order":8,"path":"scripts/node_vector_swizzle/node_vector_swizzle.yy",},
|
||||
{"name":"node_vector2","order":4,"path":"scripts/node_vector2/node_vector2.yy",},
|
||||
|
@ -1394,7 +1395,6 @@
|
|||
{"name":"theme_definition","order":14,"path":"scripts/theme_definition/theme_definition.yy",},
|
||||
{"name":"tiler_tool_brush_shape","order":7,"path":"scripts/tiler_tool_brush_shape/tiler_tool_brush_shape.yy",},
|
||||
{"name":"tiler_tool_brush","order":5,"path":"scripts/tiler_tool_brush/tiler_tool_brush.yy",},
|
||||
{"name":"sh_normalize_local","order":1,"path":"shaders/sh_normalize_local/sh_normalize_local.yy",},
|
||||
{"name":"tiler_tool_fill","order":6,"path":"scripts/tiler_tool_fill/tiler_tool_fill.yy",},
|
||||
{"name":"tiler_tool_selection_shape","order":9,"path":"scripts/tiler_tool_selection_shape/tiler_tool_selection_shape.yy",},
|
||||
{"name":"tiler_tool_selection","order":8,"path":"scripts/tiler_tool_selection/tiler_tool_selection.yy",},
|
||||
|
@ -1687,6 +1687,7 @@
|
|||
{"name":"sh_noise","order":1,"path":"shaders/sh_noise/sh_noise.yy",},
|
||||
{"name":"sh_normal_light_apply","order":5,"path":"shaders/sh_normal_light_apply/sh_normal_light_apply.yy",},
|
||||
{"name":"sh_normal_light","order":1,"path":"shaders/sh_normal_light/sh_normal_light.yy",},
|
||||
{"name":"sh_normalize_local","order":1,"path":"shaders/sh_normalize_local/sh_normalize_local.yy",},
|
||||
{"name":"sh_offset","order":28,"path":"shaders/sh_offset/sh_offset.yy",},
|
||||
{"name":"sh_outline_only","order":1,"path":"shaders/sh_outline_only/sh_outline_only.yy",},
|
||||
{"name":"sh_override_channel","order":5,"path":"shaders/sh_override_channel/sh_override_channel.yy",},
|
||||
|
@ -2379,6 +2380,7 @@
|
|||
{"name":"s_node_vector_cross_3d","order":47,"path":"sprites/s_node_vector_cross_3d/s_node_vector_cross_3d.yy",},
|
||||
{"name":"s_node_vector_dot","order":48,"path":"sprites/s_node_vector_dot/s_node_vector_dot.yy",},
|
||||
{"name":"s_node_vector_magnitude","order":63,"path":"sprites/s_node_vector_magnitude/s_node_vector_magnitude.yy",},
|
||||
{"name":"s_node_vector_normalize","order":139,"path":"sprites/s_node_vector_normalize/s_node_vector_normalize.yy",},
|
||||
{"name":"s_node_vector_split","order":59,"path":"sprites/s_node_vector_split/s_node_vector_split.yy",},
|
||||
{"name":"s_node_vector_swizzle","order":64,"path":"sprites/s_node_vector_swizzle/s_node_vector_swizzle.yy",},
|
||||
{"name":"s_node_vector2","order":60,"path":"sprites/s_node_vector2/s_node_vector2.yy",},
|
||||
|
|
|
@ -1180,6 +1180,7 @@
|
|||
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Node_Vector_Cross_3D","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Node_Vector_Dot","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Node_Vector_Magnitude","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Node_Vector_Normalize","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Node_Vector_Split","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Node_Vector_Swizzle","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/Values/Node_Vector2","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
|
@ -1202,9 +1203,14 @@
|
|||
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/VFX/Node_VFX_Vortex","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
{"$GMIncludedFile":"","%Name":"info.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes/Internal/VFX/Node_VFX_Wind","name":"info.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
{"$GMIncludedFile":"","%Name":"related_node.json","CopyToMask":-1,"filePath":"datafiles/data/Nodes","name":"related_node.json","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
{"$GMIncludedFile":"","%Name":"Update.ps1","CopyToMask":-1,"filePath":"datafiles/data/Nodes","name":"Update.ps1","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
{"$GMIncludedFile":"","%Name":"tileset_gamemaker2_room.yy","CopyToMask":-1,"filePath":"datafiles/data/TemplateStrings","name":"tileset_gamemaker2_room.yy","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
{"$GMIncludedFile":"","%Name":"Theme.zip","CopyToMask":-1,"filePath":"datafiles/data","name":"Theme.zip","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
{"$GMIncludedFile":"","%Name":"dllcredits.txt","ConfigValues":{"Itch":{"CopyToMask":"0",},},"CopyToMask":0,"filePath":"datafiles","name":"dllcredits.txt","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
{"$GMIncludedFile":"","%Name":"dllcredits.txt","ConfigValues":{
|
||||
"Itch":{
|
||||
"CopyToMask":"0",
|
||||
},
|
||||
},"CopyToMask":0,"filePath":"datafiles","name":"dllcredits.txt","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
{"$GMIncludedFile":"","%Name":"dlltest1.dll","CopyToMask":-1,"filePath":"datafiles","name":"dlltest1.dll","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
{"$GMIncludedFile":"","%Name":"ffmpeg.exe","CopyToMask":-1,"filePath":"datafiles/ffmpeg/bin","name":"ffmpeg.exe","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
{"$GMIncludedFile":"","%Name":"LICENSE","CopyToMask":-1,"filePath":"datafiles/ffmpeg","name":"LICENSE","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
|
@ -1223,7 +1229,11 @@
|
|||
{"$GMIncludedFile":"","%Name":"mf.dll","CopyToMask":-1,"filePath":"datafiles","name":"mf.dll","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
{"$GMIncludedFile":"","%Name":"mfcore.dll","CopyToMask":-1,"filePath":"datafiles","name":"mfcore.dll","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
{"$GMIncludedFile":"","%Name":"mfplat.dll","CopyToMask":-1,"filePath":"datafiles","name":"mfplat.dll","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
{"$GMIncludedFile":"","%Name":"PixelComposer_profile-2.provisionprofile","ConfigValues":{"Itch":{"CopyToMask":"2",},},"CopyToMask":-1,"filePath":"datafiles","name":"PixelComposer_profile-2.provisionprofile","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
{"$GMIncludedFile":"","%Name":"PixelComposer_profile-2.provisionprofile","ConfigValues":{
|
||||
"Itch":{
|
||||
"CopyToMask":"2",
|
||||
},
|
||||
},"CopyToMask":-1,"filePath":"datafiles","name":"PixelComposer_profile-2.provisionprofile","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
{"$GMIncludedFile":"","%Name":"data.win","CopyToMask":-1,"filePath":"datafiles/report","name":"data.win","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
{"$GMIncludedFile":"","%Name":"execute_shell_simple_ext_x64.dll","CopyToMask":-1,"filePath":"datafiles/report","name":"execute_shell_simple_ext_x64.dll","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
{"$GMIncludedFile":"","%Name":"options.ini","CopyToMask":-1,"filePath":"datafiles/report","name":"options.ini","resourceType":"GMIncludedFile","resourceVersion":"2.0",},
|
||||
|
@ -1652,7 +1662,6 @@
|
|||
{"id":{"name":"d3d_torus","path":"scripts/d3d_torus/d3d_torus.yy",},},
|
||||
{"id":{"name":"d3d_transformation","path":"scripts/d3d_transformation/d3d_transformation.yy",},},
|
||||
{"id":{"name":"d3d_uvsphere","path":"scripts/d3d_uvsphere/d3d_uvsphere.yy",},},
|
||||
{"id":{"name":"sh_normalize_local","path":"shaders/sh_normalize_local/sh_normalize_local.yy",},},
|
||||
{"id":{"name":"d3d_vertex","path":"scripts/d3d_vertex/d3d_vertex.yy",},},
|
||||
{"id":{"name":"d3d_wall_builder","path":"scripts/d3d_wall_builder/d3d_wall_builder.yy",},},
|
||||
{"id":{"name":"debug","path":"scripts/debug/debug.yy",},},
|
||||
|
@ -2421,6 +2430,7 @@
|
|||
{"id":{"name":"node_vector_cross_3D","path":"scripts/node_vector_cross_3D/node_vector_cross_3D.yy",},},
|
||||
{"id":{"name":"node_vector_dot","path":"scripts/node_vector_dot/node_vector_dot.yy",},},
|
||||
{"id":{"name":"node_vector_magnitude","path":"scripts/node_vector_magnitude/node_vector_magnitude.yy",},},
|
||||
{"id":{"name":"node_vector_normalize","path":"scripts/node_vector_normalize/node_vector_normalize.yy",},},
|
||||
{"id":{"name":"node_vector_split","path":"scripts/node_vector_split/node_vector_split.yy",},},
|
||||
{"id":{"name":"node_vector_swizzle","path":"scripts/node_vector_swizzle/node_vector_swizzle.yy",},},
|
||||
{"id":{"name":"node_vector2","path":"scripts/node_vector2/node_vector2.yy",},},
|
||||
|
@ -2943,6 +2953,7 @@
|
|||
{"id":{"name":"sh_normal_light_apply","path":"shaders/sh_normal_light_apply/sh_normal_light_apply.yy",},},
|
||||
{"id":{"name":"sh_normal_light","path":"shaders/sh_normal_light/sh_normal_light.yy",},},
|
||||
{"id":{"name":"sh_normal","path":"shaders/sh_normal/sh_normal.yy",},},
|
||||
{"id":{"name":"sh_normalize_local","path":"shaders/sh_normalize_local/sh_normalize_local.yy",},},
|
||||
{"id":{"name":"sh_normalize","path":"shaders/sh_normalize/sh_normalize.yy",},},
|
||||
{"id":{"name":"sh_offset","path":"shaders/sh_offset/sh_offset.yy",},},
|
||||
{"id":{"name":"sh_outline_only","path":"shaders/sh_outline_only/sh_outline_only.yy",},},
|
||||
|
@ -3684,6 +3695,7 @@
|
|||
{"id":{"name":"s_node_vector_cross_3d","path":"sprites/s_node_vector_cross_3d/s_node_vector_cross_3d.yy",},},
|
||||
{"id":{"name":"s_node_vector_dot","path":"sprites/s_node_vector_dot/s_node_vector_dot.yy",},},
|
||||
{"id":{"name":"s_node_vector_magnitude","path":"sprites/s_node_vector_magnitude/s_node_vector_magnitude.yy",},},
|
||||
{"id":{"name":"s_node_vector_normalize","path":"sprites/s_node_vector_normalize/s_node_vector_normalize.yy",},},
|
||||
{"id":{"name":"s_node_vector_split","path":"sprites/s_node_vector_split/s_node_vector_split.yy",},},
|
||||
{"id":{"name":"s_node_vector_swizzle","path":"sprites/s_node_vector_swizzle/s_node_vector_swizzle.yy",},},
|
||||
{"id":{"name":"s_node_vector2","path":"sprites/s_node_vector2/s_node_vector2.yy",},},
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"tooltip":"Scale vector to length 1.",
|
||||
"alias":[
|
||||
"vector normalize",
|
||||
],
|
||||
"spr":"s_node_vector_normalize",
|
||||
"pxc_version":118068,
|
||||
"baseNode":"Node_Vector_Normalize",
|
||||
"io":[
|
||||
"float"
|
||||
],
|
||||
"name":"Normalize"
|
||||
}
|
2
datafiles/data/Nodes/Update.ps1
Normal file
2
datafiles/data/Nodes/Update.ps1
Normal file
|
@ -0,0 +1,2 @@
|
|||
Compress-Archive -Path 'D:\Project\MakhamDev\LTS-PixelComposer\PixelComposer\datafiles\data\Nodes\Internal' -DestinationPath 'D:\Project\MakhamDev\LTS-PixelComposer\PixelComposer\datafiles\data\Nodes\Internal.zip' -Update
|
||||
Compress-Archive -Path 'D:\Project\MakhamDev\LTS-PixelComposer\PixelComposer\datafiles\data\Nodes\Actions' -DestinationPath 'D:\Project\MakhamDev\LTS-PixelComposer\PixelComposer\datafiles\data\Nodes\Actions.zip' -Update
|
|
@ -675,6 +675,7 @@
|
|||
"Node_Vector_Swizzle",
|
||||
{ "label": "/Operators" },
|
||||
"Node_Vector_Magnitude",
|
||||
"Node_Vector_Normalize",
|
||||
"Node_Vector_Dot",
|
||||
"Node_Vector_Cross_2D",
|
||||
"Node_Vector_Cross_3D",
|
||||
|
|
Binary file not shown.
|
@ -1 +1,3 @@
|
|||
py "%~dp0datafiles/Shaders/shader_replace.py"
|
||||
py "%~dp0datafiles/Shaders/shader_replace.py"
|
||||
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe "%~dp0datafiles/data/Nodes/Update.ps1"
|
||||
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe "D:/Project/MakhamDev/LTS-PixelComposer/RESOURCE/data/Update.ps1"
|
|
@ -33,11 +33,14 @@ function Node_Level_Selector(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
|
|||
|
||||
newInput(11, nodeValue_Bool("Keep Original", self, false));
|
||||
|
||||
newInput(12, nodeValue_Float("Smoothness", self, 0))
|
||||
.setDisplay(VALUE_DISPLAY.slider);
|
||||
|
||||
newOutput(0, nodeValue_Output("Surface out", self, VALUE_TYPE.surface, noone));
|
||||
|
||||
attribute_surface_depth();
|
||||
|
||||
level_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) { #region
|
||||
level_renderer = new Inspector_Custom_Renderer(function(_x, _y, _w, _m, _hover, _focus) {
|
||||
var _h = 128;
|
||||
var x0 = _x;
|
||||
var x1 = _x + _w;
|
||||
|
@ -74,41 +77,42 @@ function Node_Level_Selector(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
|
|||
draw_rectangle(x0, y0, x1, y1, true);
|
||||
|
||||
return _h;
|
||||
}); #endregion
|
||||
});
|
||||
|
||||
input_display_list = [ 5, 6,
|
||||
level_renderer,
|
||||
["Surfaces", true], 0, 3, 4, 7, 8,
|
||||
["Level", false], 1, 9, 2, 10,
|
||||
["Level", false], 1, 9, 2, 10, 12,
|
||||
["Output", false], 11,
|
||||
];
|
||||
histogramInit();
|
||||
|
||||
static onInspect = function() { #region
|
||||
static onInspect = function() {
|
||||
if(array_length(current_data) > 0)
|
||||
histogramUpdate(current_data[0]);
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static onValueFromUpdate = function(index) { #region
|
||||
static onValueFromUpdate = function(index) {
|
||||
if(index == 0) {
|
||||
update();
|
||||
if(array_length(current_data) > 0)
|
||||
histogramUpdate(current_data[0]);
|
||||
}
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static step = function() { #region
|
||||
static step = function() {
|
||||
__step_mask_modifier();
|
||||
|
||||
inputs[1].mappableStep();
|
||||
inputs[2].mappableStep();
|
||||
} #endregion
|
||||
}
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) {
|
||||
|
||||
surface_set_shader(_outSurf, sh_level_selector);
|
||||
shader_set_f_map("middle", _data[1], _data[ 9], inputs[1]);
|
||||
shader_set_f_map("range" , _data[2], _data[10], inputs[2]);
|
||||
shader_set_f("smoothness", _data[12]);
|
||||
shader_set_i("keep", _data[11]);
|
||||
|
||||
draw_surface_safe(_data[0]);
|
||||
|
@ -119,5 +123,5 @@ function Node_Level_Selector(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
|
|||
_outSurf = channel_apply(_data[0], _outSurf, _data[6]);
|
||||
|
||||
return _outSurf;
|
||||
} #endregion
|
||||
}
|
||||
}
|
|
@ -4,16 +4,23 @@ function Node_Random(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
|
|||
|
||||
setDimension(96, 48);
|
||||
|
||||
newInput(0, nodeValue_Int("seed", self, irandom(99999)));
|
||||
newInput(0, nodeValue_Int("Seed", self, irandom(99999)));
|
||||
|
||||
newInput(1, nodeValue_Float("from", self, 0));
|
||||
newInput(1, nodeValue_Float("From", self, 0));
|
||||
|
||||
newInput(2, nodeValue_Float("to", self, 1));
|
||||
newInput(2, nodeValue_Float("To", self, 1));
|
||||
|
||||
newInput(3, nodeValue_Bool("Shuffle", self, false));
|
||||
|
||||
newOutput(0, nodeValue_Output("Result", self, VALUE_TYPE.float, 0));
|
||||
|
||||
static processData = function(_output, _data, _output_index, _array_index = 0) {
|
||||
random_set_seed(_data[0]);
|
||||
static processData_prebatch = function() {
|
||||
var _shuffle = getSingleValue(3);
|
||||
update_on_frame = _shuffle;
|
||||
}
|
||||
|
||||
static processData = function(_output, _data, _output_index, _array_index = 0) {
|
||||
random_set_seed(_data[0] + _data[3] * CURRENT_FRAME * pi);
|
||||
return random_range(_data[1], _data[2]);
|
||||
}
|
||||
|
||||
|
|
48
scripts/node_vector_normalize/node_vector_normalize.gml
Normal file
48
scripts/node_vector_normalize/node_vector_normalize.gml
Normal file
|
@ -0,0 +1,48 @@
|
|||
function Node_Vector_Normalize(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
|
||||
name = "Vector Normalize";
|
||||
color = COLORS.node_blend_number;
|
||||
setDimension(96, 48);
|
||||
|
||||
newInput(0, nodeValue("Vector", self, CONNECT_TYPE.input, VALUE_TYPE.float, []))
|
||||
.setArrayDepth(1)
|
||||
.setVisible(true, true);
|
||||
|
||||
newOutput(0, nodeValue_Output("Normalized Vector", self, VALUE_TYPE.float, []))
|
||||
.setArrayDepth(1);
|
||||
|
||||
static processData = function(_output, _data, _output_index, _array_index = 0) {
|
||||
var _vec = _data[0];
|
||||
if(!is_array(_vec)) return 0;
|
||||
|
||||
switch(array_length(_vec)) {
|
||||
case 0 : return 1;
|
||||
case 1 : return [ 1 ];
|
||||
|
||||
case 2 :
|
||||
var _len = sqrt(sqr(_vec[0]) + sqr(_vec[1]));
|
||||
return [ _vec[0] / _len, _vec[1] / _len ];
|
||||
|
||||
case 3 :
|
||||
var _len = sqrt(sqr(_vec[0]) + sqr(_vec[1]) + sqr(_vec[2]));
|
||||
return [ _vec[0] / _len, _vec[1] / _len, _vec[2] / _len ];
|
||||
|
||||
case 4 :
|
||||
var _len = sqrt(sqr(_vec[0]) + sqr(_vec[1]) + sqr(_vec[2]) + sqr(_vec[3]));
|
||||
return [ _vec[0] / _len, _vec[1] / _len, _vec[2] / _len, _vec[3] / _len ];
|
||||
|
||||
default :
|
||||
__len = sqrt(array_reduce(_vec, function(_p, _c) /*=>*/ { return _p + _c * _c; }, 0));
|
||||
return array_map(_vec, function(v) /*=>*/ {return v / __len});
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
|
||||
var bbox = drawGetBbox(xx, yy, _s);
|
||||
var val = outputs[0].getValue();
|
||||
|
||||
draw_set_text(f_sdf, fa_center, fa_center, COLORS._main_text);
|
||||
draw_text_bbox(bbox, string(val));
|
||||
}
|
||||
}
|
14
scripts/node_vector_normalize/node_vector_normalize.yy
Normal file
14
scripts/node_vector_normalize/node_vector_normalize.yy
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"$GMScript":"v1",
|
||||
"%Name":"node_vector_normalize",
|
||||
"isCompatibility":false,
|
||||
"isDnD":false,
|
||||
"name":"node_vector_normalize",
|
||||
"parent":{
|
||||
"name":"vector",
|
||||
"path":"folders/nodes/data/value/vector.yy",
|
||||
},
|
||||
"resourceType":"GMScript",
|
||||
"resourceVersion":"2.0",
|
||||
"tags":[],
|
||||
}
|
|
@ -13,21 +13,10 @@ function Node_Vector_Swizzle(_x, _y, _group = noone) : Node_Processor(_x, _y, _g
|
|||
|
||||
static char_get_index = function(_chr) {
|
||||
switch(string_lower(_chr)) {
|
||||
case "r" :
|
||||
case "x" :
|
||||
return 0;
|
||||
|
||||
case "g" :
|
||||
case "y" :
|
||||
return 1;
|
||||
|
||||
case "b" :
|
||||
case "z" :
|
||||
return 2;
|
||||
|
||||
case "a" :
|
||||
case "w" :
|
||||
return 3;
|
||||
case "r" : case "x" : return 0;
|
||||
case "g" : case "y" : return 1;
|
||||
case "b" : case "z" : return 2;
|
||||
case "a" : case "w" : return 3;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -9,7 +9,8 @@ uniform vec2 range;
|
|||
uniform int rangeUseSurf;
|
||||
uniform sampler2D rangeSurf;
|
||||
|
||||
uniform int keep;
|
||||
uniform float smoothness;
|
||||
uniform int keep;
|
||||
|
||||
void main() {
|
||||
float mid = middle.x;
|
||||
|
@ -24,13 +25,15 @@ void main() {
|
|||
rng = mix(range.x, range.y, (_vMap.r + _vMap.g + _vMap.b) / 3.);
|
||||
}
|
||||
|
||||
vec4 col = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
|
||||
vec4 col = texture2D( gm_BaseTexture, v_vTexcoord );
|
||||
float bright = dot(col.rgb, vec3(0.2126, 0.7152, 0.0722));
|
||||
|
||||
if(bright > mid + rng || bright < mid - rng)
|
||||
gl_FragColor = vec4(vec3(0.), col.a);
|
||||
else if(keep == 0)
|
||||
gl_FragColor = vec4(vec3(1.), col.a);
|
||||
if(keep == 0) col.rgb = vec3(1.);
|
||||
|
||||
if(smoothness == 0.)
|
||||
col.rgb *= 1. - step(rng, abs(bright - mid));
|
||||
else
|
||||
gl_FragColor = vec4(vec3(bright), col.a);
|
||||
col.rgb *= 1. - smoothstep(rng - smoothness, rng + smoothness, abs(bright - mid));
|
||||
|
||||
gl_FragColor = vec4(col.rgb, col.a);
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
90
sprites/s_node_vector_normalize/s_node_vector_normalize.yy
Normal file
90
sprites/s_node_vector_normalize/s_node_vector_normalize.yy
Normal file
|
@ -0,0 +1,90 @@
|
|||
{
|
||||
"$GMSprite":"",
|
||||
"%Name":"s_node_vector_normalize",
|
||||
"bboxMode":0,
|
||||
"bbox_bottom":55,
|
||||
"bbox_left":11,
|
||||
"bbox_right":54,
|
||||
"bbox_top":11,
|
||||
"collisionKind":1,
|
||||
"collisionTolerance":0,
|
||||
"DynamicTexturePage":false,
|
||||
"edgeFiltering":false,
|
||||
"For3D":false,
|
||||
"frames":[
|
||||
{"$GMSpriteFrame":"","%Name":"4b3c46d1-dc56-4c55-a8e1-9cbfa36cfc5c","name":"4b3c46d1-dc56-4c55-a8e1-9cbfa36cfc5c","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
|
||||
],
|
||||
"gridX":0,
|
||||
"gridY":0,
|
||||
"height":64,
|
||||
"HTile":false,
|
||||
"layers":[
|
||||
{"$GMImageLayer":"","%Name":"8c250188-3425-4725-bea6-2609f677aa71","blendMode":0,"displayName":"default","isLocked":false,"name":"8c250188-3425-4725-bea6-2609f677aa71","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
|
||||
],
|
||||
"name":"s_node_vector_normalize",
|
||||
"nineSlice":null,
|
||||
"origin":4,
|
||||
"parent":{
|
||||
"name":"value",
|
||||
"path":"folders/nodes/icons/value.yy",
|
||||
},
|
||||
"preMultiplyAlpha":false,
|
||||
"resourceType":"GMSprite",
|
||||
"resourceVersion":"2.0",
|
||||
"sequence":{
|
||||
"$GMSequence":"",
|
||||
"%Name":"s_node_vector_normalize",
|
||||
"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_vector_normalize",
|
||||
"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":"4b3c46d1-dc56-4c55-a8e1-9cbfa36cfc5c","path":"sprites/s_node_vector_normalize/s_node_vector_normalize.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
|
||||
},"Disabled":false,"id":"156b3348-5cde-4a2b-9f7d-7d02616a0eb4","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…
Add table
Reference in a new issue