feat(component): implement CCharacterComponent::Paste

This commit is contained in:
fallenoak 2025-10-22 16:33:14 -05:00
parent 15deaf2ce0
commit bccfec9f14
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
2 changed files with 100 additions and 2 deletions

View File

@ -117,8 +117,85 @@ void CCharacterComponent::InitDbData() {
// TODO CountFacialFeatures(varArrayLength, &CCharacterComponent::s_characterFacialHairStylesList);
}
void CCharacterComponent::Paste(void* srcTexture, MipBits* dstMips, const C2iVector& a3, const C2iVector& a4, const C2iVector& a5, TCTEXTUREINFO& srcInfo, int32_t srcMipLevel) {
// TODO
void CCharacterComponent::Paste(void* srcTexture, MipBits* dstMips, const C2iVector& dstPos, const C2iVector& srcPos, const C2iVector& srcSize, TCTEXTUREINFO& srcInfo, int32_t srcMipLevel) {
uint32_t dstStride = CCharacterComponent::s_textureSize * 4;
auto srcPal = TextureCacheGetPal(srcTexture);
if (!srcPal) {
// TODO fill in with crappy green (0x00FF00FF)
return;
}
switch (srcInfo.alphaSize) {
case 0:
CCharacterComponent::PasteOpaque(
srcTexture,
srcPal,
dstMips,
dstPos,
dstStride,
srcPos,
srcSize,
srcInfo,
srcMipLevel,
-srcMipLevel
);
break;
case 1:
CCharacterComponent::PasteTransparent1Bit(
srcTexture,
srcPal,
dstMips,
dstPos,
dstStride,
srcPos,
srcSize,
srcInfo,
srcMipLevel,
-srcMipLevel
);
break;
case 4:
CCharacterComponent::PasteTransparent4Bit(
srcTexture,
srcPal,
dstMips,
dstPos,
dstStride,
srcPos,
srcSize,
srcInfo,
srcMipLevel,
-srcMipLevel
);
break;
case 8:
CCharacterComponent::PasteTransparent8Bit(
srcTexture,
srcPal,
dstMips,
dstPos,
dstStride,
srcPos,
srcSize,
srcInfo,
srcMipLevel,
-srcMipLevel
);
break;
default:
// Do nothing
break;
}
}
void CCharacterComponent::PasteFromSkin(COMPONENT_SECTIONS section, void* srcTexture, MipBits* dstMips) {
@ -149,10 +226,26 @@ void CCharacterComponent::PasteFromSkin(COMPONENT_SECTIONS section, void* srcTex
}
}
void CCharacterComponent::PasteOpaque(void* srcTexture, const BlpPalPixel* srcPal, MipBits* dstMips, const C2iVector& dstPos, uint32_t dstStride, const C2iVector& srcPos, const C2iVector& srcSize, TCTEXTUREINFO& srcInfo, int32_t srcMipLevel, int32_t dstMipLevelOfs) {
// TODO
}
void CCharacterComponent::PasteScale(void* srcTexture, MipBits* dstMips, const C2iVector& a3, const C2iVector& a4, const C2iVector& a5, TCTEXTUREINFO& srcInfo) {
// TODO
}
void CCharacterComponent::PasteTransparent1Bit(void* srcTexture, const BlpPalPixel* srcPal, MipBits* dstMips, const C2iVector& dstPos, uint32_t dstStride, const C2iVector& srcPos, const C2iVector& srcSize, TCTEXTUREINFO& srcInfo, int32_t srcMipLevel, int32_t dstMipLevelOfs) {
// TODO
}
void CCharacterComponent::PasteTransparent4Bit(void* srcTexture, const BlpPalPixel* srcPal, MipBits* dstMips, const C2iVector& dstPos, uint32_t dstStride, const C2iVector& srcPos, const C2iVector& srcSize, TCTEXTUREINFO& srcInfo, int32_t srcMipLevel, int32_t dstMipLevelOfs) {
// TODO
}
void CCharacterComponent::PasteTransparent8Bit(void* srcTexture, const BlpPalPixel* srcPal, MipBits* dstMips, const C2iVector& dstPos, uint32_t dstStride, const C2iVector& srcPos, const C2iVector& srcSize, TCTEXTUREINFO& srcInfo, int32_t srcMipLevel, int32_t dstMipLevelOfs) {
// TODO
}
void CCharacterComponent::RenderPrepAL(CCharacterComponent* component) {
auto skin = component->m_texture[TEXTURE_INDEX(VARIATION_SKIN, 0)];
CCharacterComponent::PasteFromSkin(SECTION_ARM_LOWER, skin, CCharacterComponent::s_textureBuffer);

View File

@ -11,6 +11,7 @@ class CCharacterComponent;
class CharSectionsRec;
class CM2Model;
struct BlpPalPixel;
struct MipBits;
struct st_race;
struct TCTEXTUREINFO;
@ -89,7 +90,11 @@ class CCharacterComponent {
static void RenderPrepTU(CCharacterComponent* component);
static void Paste(void* srcTexture, MipBits* dstMips, const C2iVector& a3, const C2iVector& a4, const C2iVector& a5, TCTEXTUREINFO& srcInfo, int32_t srcMipLevel);
static void PasteFromSkin(COMPONENT_SECTIONS section, void* srcTexture, MipBits* dstMips);
static void PasteOpaque(void* srcTexture, const BlpPalPixel* srcPal, MipBits* dstMips, const C2iVector& dstPos, uint32_t dstStride, const C2iVector& srcPos, const C2iVector& srcSize, TCTEXTUREINFO& srcInfo, int32_t srcMipLevel, int32_t dstMipLevelOfs);
static void PasteScale(void* srcTexture, MipBits* dstMips, const C2iVector& a3, const C2iVector& a4, const C2iVector& a5, TCTEXTUREINFO& srcInfo);
static void PasteTransparent1Bit(void* srcTexture, const BlpPalPixel* srcPal, MipBits* dstMips, const C2iVector& dstPos, uint32_t dstStride, const C2iVector& srcPos, const C2iVector& srcSize, TCTEXTUREINFO& srcInfo, int32_t srcMipLevel, int32_t dstMipLevelOfs);
static void PasteTransparent4Bit(void* srcTexture, const BlpPalPixel* srcPal, MipBits* dstMips, const C2iVector& dstPos, uint32_t dstStride, const C2iVector& srcPos, const C2iVector& srcSize, TCTEXTUREINFO& srcInfo, int32_t srcMipLevel, int32_t dstMipLevelOfs);
static void PasteTransparent8Bit(void* srcTexture, const BlpPalPixel* srcPal, MipBits* dstMips, const C2iVector& dstPos, uint32_t dstStride, const C2iVector& srcPos, const C2iVector& srcSize, TCTEXTUREINFO& srcInfo, int32_t srcMipLevel, int32_t dstMipLevelOfs);
static void UpdateBaseTexture(EGxTexCommand cmd, uint32_t width, uint32_t height, uint32_t depth, uint32_t mipLevel, void* userArg, uint32_t& texelStrideInBytes, const void*& texels);
// Member variables