mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
feat(component): add section info array
This commit is contained in:
parent
9e25e6246f
commit
904782c8df
@ -14,10 +14,24 @@ uint32_t CCharacterComponent::s_chrVarArrayLength;
|
||||
EGxTexFormat CCharacterComponent::s_gxFormat;
|
||||
uint32_t CCharacterComponent::s_mipLevels;
|
||||
PREP_FUNC* CCharacterComponent::s_prepFunc[];
|
||||
CompSectionInfo CCharacterComponent::s_sectionInfo[];
|
||||
MipBits* CCharacterComponent::s_textureBuffer;
|
||||
MipBits* CCharacterComponent::s_textureBufferCompressed;
|
||||
uint32_t CCharacterComponent::s_textureSize;
|
||||
|
||||
CompSectionInfo CCharacterComponent::s_sectionInfoRaw[] = {
|
||||
{ 0, 0, 256, 128 }, // SECTION_ARM_UPPER
|
||||
{ 0, 128, 256, 128 }, // SECTION_ARM_LOWER
|
||||
{ 0, 256, 256, 64 }, // SECTION_HAND
|
||||
{ 256, 0, 256, 128 }, // SECTION_TORSO_UPPER
|
||||
{ 256, 128, 256, 64 }, // SECTION_TORSO_LOWER
|
||||
{ 256, 192, 256, 128 }, // SECTION_LEG_UPPER
|
||||
{ 256, 320, 256, 128 }, // SECTION_LEG_LOWER
|
||||
{ 256, 448, 256, 64 }, // SECTION_FOOT
|
||||
{ 0, 320, 256, 64 }, // SECTION_HEAD_UPPER
|
||||
{ 0, 384, 256, 128 }, // SECTION_HEAD_LOWER
|
||||
};
|
||||
|
||||
int32_t s_bInRenderPrep = 0;
|
||||
char* s_pathEnd;
|
||||
char s_path[STORM_MAX_PATH];
|
||||
@ -65,6 +79,17 @@ void CCharacterComponent::Initialize(EGxTexFormat textureFormat, uint32_t textur
|
||||
CCharacterComponent::s_mipLevels = mipLevels;
|
||||
CCharacterComponent::s_textureSize = 1 << mipLevels;
|
||||
|
||||
// Scale section info to match mip levels
|
||||
for (int32_t i = 0; i < NUM_COMPONENT_VARIATIONS; i++) {
|
||||
auto& info = CCharacterComponent::s_sectionInfo[i];
|
||||
auto& infoRaw = CCharacterComponent::s_sectionInfoRaw[i];
|
||||
|
||||
info.pos.x = infoRaw.pos.x >> (9 - mipLevels);
|
||||
info.pos.y = infoRaw.pos.y >> (9 - mipLevels);
|
||||
info.size.x = infoRaw.size.x >> (9 - mipLevels);
|
||||
info.size.y = infoRaw.size.y >> (9 - mipLevels);
|
||||
}
|
||||
|
||||
// TODO
|
||||
|
||||
CCharacterComponent::s_gxFormat = textureFormat;
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
|
||||
#include "component/Types.hpp"
|
||||
#include "gx/Texture.hpp"
|
||||
#include <tempest/Vector.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
class CACHEENTRY;
|
||||
@ -51,6 +52,11 @@ struct ComponentData {
|
||||
};
|
||||
};
|
||||
|
||||
struct CompSectionInfo {
|
||||
C2iVector pos;
|
||||
C2iVector size;
|
||||
};
|
||||
|
||||
class CCharacterComponent {
|
||||
public:
|
||||
// Static variables
|
||||
@ -59,6 +65,8 @@ class CCharacterComponent {
|
||||
static EGxTexFormat s_gxFormat;
|
||||
static uint32_t s_mipLevels;
|
||||
static PREP_FUNC* s_prepFunc[NUM_COMPONENT_SECTIONS];
|
||||
static CompSectionInfo s_sectionInfo[NUM_COMPONENT_SECTIONS];
|
||||
static CompSectionInfo s_sectionInfoRaw[NUM_COMPONENT_SECTIONS];
|
||||
static MipBits* s_textureBuffer;
|
||||
static MipBits* s_textureBufferCompressed;
|
||||
static uint32_t s_textureSize;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user