#pragma once #include "evo/client/camera.hpp" #include "evo/client/organism_view.hpp" #include "evo/render/frame.hpp" #include #include #include #include namespace evo::render { // Full detail: motility ring (4), body (1), membrane (4), ingestion mark (1). Bodies // smaller than organism_detail_side draw as a dark halo plus body (2). inline constexpr std::size_t organism_detail_rectangles = 10; // Freshness chip plus an explicit truncation marker. inline constexpr std::size_t organism_status_rectangles = 2; // Uniform minimum on-screen body side (logical units) so micrometre organisms stay // visible when zoomed out. Below it, drawn sizes are not comparable; inspect values. inline constexpr double organism_visibility_floor = 5; inline constexpr double organism_detail_side = 6; namespace organism_palette { inline constexpr Color ring{200, 230, 240, 255}; inline constexpr Color mouth{20, 16, 24, 255}; inline constexpr Color halo{8, 8, 12, 255}; // Contrast backing for collapsed bodies. inline constexpr Color remnant{110, 95, 80, 255}; inline constexpr Color truncated{255, 0, 200, 255}; } // namespace organism_palette struct ScreenBox { double left{}, top{}, right{}, bottom{}; }; // Unclipped body box in logical window units, after the visibility floor. Shared by // rendering and picking so both agree on what is under the pointer. [[nodiscard]] ScreenBox organism_bounds(const client::OrganismCell& cell, const client::Camera& camera) noexcept; // Body colour from conversion, realized growth, damage and alive/dead state only. [[nodiscard]] Color organism_fill(const client::OrganismCell& cell) noexcept; enum class OrganismDetail : std::uint8_t { full, body_only }; struct OrganismRenderReport { std::size_t visible{}, drawn{}; OrganismDetail detail{OrganismDetail::full}; }; enum class OrganismRenderError : std::uint8_t { invalid_budget }; // Appends at most `budget` rectangles (>= organism_status_rectangles) in id order. // Detail is chosen once per call: full when every visible organism fits at full // detail, otherwise one body rectangle each (no halo); organisms beyond the budget are not // drawn and the magenta truncation marker appears. Nothing is dropped silently. [[nodiscard]] std::expected append_organisms(std::vector& out, std::size_t budget, const client::OrganismPresentation* presentation, client::Freshness freshness, const client::Camera& camera); } // namespace evo::render