Fix vendor buying, improve character select, parallelize WMO culling, and optimize collision

- Fix CMSG_BUY_ITEM count field from uint8 to uint32 (server silently dropped undersized packets)
- Character select screen: remember last selected character, two-column layout with details panel, double-click to enter world, responsive window sizing
- Fix stale character data between logins by replacing static init flag with per-character GUID tracking
- Parallelize WMO visibility culling across worker threads (same pattern as M2 renderer)
- Optimize WMO collision queries with world-space group bounds early rejection in getFloorHeight, checkWallCollision, isInsideWMO, and raycastBoundingBoxes
- Reduce camera ground samples from 5 to 3 movement-aligned probes
- Add WMO interior lighting, unlit materials, vertex color multiply, and alpha blending support
This commit is contained in:
Kelsi 2026-02-07 15:29:19 -08:00
parent ca88860929
commit 751e6fdbde
11 changed files with 741 additions and 307 deletions

View file

@ -324,6 +324,10 @@ public:
const std::array<ActionBarSlot, ACTION_BAR_SLOTS>& getActionBar() const { return actionBar; }
void setActionBarSlot(int slot, ActionBarSlot::Type type, uint32_t id);
void saveCharacterConfig();
void loadCharacterConfig();
static std::string getCharacterConfigDir();
// Auras
const std::vector<AuraSlot>& getPlayerAuras() const { return playerAuras; }
const std::vector<AuraSlot>& getTargetAuras() const { return targetAuras; }
@ -449,7 +453,7 @@ public:
// Vendor
void openVendor(uint64_t npcGuid);
void closeVendor();
void buyItem(uint64_t vendorGuid, uint32_t itemId, uint32_t slot, uint8_t count);
void buyItem(uint64_t vendorGuid, uint32_t itemId, uint32_t slot, uint32_t count);
void sellItem(uint64_t vendorGuid, uint64_t itemGuid, uint32_t count);
void sellItemBySlot(int backpackIndex);
void autoEquipItemBySlot(int backpackIndex);

View file

@ -1637,7 +1637,7 @@ public:
/** CMSG_BUY_ITEM packet builder */
class BuyItemPacket {
public:
static network::Packet build(uint64_t vendorGuid, uint32_t itemId, uint32_t slot, uint8_t count);
static network::Packet build(uint64_t vendorGuid, uint32_t itemId, uint32_t slot, uint32_t count);
};
/** CMSG_SELL_ITEM packet builder */

View file

@ -245,6 +245,8 @@ private:
glm::vec3 boundingBoxMin;
glm::vec3 boundingBoxMax;
uint32_t groupFlags = 0;
// Material batches (start index, count, material ID)
struct Batch {
uint32_t startIndex; // First index in EBO
@ -258,6 +260,8 @@ private:
GLuint texId;
bool hasTexture;
bool alphaTest;
bool unlit = false;
uint32_t blendMode = 0;
std::vector<GLsizei> counts;
std::vector<const void*> offsets;
};
@ -302,6 +306,9 @@ private:
// Material blend modes (materialId -> blendMode; 1 = alpha-test cutout)
std::vector<uint32_t> materialBlendModes;
// Material flags (materialId -> flags; 0x01 = unlit)
std::vector<uint32_t> materialFlags;
// Portal visibility data
std::vector<PortalData> portals;
std::vector<glm::vec3> portalVertices;
@ -339,7 +346,7 @@ private:
/**
* Create GPU resources for a WMO group
*/
bool createGroupResources(const pipeline::WMOGroup& group, GroupResources& resources);
bool createGroupResources(const pipeline::WMOGroup& group, GroupResources& resources, uint32_t groupFlags = 0);
/**
* Render a single group
@ -492,6 +499,17 @@ private:
mutable std::vector<size_t> candidateScratch;
mutable std::unordered_set<uint32_t> candidateIdScratch;
// Parallel visibility culling
uint32_t numCullThreads_ = 1;
struct InstanceDrawList {
size_t instanceIndex;
std::vector<uint32_t> visibleGroups; // group indices that passed culling
uint32_t portalCulled = 0;
uint32_t distanceCulled = 0;
uint32_t occlusionCulled = 0;
};
// Collision query profiling (per frame).
mutable double queryTimeMs = 0.0;
mutable uint32_t queryCallCount = 0;

View file

@ -54,6 +54,7 @@ private:
int selectedCharacterIndex = -1;
bool characterSelected = false;
uint64_t selectedCharacterGuid = 0;
bool restoredLastCharacter = false;
// Status
std::string statusMessage;
@ -69,6 +70,13 @@ private:
* Get faction color based on race
*/
ImVec4 getFactionColor(game::Race race) const;
/**
* Persist / restore last selected character GUID
*/
static std::string getConfigDir();
void saveLastCharacter(uint64_t guid);
uint64_t loadLastCharacter();
};
}} // namespace wowee::ui

View file

@ -37,6 +37,9 @@ public:
*/
bool isChatInputActive() const { return chatInputActive; }
void saveSettings();
void loadSettings();
private:
// Chat state
char chatInputBuffer[512] = "";
@ -66,10 +69,10 @@ private:
int pendingSfxVolume = 100;
float pendingMouseSensitivity = 0.2f;
bool pendingInvertMouse = false;
int pendingUiOpacity = 100;
int pendingUiOpacity = 65;
// UI element transparency (0.0 = fully transparent, 1.0 = fully opaque)
float uiOpacity_ = 1.0f;
float uiOpacity_ = 0.65f;
/**
* Render player info window
@ -152,6 +155,7 @@ private:
void renderWorldMap(game::GameHandler& gameHandler);
InventoryScreen inventoryScreen;
uint64_t inventoryScreenCharGuid_ = 0; // GUID of character inventory screen was initialized for
QuestLogScreen questLogScreen;
SpellbookScreen spellbookScreen;
TalentScreen talentScreen;
@ -174,6 +178,8 @@ private:
int actionBarDragSlot_ = -1;
GLuint actionBarDragIcon_ = 0;
static std::string getSettingsPath();
// Left-click targeting: distinguish click from camera drag
glm::vec2 leftClickPressPos_ = glm::vec2(0.0f);
bool leftClickWasPress_ = false;