From 18b9ed493a8b0c37b38a45c947ac9c8b2da81643 Mon Sep 17 00:00:00 2001 From: Joshua Achorn Date: Fri, 7 Apr 2023 14:14:51 -0400 Subject: [PATCH] chore(gx): move GxDrawLockedElements from gx/Buffer into gx/Draw --- src/gx/Buffer.cpp | 19 ------------------- src/gx/Buffer.hpp | 2 -- src/gx/Draw.cpp | 20 ++++++++++++++++++++ src/gx/Draw.hpp | 2 ++ 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/gx/Buffer.cpp b/src/gx/Buffer.cpp index 40073cf..262a95a 100644 --- a/src/gx/Buffer.cpp +++ b/src/gx/Buffer.cpp @@ -433,25 +433,6 @@ void GxPrimLockVertexPtrs(uint32_t vertexCount, const C3Vector* pos, uint32_t po GxPrimVertexPtr(vertexCount, pos, posStride, normal, normalStride, color, colorStride, tex0, tex0Stride, tex1, tex1Stride); } -void GxDrawLockedElements(EGxPrim primType, uint32_t indexCount, const uint16_t* indices) { - if (Buffer::s_lockVertexCount == 0) { - return; - } - - GxPrimIndexPtr(indexCount, indices); - - CGxBatch batch; - batch.m_primType = primType; - batch.m_minIndex = 0; - batch.m_maxIndex = Buffer::s_lockVertexCount - 1; - batch.m_start = 0; - batch.m_count = indexCount; - - BLIZZARD_ASSERT(batch.m_count > 0); - - g_theGxDevicePtr->Draw(&batch, 1); -} - void GxPrimUnlockVertexPtrs() { Buffer::s_lockVertexCount = 0; } diff --git a/src/gx/Buffer.hpp b/src/gx/Buffer.hpp index ae6a6ef..2732ac2 100644 --- a/src/gx/Buffer.hpp +++ b/src/gx/Buffer.hpp @@ -45,8 +45,6 @@ void GxPrimVertexPtr(uint32_t vertexCount, const C3Vector* pos, uint32_t posStri void GxPrimLockVertexPtrs(uint32_t vertexCount, const C3Vector* pos, uint32_t posStride, const C3Vector* normal, uint32_t normalStride, const CImVector* color, uint32_t colorStride, const unsigned char* bone, uint32_t boneStride, const C2Vector* tex0, uint32_t tex0Stride, const C2Vector* tex1, uint32_t tex1Stride); -void GxDrawLockedElements(EGxPrim primType, uint32_t indexCount, const uint16_t* indices); - void GxPrimUnlockVertexPtrs(); #endif diff --git a/src/gx/Draw.cpp b/src/gx/Draw.cpp index 54d8954..40d420e 100644 --- a/src/gx/Draw.cpp +++ b/src/gx/Draw.cpp @@ -1,10 +1,30 @@ #include "gx/Draw.hpp" #include "gx/Device.hpp" +#include void GxDraw(CGxBatch* batch, int32_t indexed) { g_theGxDevicePtr->Draw(batch, indexed); } +void GxDrawLockedElements(EGxPrim primType, uint32_t indexCount, const uint16_t* indices) { + if (Buffer::s_lockVertexCount == 0) { + return; + } + + GxPrimIndexPtr(indexCount, indices); + + CGxBatch batch; + batch.m_primType = primType; + batch.m_minIndex = 0; + batch.m_maxIndex = Buffer::s_lockVertexCount - 1; + batch.m_start = 0; + batch.m_count = indexCount; + + BLIZZARD_ASSERT(batch.m_count > 0); + + g_theGxDevicePtr->Draw(&batch, 1); +} + void GxSceneClear(uint32_t mask, CImVector color) { g_theGxDevicePtr->SceneClear(mask, color); } diff --git a/src/gx/Draw.hpp b/src/gx/Draw.hpp index e3dd0c5..0d1e698 100644 --- a/src/gx/Draw.hpp +++ b/src/gx/Draw.hpp @@ -10,6 +10,8 @@ class CImVector; void GxDraw(CGxBatch* batch, int32_t indexed); +void GxDrawLockedElements(EGxPrim primType, uint32_t indexCount, const uint16_t* indices); + void GxSceneClear(uint32_t, CImVector); void GxScenePresent(uint32_t a2);