cntrl/src/render/presenter.hpp
dandovlatov a205f37028 Added a rare ambient Hiss riser that floats up and dissolves
A dark, upward-tilted figure now appears occasionally around Floor 01, climbs a few metres with a red Hiss wake and dissolves into the haze. There is deliberately no roof mesh: the tactical camera sits above the room, so a ceiling would hide the play area. The riser is presentation-only - no collision, health, XP, director card or steering - and its fixed anchors never follow the player.

- Added ascended.glb (1,474 tris, one merged mesh and material, jacket with trouser legs and boots) and the reproducible tools/blender/build_ambient.py generator
- Registered ActorModel::Ascended with rig, Hiss tint, height, name mapping and a dark humanoid fallback
- Authored wall-side anchors in map space, validated against cooked walls; one active early, up to three as corruption climbs, visible only ~5 s of a 34-62 s cycle
- Added the rise, red ground bloom, haze veil and fade directly in the presenter, plus --ascension-test to stage one mid-rise in the plaza for screenshot QA
- README updated; build clean and 17/17 tests pass with staged and normal-play captures reviewed
2026-11-25 07:05:51 +04:00

171 lines
5.8 KiB
C++

#pragma once
#include <vector>
#include "raylib.h"
#include "game/game.hpp"
#include "render/aura.hpp"
#include "render/camera_tuning.hpp"
#include "render/concrete.hpp"
#include "render/debris.hpp"
#include "render/dressing.hpp"
#include "render/models.hpp"
#include "render/shadow_map.hpp"
// The hybrid look: brutalist 3D diorama + low-poly Blender actors.
// This is the only place that knows how the sim is drawn (ART_DIRECTION.md).
// Actor GLBs come from tools/blender/build_enemies.py; if they are missing the
// presenter falls back to primitive shapes so the game never shows 2D cards.
struct DamageNumber {
Vec2 pos{};
float value = 0.0f;
float age = 0.0f;
};
struct Spark {
Vector3 pos{};
Vector3 vel{};
Color color{};
float age = 0.0f;
float life = 0.5f;
float size = 0.12f;
};
struct RoundTrail {
Vector3 pos{};
Color color{};
float age = 0.0f;
float life = 0.22f;
float size = 0.2f;
};
// Presentation-only expanding/contracting ground rings: landing telegraphs,
// dust puffs and the teal implosion left behind when a WARP field collapses.
struct SkillRing {
Vec2 pos{};
float radius = 1.0f;
float end_radius = 1.0f;
float age = 0.0f;
float life = 0.5f;
float height = 0.14f;
float spin = 0.0f; // DrawCircle3D's rotation angle (rings are symmetric)
Color color{};
};
// PUSH's GLB rubble: the same shattered-concrete model the CALL heap uses,
// flung outward as a one-shot presentation effect (no simulation state).
struct PushShard {
Vector3 pos{};
Vector3 vel{};
float yaw = 0.0f;
float spin = 0.0f;
float size = 0.0f;
float age = 0.0f;
float life = 0.0f;
};
// Ambient Hiss riser: a figure caught mid-ascent, presentation-only. Anchors
// sit near room walls so the vertical motion never sits on top of the horde;
// the GLB rises a few metres, then dissolves into the red haze above the
// tactical camera instead of clipping through a roof plane.
struct Ascension {
Vec2 pos{};
float phase = 0.0f; // offset into the shared rise cycle
float cycle = 17.0f; // seconds from one appearance to the next
float yaw = 0.0f;
float scale = 1.0f;
};
class ViewCull;
class Presenter {
public:
void init(float arena_half, const class Floor& floor);
void shutdown();
// Draws the 3D scene and world-anchored text. Call inside BeginDrawing()
// (main.cpp renders into a texture first so post FX can run over the frame).
void draw_scene(Game& game);
void draw_shadow_map(const Game& game, bool enabled);
void set_hiss_test(bool on) { hiss_test_ = on; }
void set_floor_overview(bool on) { floor_overview_ = on; }
void set_ascension_test(bool on) { ascension_test_ = on; }
// Called by the graphics menu (later phase) after settings change.
void apply_graphics_settings();
// Presentation-only reset: revives dressing and clears transient FX on R.
void reset();
CameraTuning& camera_tuning() { return tuning_; }
float damage_flash() const { return damage_flash_; }
int debris_count() const { return debris_.count() + concrete_debris_.count(); }
int dressing_count() const { return dressing_.alive_count(); }
private:
void draw_environment(const Game& game, const ViewCull& cull);
void draw_floor_environment(const Game& game, const ViewCull& cull);
// Projector-screen pocket: black room, player, red phone tables, glass case.
void draw_blackout(Game& game);
// Close-range, world-anchored placards replace the old task HUD.
void draw_blackout_labels(const Game& game);
void draw_initial_scene(const Game& game, const ViewCull& cull);
void draw_office_suite(const Game& game, const ViewCull& cull);
void spawn_sparks(Vec2 pos, float height, Color color, int count, float speed);
void spawn_skill_ring(Vec2 pos, float radius, float end_radius, float life,
Color color, float spin = 0.0f,
float height = 0.14f);
void spawn_push_shards(Vec2 center, float radius);
// Skills shake nearby shelves/tables/garbage cans into paper + rock debris
// without destroying the props (presentation-only).
void shed_surface_debris(Vec2 center, float radius);
Camera3D camera_{};
CameraTuning tuning_;
Texture2D soft_disc_{}; // projectile glow fallback
Texture2D spr_glow_{}; // projectile glow sprite
ModelBank models_;
ConcreteMaterial concrete_;
ShadowMap shadow_map_;
bool shadows_active_ = false;
CorruptionAura aura_;
Dressing dressing_;
PaperDebris debris_;
ConcreteDebris concrete_debris_;
ScorchDecals scorch_;
Model static_env_model_{};
bool static_env_ready_ = false;
float shake_ = 0.0f;
float damage_flash_ = 0.0f;
float anim_time_ = 0.0f;
float player_yaw_ = 0.0f;
float player_walk_ = 0.0f; // smoothed locomotion weight for the agent clips
float dash_pose_ = 0.0f; // presentation-only hold for the Dash pose
float dash_prev_ = 0.0f; // previous dash timer, for rising-edge detection
float fire_pose_ = 0.0f; // brief fire clip hold
float muzzle_flash_ = 0.0f;
float trail_clock_ = 0.0f;
Vector3 muzzle_flash_pos_{};
float muzzle_flash_yaw_ = 0.0f;
int muzzle_flash_tier_ = 0;
bool player_running_ = false; // hysteresis latch for Idle <-> Run
bool hiss_test_ = false;
bool ascension_test_ = false;
std::vector<Ascension> ascensions_;
float ascension_clock_ = 0.0f;
bool floor_mode_ = false;
bool floor_overview_ = false;
bool shadow_pass_ = false;
bool tier_wave_pending_ = false;
Vec2 last_player_pos_{};
std::vector<DamageNumber> damage_numbers_;
std::vector<Spark> sparks_;
std::vector<RoundTrail> trails_;
std::vector<SkillRing> skill_rings_;
std::vector<PushShard> push_shards_;
};