diff --git a/PixelComposer.resource_order b/PixelComposer.resource_order index 5bdc246ec..9d211e17b 100644 --- a/PixelComposer.resource_order +++ b/PixelComposer.resource_order @@ -219,7 +219,7 @@ {"name":"sh_fd_add_velocity_glsl","order":1,"path":"shaders/sh_fd_add_velocity_glsl/sh_fd_add_velocity_glsl.yy",}, {"name":"s_node_normal","order":30,"path":"sprites/s_node_normal/s_node_normal.yy",}, {"name":"node_pixel_sort","order":12,"path":"scripts/node_pixel_sort/node_pixel_sort.yy",}, - {"name":"node_glsl","order":13,"path":"scripts/node_glsl/node_glsl.yy",}, + {"name":"node_hlsl","order":13,"path":"scripts/node_hlsl/node_hlsl.yy",}, {"name":"sh_dither","order":28,"path":"shaders/sh_dither/sh_dither.yy",}, {"name":"__vec2","order":7,"path":"scripts/__vec2/__vec2.yy",}, {"name":"node_region_fill","order":20,"path":"scripts/node_region_fill/node_region_fill.yy",}, diff --git a/PixelComposer.yyp b/PixelComposer.yyp index 6c9d58e54..e0653b6de 100644 --- a/PixelComposer.yyp +++ b/PixelComposer.yyp @@ -751,7 +751,7 @@ {"id":{"name":"sh_fd_add_velocity_glsl","path":"shaders/sh_fd_add_velocity_glsl/sh_fd_add_velocity_glsl.yy",},}, {"id":{"name":"s_node_normal","path":"sprites/s_node_normal/s_node_normal.yy",},}, {"id":{"name":"node_pixel_sort","path":"scripts/node_pixel_sort/node_pixel_sort.yy",},}, - {"id":{"name":"node_glsl","path":"scripts/node_glsl/node_glsl.yy",},}, + {"id":{"name":"node_hlsl","path":"scripts/node_hlsl/node_hlsl.yy",},}, {"id":{"name":"sh_dither","path":"shaders/sh_dither/sh_dither.yy",},}, {"id":{"name":"__vec2","path":"scripts/__vec2/__vec2.yy",},}, {"id":{"name":"control_function","path":"scripts/control_function/control_function.yy",},}, @@ -1521,7 +1521,7 @@ {"id":{"name":"sh_surface_replace_replace","path":"shaders/sh_surface_replace_replace/sh_surface_replace_replace.yy",},}, {"id":{"name":"node_ase_file_read","path":"scripts/node_ase_file_read/node_ase_file_read.yy",},}, {"id":{"name":"s_workshop_frame","path":"sprites/s_workshop_frame/s_workshop_frame.yy",},}, - {"id":{"name":"glsl_draw","path":"scripts/glsl_draw/glsl_draw.yy",},}, + {"id":{"name":"hlsl_draw","path":"scripts/hlsl_draw/hlsl_draw.yy",},}, {"id":{"name":"s_node_print","path":"sprites/s_node_print/s_node_print.yy",},}, {"id":{"name":"sh_seperate_shape_counter","path":"shaders/sh_seperate_shape_counter/sh_seperate_shape_counter.yy",},}, {"id":{"name":"s_node_stack","path":"sprites/s_node_stack/s_node_stack.yy",},}, diff --git a/datafiles/HLSL/D3D11ShaderParser.exe b/datafiles/HLSL/D3D11ShaderParser.exe deleted file mode 100644 index 48c34db15..000000000 Binary files a/datafiles/HLSL/D3D11ShaderParser.exe and /dev/null differ diff --git a/datafiles/HLSL/D3D12ShaderParser.exe b/datafiles/HLSL/D3D12ShaderParser.exe deleted file mode 100644 index 8a6840f8b..000000000 Binary files a/datafiles/HLSL/D3D12ShaderParser.exe and /dev/null differ diff --git a/datafiles/HLSL/FShaderCommon.shader b/datafiles/HLSL/FShaderCommon.shader deleted file mode 100644 index c9b456caa..000000000 --- a/datafiles/HLSL/FShaderCommon.shader +++ /dev/null @@ -1,28 +0,0 @@ -// Uniforms look like they're shared between vertex and fragment shaders in GLSL, so we have to be careful to avoid name clashes - -uniform sampler2D gm_BaseTexture; - -uniform bool gm_PS_FogEnabled; -uniform vec4 gm_FogColour; -uniform bool gm_AlphaTestEnabled; -uniform float gm_AlphaRefValue; - -void DoAlphaTest(vec4 SrcColour) -{ - if (gm_AlphaTestEnabled) - { - if (SrcColour.a <= gm_AlphaRefValue) - { - discard; - } - } -} - -void DoFog(inout vec4 SrcColour, float fogval) -{ - if (gm_PS_FogEnabled) - { - SrcColour = mix(SrcColour, gm_FogColour, clamp(fogval, 0.0, 1.0)); - } -} - diff --git a/datafiles/HLSL/HLSL11_PShaderCommon.shader b/datafiles/HLSL/HLSL11_PShaderCommon.shader deleted file mode 100644 index 9be8b99c5..000000000 --- a/datafiles/HLSL/HLSL11_PShaderCommon.shader +++ /dev/null @@ -1,12 +0,0 @@ -// GameMaker reserved and common types/inputs - -Texture2D gm_BaseTextureObject : register(t0); -SamplerState gm_BaseTexture : register(S0); - -cbuffer gm_PSMaterialConstantBuffer -{ - bool gm_PS_FogEnabled; - float4 gm_FogColour; - bool gm_AlphaTestEnabled; - float4 gm_AlphaRefValue; -}; diff --git a/datafiles/HLSL/HLSL11_VShaderCommon.shader b/datafiles/HLSL/HLSL11_VShaderCommon.shader deleted file mode 100644 index 4d03a86f0..000000000 --- a/datafiles/HLSL/HLSL11_VShaderCommon.shader +++ /dev/null @@ -1,30 +0,0 @@ -#define MATRIX_VIEW 0 -#define MATRIX_PROJECTION 1 -#define MATRIX_WORLD 2 -#define MATRIX_WORLD_VIEW 3 -#define MATRIX_WORLD_VIEW_PROJECTION 4 -#define MATRICES_MAX 5 - -cbuffer gm_VSTransformBuffer -{ - float4x4 gm_Matrices[MATRICES_MAX]; -}; - -cbuffer gm_VSMaterialConstantBuffer -{ - bool gm_LightingEnabled; - bool gm_VS_FogEnabled; - float gm_FogStart; - float gm_RcpFogRange; -}; - -#define MAX_VS_LIGHTS 8 - -cbuffer gm_VSLightingConstantBuffer -{ - float4 gm_AmbientColour; // rgb=colour, a=1 - float3 gm_Lights_Direction[MAX_VS_LIGHTS]; // normalised direction - float4 gm_Lights_PosRange[MAX_VS_LIGHTS]; // X,Y,Z position, W range - float4 gm_Lights_Colour[MAX_VS_LIGHTS]; // rgb=colour, a=1 -} - diff --git a/datafiles/HLSL/HLSL9_PShaderCommon.shader b/datafiles/HLSL/HLSL9_PShaderCommon.shader deleted file mode 100644 index e951b89f5..000000000 --- a/datafiles/HLSL/HLSL9_PShaderCommon.shader +++ /dev/null @@ -1,8 +0,0 @@ -// GameMaker reserved and common types/inputs - -sampler2D gm_BaseTexture : register(S0); - -bool gm_PS_FogEnabled; -float4 gm_FogColour; -bool gm_AlphaTestEnabled; -float4 gm_AlphaRefValue; diff --git a/datafiles/HLSL/HLSL9_VShaderCommon.shader b/datafiles/HLSL/HLSL9_VShaderCommon.shader deleted file mode 100644 index 9518b36c5..000000000 --- a/datafiles/HLSL/HLSL9_VShaderCommon.shader +++ /dev/null @@ -1,20 +0,0 @@ -#define MATRIX_VIEW 0 -#define MATRIX_PROJECTION 1 -#define MATRIX_WORLD 2 -#define MATRIX_WORLD_VIEW 3 -#define MATRIX_WORLD_VIEW_PROJECTION 4 -#define MATRICES_MAX 5 - -float4x4 gm_Matrices[MATRICES_MAX] : register(c0); - -bool gm_LightingEnabled; -bool gm_VS_FogEnabled; -float gm_FogStart; -float gm_RcpFogRange; - -#define MAX_VS_LIGHTS 8 -float4 gm_AmbientColour; // rgb=colour, a=1 -float3 gm_Lights_Direction[MAX_VS_LIGHTS]; // normalised direction -float4 gm_Lights_PosRange[MAX_VS_LIGHTS]; // X,Y,Z position, W range -float4 gm_Lights_Colour[MAX_VS_LIGHTS]; // rgb=colour, a=1 - diff --git a/datafiles/HLSL/HLSLCompiler.exe b/datafiles/HLSL/HLSLCompiler.exe deleted file mode 100644 index 20cf53244..000000000 Binary files a/datafiles/HLSL/HLSLCompiler.exe and /dev/null differ diff --git a/datafiles/HLSL/VShaderCommon.shader b/datafiles/HLSL/VShaderCommon.shader deleted file mode 100644 index d59f716f1..000000000 --- a/datafiles/HLSL/VShaderCommon.shader +++ /dev/null @@ -1,118 +0,0 @@ -#define MATRIX_VIEW 0 -#define MATRIX_PROJECTION 1 -#define MATRIX_WORLD 2 -#define MATRIX_WORLD_VIEW 3 -#define MATRIX_WORLD_VIEW_PROJECTION 4 -#define MATRICES_MAX 5 - -uniform mat4 gm_Matrices[MATRICES_MAX]; - -uniform bool gm_LightingEnabled; -uniform bool gm_VS_FogEnabled; -uniform float gm_FogStart; -uniform float gm_RcpFogRange; - -#define MAX_VS_LIGHTS 8 -#define MIRROR_WIN32_LIGHTING_EQUATION - - -//#define MAX_VS_LIGHTS 8 -uniform vec4 gm_AmbientColour; // rgb=colour, a=1 -uniform vec4 gm_Lights_Direction[MAX_VS_LIGHTS]; // normalised direction -uniform vec4 gm_Lights_PosRange[MAX_VS_LIGHTS]; // X,Y,Z position, W range -uniform vec4 gm_Lights_Colour[MAX_VS_LIGHTS]; // rgb=colour, a=1 - -float CalcFogFactor(vec4 pos) -{ - if (gm_VS_FogEnabled) - { - vec4 viewpos = gm_Matrices[MATRIX_WORLD_VIEW] * pos; - float fogfactor = ((viewpos.z - gm_FogStart) * gm_RcpFogRange); - return fogfactor; - } - else - { - return 0.0; - } -} - -vec4 DoDirLight(vec3 ws_normal, vec4 dir, vec4 diffusecol) -{ - float dotresult = dot(ws_normal, dir.xyz); - dotresult = min(dotresult, dir.w); // the w component is 1 if the directional light is active, or 0 if it isn't - dotresult = max(0.0, dotresult); - - return dotresult * diffusecol; -} - -vec4 DoPointLight(vec3 ws_pos, vec3 ws_normal, vec4 posrange, vec4 diffusecol) -{ - vec3 diffvec = ws_pos - posrange.xyz; - float veclen = length(diffvec); - diffvec /= veclen; // normalise - float atten; - if (posrange.w == 0.0) // the w component of posrange is 0 if the point light is disabled - if we don't catch it here we might end up generating INFs or NaNs - { - atten = 0.0; - } - else - { -#ifdef MIRROR_WIN32_LIGHTING_EQUATION - // This is based on the Win32 D3D and OpenGL falloff model, where: - // Attenuation = 1.0f / (factor0 + (d * factor1) + (d*d * factor2)) - // For some reason, factor0 is set to 0.0f while factor1 is set to 1.0f/lightrange (on both D3D and OpenGL) - // This'll result in no visible falloff as 1.0f / (d / lightrange) will always be larger than 1.0f (if the vertex is within range) - - atten = 1.0 / (veclen / posrange.w); - if (veclen > posrange.w) - { - atten = 0.0; - } -#else - atten = clamp( (1.0 - (veclen / posrange.w)), 0.0, 1.0); // storing 1.0f/range instead would save a rcp -#endif - } - float dotresult = dot(ws_normal, diffvec); - dotresult = max(0.0, dotresult); - - return dotresult * atten * diffusecol; -} - -vec4 DoLighting(vec4 vertexcolour, vec4 objectspacepos, vec3 objectspacenormal) -{ - if (gm_LightingEnabled) - { - // Normally we'd have the light positions\\directions back-transformed from world to object space - // But to keep things simple for the moment we'll just transform the normal to world space - vec4 objectspacenormal4 = vec4(objectspacenormal, 0.0); - vec3 ws_normal; - ws_normal = (gm_Matrices[MATRIX_WORLD] * objectspacenormal4).xyz; - ws_normal = normalize(ws_normal); - - vec3 ws_pos; - ws_pos = (gm_Matrices[MATRIX_WORLD] * objectspacepos).xyz; - - // Accumulate lighting from different light types - vec4 accumcol = vec4(0.0, 0.0, 0.0, 0.0); - for(int i = 0; i < MAX_VS_LIGHTS; i++) - { - accumcol += DoDirLight(ws_normal, gm_Lights_Direction[i], gm_Lights_Colour[i]); - } - - for(int i = 0; i < MAX_VS_LIGHTS; i++) - { - accumcol += DoPointLight(ws_pos, ws_normal, gm_Lights_PosRange[i], gm_Lights_Colour[i]); - } - - accumcol *= vertexcolour; - accumcol += gm_AmbientColour; - accumcol = min(vec4(1.0, 1.0, 1.0, 1.0), accumcol); - accumcol.a = vertexcolour.a; - return accumcol; - } - else - { - return vertexcolour; - } -} - diff --git a/datafiles/HLSL/d3dcompiler_46.dll b/datafiles/HLSL/d3dcompiler_46.dll deleted file mode 100644 index c7063287e..000000000 Binary files a/datafiles/HLSL/d3dcompiler_46.dll and /dev/null differ diff --git a/datafiles/HLSL/libEGL.dll b/datafiles/HLSL/libEGL.dll deleted file mode 100644 index eb490691a..000000000 Binary files a/datafiles/HLSL/libEGL.dll and /dev/null differ diff --git a/datafiles/HLSL/libGLESv2.dll b/datafiles/HLSL/libGLESv2.dll deleted file mode 100644 index 56c9ddb5d..000000000 Binary files a/datafiles/HLSL/libGLESv2.dll and /dev/null differ diff --git a/datafiles/data/themes/default.zip b/datafiles/data/themes/default.zip index a8e54c869..de76e0f11 100644 Binary files a/datafiles/data/themes/default.zip and b/datafiles/data/themes/default.zip differ diff --git a/objects/o_dialog_panel/Create_0.gml b/objects/o_dialog_panel/Create_0.gml index 2c74b8b16..c35cb58e2 100644 --- a/objects/o_dialog_panel/Create_0.gml +++ b/objects/o_dialog_panel/Create_0.gml @@ -27,8 +27,7 @@ event_inherited(); content.in_dialog = true; - if(instanceof(content) == "Panel_Menu") - destroy_on_click_out = false; + if(content.auto_pin) destroy_on_click_out = false; } function resetMask() { diff --git a/scripts/glsl_draw/glsl_draw.gml b/scripts/hlsl_draw/hlsl_draw.gml similarity index 88% rename from scripts/glsl_draw/glsl_draw.gml rename to scripts/hlsl_draw/hlsl_draw.gml index fb9978051..7c8cc4473 100644 --- a/scripts/glsl_draw/glsl_draw.gml +++ b/scripts/hlsl_draw/hlsl_draw.gml @@ -1,9 +1,9 @@ global.glsl_reserved = ds_map_create(); global.glsl_constant = ds_map_create(); -var reserved = ["int", "float", "bool", "vec2", "vec3", "vec4", "mat3", "mat4", "sampler2D", +var reserved = ["int", "float", "float2", "float3", "float4", "float3x3", "float4x4", "Texture2D", "SamplerState", "uniform", "gl_position", "gm_Matrices", "gl_FragColor", "gm_BaseTexture", - "and", "break", "do", "else", "elseif", "end", "false", + "and", "break", "do", "else", "end", "false", "for", "function", "if", "in", "local", "nil", "not", "or", "repeat", "return", "then", "true", "until", "while"]; diff --git a/scripts/glsl_draw/glsl_draw.yy b/scripts/hlsl_draw/hlsl_draw.yy similarity index 89% rename from scripts/glsl_draw/glsl_draw.yy rename to scripts/hlsl_draw/hlsl_draw.yy index 9e857a972..10981cdc1 100644 --- a/scripts/glsl_draw/glsl_draw.yy +++ b/scripts/hlsl_draw/hlsl_draw.yy @@ -1,7 +1,7 @@ { "resourceType": "GMScript", "resourceVersion": "1.0", - "name": "glsl_draw", + "name": "hlsl_draw", "isCompatibility": false, "isDnD": false, "parent": { diff --git a/scripts/nodeValue_drawer/nodeValue_drawer.gml b/scripts/nodeValue_drawer/nodeValue_drawer.gml index d03a77ec2..8559d6311 100644 --- a/scripts/nodeValue_drawer/nodeValue_drawer.gml +++ b/scripts/nodeValue_drawer/nodeValue_drawer.gml @@ -183,12 +183,11 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc if(jun.expUse || jun.type == VALUE_TYPE.text) { bx -= ui(28); - if(buttonInstant(THEME.button_hide, bx - ui(12), by - ui(12), ui(24), ui(24), _m, _focus, _hover, __txtx("panel_inspector_pop_text", "Pop up Editor"), THEME.text_popup, 0, COLORS._main_icon) == 2) { - var _panel = noone; - - if(jun.expUse) _panel = dialogPanelCall(new Panel_Text_Editor(jun.express_edit, function() { return context.expression; }, jun)); - else _panel = dialogPanelCall(new Panel_Text_Editor(jun.editWidget, function() { return context.showValue(); }, jun)); - _panel.content.title = $"{jun.node.name} - {jun.name}"; + var cc = jun.popup_dialog == noone? COLORS._main_icon : COLORS._main_value_positive; + if(buttonInstant(THEME.button_hide, bx - ui(12), by - ui(12), ui(24), ui(24), _m, _focus, _hover, __txtx("panel_inspector_pop_text", "Pop up Editor"), THEME.text_popup, 0, cc) == 2) { + if(jun.expUse) jun.popup_dialog = dialogPanelCall(new Panel_Text_Editor(jun.express_edit, function() { return context.expression; }, jun)); + else jun.popup_dialog = dialogPanelCall(new Panel_Text_Editor(jun.editWidget, function() { return context.showValue(); }, jun)); + jun.popup_dialog.content.title = $"{jun.node.name} - {jun.name}"; } } } diff --git a/scripts/node_export/node_export.gml b/scripts/node_export/node_export.gml index d4fe0821c..ae2d32e0a 100644 --- a/scripts/node_export/node_export.gml +++ b/scripts/node_export/node_export.gml @@ -202,8 +202,7 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor converter = working_directory + "ImageMagick/convert.exe"; magick = working_directory + "ImageMagick/magick.exe"; webp = working_directory + "webp/webpmux.exe"; - - gifski = working_directory + "gifski\\win\\gifski.exe"; + gifski = working_directory + "gifski\\win\\gifski.exe"; static onValueUpdate = function(_index) { var form = inputs[| 3].getValue(); diff --git a/scripts/node_glsl/node_glsl.gml b/scripts/node_glsl/node_glsl.gml deleted file mode 100644 index 579cb8d07..000000000 --- a/scripts/node_glsl/node_glsl.gml +++ /dev/null @@ -1,237 +0,0 @@ -globalvar CUSTOM_SHADER_SLOT, CUSTOM_SHADER_UNIFORM; -CUSTOM_SHADER_SLOT = ds_map_create(); -CUSTOM_SHADER_SLOT[? sh_dummy_0] = noone; - -CUSTOM_SHADER_UNIFORM = @" -uniform float u_float_0, u_float_1, u_float_2, u_float_3, u_float_4, u_float_5, u_float_6, u_float_7; -uniform float u_float_8, u_float_9, u_float_10, u_float_11, u_float_12, u_float_13, u_float_14, u_float_15; - -uniform int u_int_0, u_int_1, u_int_2, u_int_3, u_int_4, u_int_5, u_int_6, u_int_7; -uniform int u_int_8, u_int_9, u_int_10, u_int_11, u_int_12, u_int_13, u_int_14, u_int_15; - -uniform vec2 u_vec2_0, u_vec2_1, u_vec2_2, u_vec2_3, u_vec2_4, u_vec2_5, u_vec2_6, u_vec2_7; -uniform vec2 u_vec2_8, u_vec2_9, u_vec2_10, u_vec2_11, u_vec2_12, u_vec2_13, u_vec2_14, u_vec2_15; - -uniform vec3 u_vec3_0, u_vec3_1, u_vec3_2, u_vec3_3, u_vec3_4, u_vec3_5, u_vec3_6, u_vec3_7; -uniform vec3 u_vec3_8, u_vec3_9, u_vec3_10, u_vec3_11, u_vec3_12, u_vec3_13, u_vec3_14, u_vec3_15; - -uniform vec4 u_vec4_0, u_vec4_1, u_vec4_2, u_vec4_3, u_vec4_4, u_vec4_5, u_vec4_6, u_vec4_7; -uniform vec4 u_vec4_8, u_vec4_9, u_vec4_10, u_vec4_11, u_vec4_12, u_vec4_13, u_vec4_14, u_vec4_15; - -uniform mat3 u_mat3_0, u_mat3_1, u_mat3_2, u_mat3_3, u_mat3_4, u_mat3_5, u_mat3_6, u_mat3_7; -uniform mat3 u_mat3_8, u_mat3_9, u_mat3_10, u_mat3_11, u_mat3_12, u_mat3_13, u_mat3_14, u_mat3_15; - -uniform mat4 u_mat4_0, u_mat4_1, u_mat4_2, u_mat4_3, u_mat4_4, u_mat4_5, u_mat4_6, u_mat4_7; -uniform mat4 u_mat4_8, u_mat4_9, u_mat4_10, u_mat4_11, u_mat4_12, u_mat4_13, u_mat4_14, u_mat4_15; - -uniform sampler2D u_sampler2D_0, u_sampler2D_1, u_sampler2D_2, u_sampler2D_3, u_sampler2D_4, u_sampler2D_5, u_sampler2D_6; "; - -function custom_shader_reserve(node) { - var keys = ds_map_keys_to_array(CUSTOM_SHADER_SLOT); - for( var i = 0, n = array_length(keys); i < n; i++ ) { - if(CUSTOM_SHADER_SLOT[? keys[i]] == noone) { - CUSTOM_SHADER_SLOT[? keys[i]] = node; - return keys[i]; - } - } - - return noone; -} - -function custom_shader_free(node) { - var keys = ds_map_keys_to_array(CUSTOM_SHADER_SLOT); - for( var i = 0, n = array_length(keys); i < n; i++ ) { - if(CUSTOM_SHADER_SLOT[? keys[i]] == node) - CUSTOM_SHADER_SLOT[? keys[i]] = noone; - } -} - -function glsl_wrap_vertex(content) { - return @" -attribute vec3 in_Position; -attribute vec4 in_Colour; -attribute vec2 in_TextureCoord; -" + CUSTOM_SHADER_UNIFORM + @" -varying vec2 v_vTexcoord; - -void main() { -" + string(content) + "\n}"; -} - -function glsl_wrap_fragment(content) { - return @" -varying vec2 v_vTexcoord; -" + CUSTOM_SHADER_UNIFORM + @" -void main() { -" + string(content) + "\n}"; -} - -function Node_GLSL(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { - name = "GLSL"; - shader = custom_shader_reserve(self); - - hlslCompiler = working_directory + "HLSL/HLSLCompiler.exe"; - - inputs[| 0] = nodeValue("Vertex", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, -@"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_vTexcoord = in_TextureCoord;") - .setDisplay(VALUE_DISPLAY.codeGLSL) - .rejectArray(); - - inputs[| 1] = nodeValue("Fragment", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, -@"gl_FragColor = texture2D( gm_BaseTexture, v_vTexcoord );") - .setDisplay(VALUE_DISPLAY.codeGLSL) - .rejectArray(); - - inputs[| 2] = nodeValue("Base Texture", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); - - outputs[| 0] = nodeValue("Surface", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone ); - - static createNewInput = function() { - var index = ds_list_size(inputs); - inputs[| index + 0] = nodeValue("Argument name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ); - - inputs[| index + 1] = nodeValue("Argument type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) - .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Float", "Int", "Vec2", "Vec3", "Vec4", "Mat3", "Mat4", "Sampler2D" ], { update_hover: false }); - inputs[| index + 1].editWidget.interactable = false; - - inputs[| index + 2] = nodeValue("Argument value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ) - .setVisible(true, true); - inputs[| index + 2].editWidget.interactable = false; - } - - argumentRenderer(); - - input_display_list = [ 2, - ["Shader", false], 1, - ["Arguments", false], argument_renderer, - ]; - - setIsDynamicInput(3); - - uniform_name = [ - "u_float_", - "u_int_", - "u_vec2_", - "u_vec3_", - "u_vec4_", - "u_mat3_", - "u_mat4_", - "u_sampler2D_", - ]; - - insp1UpdateTooltip = __txt("Compile"); - insp1UpdateIcon = [ THEME.refresh, 1, COLORS._main_value_positive ]; - - static onInspector1Update = function() { //compile - refreshShader(); - } - - static refreshShader = function() { - var vs = inputs[| 0].getValue(); - var fs = inputs[| 1].getValue(); - - var uTypes = array_create(8, 0); - for( var i = input_fix_len, n = ds_list_size(inputs); i < n; i += data_length ) { - var _arg_name = inputs[| i + 0].getValue(); - var _arg_type = inputs[| i + 1].getValue(); - - var _index = uTypes[_arg_type]; - uTypes[_arg_type]++; - var _uni_name = uniform_name + string(_index); - - vs = string_replace_all(vs, _arg_name, _uni_name); - fs = string_replace_all(fs, _arg_name, _uni_name); - } - - vs = glsl_wrap_vertex(vs); - fs = glsl_wrap_fragment(fs); - - var _dir = DIRECTORY + "shadertemp/"; - directory_create(_dir); - - file_text_write_all(_dir + "temp.shader", - vs - + "\n//######################_==_YOYO_SHADER_MARKER_==_######################@~\n" - + fs - ); - - //print(file_text_read_all(_dir + "temp.shader")); - //print(hlslCompiler); - - var cmd = (scr_cmd_arg(hlslCompiler) - + " -hlsl11" - + " -shader " + scr_cmd_arg(_dir + "temp.shader") - + " -name temp" - + " -out " + scr_cmd_arg(_dir) - + " -typedefine " + scr_cmd_arg("#define _YY_HLSL11_ 1") - + " -preamble " + scr_cmd_arg(filename_dir(hlslCompiler)) - ); - // - var ex = execute_program_pipe(cmd, 0 - | program_pipe_flags_hide_window - | program_pipe_flags_capture_stdout - | program_pipe_flags_capture_stderr - ); - - //print(ex) - - if (ex[0] != 0) { // didn't even run - noti_warning($"Error executing HLSLCompiler: {ex[2]}"); - } else if (ex[1] != 0) { // errored out - noti_warning($"Error compiling the shader: {ex[2]}"); - } else { // OK! Let's pick up those shaders - var vsh = file_text_read_all(_dir + "vout.shader"); - var fsh = file_text_read_all(_dir + "fout.shader"); - var e = shader_replace_simple(shader, vsh, fsh); - if (e != "") noti_warning($"Error applying the shader: {e}"); - } - } - - static onValueUpdate = function(index) { - refreshShader(); - } - - static processData = function(_output, _data, _output_index, _array_index = 0) { - var _surf = _data[2]; - _output = surface_verify(_output, surface_get_width(_surf), surface_get_height(_surf)); - - surface_set_shader(_output, shader); - - var uTypes = array_create(8, 0); - for( var i = input_fix_len, n = array_length(_data); i < n; i += data_length ) { - var _arg_name = _data[i + 0]; - var _arg_type = _data[i + 1]; - var _arg_valu = _data[i + 2]; - - var _index = uTypes[_arg_type]; - uTypes[_arg_type]++; - var _uni_name = uniform_name + string(_index); - - switch(_arg_type) { - case 0 : shader_set_f(_uni_name, _arg_valu); break; //u_float - case 1 : shader_set_i(_uni_name, _arg_valu); break; //u_int - case 2 : shader_set_f(_uni_name, _arg_valu); break; //u_vec2 - case 3 : shader_set_f(_uni_name, _arg_valu); break; //u_vec3 - case 4 : shader_set_f(_uni_name, _arg_valu); break; //u_vec4 - case 5 : shader_set_f(_uni_name, _arg_valu); break; //u_mat3 - case 6 : shader_set_f(_uni_name, _arg_valu); break; //u_mat4 - case 7 : shader_set_surface(_uni_name, _arg_valu); break; //u_sampler2D - } - } - - draw_surface_safe(_surf); - surface_reset_shader(); - - return _output; - } - - static postConnect = function() { - refreshShader(); - } - - static onCleanUp = function() { - custom_shader_free(self); - } -} \ No newline at end of file diff --git a/scripts/node_hlsl/node_hlsl.gml b/scripts/node_hlsl/node_hlsl.gml new file mode 100644 index 000000000..efb8ef5be --- /dev/null +++ b/scripts/node_hlsl/node_hlsl.gml @@ -0,0 +1,173 @@ +function Node_HLSL(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor { + name = "HLSL"; + shader = { vs: -1, fs: -1 }; + + inputs[| 0] = nodeValue("Vertex", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, @"") + .setDisplay(VALUE_DISPLAY.codeHLSL) + .rejectArray(); + + inputs[| 1] = nodeValue("Fragment", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, +@"float4 combinedColour = gm_BaseTextureObject.Sample(gm_BaseTexture, input.uv); +return combinedColour;") + .setDisplay(VALUE_DISPLAY.codeHLSL) + .rejectArray(); + + inputs[| 2] = nodeValue("Base Texture", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone); + + outputs[| 0] = nodeValue("Surface", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone ); + + static createNewInput = function() { + var index = ds_list_size(inputs); + inputs[| index + 0] = nodeValue("Argument name", self, JUNCTION_CONNECT.input, VALUE_TYPE.text, "" ); + + inputs[| index + 1] = nodeValue("Argument type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0 ) + .setDisplay(VALUE_DISPLAY.enum_scroll, [ "Float", "Int", "Vec2", "Vec3", "Vec4", "Mat3", "Mat4", "Sampler2D" ], { update_hover: false }); + inputs[| index + 1].editWidget.interactable = false; + + inputs[| index + 2] = nodeValue("Argument value", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0 ) + .setVisible(true, true); + inputs[| index + 2].editWidget.interactable = false; + } + + argumentRenderer(); + + input_display_list = [ 2, + ["Shader", false], 1, + ["Arguments", false], argument_renderer, + ]; + + setIsDynamicInput(3); + + insp1UpdateTooltip = __txt("Compile"); + insp1UpdateIcon = [ THEME.refresh, 1, COLORS._main_value_positive ]; + + static onInspector1Update = function() { //compile + refreshShader(); + } + + static refreshShader = function() { + var vs = inputs[| 0].getValue(); + var fs = inputs[| 1].getValue(); + + var _dir = DIRECTORY + "shadertemp/"; + var vs = @" +#define MATRIX_WORLD 0 +#define MATRIX_WORLD_VIEW 1 +#define MATRIX_WORLD_VIEW_PROJECTION 2 + +cbuffer Matrices : register(b0) { + float4x4 gm_Matrices[3]; +}; + +struct VertexShaderInput { + float3 pos : POSITION; + float4 color : COLOR0; + float2 uv : TEXCOORD0; +}; + +struct VertexShaderOutput { + float4 pos : SV_POSITION; + float2 uv : TEXCOORD0; +}; + +VertexShaderOutput main(VertexShaderInput input) { + VertexShaderOutput output; + + output.pos = mul(gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION], float4(input.pos, 1.0f)); + output.uv = input.uv; + + return output; +}"; + file_text_write_all(_dir + "vout.shader", vs); + + var fs_pre = @" +Texture2D gm_BaseTextureObject : register(t0); +SamplerState gm_BaseTexture : register(s0); + +struct PixelShaderInput { + float4 pos : SV_POSITION; + float2 uv : TEXCOORD0; +}; +" + var fs_param = ""; + var sampler_slot = 1; + + for( var i = input_fix_len, n = ds_list_size(inputs); i < n; i += data_length ) { + var _arg_name = inputs[| i + 0].getValue(); + var _arg_type = inputs[| i + 1].getValue(); + + switch(_arg_type) { + case 0 : fs_param += $"uniform float {_arg_name};\n"; break; //u_float + case 1 : fs_param += $"uniform int {_arg_name};\n"; break; //u_int + case 2 : fs_param += $"uniform float2 {_arg_name};\n"; break; //u_vec2 + case 3 : fs_param += $"uniform float3 {_arg_name};\n"; break; //u_vec3 + case 4 : fs_param += $"uniform float4 {_arg_name};\n"; break; //u_vec4 + case 5 : fs_param += $"uniform float3x3 {_arg_name};\n"; break; //u_mat3 + case 6 : fs_param += $"uniform float4x4 {_arg_name};\n"; break; //u_mat4 + case 7 : //u_sampler2D + fs_param += $"Texture2D {_arg_name}Object : register(t{sampler_slot});\nSamplerState {_arg_name} : register(s{sampler_slot});\n"; + sampler_slot++; + break; + } + } + + var fs_pos = "float4 main(PixelShaderInput input) : SV_TARGET {" + fs + "}"; + + fs = fs_pre + fs_param + fs_pos; + file_text_write_all(_dir + "fout.shader", fs); + + shader.vs = d3d11_shader_compile_vs(_dir + "vout.shader", "main", "vs_4_0"); + if (!d3d11_shader_exists(shader.vs)) + print(d3d11_get_error_string()); + + shader.fs = d3d11_shader_compile_ps(_dir + "fout.shader", "main", "ps_4_0"); + if (!d3d11_shader_exists(shader.fs)) + print(d3d11_get_error_string()); + } + + static onValueUpdate = function(index) { + var _refresh = index == 0 || index == 1 || (index > input_fix_len && (index - input_fix_len) % data_length != 2); + if(_refresh) refreshShader(); + } + + static processData = function(_output, _data, _output_index, _array_index = 0) { + var _surf = _data[2]; + _output = surface_verify(_output, surface_get_width(_surf), surface_get_height(_surf)); + + surface_set_target(_output); + DRAW_CLEAR + + d3d11_shader_override_vs(shader.vs); + d3d11_shader_override_ps(shader.fs); + + var uTypes = array_create(8, 0); + for( var i = input_fix_len, n = array_length(_data); i < n; i += data_length ) { + var _arg_name = _data[i + 0]; + var _arg_type = _data[i + 1]; + var _arg_valu = _data[i + 2]; + + switch(_arg_type) { + case 0 : shader_set_f(_arg_name, _arg_valu); break; //u_float + case 1 : shader_set_i(_arg_name, _arg_valu); break; //u_int + case 2 : shader_set_f(_arg_name, _arg_valu); break; //u_vec2 + case 3 : shader_set_f(_arg_name, _arg_valu); break; //u_vec3 + case 4 : shader_set_f(_arg_name, _arg_valu); break; //u_vec4 + case 5 : shader_set_f(_arg_name, _arg_valu); break; //u_mat3 + case 6 : shader_set_f(_arg_name, _arg_valu); break; //u_mat4 + case 7 : shader_set_surface(_arg_name, _arg_valu); break; //u_sampler2D + } + } + + draw_surface_safe(_surf); + + d3d11_shader_override_vs(-1); + d3d11_shader_override_ps(-1); + surface_reset_target(); + + return _output; + } + + static postConnect = function() { + refreshShader(); + } +} \ No newline at end of file diff --git a/scripts/node_glsl/node_glsl.yy b/scripts/node_hlsl/node_hlsl.yy similarity index 89% rename from scripts/node_glsl/node_glsl.yy rename to scripts/node_hlsl/node_hlsl.yy index a5a1493ba..d14a9a743 100644 --- a/scripts/node_glsl/node_glsl.yy +++ b/scripts/node_hlsl/node_hlsl.yy @@ -1,7 +1,7 @@ { "resourceType": "GMScript", "resourceVersion": "1.0", - "name": "node_glsl", + "name": "node_hlsl", "isCompatibility": false, "isDnD": false, "parent": { diff --git a/scripts/node_glsl/node_outline.yy b/scripts/node_hlsl/node_outline.yy similarity index 100% rename from scripts/node_glsl/node_outline.yy rename to scripts/node_hlsl/node_outline.yy diff --git a/scripts/node_registry/node_registry.gml b/scripts/node_registry/node_registry.gml index 0ee7c08e8..a8b6e3149 100644 --- a/scripts/node_registry/node_registry.gml +++ b/scripts/node_registry/node_registry.gml @@ -651,7 +651,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { addNodeObject(node, "Lua Compute", s_node_lua_compute, "Node_Lua_Compute", [1, Node_Lua_Compute]).setVersion(1090); ds_list_add(node, "Shader"); - addNodeObject(node, "GLSL", s_node_lua_compute, "Node_GLSL", [1, Node_GLSL]).setVersion(11520); + addNodeObject(node, "HLSL", s_node_lua_compute, "Node_HLSL", [1, Node_HLSL]).setVersion(11520); ds_list_add(node, "Organize"); addNodeObject(node, "Pin", s_node_pin, "Node_Pin", [1, Node_Pin],, "Craete pin to organize your connection. Can be create by double clicking on a connection line."); diff --git a/scripts/node_value/node_value.gml b/scripts/node_value/node_value.gml index 6a0918c3a..b702a8698 100644 --- a/scripts/node_value/node_value.gml +++ b/scripts/node_value/node_value.gml @@ -93,7 +93,7 @@ enum VALUE_DISPLAY { //Text codeLUA, - codeGLSL, + codeHLSL, text_array, text_box, @@ -497,6 +497,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru display_data = -1; display_attribute = noone; + + popup_dialog = noone; #endregion #region ---- graph ---- @@ -974,13 +976,13 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru editWidget.min_lines = 4; extract_node = "Node_String"; break; - case VALUE_DISPLAY.codeGLSL: + case VALUE_DISPLAY.codeHLSL: editWidget = new textArea(TEXTBOX_INPUT.text, function(str) { return setValueDirect(str); }); editWidget.font = f_code; - editWidget.format = TEXT_AREA_FORMAT.codeGLSL; + editWidget.format = TEXT_AREA_FORMAT.codeHLSL; editWidget.min_lines = 4; extract_node = "Node_String"; break; diff --git a/scripts/panel_data/panel_data.gml b/scripts/panel_data/panel_data.gml index 92f736d48..65609b771 100644 --- a/scripts/panel_data/panel_data.gml +++ b/scripts/panel_data/panel_data.gml @@ -834,6 +834,7 @@ function PanelContent() constructor { expandable = true; resizable = true; + auto_pin = false; panel = noone; mx = 0; my = 0; diff --git a/scripts/panel_menu/panel_menu.gml b/scripts/panel_menu/panel_menu.gml index 70fcbb4dc..68a9b0fbb 100644 --- a/scripts/panel_menu/panel_menu.gml +++ b/scripts/panel_menu/panel_menu.gml @@ -1,11 +1,12 @@ function Panel_Menu() : PanelContent() constructor { - title = __txt("Menu"); + title = __txt("Menu"); + auto_pin = true; - noti_flash = 0; + noti_flash = 0; noti_flash_color = COLORS._main_accent; - noti_icon = noone; - noti_icon_show = 0; - noti_icon_time = 0; + noti_icon = noone; + noti_icon_show = 0; + noti_icon_time = 0; version_name_copy = 0; diff --git a/scripts/panel_text_editor/panel_text_editor.gml b/scripts/panel_text_editor/panel_text_editor.gml index e63130418..8603639e0 100644 --- a/scripts/panel_text_editor/panel_text_editor.gml +++ b/scripts/panel_text_editor/panel_text_editor.gml @@ -2,6 +2,7 @@ function Panel_Text_Editor(_textArea, _inputFunc, _context) : PanelContent() con title = ""; w = ui(640); h = ui(480); + auto_pin = true; self._textArea = new textArea(_textArea.input, _textArea.onModify); self._textArea.color = _textArea.color; @@ -44,5 +45,6 @@ function Panel_Text_Editor(_textArea, _inputFunc, _context) : PanelContent() con function onClose() { _textArea.apply(); + context.popup_dialog = noone; } } \ No newline at end of file diff --git a/scripts/textArea/textArea.gml b/scripts/textArea/textArea.gml index cba7e2542..c19c62e6d 100644 --- a/scripts/textArea/textArea.gml +++ b/scripts/textArea/textArea.gml @@ -1,7 +1,7 @@ enum TEXT_AREA_FORMAT { _default, codeLUA, - codeGLSL, + codeHLSL, delimiter, path_template, node_title, @@ -83,7 +83,7 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod } #endregion static onModified = function() { #region - if((format == TEXT_AREA_FORMAT.codeLUA || format == TEXT_AREA_FORMAT.codeGLSL) && autocomplete_server != noone) { + if((format == TEXT_AREA_FORMAT.codeLUA || format == TEXT_AREA_FORMAT.codeHLSL) && autocomplete_server != noone) { var crop = string_copy(_input_text, 1, cursor); var slp = string_splice(crop, [" ", "(", ",", "\n"]); var pmt = array_safe_get(slp, -1,, ARRAY_OVERFLOW.loop); @@ -177,7 +177,7 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod } } - if(!(format == TEXT_AREA_FORMAT.codeLUA || format == TEXT_AREA_FORMAT.codeGLSL) || !autocomplete_box.active) { + if(!(format == TEXT_AREA_FORMAT.codeLUA || format == TEXT_AREA_FORMAT.codeHLSL) || !autocomplete_box.active) { if(key == vk_up) { var _target; @@ -268,7 +268,7 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod var _txtLines = string_splice(_input_text, "\n"); var ss = ""; - var _code = format == TEXT_AREA_FORMAT.codeLUA || format == TEXT_AREA_FORMAT.codeGLSL; + var _code = format == TEXT_AREA_FORMAT.codeLUA || format == TEXT_AREA_FORMAT.codeHLSL; for( var i = 0, n = array_length(_txtLines); i < n; i++ ) { var _txt = _txtLines[i] + (i < array_length(_txtLines)? "\n" : ""); @@ -531,7 +531,7 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod draw_text_add(ch_x, ch_y, _str); else if(format == TEXT_AREA_FORMAT.codeLUA) draw_code_lua(ch_x, ch_y, _str); - else if(format == TEXT_AREA_FORMAT.codeGLSL) + else if(format == TEXT_AREA_FORMAT.codeHLSL) draw_code_glsl(ch_x, ch_y, _str); else if(format == TEXT_AREA_FORMAT.delimiter) draw_text_delimiter(ch_x, ch_y, _str); @@ -584,12 +584,10 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod if(target != -999) { if(mouse_press(mb_left, active) || click_block == 1) { - cursor_select = -1; - cursor = target; - click_block = 0; - } else if(mouse_click(mb_left, active) && cursor != target) { cursor_select = target; - } + click_block = 0; + } else if(mouse_click(mb_left, active) && cursor != target) + cursor = target; } } #endregion @@ -627,7 +625,7 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod if(format == TEXT_AREA_FORMAT._default) { line_width = _w - ui(16); - } else if(format == TEXT_AREA_FORMAT.codeLUA || format == TEXT_AREA_FORMAT.codeGLSL) { + } else if(format == TEXT_AREA_FORMAT.codeLUA || format == TEXT_AREA_FORMAT.codeHLSL) { line_width = _w - ui(16 + code_line_width); tx += ui(code_line_width); } @@ -642,7 +640,7 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, hh, boxColor, 1); - if(format == TEXT_AREA_FORMAT.codeLUA || format == TEXT_AREA_FORMAT.codeGLSL) { + if(format == TEXT_AREA_FORMAT.codeLUA || format == TEXT_AREA_FORMAT.codeHLSL) { draw_sprite_stretched_ext(THEME.textbox_code, 0, _x, _y, ui(code_line_width), hh, boxColor, 1); draw_set_text(f_code, fa_right, fa_top, COLORS._main_text_sub); diff --git a/scripts/textBox/textBox.gml b/scripts/textBox/textBox.gml index d58eede3f..f11d5a86f 100644 --- a/scripts/textBox/textBox.gml +++ b/scripts/textBox/textBox.gml @@ -272,12 +272,10 @@ function textBox(_input, _onModify, _extras = noone) : textInput(_input, _onModi if(target != -999) { if(mouse_press(mb_left, active) || click_block == 1) { - cursor_select = -1; - cursor = target; - click_block = 0; - } else if(mouse_click(mb_left, active) && cursor != target) { cursor_select = target; - } + click_block = 0; + } else if(mouse_click(mb_left, active) && cursor != target) + cursor = target; } }