The stadium as a card model with a camera
The ground, its stands, facilities and periphery are built as bodies from the stadium overview, seen through an axonometric camera, sorted by depth and drawn as a vector picture. A click chooses the bowl, a stand, the floodlights or a house; the camera flies there in 0.6 seconds (reduced motion jumps) and a card shows what stands there and leads to the builder's offer. Stands are as deep as they have places, seats take the club's colour, a roof and scaffolding show, and what may still be built is a dashed footprint. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
d75617052f
commit
b9d8b2db96
7 files changed
+524
-20
No files matched your search
@@ -4,6 +4,7 @@
|
||||
#include "modern/ui/demo_reports.hpp"
|
||||
#include "modern/ui/demo_finance.hpp"
|
||||
#include "modern/ui/desktop.hpp"
|
||||
#include "modern/ui/stadium_model.hpp"
|
||||
#include "modern/ui/gui_assets.hpp"
|
||||
#include "modern/ui/model.hpp"
|
||||
#include "modern/ui/crest_contrast.hpp"
|
||||
@@ -539,6 +540,31 @@ int main(int argc, char **argv) try {
|
||||
require(fit_desktop(tall) && valid_desktop(tall) && tall["objects"]["app-almanac"]["y"].get<int>() + 224 <= 2160,
|
||||
"Object below the shown desk was not brought back into sight");
|
||||
}
|
||||
// the stadium's card model: drawn from the overview alone, the same picture for the same input
|
||||
{
|
||||
Json overview = {{"blocks", Json::array()}, {"facilities", Json::array()}, {"periphery", Json::array()}};
|
||||
for (int i = 0; i < 8; ++i)
|
||||
overview["blocks"].push_back({{"letter", std::string(1, char('A' + i))}, {"display_places", 3000 + 1000 * i}, {"max_places", 18000},
|
||||
{"display_seats", i % 2 == 0}, {"display_roof", i == 3}, {"building", i == 5}, {"job", {{"places", 9000}, {"weeks", 12}}}});
|
||||
for (int i = 0; i < 8; ++i) overview["facilities"].push_back({{"name", "Anlage"}, {"display_level", 2}, {"building", false}});
|
||||
for (int i = 0; i < 14; ++i) overview["periphery"].push_back({{"name", "Haus"}, {"level", i % 3}, {"max_level", 3}, {"building", false}});
|
||||
const auto scene = stadium3d::build(overview, "#aa2233", true);
|
||||
require(scene.centres.contains("block:7") && scene.centres.contains("facility:0") && scene.centres.contains("periphery:13"),
|
||||
"Stadium model misses a selectable part");
|
||||
const auto whole = stadium3d::draw(scene, stadium3d::camera_for(scene, ""), 1790, 1600);
|
||||
const auto again = stadium3d::draw(stadium3d::build(overview, "#aa2233", true), stadium3d::camera_for(scene, ""), 1790, 1600);
|
||||
require(whole.svg == again.svg && whole.svg.size() > 4000,
|
||||
"Stadium model is not drawn the same way twice");
|
||||
require(std::count_if(whole.anchors.begin(), whole.anchors.end(), [](const auto &a) { return a.id == "facility:0"; }) == 4,
|
||||
"Each floodlight mast should choose the floodlights");
|
||||
const auto near = stadium3d::camera_for(scene, "block:5"), far = stadium3d::camera_for(scene, "stadium");
|
||||
require(near.zoom > far.zoom && stadium3d::mix(far, near, 0).zoom == far.zoom && stadium3d::mix(far, near, 1).zoom == near.zoom,
|
||||
"Camera flight does not start and end at its stations");
|
||||
const auto close = stadium3d::draw(scene, near, 1790, 1600, "block:5");
|
||||
const auto chosen = std::find_if(close.parts.begin(), close.parts.end(), [](const auto &p) { return p.id == "block:5"; });
|
||||
require(chosen != close.parts.end() && chosen->cx > 300 && chosen->cx < 1490 && chosen->cy > 300 && chosen->cy < 1300,
|
||||
"The chosen stand does not lie in the middle of the picture");
|
||||
}
|
||||
auto corrupt = layout;
|
||||
corrupt["objects"]["calendar"]["x"] = 999999;
|
||||
require(!valid_desktop(corrupt), "Out of bounds desktop accepted");
|
||||
|
||||
Reference in new issue
Block a user