perf: eliminate double map lookups, dynamic_cast in render loops, div by 255

- Replace count()+operator[] double lookups with find() or try_emplace()
  in gameObjectInstances_, playerTextureSlotsByModelId_, onlinePlayerAppearance_
- Add Entity::isUnit() helper; replace 5 dynamic_cast<Unit*> in per-frame
  UI rendering (nameplates, combat text, pet frame) with isUnit()+static_cast
- Add constexpr kInv255 reciprocal for per-pixel normal map generation loops
  in character_renderer and wmo_renderer
This commit is contained in:
Kelsi 2026-03-27 17:04:13 -07:00
parent 6f2c8962e5
commit 6b1c728377
5 changed files with 36 additions and 27 deletions

View file

@ -153,6 +153,9 @@ public:
ObjectType getType() const { return type; }
void setType(ObjectType t) { type = t; }
/// True if this entity is a Unit or Player (both derive from Unit).
bool isUnit() const { return type == ObjectType::UNIT || type == ObjectType::PLAYER; }
// Fields (for update values)
void setField(uint16_t index, uint32_t value) {
fields[index] = value;