diff --git a/README.md b/README.md index 8ec7392..aee546d 100644 --- a/README.md +++ b/README.md @@ -37,8 +37,9 @@ 2. 对着下载好的图片右键,选择`属性-详细信息`,查看图片的`宽度`和`高度` 3. 将准星图片复制到`游戏根目录/reshade-shaders/Textures/`并覆盖 4. 如果更新准星时游戏正在运行,点击键盘上的`Home`键(默认的ReShade设置面板切换键),然后点击下方的`重新加载` -5. 在设置选项中调整自定义准星的宽度和高度(建议设置为`步骤2`中的`宽度`和`高度`) -6. 如果需要将其他来源的图片设置为准星,请将图片文件名修改为`KovaaK-Crosshair.png`,然后进行`步骤2~5`,图片的宽度和高度不应超过`500像素` +5. 在设置选项中将准星样式调整为`自定义准星图片` +6. 调整图片宽度和图片高度(建议设置为`步骤2`中的`宽度`和`高度`) +7. 如果需要将其他来源的图片设置为准星,请将图片文件名修改为`KovaaK-Crosshair.png`,然后进行`步骤2~5`,图片的宽度和高度不应超过`500像素` ## 建议和反馈 diff --git a/reshade-shaders/Shaders/ApexReticle.fx b/reshade-shaders/Shaders/ApexReticle.fx index c31240f..570bee9 100644 --- a/reshade-shaders/Shaders/ApexReticle.fx +++ b/reshade-shaders/Shaders/ApexReticle.fx @@ -1,7 +1,7 @@ /*************************************************************************************************** ApexReticle - Copyright 2024 roundRekt v1.1 + Copyright 2024 roundRekt v1.2 GitHub:https://github.com/roundRekt bilibili:https://space.bilibili.com/2122119709 @@ -12,6 +12,10 @@ https://github.com/roundRekt/ApexReticle 历史: + 版本 1.2 + * 添加了腰射专用准星 + * 添加了三种准星样式 + * 添加了切换开镜兼容 版本 1.1 * 现在当高抛雷分划的显示策略设置为“捏雷时显示”时如果右键被按住则不会显示 版本 1.0 @@ -25,58 +29,108 @@ #include "ReShade.fxh" -#define CROSSHAIR "自定义准星" -#define GRENADE "高抛雷分划" -#define AUTHOR "Copyright 2024 roundRekt v1.1" - uniform bool Crosshair_Flag < - ui_category = CROSSHAIR; + ui_category = "自定义准星"; ui_label = "启用"; ui_tooltip = "设置是否启用自定义准星"; > = 1; +uniform bool Crosshair_Toggle +< + ui_category = "自定义准星"; + ui_label = "切换开镜"; + ui_tooltip = "设置是否使用切换开镜"; +> = 0; + +uniform int Crosshair_Display +< + ui_category = "自定义准星"; + ui_type = "combo"; + ui_items = "开镜时显示\0开火时显示\0开镜或开火时显示\0始终显示\0"; + ui_label = "显示策略"; + ui_tooltip = "设置自定义准星的显示策略(默认开火为鼠标左键,开镜为按住鼠标右键)"; +> = 0; + +uniform int Crosshair_Type +< + ui_category = "自定义准星"; + ui_type = "combo"; + ui_items = "点状 ・\0十字 +\0叉形 ×\0自定义准星图片\0"; + ui_label = "准星样式"; + ui_tooltip = "设置准星的样式(“自定义准星图片”需要手动添加准星图片,并设置宽度和高度)"; +> = 0; + uniform int Crosshair_Width < - ui_category = CROSSHAIR; + ui_category = "自定义准星"; ui_type = "slider"; ui_min = 1; ui_max = 500; ui_step = 1; - ui_label = "宽度"; - ui_tooltip = "设置自定义准星的宽度(此项建议与图片宽度保持一致)"; -> = 8; + ui_label = "图片宽度"; + ui_tooltip = "设置自定义准星图片的宽度(当准星样式为“自定义准星图片”时生效,建议与图片宽度保持一致)"; +> = 250; uniform int Crosshair_Height < - ui_category = CROSSHAIR; + ui_category = "自定义准星"; ui_type = "slider"; ui_min = 1; ui_max = 500; ui_step = 1; - ui_label = "高度"; - ui_tooltip = "设置自定义准星的高度(此项建议与图片高度保持一致)"; -> = 8; + ui_label = "图片高度"; + ui_tooltip = "设置自定义准星图片的高度(当准星样式为“自定义准星图片”时生效,建议与图片高度保持一致)"; +> = 250; -uniform int Crosshair_Display +uniform bool Crosshair_Hipfire < - ui_category = CROSSHAIR; + ui_category = "自定义准星"; + ui_label = "添加腰射准星"; + ui_tooltip = "设置是否添加腰射专用准星(仅在腰射时显示)"; +> = 1; + +uniform int Crosshair_Hipfire_Type +< + ui_category = "自定义准星"; ui_type = "combo"; - ui_items = "开镜时显示\0开火时显示\0开镜或开火时显示\0始终显示\0"; - ui_label = "显示策略"; - ui_tooltip = "设置自定义准星的显示策略(默认开火为鼠标左键,开镜为按住鼠标右键)"; + ui_items = "点状 ・\0十字 +\0叉形 ×\0自定义图片\0"; + ui_label = "准星样式"; + ui_tooltip = "设置准星的样式(“自定义准星图片”需要手动添加准星图片,并设置宽度和高度)"; > = 2; +uniform int Crosshair_Hipfire_Width +< + ui_category = "自定义准星"; + ui_type = "slider"; + ui_min = 1; + ui_max = 500; + ui_step = 1; + ui_label = "图片宽度"; + ui_tooltip = "设置自定义准星图片的宽度(当准星样式为“自定义准星图片”时生效,建议与图片宽度保持一致)"; +> = 250; + +uniform int Crosshair_Hipfire_Height +< + ui_category = "自定义准星"; + ui_type = "slider"; + ui_min = 1; + ui_max = 500; + ui_step = 1; + ui_label = "图片高度"; + ui_tooltip = "设置自定义准星图片的高度(当准星样式为“自定义准星图片”时生效,建议与图片高度保持一致)"; +> = 250; + uniform bool Grenade_Flag < - ui_category = GRENADE; + ui_category = "高抛雷分划"; ui_label = "启用"; - ui_tooltip = "设置是否启用高抛雷分划(不提倡在对局中启用)"; + ui_tooltip = "设置是否启用高抛雷分划"; > = 1; uniform float Grenade_Opacity < - ui_category = GRENADE; + ui_category = "高抛雷分划"; ui_type = "slider"; ui_min = 0; ui_max = 1; @@ -87,7 +141,7 @@ uniform float Grenade_Opacity uniform int Grenade_FOV < - ui_category = GRENADE; + ui_category = "高抛雷分划"; ui_type = "combo"; ui_items = "90\0""100\0""104\0""106\0""110\0""120\0"; ui_label = "视野(FOV)"; @@ -96,39 +150,39 @@ uniform int Grenade_FOV uniform int Grenade_Display < - ui_category = GRENADE; + ui_category = "高抛雷分划"; ui_type = "combo"; ui_items = "捏雷时显示\0始终显示\0"; ui_label = "显示策略"; ui_tooltip = "设置高抛雷分划的显示策略(默认捏雷为长按鼠标左键)"; > = 0; -uniform int Repository +uniform int Bilibili < - ui_category = AUTHOR; - ui_type = "list"; - ui_items = "https://github.com/roundRekt/ApexReticle\0"; - ui_label = "项目地址"; - ui_tooltip = "项目里有文字教程喵~"; -> = 0; + ui_category = "Copyright 2024 roundRekt v1.2"; + ui_type = "radio"; + ui_items = "https://space.bilibili.com/2122119709\0"; + ui_label = "bilibili"; + ui_tooltip = "空间里有视频教程喵~"; +>; uniform int GitHub < - ui_category = AUTHOR; - ui_type = "list"; + ui_category = "Copyright 2024 roundRekt v1.2"; + ui_type = "radio"; ui_items = "https://github.com/roundRekt\0"; ui_label = "GitHub"; ui_tooltip = "主页里有项目详情喵~"; -> = 0; +>; -uniform int Bilibili +uniform int Repository < - ui_category = AUTHOR; - ui_type = "list"; - ui_items = "https://space.bilibili.com/2122119709\0"; - ui_label = "bilibili"; - ui_tooltip = "空间里有视频教程喵~"; -> = 0; + ui_category = "Copyright 2024 roundRekt v1.2"; + ui_type = "radio"; + ui_items = "https://github.com/roundRekt/ApexReticle\0"; + ui_label = "项目地址"; + ui_tooltip = "项目里有文字教程喵~"; +>; uniform bool Mouse_Left < @@ -144,13 +198,26 @@ uniform bool Mouse_Right toggle = false; >; -texture Crosshair_Texture_KovaaK {Width = 500; Height = 500; Format = RGBA8;}; +uniform bool Mouse_Right_Toggle +< + source = "mousebutton"; + keycode = 1; + toggle = true; +>; + +texture Crosshair_Texture_Dot {Width = 8; Height = 8; Format = RGBA8;}; +texture Crosshair_Texture_Cross {Width = 100; Height = 100; Format = RGBA8;}; +texture Crosshair_Texture_X {Width = 62; Height = 62; Format = RGBA8;}; +texture Crosshair_Texture_KovaaK {Width = 500; Height = 500; Format = RGBA8;}; texture Grenade_Texture_FOV90 {Width = 1920; Height = 1080; Format = RGBA8;}; texture Grenade_Texture_FOV100 {Width = 1920; Height = 1080; Format = RGBA8;}; texture Grenade_Texture_FOV104 {Width = 1920; Height = 1080; Format = RGBA8;}; texture Grenade_Texture_FOV106 {Width = 1920; Height = 1080; Format = RGBA8;}; texture Grenade_Texture_FOV110 {Width = 1920; Height = 1080; Format = RGBA8;}; texture Grenade_Texture_FOV120 {Width = 1920; Height = 1080; Format = RGBA8;}; +sampler Crosshair_Sampler_Dot {Texture = Crosshair_Texture_Dot;}; +sampler Crosshair_Sampler_Cross {Texture = Crosshair_Texture_Cross;}; +sampler Crosshair_Sampler_X {Texture = Crosshair_Texture_X;}; sampler Crosshair_Sampler_KovaaK {Texture = Crosshair_Texture_KovaaK;}; sampler Grenade_Sampler_FOV90 {Texture = Grenade_Texture_FOV90;}; sampler Grenade_Sampler_FOV100 {Texture = Grenade_Texture_FOV100;}; @@ -162,18 +229,61 @@ sampler Grenade_Sampler_FOV120 {Texture = Grenade_Texture_FOV120;}; float4 VS_Crosshair(uint vid : SV_VertexID, out float2 texcoord : TexCoord) : SV_POSITION { texcoord.y = vid % 2, texcoord.x = vid / 2; - return float4((texcoord.x*2-1.)*Crosshair_Width*BUFFER_RCP_WIDTH,(1.-texcoord.y*2)*Crosshair_Height*BUFFER_RCP_HEIGHT,0,1); + int Width,Height; + switch(Crosshair_Type) + { + case 0:Width=Height=8*BUFFER_HEIGHT/1080; break; + case 1:Width=Height=100*BUFFER_HEIGHT/1080; break; + case 2:Width=Height=62*BUFFER_HEIGHT/1080; break; + case 3:Width=Crosshair_Width; Height=Crosshair_Height; break; + } + return float4((texcoord.x*2-1)*Width/BUFFER_WIDTH,(1-texcoord.y*2)*Height/BUFFER_HEIGHT,0,1); +} + +float4 VS_Crosshair_Hipfire(uint vid : SV_VertexID, out float2 texcoord : TexCoord) : SV_POSITION +{ + texcoord.y = vid % 2, texcoord.x = vid / 2; + int Width,Height; + switch(Crosshair_Hipfire_Type) + { + case 0:Width=Height=8*BUFFER_HEIGHT/1080; break; + case 1:Width=Height=100*BUFFER_HEIGHT/1080; break; + case 2:Width=Height=62*BUFFER_HEIGHT/1080; break; + case 3:Width=Crosshair_Hipfire_Width; Height=Crosshair_Hipfire_Height; break; + } + return float4((texcoord.x*2-1)*Width/BUFFER_WIDTH,(1-texcoord.y*2)*Height/BUFFER_HEIGHT,0,1); } float4 PS_Crosshair(float4 pos : SV_Position, float2 texcoord : TexCoord) : SV_Target { if (Crosshair_Flag) { - switch (Crosshair_Display) + switch(Crosshair_Display) + { + case 0:if (Crosshair_Toggle ? Mouse_Right_Toggle : Mouse_Right) {}else return 0; break; + case 1:if (Mouse_Left) {}else return 0; break; + case 2:if (Mouse_Left || (Crosshair_Toggle ? Mouse_Right_Toggle : Mouse_Right)) {}else return 0; break; + } + switch(Crosshair_Type) + { + case 0:return tex2D(Crosshair_Sampler_Dot, texcoord); + case 1:return tex2D(Crosshair_Sampler_Cross, texcoord); + case 2:return tex2D(Crosshair_Sampler_X, texcoord); + case 3:return tex2D(Crosshair_Sampler_KovaaK, texcoord); + } + } + return 0; +} + +float4 PS_Crosshair_Hipfire(float4 pos : SV_Position, float2 texcoord : TexCoord) : SV_Target +{ + if (Crosshair_Hipfire && Mouse_Left && !(Crosshair_Toggle ? Mouse_Right_Toggle : Mouse_Right)) + { + switch(Crosshair_Hipfire_Type) { - case 0:if (Mouse_Right) {return tex2D(Crosshair_Sampler_KovaaK, texcoord);} break; - case 1:if (Mouse_Left) {return tex2D(Crosshair_Sampler_KovaaK, texcoord);} break; - case 2:if (Mouse_Left || Mouse_Right) {return tex2D(Crosshair_Sampler_KovaaK, texcoord);} break; + case 0:return tex2D(Crosshair_Sampler_Dot, texcoord); + case 1:return tex2D(Crosshair_Sampler_Cross, texcoord); + case 2:return tex2D(Crosshair_Sampler_X, texcoord); case 3:return tex2D(Crosshair_Sampler_KovaaK, texcoord); } } @@ -182,7 +292,7 @@ float4 PS_Crosshair(float4 pos : SV_Position, float2 texcoord : TexCoord) : SV_T float4 PS_Grenade(float4 pos : SV_Position, float2 texcoord : TexCoord) : SV_Target { - if (Grenade_Flag && Mouse_Left && !Mouse_Right || Grenade_Display) + if (Grenade_Flag && Mouse_Left && !(Crosshair_Toggle ? Mouse_Right_Toggle : Mouse_Right) || Grenade_Display) { switch (Grenade_FOV) { @@ -212,6 +322,16 @@ technique ApexReticle SrcBlend = SRCALPHA; DestBlend = INVSRCALPHA; } + pass CrosshairHipfirePass + { + VertexCount = 4; + PrimitiveTopology = TRIANGLESTRIP; + VertexShader = VS_Crosshair_Hipfire; + PixelShader = PS_Crosshair_Hipfire; + BlendEnable = true; + SrcBlend = SRCALPHA; + DestBlend = INVSRCALPHA; + } pass GrenadePass { VertexShader = PostProcessVS; diff --git a/reshade-shaders/Textures/Cross.png b/reshade-shaders/Textures/Cross.png new file mode 100644 index 0000000..0fee4a6 Binary files /dev/null and b/reshade-shaders/Textures/Cross.png differ diff --git a/reshade-shaders/Textures/Dot.png b/reshade-shaders/Textures/Dot.png new file mode 100644 index 0000000..9571223 Binary files /dev/null and b/reshade-shaders/Textures/Dot.png differ diff --git a/reshade-shaders/Textures/KovaaK-Crosshair.png b/reshade-shaders/Textures/KovaaK-Crosshair.png index 9571223..283b262 100644 Binary files a/reshade-shaders/Textures/KovaaK-Crosshair.png and b/reshade-shaders/Textures/KovaaK-Crosshair.png differ diff --git a/reshade-shaders/Textures/X.png b/reshade-shaders/Textures/X.png new file mode 100644 index 0000000..f02b356 Binary files /dev/null and b/reshade-shaders/Textures/X.png differ