Monopoly — Portage moderne 0.1.0
Portage moderne C/C++23 du Monopoly de 1999
Loading...
Searching...
No Matches
BoardLightingController.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "World3DRenderer.hpp"
4
5#include <array>
6#include <cstdint>
7#include <expected>
8#include <string>
9
11{
12 inline constexpr std::uint64_t SpotlightIdleDelayTicks = 60U * 25U;
13 inline constexpr std::uint64_t SpotlightFocusMoveTicks = 210U;
14 inline constexpr float SpotlightFollowRatio = 0.3F;
15 inline constexpr float SpotlightIdleIncrement = 3.0F;
16 inline constexpr float SpotlightColourIncrement = 0.003F;
17
19 {
20 bool game3DOn{true};
21 bool board3DOn{};
22 bool lightingOn{true};
24 std::uint64_t tick{};
25 std::uint64_t numberOfTicks{};
26 std::uint64_t lastBoardActivityTick{};
27 std::array<float, 3> tokenPosition{};
28 std::uint8_t playerColour{};
29 };
30
32 {
33 public:
34 [[nodiscard]] std::expected<engine::World3DLighting, std::string>
36 void reset() noexcept;
38 { return lighting_; }
39
40 private:
41 void beginSpotlight(std::uint64_t tick) noexcept;
42 void updateSpotlightMotion(const BoardLightingInputs& inputs) noexcept;
43 void updateSpotlightColour(const BoardLightingInputs& inputs) noexcept;
44 [[nodiscard]] std::array<float, 3> interpolatedTarget(
45 std::uint64_t tick) const noexcept;
46
47 engine::World3DLighting lighting_{};
48 bool spotlightActive_{};
49 bool ascendingX_{true};
50 bool ascendingZ_{true};
51 bool fixedRatio_{};
52 float fixedRatioValue_{};
53 std::array<float, 3> startTarget_{240.0F, 300.0F, 240.0F};
54 std::array<float, 3> endTarget_{240.0F, 300.0F, 240.0F};
55 std::array<float, 3> currentTarget_{240.0F, 300.0F, 240.0F};
56 std::array<float, 3> currentColour_{1.0F, 1.0F, 1.0F};
57 std::uint64_t moveStartTick_{};
58 std::uint64_t moveEndTick_{};
59 };
60}
unsigned index
const engine::World3DLighting & current() const noexcept
std::expected< engine::World3DLighting, std::string > tick(const BoardLightingInputs &inputs)
constexpr std::uint64_t SpotlightIdleDelayTicks
constexpr std::uint64_t SpotlightFocusMoveTicks