diff --git a/src/component/CCharacterComponent.cpp b/src/component/CCharacterComponent.cpp index 4bc82e1..86faad6 100644 --- a/src/component/CCharacterComponent.cpp +++ b/src/component/CCharacterComponent.cpp @@ -14,6 +14,7 @@ uint32_t CCharacterComponent::s_chrVarArrayLength; EGxTexFormat CCharacterComponent::s_gxFormat; uint32_t CCharacterComponent::s_mipLevels; MipBits* CCharacterComponent::s_textureBuffer; +MipBits* CCharacterComponent::s_textureBufferCompressed; uint32_t CCharacterComponent::s_textureSize; int32_t s_bInRenderPrep = 0; @@ -80,7 +81,42 @@ void CCharacterComponent::InitDbData() { } void CCharacterComponent::UpdateBaseTexture(EGxTexCommand cmd, uint32_t width, uint32_t height, uint32_t depth, uint32_t mipLevel, void* userArg, uint32_t& texelStrideInBytes, const void*& texels) { - // TODO + auto component = static_cast(userArg); + + switch(cmd) { + case GxTex_Lock: { + if (!s_bInRenderPrep) { + component->RenderPrepAll(); + } + + break; + } + + case GxTex_Latch: { + if (component->m_textureFormat == GxTex_Dxt1) { + // TODO + STORM_ASSERT(false); + } else { + texelStrideInBytes = 4 * width; + } + + // TODO conditional check on some member of component + + auto buffer = component->m_textureFormat == GxTex_Dxt1 + ? CCharacterComponent::s_textureBufferCompressed + : CCharacterComponent::s_textureBuffer; + + texels = buffer[mipLevel].mip[0]; + + break; + } + + // TODO unknown command + case 3: { + // TODO + break; + } + } } void CCharacterComponent::CreateBaseTexture() { @@ -107,7 +143,7 @@ void CCharacterComponent::CreateBaseTexture() { this->m_baseTexture = baseTexture; - // TODO this->m_data->m_model->ReplaceTexture(1, this->m_baseTexture); + this->m_data.model->ReplaceTexture(1, this->m_baseTexture); } void CCharacterComponent::GeosRenderPrep() { @@ -230,6 +266,10 @@ int32_t CCharacterComponent::RenderPrep(int32_t a2) { // TODO } +void CCharacterComponent::RenderPrepAll() { + // TODO +} + void CCharacterComponent::RenderPrepSections() { s_bInRenderPrep = 1; diff --git a/src/component/CCharacterComponent.hpp b/src/component/CCharacterComponent.hpp index 92f173f..64d9068 100644 --- a/src/component/CCharacterComponent.hpp +++ b/src/component/CCharacterComponent.hpp @@ -56,6 +56,7 @@ class CCharacterComponent { static EGxTexFormat s_gxFormat; static uint32_t s_mipLevels; static MipBits* s_textureBuffer; + static MipBits* s_textureBufferCompressed; static uint32_t s_textureSize; // Static functions @@ -82,6 +83,7 @@ class CCharacterComponent { void LoadBaseVariation(COMPONENT_VARIATIONS sectionIndex, int32_t textureIndex, int32_t variationIndex, int32_t colorIndex, COMPONENT_SECTIONS section, const char* a7); void PrepSections(); int32_t RenderPrep(int32_t a2); + void RenderPrepAll(); void RenderPrepSections(); void ReplaceExtraSkinTexture(const char* a2); void SetFace(int32_t faceID, bool a3, const char* a4);