rsx/overlays: Implement arrow rendering

This commit is contained in:
kd-11 2026-03-15 19:55:17 +03:00 committed by kd-11
parent 7866c7195c
commit 7240cbfdab
4 changed files with 97 additions and 0 deletions

View file

@ -0,0 +1,47 @@
#pragma once
#include "overlay_controls.h"
namespace rsx::overlays
{
template <int Anchor, int Base, int Edge0, int Edge1>
requires (Anchor >= 0 && Anchor < 4 && Base >= 0 && Base < 4 && Edge0 >= 0 && Edge0 < 4 && Edge1 >= 0 && Edge1 < 4)
struct arrow_base : public overlay_element
{
compiled_resource& get_compiled() override
{
if (is_compiled())
{
return compiled_resources;
}
overlay_element::get_compiled();
m_vertex_cache.resize(3);
m_vertex_cache[0] = compiled_resources.draw_commands[0].verts[Anchor];
m_vertex_cache[1] = compiled_resources.draw_commands[0].verts[Base];
m_vertex_cache[2] = compiled_resources.draw_commands[0].verts[Edge0] + compiled_resources.draw_commands[0].verts[Edge1];
m_vertex_cache[2] /= 2;
compiled_resources.draw_commands[0].verts.swap(m_vertex_cache);
compiled_resources.draw_commands[0].config.primitives = overlays::primitive_type::triangle_strip;
m_is_compiled = true;
return compiled_resources;
}
private:
std::vector<vertex> m_vertex_cache;
};
struct arrow_up : public arrow_base<2, 3, 0, 1>
{};
struct arrow_down : public arrow_base<0, 1, 2, 3>
{};
struct arrow_left : public arrow_base<1, 2, 3, 0>
{};
struct arrow_right : public arrow_base<3, 0, 1, 2>
{};
}

View file

@ -95,6 +95,52 @@ struct vertex
values[2] -= other.values[2];
values[3] -= other.values[3];
}
void operator /= (const vertex& other)
{
values[0] /= other.values[0];
values[1] /= other.values[1];
values[2] /= other.values[2];
values[3] /= other.values[3];
}
void operator /= (float rhs)
{
values[0] /= rhs;
values[1] /= rhs;
values[2] /= rhs;
values[3] /= rhs;
}
void operator *= (const vertex& other)
{
values[0] *= other.values[0];
values[1] *= other.values[1];
values[2] *= other.values[2];
values[3] *= other.values[3];
}
void operator *= (float rhs)
{
values[0] *= rhs;
values[1] *= rhs;
values[2] *= rhs;
values[3] *= rhs;
}
vertex operator + (const vertex& other) const
{
vertex result = *this;
result += other;
return result;
}
vertex operator - (const vertex& other) const
{
vertex result = *this;
result -= other;
return result;
}
};

View file

@ -711,6 +711,7 @@
<ClInclude Include="Emu\RSX\Overlays\Network\overlay_recvmessage_dialog.h" />
<ClInclude Include="Emu\RSX\Overlays\Network\overlay_sendmessage_dialog.h" />
<ClInclude Include="Emu\RSX\Overlays\overlay_animated_icon.h" />
<ClInclude Include="Emu\RSX\Overlays\overlay_arrow.h" />
<ClInclude Include="Emu\RSX\Overlays\overlay_audio.h" />
<ClInclude Include="Emu\RSX\Overlays\overlay_checkbox.h" />
<ClInclude Include="Emu\RSX\Overlays\overlay_cursor.h" />

View file

@ -2869,6 +2869,9 @@
<ClInclude Include="Emu\RSX\Overlays\overlay_select.h">
<Filter>Emu\GPU\RSX\Overlays</Filter>
</ClInclude>
<ClInclude Include="Emu\RSX\Overlays\overlay_arrow.h">
<Filter>Emu\GPU\RSX\Overlays</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="Emu\RSX\Program\GLSLSnippets\GPUDeswizzle.glsl">