refactor: promote static const arrays to constexpr across audio/core/rendering

audio: birdPaths, cricketPaths, races
core/application: componentDirs (4 instances), compDirs
rendering/character_preview: componentDirs
rendering/character_renderer: regionCoords256, regionSizes256
This commit is contained in:
Kelsi 2026-03-27 15:31:21 -07:00
parent d6769172d1
commit c762688202
5 changed files with 10 additions and 10 deletions

View file

@ -355,7 +355,7 @@ void ActivitySoundManager::setCharacterVoiceProfile(const std::string& modelName
std::string base = "Human";
struct RaceMap { const char* token; const char* folder; const char* base; };
static const RaceMap races[] = {
static constexpr RaceMap races[] = {
{"human", "Human", "Human"},
{"orc", "Orc", "Orc"},
{"dwarf", "Dwarf", "Dwarf"},

View file

@ -85,7 +85,7 @@ bool AmbientSoundManager::initialize(pipeline::AssetManager* assets) {
// Load bird chirp sounds (daytime periodic) — up to 6 variants
{
static const char* birdPaths[] = {
static constexpr const char* birdPaths[] = {
"Sound\\Ambience\\BirdAmbience\\BirdChirp01.wav",
"Sound\\Ambience\\BirdAmbience\\BirdChirp02.wav",
"Sound\\Ambience\\BirdAmbience\\BirdChirp03.wav",
@ -101,7 +101,7 @@ bool AmbientSoundManager::initialize(pipeline::AssetManager* assets) {
// Load cricket/insect sounds (nighttime periodic)
{
static const char* cricketPaths[] = {
static constexpr const char* cricketPaths[] = {
"Sound\\Ambience\\Insect\\InsectMorning.wav",
"Sound\\Ambience\\Insect\\InsectNight.wav",
};

View file

@ -5997,7 +5997,7 @@ void Application::spawnOnlineCreature(uint64_t guid, uint32_t displayId, float x
// --- Equipment region layers (ItemDisplayInfo DBC) ---
auto idiDbc = am->loadDBC("ItemDisplayInfo.dbc");
if (idiDbc) {
static const char* componentDirs[] = {
static constexpr const char* componentDirs[] = {
"ArmUpperTexture", "ArmLowerTexture", "HandTexture",
"TorsoUpperTexture", "TorsoLowerTexture",
"LegUpperTexture", "LegLowerTexture", "FootTexture",
@ -7438,7 +7438,7 @@ void Application::setOnlinePlayerEquipment(uint64_t guid,
charRenderer->setActiveGeosets(st.instanceId, geosets);
// --- Textures (skin atlas compositing) ---
static const char* componentDirs[] = {
static constexpr const char* componentDirs[] = {
"ArmUpperTexture",
"ArmLowerTexture",
"HandTexture",
@ -8221,7 +8221,7 @@ void Application::processCreatureSpawnQueue(bool unlimited) {
// Equipment region textures
auto idiDbc = am->loadDBC("ItemDisplayInfo.dbc");
if (idiDbc) {
static const char* compDirs[] = {
static constexpr const char* compDirs[] = {
"ArmUpperTexture", "ArmLowerTexture", "HandTexture",
"TorsoUpperTexture", "TorsoLowerTexture",
"LegUpperTexture", "LegLowerTexture", "FootTexture",
@ -8439,7 +8439,7 @@ std::vector<std::string> Application::resolveEquipmentTexturePaths(uint64_t guid
const auto* idiL = pipeline::getActiveDBCLayout()
? pipeline::getActiveDBCLayout()->getLayout("ItemDisplayInfo") : nullptr;
static const char* componentDirs[] = {
static constexpr const char* componentDirs[] = {
"ArmUpperTexture", "ArmLowerTexture", "HandTexture",
"TorsoUpperTexture", "TorsoLowerTexture",
"LegUpperTexture", "LegLowerTexture", "FootTexture",

View file

@ -643,7 +643,7 @@ bool CharacterPreview::applyEquipment(const std::vector<game::EquipmentItem>& eq
// --- Textures (equipment overlays onto body skin) ---
if (bodySkinPath_.empty()) return true; // geosets applied, but can't composite
static const char* componentDirs[] = {
static constexpr const char* componentDirs[] = {
"ArmUpperTexture", "ArmLowerTexture", "HandTexture",
"TorsoUpperTexture", "TorsoLowerTexture",
"LegUpperTexture", "LegLowerTexture", "FootTexture",

View file

@ -1122,7 +1122,7 @@ VkTexture* CharacterRenderer::compositeWithRegions(const std::string& basePath,
// Region index -> pixel coordinates on the 256x256 base atlas
// These are scaled up by (width/256, height/256) for larger textures (512x512, 1024x1024)
static const int regionCoords256[][2] = {
static constexpr int regionCoords256[][2] = {
{ 0, 0 }, // 0 = ArmUpper
{ 0, 64 }, // 1 = ArmLower
{ 0, 128 }, // 2 = Hand
@ -1263,7 +1263,7 @@ VkTexture* CharacterRenderer::compositeWithRegions(const std::string& basePath,
}
// Expected region sizes on the 256x256 base atlas (scaled like coords)
static const int regionSizes256[][2] = {
static constexpr int regionSizes256[][2] = {
{ 128, 64 }, // 0 = ArmUpper
{ 128, 64 }, // 1 = ArmLower
{ 128, 32 }, // 2 = Hand