feat(lighting): mode additive amb color per emissor
This commit is contained in:
1 parent
24609d6c5c
commit
771ff1f6cd
10 files changed
+352
-71
No files matched your search
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
@@ -266,6 +267,19 @@ class Entity {
|
||||
[[nodiscard]] auto getLightFlicker() const -> bool { return light_flicker_; }
|
||||
void setLightFlicker(bool f) { light_flicker_ = f; }
|
||||
|
||||
// Color emès en mode additive (RGB 0..255 per canal). Default blanc:
|
||||
// en mode subtractive aquest valor s'ignora completament; en mode
|
||||
// additive és el tint que l'emissor afegeix al canvas. La cadena de
|
||||
// resolució (tipus → sala → spawn) el pobla via `setLightColor`.
|
||||
[[nodiscard]] auto getLightColorR() const -> std::uint8_t { return light_color_r_; }
|
||||
[[nodiscard]] auto getLightColorG() const -> std::uint8_t { return light_color_g_; }
|
||||
[[nodiscard]] auto getLightColorB() const -> std::uint8_t { return light_color_b_; }
|
||||
void setLightColor(std::uint8_t r, std::uint8_t g, std::uint8_t b) {
|
||||
light_color_r_ = r;
|
||||
light_color_g_ = g;
|
||||
light_color_b_ = b;
|
||||
}
|
||||
|
||||
// Identificador estable per al flicker. Cada Entity rep un valor
|
||||
// únic a la construcció (contador estàtic) i el conserva fins a la
|
||||
// mort — així el patró del flicker no "deriva" quan l'entitat es
|
||||
@@ -302,6 +316,9 @@ class Entity {
|
||||
static inline int s_next_light_seed{0};
|
||||
int light_seed_{++s_next_light_seed};
|
||||
bool light_flicker_{false};
|
||||
std::uint8_t light_color_r_{255};
|
||||
std::uint8_t light_color_g_{255};
|
||||
std::uint8_t light_color_b_{255};
|
||||
bool dead_{false};
|
||||
SDL_FlipMode flip_{SDL_FLIP_NONE};
|
||||
EventBus* bus_{nullptr};
|
||||
|
||||
Reference in new issue
Block a user