RU
games/rob-revisited / src / Revisited / Render / View.php · commit f9a1307
<?phpnamespace App\Revisited\Render;use App\Revisited\Land\Creature;use App\Revisited\Land\Npc;use App\Revisited\Land\Thing;/** * What Graphics::render() draws this frame (docs/reborn.md "Render"): filled by the scene from the game state. * * Conventions: metres, y up; $yaw in radians, forward = (sin yaw, 0, cos yaw) (yaw 0 looks toward +z); * $pitch in radians, positive looks up; $fov the horizontal field of view in degrees; $y the eye's height * (absolute, not above the ground). */final class View{    public float $x = 0.0;    public float $y = 1.7;    public float $z = 0.0;    public float $yaw = 0.0;    public float $pitch = 0.0;    public float $fov = 70.0;    /** time of day: game minutes (any count of days; 07:00 of day 1 = 420) */    public float $minutes = 720.0;    /** @var array{kind?: string, amount?: float}|null clear | rain | storm | snow | fog, amount 0..1 */    public ?array $weather = null;    /** Game::lightLevel(): 0 night / cave, 1 noon (darkens the caves' ambient when low) */    public float $light = 1.0;    /** the player's torch: a flickering light at the eye */    public bool $torch = false;    /**     * @var list<array{x: float, z: float, minutes?: float, r?: float}> fires burning (light + flames); 'r' > 1: a     * spreading blaze of that radius in metres (many flames, a column of smoke, a light reaching farther)     */    public array $fires = [];    /** @var array<string, float>|null a lightning strike (keys x, z, t) at (x, z) at View::$time = t (bolt + flash ~0.6 s) */    public ?array $lightning = null;    /** @var array<string, float>|null (keys x, z, yaw) Rob's raft under the eye (drawn on the water, bobbing) */    public ?array $raft = null;    /** @var list<array<string, float>> (keys x, z, r) blackened ground (ash), the nearest eight drawn */    public array $burnt = [];    /** @var list<Thing|Creature|Npc> drawn besides the zone's own things */    public array $entities = [];    /** the item in hand, drawn in first person: spear, knife, axe, torch, bow (French names work too) */    public ?string $held = null;    /** the left hand's item (a torch, a knife...), drawn on the left while the right one is on the right */    public ?string $heldLeft = null;    /** 0..1 through a blow (0: none): HeldPose::attack() */    public float $attackPhase = 0.0;    /** the blow's kind (Weapons::anim: swing chop stab thrust bow crossbow gun sling punch) */    public string $attackKind = 'swing';    /** where in the blow (0..1) it strikes */    public float $attackStrike = 0.4;    /** the hand striking: right | left */    public string $attackSide = 'right';    /** 0..1 through the torch's sweep (0: none): HeldPose::brandish() */    public float $brandish = 0.0;    /** 0..1: the shield on the left arm raised (Game::guardPhase(); 0: lowered at the side) */    public float $guard = 0.0;    /** red flash 0..1 */    public float $hurt = 0.0;    /** seconds of real time (animations: water, flames, wind); 0 = Graphics counts by itself */    public float $time = 0.0;    /** walking: the held item bobs (0 still .. 1 running) */    public float $bob = 0.0;}