rodecomp/Source/Render/Primitives/RenderQueues.cpp
ragnarok-clanker 208a26ff19 Confirm 3 functions in Source/Render/Renderer.cpp, Source/Render/Primitives/RenderCommandPool.h, ...
Batch #11764 by SapitoSucio: 0 byte-identical, 3 confirmed by peer review.

- fn_02161 CRenderer::CRenderer: logic confirmed by peer review (already on main)
- fn_02175 CRenderer::~CRenderer: logic confirmed by peer review (already on main)
- fn_20958 RenderCommandPool::Acquire: logic confirmed by peer review (already on main)

Peer-reviewed-by: Yommy, KWDev
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
2026-11-05 04:43:11 +00:00

98 lines
3.2 KiB
C++

#include "Render/Primitives/DepthAlpha.h"
#include "Render/Primitives/RenderCommandPool.h"
#include "Render/Primitives/RenderQueues.h"
#include <algorithm>
// OFFSET: 0x00559CA0
// FUNCTION: fn_02073
void RenderQueues::Submit(RenderCommand* primitive, std::uint16_t flags, bool depthAlpha, float depthStart, float depthEnd) {
if (depthAlpha) {
ApplyDepthAlpha(*primitive, depthStart, depthEnd);
}
if (flags & 1) {
const auto first = [&]() { return primitive->vertices[0].rhw; };
const auto average = [&]() {
const float second = primitive->vertices[1].rhw;
return (first() - second) * 0.5f + second;
};
if (flags & 4) {
if (flags & 8) {
this->queue_0210.push_back(primitive);
} else if (flags & 0x200) {
this->queue_0234.push_back({average(), primitive});
} else {
this->queue_01EC.push_back(primitive);
}
} else if (flags & 2) {
if (flags & 0x100) {
this->queue_01C8.push_back({average(), primitive});
} else if (flags & 0x200) {
this->queue_01E0.push_back({average(), primitive});
} else {
this->queue_01D4.push_back({average(), primitive});
}
} else if (flags & 0x10) {
this->queue_0228.push_back({average(), primitive});
} else if (flags & 0x100) {
this->queue_0180.push_back({average(), primitive});
} else if (flags & 0x200) {
if (flags & 8) {
this->queue_021C.push_back({average(), primitive});
} else {
this->queue_0198.push_back({average(), primitive});
}
} else if (flags & 0x20) {
this->queue_01BC.push_back({first(), primitive});
} else if (static_cast<unsigned char>(primitive->unknown_0014) == 1) {
this->queue_018C.push_back({first(), primitive});
} else {
this->queue_01A4.push_back({first(), primitive});
}
} else if (flags & 0x800) {
this->queue_0168.push_back(primitive);
} else if (flags & 0x1000) {
this->queue_0174.push_back(primitive);
} else if (flags & 0x20) {
this->queue_01B0.push_back(primitive);
} else {
this->queue_015C.push_back(primitive);
}
}
// OFFSET: 0x00559F70
// FUNCTION: fn_02074
void RenderQueues::SubmitTriangle(RenderTriangle& triangle, std::uint16_t flags, RenderCommandPool& pool, bool depthAlpha, float depthStart, float depthEnd) {
RenderCommand* command = pool.Acquire();
command->vertices = triangle.vertices;
command->vertexCount = 3;
command->texture = triangle.texture;
command->unknown_0020 = 0;
command->unknown_0018 = triangle.unknown_0064;
command->unknown_001C = triangle.unknown_0068;
this->Submit(command, flags, depthAlpha, depthStart, depthEnd);
}
// INLINED
void RenderQueues::Clear() {
this->queue_015C.clear();
this->queue_0168.clear();
this->queue_0174.clear();
this->queue_0180.clear();
this->queue_018C.clear();
this->queue_0198.clear();
this->queue_01A4.clear();
this->queue_01B0.clear();
this->queue_01BC.clear();
this->queue_01C8.clear();
this->queue_01D4.clear();
this->queue_01E0.clear();
this->queue_01EC.clear();
this->lightmapped.Clear();
this->queue_0210.clear();
this->queue_021C.clear();
this->queue_0228.clear();
this->queue_0234.clear();
this->queue_0240.clear();
}