rodecomp/Source/Render/DX9/OpaqueQueuesDX9.cpp
ragnarok-clanker a47d20f8be Reconstruct readable C++ and organize cohesive source subsystems
Administrative source import: native x86 compilation passed for 423 authored units. Source placement and submission states are migrated separately; this commit does not imply peer acceptance.

Previous head: 35d2a8cb36
Payload SHA256: 592f016d2730c5593bb653aa054c1e5f76a6df72c8f5a09e66f74876e2e33dee
2026-10-25 07:42:41 +00:00

37 lines
1.4 KiB
C++

#include "Render/DX9/DeviceStateDX9.h"
#include "Render/Primitives/RenderQueues.h"
#include "Render/DX9/RendererDX9Operations.h"
#include "Render/DX9/TextureDX9.h"
#include <algorithm>
#include <cstdint>
// OFFSET: 0x005666E0
// FUNCTION: fn_02225
void RendererDX9Operations::DrawOpaqueQueues(RenderQueues& queues) {
ScopedDeviceStateDX9 restore(this->state);
this->state.SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
this->state.SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
const auto before = [](const RenderCommand* left, const RenderCommand* right) {
return reinterpret_cast<std::uintptr_t>(left->texture) < reinterpret_cast<std::uintptr_t>(right->texture);
};
std::sort(queues.queue_015C.begin(), queues.queue_015C.end(), before);
for (RenderCommand* command : queues.queue_015C) {
if (command) {
this->state.SetTexture(0, command->texture ? static_cast<CTextureDX9*>(command->texture)->NativeTexture() : nullptr);
this->DrawPrimitive(command);
}
}
this->state.SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP);
this->state.SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP);
std::sort(queues.queue_01B0.begin(), queues.queue_01B0.end(), before);
for (RenderCommand* command : queues.queue_01B0) {
if (command) {
this->state.SetTexture(0, command->texture ? static_cast<CTextureDX9*>(command->texture)->NativeTexture() : nullptr);
this->DrawPrimitive(command);
}
}
}