feat(component): set up component base texture in character model

This commit is contained in:
fallenoak 2025-10-21 20:19:49 -05:00
parent 5e6bdc78f6
commit 8b418a68b1
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
2 changed files with 44 additions and 2 deletions

View File

@ -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<CCharacterComponent*>(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;

View File

@ -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);