1 #include "rogueviz.h"
2
3 namespace rogueviz {
4
5 namespace honey {
6
7 bool alone = true;
8
9 bool in_special = false;
10
geoslide(eGeometry g,char canvas,int jhole,int jblock)11 auto geoslide(eGeometry g, char canvas, int jhole, int jblock) {
12 using namespace tour;
13 return [=] (presmode mode) {
14 if(mode == pmStart) {
15 tour::slide_backup(mapeditor::drawplayer, false);
16 tour::slide_backup(smooth_scrolling, true);
17 stop_game();
18 set_geometry(g);
19 if(g == gSphere) {
20 set_geometry(gProduct);
21 }
22 if(g == gNormal) {
23 set_geometry(gRotSpace);
24 }
25 tour::slide_backup<ld>(sightranges[gProduct], 12);
26 tour::slide_backup<ld>(sightranges[gNil], 7);
27 tour::slide_backup<ld>(sightranges[gSol], 7);
28 tour::slide_backup<ld>(sightranges[gSpace435], 7);
29 vid.texture_step = 4;
30 firstland = specialland = laCanvas;
31 tour::slide_backup(patterns::jhole, jhole);
32 tour::slide_backup(patterns::rwalls, jhole);
33 tour::slide_backup(patterns::jblock, jblock);
34 tour::slide_backup(patterns::whichCanvas, canvas);
35 tour::slide_backup(vid.linewidth, vid.linewidth / 10);
36 start_game();
37 if(jblock < 0) {
38 pmodel = mdDisk;
39 sightranges[gSol] = 4;
40 }
41 }
42 if(mode == pmStop && jblock < 0)
43 pmodel = mdGeodesic;
44 slidecommand = "switch raycaster";
45
46 if(in_special && among(mode, pmGeometrySpecial, pmStop)) {
47 in_special = false;
48 gamestack::pop();
49 patterns::whichCanvas = canvas;
50 vid.grid = false;
51 fat_edges = false;
52 sightranges[gSpace435] = 7;
53 }
54
55 else if(mode == pmGeometrySpecial && !in_special) {
56 in_special = true;
57 gamestack::push();
58 patterns::whichCanvas = 'g';
59 vid.grid = true;
60 stdgridcolor = 0xFFFF00FF;
61 fat_edges = true;
62 start_game();
63 sightranges[gSpace435] = 3;
64 }
65
66 if(mode == pmKey && jblock < 0) {
67 sightranges[gSol] = 11 - sightranges[gSol];
68 addMessage("Changed the sight range to ", sightranges[gSol]);
69 }
70 else if(mode == pmKey) {
71 if(sl2) {
72 addMessage("Raycaster not implemented here.");
73 }
74 #if CAP_RAY
75 else if(ray::want_use != 2) {
76 ray::want_use = 2;
77 ray::max_cells = 4096;
78 addMessage("Using a raycaster.");
79 }
80 #endif
81 else {
82 #if CAP_RAY
83 ray::want_use = 0;
84 #endif
85 addMessage("Using primitives.");
86 }
87 }
88 };
89 }
90
91 string cap = "honeycombs/";
92
honey(string s,vector<tour::slide> & v)93 void honey(string s, vector<tour::slide>& v) {
94 if(s != "noniso") return;
95 using namespace tour;
96
97 v.emplace_back(
98 slide{cap+"Tessellations in 3D geometries", 999, LEGAL::NONE | QUICKSKIP,
99 "This series of slides presents the honeycombs we use. "
100 "You can compare the output of primitive-based and raycaster-based rendering by pressing '5'.",
101 [] (presmode mode) {}
102 });
103
104 v.emplace_back(
105 slide{cap+"Hyperbolic space", 999, LEGAL::SPECIAL,
106 "Traditional visualizations of non-Euclidean honeycombs "
107 "show the edges of all cells. In our visualizations, we fill some of the cells. "
108 "The disadvantage of the traditional visualization is visible here, on the example of {4,3,5} hyperbolic honeycomb: "
109 "our Euclidean brains tend to interpret this visualization incorrectly. (Press '2' to get the traditional visualization.)",
110 geoslide(gSpace435, 'r', 50, 0)
111 });
112 v.emplace_back(
113 slide{cap+"S2xE", 999, LEGAL::NONE,
114 "This is the S2xE geometry.",
115 geoslide(gSphere, 'r', 10, 0)
116 });
117 v.emplace_back(
118 slide{cap+"Solv: random", 999, LEGAL::NONE,
119 "Random blocks in Solv geometry.",
120 geoslide(gSol, 'r', 20, 0)
121 });
122 v.emplace_back(
123 slide{cap+"Solv: Poincaré ball", 999, LEGAL::NONE,
124 "Surfaces of constant 'z' in Solv geometry, displayed in Poincaré ball-like model. "
125 "Press '5' to change the sight range (this slide is not optimized, so it will be slow).",
126 geoslide(gSol, 'j', 0, -1)
127 });
128 v.emplace_back(
129 slide{cap+"Solv: horotori", 999, LEGAL::NONE,
130 "Solv geometry. Colored torus-like surfaces are surfaces of constant 'z'. "
131 "Press '5' to enable the raycaster",
132 geoslide(gSol, 'j', 50, 0)
133 });
134 v.emplace_back(
135 slide{cap+"Solv: difficult region", 999, LEGAL::NONE,
136 "This slide focuses on the area in Solv geometry which is difficult to render using primitives. "
137 "Press '5' to enable the raycaster.",
138 geoslide(gSol, 'J', 0, 10)
139 });
140 v.emplace_back(
141 slide{cap+"Nil geometry", 999, LEGAL::NONE,
142 "Nil geometry. Colored surfaces are surfaces of constant 'x'. "
143 "Press '5' to enable the raycaster",
144 geoslide(gNil, 'j', 10, 10)
145 });
146 v.emplace_back(
147 slide{cap+"SL(2,R) geometry", 999, LEGAL::NONE,
148 "SL(2,R) geometry.",
149 geoslide(gNormal, 'G', 90, 0)
150 });
151
152 }
153
154 #if CAP_RVSLIDES
155 vector<tour::slide> noniso_slides;
gen_noniso_demo()156 tour::slide *gen_noniso_demo() {
157 noniso_slides.clear();
158 using namespace tour;
159 noniso_slides.emplace_back(
160 slide{"Non-isotropic geometry demo", 999, LEGAL::NONE | QUICKSKIP,
161 "This is a presentation of non-isotropic geometries.",
162 [] (presmode mode) {
163 slide_url(mode, 'p', "paper about non-isotropic geometries", "https://arxiv.org/abs/2002.09533");
164 if(mode == pmStart) {
165 stop_game();
166 set_geometry(gCubeTiling);
167 start_game();
168 }
169 }
170 });
171
172 callhooks(pres::hooks_build_rvtour, "noniso", noniso_slides);
173 pres::add_end(noniso_slides);
174 return &noniso_slides[0];
175 }
176 #endif
177
178 auto hooks = addHook_rvslides(163, honey)
__anonf1214ca10402(tour::ss::slideshow_callback cb) 179 + addHook_slideshows(120, [] (tour::ss::slideshow_callback cb) {
180
181 if(noniso_slides.empty())
182 gen_noniso_demo();
183
184 cb(XLAT("non-isotropic geometries"), &noniso_slides[0], 'n');
185 });
186
187 } }
188