cntrl/src/render/aura.hpp

43 lines
1 KiB
C++

#pragma once
#include <vector>
#include "raylib.h"
// Flat ground emitters for tier-ups / boss entrances. Hiss corruption on units
// is part of the actor models themselves (tools/blender/build_enemies.py).
struct GroundWave {
Vector3 pos{};
float radius = 1.0f;
float age = 0.0f;
float life = 1.0f;
float phase = 0.0f;
};
class CorruptionAura {
public:
void init();
void shutdown();
bool ready() const { return ready_; }
void begin_frame(float time, float corruption);
void update(float dt);
// `pos.y` should be ~0.08.
void spawn_ground(Vector3 pos, float radius, float life, float phase);
void draw_ground_waves();
int active_waves() const { return static_cast<int>(waves_.size()); }
private:
Matrix ground_transform(const GroundWave& wave) const;
std::vector<GroundWave> waves_;
Shader shader_{};
Material material_{};
Mesh quad_{};
int loc_time_ = -1;
int loc_phase_ = -1;
int loc_corruption_ = -1;
int loc_intensity_ = -1;
bool ready_ = false;
};