diff --git a/Source/Client/ModeFade.cpp b/Source/Client/ModeFade.cpp index a24a5871d..68f36a35b 100644 --- a/Source/Client/ModeFade.cpp +++ b/Source/Client/ModeFade.cpp @@ -21,9 +21,6 @@ void CMode::DrawFadeIn() { const std::uint32_t elapsed = timeGetTime() - g_modeFadeTick; if (elapsed < 255) { - DrawAlphaRectangle( - g_renderer->primitives, g_renderer->queues, 0, 0, g_renderer->viewport.width, g_renderer->viewport.height, (255 - elapsed) << 24, - g_renderer->fog.supported != 0, g_depthStart, g_depthEnd - ); + DrawAlphaRectangle(0, 0, g_renderer->viewport.width, g_renderer->viewport.height, (255 - elapsed) << 24); } } diff --git a/Source/Client/ModeFadeOut.cpp b/Source/Client/ModeFadeOut.cpp index aa4559d25..f0b548453 100644 --- a/Source/Client/ModeFadeOut.cpp +++ b/Source/Client/ModeFadeOut.cpp @@ -19,8 +19,7 @@ std::uint32_t FadeOutMode(CRenderer& renderer, CRenderSystemBase& system, Resour renderer.CaptureBackBuffer(); std::uint32_t elapsed = timeGetTime() - g_modeFadeTick; while (elapsed < 255) { - DrawAlphaRectangle(renderer.primitives, renderer.queues, 0, 0, renderer.viewport.width, renderer.viewport.height, elapsed << 24, - depthAlpha, depthStart, depthEnd); + DrawAlphaRectangle(0, 0, renderer.viewport.width, renderer.viewport.height, elapsed << 24); if (showLogo != 0) { auto* logo = static_cast(resources.Load(Resolve("rag_logo.bmp"))); DrawBitmapResource(system, renderer.viewport.width - 192, renderer.viewport.height - 122, logo); diff --git a/Source/Render/AlphaRectangle.cpp b/Source/Render/AlphaRectangle.cpp index 58e1b118b..9e4f8fb54 100644 --- a/Source/Render/AlphaRectangle.cpp +++ b/Source/Render/AlphaRectangle.cpp @@ -1,19 +1,18 @@ #include "Render/Primitives/AlphaRectangle.h" #include "Render/Primitives/RenderPrimitivePool.h" #include "Render/Primitives/RenderQueues.h" +#include "Render/Renderer.h" +#include "Render/TextureQuad.h" #include "Render/Textures/TextureCache.h" // OFFSET: 0x0054E460 // FUNCTION: fn_01952 -void DrawAlphaRectangle( - RenderPrimitivePool& primitives, RenderQueues& queues, int x, int y, int width, int height, std::uint32_t color, bool depthAlpha, - float depthStart, float depthEnd -) { +void DrawAlphaRectangle(int x, int y, int width, int height, std::uint32_t color) { if ((color & 0xFF000000u) == 0) { return; } - RenderPrimitive* primitive = primitives.Acquire(); + RenderPrimitive* primitive = g_renderer->primitives.Acquire(); primitive->texture = g_texMgr.Default(); const float left = static_cast(x); const float top = static_cast(y); @@ -34,5 +33,5 @@ void DrawAlphaRectangle( vertex.u = 0.0f; vertex.v = 0.0f; } - queues.Submit(primitive, 513, depthAlpha, depthStart, depthEnd); + g_renderer->queues.Submit(primitive, 513, g_renderer->fog.supported != 0, g_depthStart, g_depthEnd); } diff --git a/Source/Render/Primitives/AlphaRectangle.h b/Source/Render/Primitives/AlphaRectangle.h index 9e6e8671a..c4a6861d5 100644 --- a/Source/Render/Primitives/AlphaRectangle.h +++ b/Source/Render/Primitives/AlphaRectangle.h @@ -7,9 +7,6 @@ class RenderPrimitivePool; class TextureCache; struct RenderQueues; -void DrawAlphaRectangle( - RenderPrimitivePool& primitives, RenderQueues& queues, int x, int y, int width, int height, std::uint32_t color, bool depthAlpha, - float depthStart, float depthEnd -); +void DrawAlphaRectangle(int x, int y, int width, int height, std::uint32_t color); #endif diff --git a/Source/Render/Primitives/ScreenLine.cpp b/Source/Render/Primitives/ScreenLine.cpp index b2365aec8..fbf628dec 100644 --- a/Source/Render/Primitives/ScreenLine.cpp +++ b/Source/Render/Primitives/ScreenLine.cpp @@ -133,10 +133,7 @@ void UIRoMapWnd::DrawRecordAreas() { if (color == 12) { color = 0; } - DrawAlphaRectangle( - g_renderer->primitives, g_renderer->queues, it->left, it->top, it->right - it->left, it->bottom - it->top, g_roMapRecordColors[color], - g_renderer->fog.supported != 0, g_depthStart, g_depthEnd - ); + DrawAlphaRectangle(it->left, it->top, it->right - it->left, it->bottom - it->top, g_roMapRecordColors[color]); ++color; } } @@ -153,15 +150,9 @@ void UINewChatWnd::Slot43() { for (int i = 0; i < static_cast(this->m_tabControl->labels.size()); ++i) { const int inactive = i != this->m_currentTab; - DrawAlphaRectangle( - g_renderer->primitives, g_renderer->queues, x + 1 + this->m_tabWidth * i, y + 1 + inactive, this->m_tabWidth - 1, this->m_inputOffsetY - inactive, - inactive ? 0x99000000 : 0x66000000, g_renderer->fog.supported != 0, g_depthStart, g_depthEnd - ); + DrawAlphaRectangle(x + 1 + this->m_tabWidth * i, y + 1 + inactive, this->m_tabWidth - 1, this->m_inputOffsetY - inactive, inactive ? 0x99000000 : 0x66000000); } - DrawAlphaRectangle( - g_renderer->primitives, g_renderer->queues, this->m_inputX + 1, this->m_inputY + 1, this->m_listWidth - 2, this->m_listHeight - 1, this->m_listColor, - g_renderer->fog.supported != 0, g_depthStart, g_depthEnd - ); + DrawAlphaRectangle(this->m_inputX + 1, this->m_inputY + 1, this->m_listWidth - 2, this->m_listHeight - 1, this->m_listColor); } // OFFSET: 0x00918300 @@ -170,14 +161,8 @@ void UISubChatHisWnd::Slot43() { int x = 0; int y = 0; this->ToScreen(x, y); - DrawAlphaRectangle( - g_renderer->primitives, g_renderer->queues, x + 1, y + 1, this->m_inputWidth - 2, this->m_inputHeight, 0x66000000, g_renderer->fog.supported != 0, - g_depthStart, g_depthEnd - ); - DrawAlphaRectangle( - g_renderer->primitives, g_renderer->queues, this->m_state.unknown_0000 + 1, this->m_state.unknown_0004 + 1, this->m_state.unknown_0008 - 2, - this->m_state.unknown_000C - 2, this->m_state.unknown_0014, g_renderer->fog.supported != 0, g_depthStart, g_depthEnd - ); + DrawAlphaRectangle(x + 1, y + 1, this->m_inputWidth - 2, this->m_inputHeight, 0x66000000); + DrawAlphaRectangle(this->m_state.unknown_0000 + 1, this->m_state.unknown_0004 + 1, this->m_state.unknown_0008 - 2, this->m_state.unknown_000C - 2, this->m_state.unknown_0014); } // OFFSET: 0x009189C0 diff --git a/Source/Render/ScreenRectangle.cpp b/Source/Render/ScreenRectangle.cpp index 2ba0a2964..d208b9360 100644 --- a/Source/Render/ScreenRectangle.cpp +++ b/Source/Render/ScreenRectangle.cpp @@ -1,6 +1,8 @@ #include "Render/ScreenRectangle.h" #include "Render/Primitives/RenderPrimitivePool.h" #include "Render/Primitives/RenderQueues.h" +#include "Render/Renderer.h" +#include "Render/TextureQuad.h" #include "Render/Textures/Texture.h" #include "Render/Textures/TextureCache.h" @@ -42,15 +44,12 @@ void DrawBlendedRectangle( // OFFSET: 0x0054ED40 // FUNCTION: fn_01954 -void DrawTexturedRectangle( - RenderPrimitivePool& primitives, RenderQueues& queues, int x, int y, int width, int height, std::uint32_t color, CTexture* texture, - bool depthAlpha, float depthStart, float depthEnd -) { +void DrawTexturedRectangle(int x, int y, int width, int height, std::uint32_t color, CTexture* texture) { if ((color & 0xFF000000u) == 0) { return; } - RenderPrimitive* primitive = primitives.Acquire(); + RenderPrimitive* primitive = g_renderer->primitives.Acquire(); primitive->texture = texture ? texture : g_texMgr.Default(); const float left = static_cast(x); const float top = static_cast(y); @@ -77,7 +76,7 @@ void DrawTexturedRectangle( vertex.rhw = 0.999999f; vertex.diffuse = color; } - queues.Submit(primitive, 513, depthAlpha, depthStart, depthEnd); + g_renderer->queues.Submit(primitive, 513, g_renderer->fog.supported != 0, g_depthStart, g_depthEnd); } // OFFSET: 0x0054EFD0 diff --git a/Source/Render/ScreenRectangle.h b/Source/Render/ScreenRectangle.h index ff656593d..2798f6719 100644 --- a/Source/Render/ScreenRectangle.h +++ b/Source/Render/ScreenRectangle.h @@ -12,10 +12,7 @@ void DrawBlendedRectangle( RenderPrimitivePool& primitives, RenderQueues& queues, int x, int y, int width, int height, std::uint32_t color, bool depthAlpha, float depthStart, float depthEnd ); -void DrawTexturedRectangle( - RenderPrimitivePool& primitives, RenderQueues& queues, int x, int y, int width, int height, std::uint32_t color, CTexture* texture, - bool depthAlpha, float depthStart, float depthEnd -); +void DrawTexturedRectangle(int x, int y, int width, int height, std::uint32_t color, CTexture* texture); void DrawTextureRegion( RenderPrimitivePool& primitives, RenderQueues& queues, float x, float y, float width, float height, std::uint32_t color, CTexture* texture, bool depthAlpha, float depthStart, float depthEnd diff --git a/Source/UI/UIBroadcastBalloon.cpp b/Source/UI/UIBroadcastBalloon.cpp index 14c6de5f6..8ac0163ac 100644 --- a/Source/UI/UIBroadcastBalloon.cpp +++ b/Source/UI/UIBroadcastBalloon.cpp @@ -68,10 +68,7 @@ void UIBroadcastBalloon::Slot43() { for (const auto& entry : this->m_messages) { for (const BroadcastBalloonMessage& message : entry.second) { if (message.lines.size() != 0) { - DrawAlphaRectangle( - g_renderer->primitives, g_renderer->queues, this->geometry.x + 1 + (this->geometry.width - message.width) / 2, this->geometry.y + 1 + y, - message.width - 2, message.height - 2, message.backgroundColor, g_renderer->fog.supported != 0, g_depthStart, g_depthEnd - ); + DrawAlphaRectangle(this->geometry.x + 1 + (this->geometry.width - message.width) / 2, this->geometry.y + 1 + y, message.width - 2, message.height - 2, message.backgroundColor); y += message.height + 10; } } diff --git a/Source/UI/Window/UIRoMapWnd.cpp b/Source/UI/Window/UIRoMapWnd.cpp index 135541005..28249d13c 100644 --- a/Source/UI/Window/UIRoMapWnd.cpp +++ b/Source/UI/Window/UIRoMapWnd.cpp @@ -346,18 +346,12 @@ void UIRoMapWnd::DrawDungeonLinks() { ); } - DrawTexturedRectangle( - g_renderer->primitives, g_renderer->queues, map->left, map->top, mapWidth, mapHeight, isSelected ? 0xFFFFFFFF : rectColor, positionTexture, - g_renderer->fog.supported != 0, g_depthStart, g_depthEnd - ); + DrawTexturedRectangle(map->left, map->top, mapWidth, mapHeight, isSelected ? 0xFFFFFFFF : rectColor, positionTexture); x = field->left; y = field->top; } - DrawTexturedRectangle( - g_renderer->primitives, g_renderer->queues, x, y, width, height, isSelected ? 0xFFFFFFFF : rectColor, selectTexture, - g_renderer->fog.supported != 0, g_depthStart, g_depthEnd - ); + DrawTexturedRectangle(x, y, width, height, isSelected ? 0xFFFFFFFF : rectColor, selectTexture); } } @@ -375,10 +369,7 @@ void UIRoMapWnd::DrawMarks() { const int y = area[1] + 1; const int width = area[2] - area[0] - 2; const int height = area[3] - area[1] - 2; - DrawAlphaRectangle( - g_renderer->primitives, g_renderer->queues, x, y, width, height, g_worldViewMgr.runColor, g_renderer->fog.supported != 0, g_depthStart, - g_depthEnd - ); + DrawAlphaRectangle(x, y, width, height, g_worldViewMgr.runColor); if (index != 0) { const int* previous = g_worldViewMgr.MarkAreaAt(index - 1, true); if (previous != nullptr) { @@ -416,10 +407,7 @@ void UIRoMapWnd::DrawMarks() { const int drawX = static_cast( static_cast(width) * g_depthAverageHalf + static_cast(x) - static_cast(texture->Width()) ); - DrawTexturedRectangle( - g_renderer->primitives, g_renderer->queues, drawX, drawY, textureWidth, textureHeight, 0xCCFFFFFF, texture, - g_renderer->fog.supported != 0, g_depthStart, g_depthEnd - ); + DrawTexturedRectangle(drawX, drawY, textureWidth, textureHeight, 0xCCFFFFFF, texture); } } } @@ -436,18 +424,17 @@ void UIRoMapWnd::DrawRecordFaces(int) { continue; } - const int x = static_cast(static_cast(it->left - faceSize) + static_cast(it->right - it->left) * g_depthAverageHalf); - const int y = static_cast(static_cast(it->top - faceSize) + static_cast(it->bottom - it->top) * g_depthAverageHalf); + const int width = it->right - it->left; + const int height = it->bottom - it->top; + const int x = static_cast(static_cast(it->left - faceSize) + static_cast(width) * 0.5f); + const int y = static_cast(static_cast(it->top - faceSize) + static_cast(height) * 0.5f); if (mapName == it->name) { image = "유저인터페이스\\worldview_interface\\wv_face1.bmp"; } else { image = "유저인터페이스\\worldview_interface\\wv_face.bmp"; } - DrawTexturedRectangle( - g_renderer->primitives, g_renderer->queues, x, y, faceSize * 2, faceSize * 2, 0xEEFFFFFF, - g_texMgr.Load(image.c_str(), 0, false, true, false), g_renderer->fog.supported != 0, g_depthStart, g_depthEnd - ); + DrawTexturedRectangle(x, y, faceSize * 2, faceSize * 2, 0xEEFFFFFF, g_texMgr.Load(image.c_str(), 0, false, true, false)); } } @@ -658,10 +645,7 @@ void UIRoMapWnd::DrawMapMarker(const RoMapMarker& marker, unsigned char skipSele } DrawRoundedBorder(*this, marker.area.left, marker.area.top, static_cast(marker.width), static_cast(marker.height), 0xFFFFFF); - DrawAlphaRectangle( - g_renderer->primitives, g_renderer->queues, marker.area.left, marker.area.top, static_cast(marker.width), static_cast(marker.height), 0x66000000, - g_renderer->fog.supported != 0, g_depthStart, g_depthEnd - ); + DrawAlphaRectangle(marker.area.left, marker.area.top, static_cast(marker.width), static_cast(marker.height), 0x66000000); std::string name = g_session.GetMapDisplayName(marker.name.c_str()); DrawOutlinedText(*this, marker.area.left + 2, marker.area.top + 5, name.c_str(), 0, 0xD2FF, 0, 0, 12, 1, 0); } @@ -954,49 +938,30 @@ void UIRoMapWnd::DrawWorld() { const int y = area[1] + 1; const int width = area[2] - area[0] - 2; const int height = area[3] - area[1] - 2; - DrawAlphaRectangle( - g_renderer->primitives, g_renderer->queues, x, y, width, height, g_worldViewMgr.searchColors[kind], g_renderer->fog.supported != 0, g_depthStart, - g_depthEnd - ); - DrawTexturedRectangle( - g_renderer->primitives, g_renderer->queues, x, y, width, height, 0xFFFFFFFF, - g_texMgr.Load(g_worldViewMgr.searchImages[kind].c_str(), 0, false, true, false), g_renderer->fog.supported != 0, g_depthStart, g_depthEnd - ); + DrawAlphaRectangle(x, y, width, height, g_worldViewMgr.searchColors[kind]); + DrawTexturedRectangle(x, y, width, height, 0xFFFFFFFF, g_texMgr.Load(g_worldViewMgr.searchImages[kind].c_str(), 0, false, true, false)); } this->DrawMarks(); if (!g_worldViewMgr.selection.name.empty() && g_worldViewMgr.currentWorld == g_worldViewMgr.selection.worldIndex) { const WorldViewRecord& selection = g_worldViewMgr.selection; - DrawTexturedRectangle( - g_renderer->primitives, g_renderer->queues, selection.left, selection.top, selection.right - selection.left, selection.bottom - selection.top, - 0xEEFFFFFF, g_texMgr.Load("유저인터페이스\\worldview_interface\\wv_Select.bmp", 0, false, true, false), g_renderer->fog.supported != 0, - g_depthStart, g_depthEnd - ); + DrawTexturedRectangle(selection.left, selection.top, selection.right - selection.left, selection.bottom - selection.top, 0xEEFFFFFF, g_texMgr.Load("유저인터페이스\\worldview_interface\\wv_Select.bmp", 0, false, true, false)); } this->DrawRecordFaces(1); this->DrawDungeonLinks(); const WorldViewRecord* selected = this->unknown_00C0; if (selected != nullptr && this->unknown_00C8 != nullptr) { - DrawAlphaRectangle( - g_renderer->primitives, g_renderer->queues, selected->left, selected->top, selected->right - selected->left, selected->bottom - selected->top, - g_worldViewMgr.selectBoxColor, g_renderer->fog.supported != 0, g_depthStart, g_depthEnd - ); + DrawAlphaRectangle(selected->left, selected->top, selected->right - selected->left, selected->bottom - selected->top, g_worldViewMgr.selectBoxColor); if (this->unknown_00D0 != 0) { - DrawAlphaRectangle( - g_renderer->primitives, g_renderer->queues, this->unknown_00C8[0], this->unknown_00C8[1], 130, 130, 0x88000000, g_renderer->fog.supported != 0, - g_depthStart, g_depthEnd - ); + DrawAlphaRectangle(this->unknown_00C8[0], this->unknown_00C8[1], 130, 130, 0x88000000); reinterpret_cast(this->unknown_00D0)->Stretch(this->unknown_00C8[0], this->unknown_00C8[1], 130, 130); } } const RoMapTooltipBox* tooltip = this->unknown_00C4; if (tooltip != nullptr) { - DrawAlphaRectangle( - g_renderer->primitives, g_renderer->queues, tooltip->x, tooltip->y, tooltip->width, tooltip->height, 0x66000000, g_renderer->fog.supported != 0, - g_depthStart, g_depthEnd - ); + DrawAlphaRectangle(tooltip->x, tooltip->y, tooltip->width, tooltip->height, 0x66000000); } if (this->m_resetTime == 1) { diff --git a/Source/UI/Window/UIWindowMgr.cpp b/Source/UI/Window/UIWindowMgr.cpp index e7fc862b1..63c5b5891 100644 --- a/Source/UI/Window/UIWindowMgr.cpp +++ b/Source/UI/Window/UIWindowMgr.cpp @@ -334,10 +334,7 @@ void UIWindowMgr::DrawWindows() { g_renderDiagnosticLine = 3815; g_renderDiagnosticFile = g_windowManagerDiagnosticFile; if (window->Slot07(&rectangle) == true) { - DrawAlphaRectangle( - g_renderer->primitives, g_renderer->queues, rectangle.x, rectangle.y, rectangle.width, rectangle.height, rectangle.color, - g_renderer->fog.supported != 0, g_depthStart, g_depthEnd - ); + DrawAlphaRectangle(rectangle.x, rectangle.y, rectangle.width, rectangle.height, rectangle.color); g_renderDiagnosticLine = 3823; g_renderDiagnosticFile = g_windowManagerDiagnosticFile; } else if (window->Slot42(&rectangle) == true) { diff --git a/Source/UI/WindowOverlay.cpp b/Source/UI/WindowOverlay.cpp index f6983864b..a2f767792 100644 --- a/Source/UI/WindowOverlay.cpp +++ b/Source/UI/WindowOverlay.cpp @@ -33,14 +33,8 @@ void UIWhisperWnd::Slot43() { int x = 0; int y = 0; this->ToScreen(x, y); - DrawAlphaRectangle( - g_renderer->primitives, g_renderer->queues, x + 1, y + 1, this->geometry.width - 2, this->geometry.height, 0x66000000, - g_renderer->fog.supported != 0, g_depthStart, g_depthEnd - ); - DrawAlphaRectangle( - g_renderer->primitives, g_renderer->queues, x + 1, y + 1, this->geometry.width - 2, 17, 0x449EB6E4, - g_renderer->fog.supported != 0, g_depthStart, g_depthEnd - ); + DrawAlphaRectangle(x + 1, y + 1, this->geometry.width - 2, this->geometry.height, 0x66000000); + DrawAlphaRectangle(x + 1, y + 1, this->geometry.width - 2, 17, 0x449EB6E4); } // OFFSET: 0x008D0F30