feat(editor): selected NPC marker is larger and yellow-cyan tinted

Marker geometry now reacts to npc.selected: 2.5x base radius (vs 1.5x),
saturated yellow with cyan tinge, and full alpha. Marker rebuild also
fires on selection change so the highlight appears immediately rather
than only after the next placement.
This commit is contained in:
Kelsi 2026-05-06 01:51:59 -07:00
parent b491ecb435
commit 63fe5da04e
3 changed files with 12 additions and 5 deletions

View file

@ -122,12 +122,15 @@ void EditorApp::run() {
size_t objCount = objectPlacer_.objectCount();
size_t npcCount = npcSpawner_.spawnCount();
bool objChanged = (objCount != lastObjCount_);
bool npcChanged = (npcCount != lastNpcCount_) || objectsDirty_;
int npcSelIdx = npcSpawner_.getSelectedIndex();
bool npcSelChanged = (npcSelIdx != lastNpcSelIdx_);
bool npcChanged = (npcCount != lastNpcCount_) || objectsDirty_ || npcSelChanged;
if (npcChanged) {
// NPC markers are cheap — always update
viewport_.updateNpcMarkers(npcSpawner_.getSpawns());
lastNpcCount_ = npcCount;
lastNpcSelIdx_ = npcSelIdx;
}
// Show gizmo arrows on selected object or NPC. NPCs only support move

View file

@ -175,6 +175,7 @@ public:
private:
size_t lastObjCount_ = 0;
size_t lastNpcCount_ = 0;
int lastNpcSelIdx_ = -1;
EditorMode mode_ = EditorMode::Sculpt;
float waterHeight_ = 100.0f;
uint16_t waterType_ = 0;

View file

@ -520,11 +520,14 @@ void EditorViewport::updateNpcMarkers(const std::vector<CreatureSpawn>& npcs) {
struct MV { float pos[3]; float color[4]; };
std::vector<MV> verts;
for (const auto& npc : npcs) {
float s = 1.5f; // base radius (was 5)
// Selected NPC: larger marker in cyan-yellow so it pops out among
// hostile/friendly markers without losing the hostile colour signal.
float s = npc.selected ? 2.5f : 1.5f;
float x = npc.position.x, y = npc.position.y, z = npc.position.z;
float r = npc.hostile ? 1.0f : 0.1f;
float g = npc.hostile ? 0.15f : 0.9f;
float b = 0.1f, a = 0.7f;
float r = npc.selected ? 1.0f : (npc.hostile ? 1.0f : 0.1f);
float g = npc.selected ? 1.0f : (npc.hostile ? 0.15f : 0.9f);
float b = npc.selected ? 0.2f : 0.1f;
float a = npc.selected ? 1.0f : 0.7f;
MV v; v.color[0]=r; v.color[1]=g; v.color[2]=b; v.color[3]=a;
// Small octagonal base