rendering/game: make player model semi-transparent in ghost form

Add GhostStateCallback to GameHandler, fired when PLAYER_FLAGS_GHOST
transitions on or off in UPDATE_OBJECT / login detection. Add
setInstanceOpacity() to CharacterRenderer to directly set opacity
without disturbing fade-in state. Application wires the callback to
set opacity 0.5 on ghost entry and 1.0 on resurrect.
This commit is contained in:
Kelsi 2026-03-10 09:57:24 -07:00
parent 366321042f
commit c8d9d6b792
5 changed files with 28 additions and 0 deletions

View file

@ -2876,6 +2876,15 @@ void CharacterRenderer::startFadeIn(uint32_t instanceId, float durationSeconds)
it->second.fadeInDuration = durationSeconds;
}
void CharacterRenderer::setInstanceOpacity(uint32_t instanceId, float opacity) {
auto it = instances.find(instanceId);
if (it != instances.end()) {
it->second.opacity = std::clamp(opacity, 0.0f, 1.0f);
// Cancel any fade-in in progress to avoid overwriting the new opacity
it->second.fadeInDuration = 0.0f;
}
}
void CharacterRenderer::setActiveGeosets(uint32_t instanceId, const std::unordered_set<uint16_t>& geosets) {
auto it = instances.find(instanceId);
if (it != instances.end()) {