forked from townforge/townforge
game: shader: whisper interpolate with day cycle
This commit is contained in:
parent
313948db3a
commit
698e50c4b6
@ -3005,13 +3005,15 @@ void CryptoCityUrho3D::UpdateSky()
|
||||
cloudsLightNode_->SetPosition(cloudsLightPosition);
|
||||
cloudsLight->SetBrightness(93.0f);
|
||||
cloudsLight->SetTemperature(sun_temperature);
|
||||
|
||||
|
||||
float cloudsInterp = std::max(0.0f, std::min(1.0f, (sin_timeOfDay + .1f) * 6));
|
||||
Color cloudsAmbient = Color::BLACK.Lerp(Color::WHITE, cloudsInterp);
|
||||
cloudsZone->SetAmbientColor(cloudsAmbient);
|
||||
|
||||
snowfall.SetDay(interp);
|
||||
|
||||
whispers.Night(.5f + night_interp / 2 - interp / 2);
|
||||
|
||||
if (disable_procsky)
|
||||
viewport->GetRenderPath()->SetEnabled("ProcSky", false);
|
||||
}
|
||||
|
@ -106,12 +106,15 @@ void Whispers::Prune(uint64_t height)
|
||||
void Whispers::Focus(uint64_t id, bool focus)
|
||||
{
|
||||
const unsigned n_whispers = billboards->GetNumBillboards();
|
||||
const float whisperFade = .75f;
|
||||
for (unsigned i = 0; i < n_whispers; ++i)
|
||||
{
|
||||
Billboard *b = billboards->GetBillboard(i);
|
||||
if (b->id_ == id)
|
||||
{
|
||||
b->color_ = focus ? whispers[i].color : whispers[i].color * 0.75f;
|
||||
b->color_.r_ = focus ? whispers[i].color.r_ : whispers[i].color.r_ * whisperFade;
|
||||
b->color_.g_ = focus ? whispers[i].color.g_ : whispers[i].color.g_ * whisperFade;
|
||||
b->color_.b_ = focus ? whispers[i].color.b_ : whispers[i].color.b_ * whisperFade;
|
||||
whispers[i].sparks->SetNumParticles(focus ? FOCUSED_PARTICLES : UNFOCUSED_PARTICLES);
|
||||
whispers[i].sparks->GetEffect()->SetColorFrame(0, ColorFrame(b->color_));
|
||||
break;
|
||||
@ -120,6 +123,17 @@ void Whispers::Focus(uint64_t id, bool focus)
|
||||
billboards->Commit();
|
||||
}
|
||||
|
||||
void Whispers::Night(float night_whisper)
|
||||
{
|
||||
const unsigned n_whispers = billboards->GetNumBillboards();
|
||||
for (unsigned i = 0; i < n_whispers; ++i)
|
||||
{
|
||||
Billboard *b = billboards->GetBillboard(i);
|
||||
b->color_.a_ = whispers[i].color.a_ * night_whisper;
|
||||
}
|
||||
billboards->Commit();
|
||||
}
|
||||
|
||||
void Whispers::Update(float timeStep)
|
||||
{
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ public:
|
||||
bool IsWhisper(const Urho3D::Node *node) const;
|
||||
uint64_t GetWhisper(int subObject) const;
|
||||
void Focus(uint64_t id, bool focus = true);
|
||||
void Night(float night_whisper);
|
||||
bool GetWhisperData(uint64_t id, uint32_t &whisperer, std::string &message) const;
|
||||
Urho3D::SharedPtr<Urho3D::Node> GetWhisperNode(uint64_t id);
|
||||
float GetNearestWhiperDistance(const Urho3D::Vector3 &position) const;
|
||||
|
Loading…
Reference in New Issue
Block a user