mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 05:52:59 +00:00 
			
		
		
		
	rogueviz:: projection visualizations have slides
This commit is contained in:
		| @@ -417,7 +417,47 @@ auto msc = arg::add3("-analogs", enable) | |||||||
|     ->editable(0, 255, 15, "Earth transparency", "", 't'); |     ->editable(0, 255, 15, "Earth transparency", "", 't'); | ||||||
|     param_b(textured, "analogs_texture") |     param_b(textured, "analogs_texture") | ||||||
|     ->editable("draw Earth", 'T'); |     ->editable("draw Earth", 'T'); | ||||||
|     }); |     }) | ||||||
|  |   + addHook(rogueviz::pres::hooks_build_rvtour, 131, [] (string s, vector<tour::slide>& v) { | ||||||
|  |       if(s != "mixed") return; | ||||||
|  |       using namespace tour; | ||||||
|  |  | ||||||
|  |       v.push_back(slide{ | ||||||
|  |         "projections/Earth and the hyperbolic plane", 10, LEGAL::NONE | QUICKGEO, | ||||||
|  |  | ||||||
|  |         "Cartographers need to project the surface of Earth to a flat paper. However, since the surface of Earth is curved, there is no perfect way to do this. " | ||||||
|  |         "Some projections will be conformal (map angles and small shapes faithfully), equidistant (map distances along SOME lines faithfully), equal-area (map areas proportionally), etc., " | ||||||
|  |         "but no map will be all at once. Cartographers use many projections.\n\n" | ||||||
|  |          | ||||||
|  |         "We need these projections because the Earth has positive curvature, while the paper has no curvature. Interestingly, " | ||||||
|  |         "most of the popular projections can be generalized, as projections from surface of curvature any K1 to surfaces of any curvature K2!\n\n" | ||||||
|  |          | ||||||
|  |         "This slide focuses on the hyperbolic analogs of popular spherical projections (projecting H² to E²). " | ||||||
|  |         "Press '5' to enable cycling between different projections, or 'o' for more options." | ||||||
|  |         , | ||||||
|  |         [] (presmode mode) { | ||||||
|  |           slide_url(mode, 'y', "YouTube link (with description)", "https://youtu.be/H7NKhKTjHVE"); | ||||||
|  |           slide_url(mode, 'm', "HyperRogue page about projections", "http://www.roguetemple.com/z/hyper/models.php"); | ||||||
|  |           setCanvas(mode, '0'); | ||||||
|  |           if(mode == pmStart) { | ||||||
|  |             enable(); | ||||||
|  |             start_game(); | ||||||
|  |             slide_backup(cycle_models); | ||||||
|  |             slide_backup(anims::period); | ||||||
|  |             } | ||||||
|  |           if(mode == pmStop) { | ||||||
|  |             dual::disable(); | ||||||
|  |             start_game(); | ||||||
|  |             } | ||||||
|  |           if(mode == pmKey) { | ||||||
|  |             cycle_models = !cycle_models; | ||||||
|  |             if(cycle_models) anims::period *= 12; | ||||||
|  |             else anims::period /= 12; | ||||||
|  |             } | ||||||
|  |           }}); | ||||||
|  |        | ||||||
|  |       callhooks(rogueviz::pres::hooks_build_rvtour, "projections", v); | ||||||
|  |       }); | ||||||
|  |  | ||||||
| } | } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -243,13 +243,15 @@ void show() { | |||||||
|   dialog::display(); |   dialog::display(); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| auto hook = arg::add3("-inner-map", [] { | void enable() { | ||||||
|   using rogueviz::rv_hook; |   using rogueviz::rv_hook; | ||||||
|   rv_hook(hooks_frame, 100, frame); |   rv_hook(hooks_frame, 100, frame); | ||||||
|   rv_hook(hooks_drawcell, 100, render); |   rv_hook(hooks_drawcell, 100, render); | ||||||
|   rv_hook(anims::hooks_anim, 100, shift); |   rv_hook(anims::hooks_anim, 100, shift); | ||||||
|   rv_hook(hooks_o_key, 80, [] (o_funcs& v) { v.push_back(named_dialog("inner maps", show)); }); |   rv_hook(hooks_o_key, 80, [] (o_funcs& v) { v.push_back(named_dialog("inner maps", show)); }); | ||||||
|   })  |   } | ||||||
|  |  | ||||||
|  | auto hook = arg::add3("-inner-map", enable)  | ||||||
|   + addHook(hooks_configfile, 100, [] { |   + addHook(hooks_configfile, 100, [] { | ||||||
|     param_f(texture_alpha, "inner_talpha") |     param_f(texture_alpha, "inner_talpha") | ||||||
|     ->editable(0, 5, .1, "texture projection distance", "", 't'); |     ->editable(0, 5, .1, "texture projection distance", "", 't'); | ||||||
| @@ -271,7 +273,31 @@ auto hook = arg::add3("-inner-map", [] { | |||||||
|       "How many times per frame should we re-render the map",  |       "How many times per frame should we re-render the map",  | ||||||
|       'i') |       'i') | ||||||
|     ->set_reaction(need_redo); |     ->set_reaction(need_redo); | ||||||
|     }); |     }) | ||||||
|  |   + addHook(rogueviz::pres::hooks_build_rvtour, 52, [] (string s, vector<tour::slide>& v) { | ||||||
|  |       if(s != "projections") return; | ||||||
|  |       using namespace tour; | ||||||
|  |  | ||||||
|  |       v.push_back(slide{ | ||||||
|  |         "projections/hyperbolic to hyperbolic", 10, LEGAL::NONE | QUICKGEO, | ||||||
|  |  | ||||||
|  |         "We can also project a hyperbolic plane to a hyperbolic plane of different curvature.\n\n" | ||||||
|  |         "Creatures living in the hyperbolic world may use the native Poincar<61> model to get conformal, circular, and totally useless maps of their whole world.\n\n" | ||||||
|  |          | ||||||
|  |         "Press 'o' to change the settings." | ||||||
|  |         , | ||||||
|  |         [] (presmode mode) { | ||||||
|  |           slide_url(mode, 't', "Twitter link (with description)", "https://twitter.com/zenorogue/status/1212408644941295619"); | ||||||
|  |           setCanvas(mode, 'r'); | ||||||
|  |            | ||||||
|  |           if(mode == pmStart) { | ||||||
|  |             if(!shmup::on) restart_game(rg::shmup); | ||||||
|  |             slide_backup(mapeditor::drawplayer, true); | ||||||
|  |             enable(); | ||||||
|  |             start_game(); | ||||||
|  |             } | ||||||
|  |           }}); | ||||||
|  |       }); | ||||||
|  |  | ||||||
| } | } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -510,7 +510,34 @@ auto msc = | |||||||
|     ->editable(0, 255, 15, "animation alpha max", "", 'm'); |     ->editable(0, 255, 15, "animation alpha max", "", 'm'); | ||||||
|     param_f(prec, "moon_precision") |     param_f(prec, "moon_precision") | ||||||
|     ->editable(0, 30, .5, "precision", "larger values are less precise", 'p'); |     ->editable(0, 30, .5, "precision", "larger values are less precise", 'p'); | ||||||
|     }); |     }) | ||||||
|  |   + addHook(rogueviz::pres::hooks_build_rvtour, 51, [] (string s, vector<tour::slide>& v) { | ||||||
|  |       if(s != "projections") return; | ||||||
|  |       using namespace tour; | ||||||
|  |  | ||||||
|  |       v.push_back(slide{ | ||||||
|  |         "projections/sphere to sphere", 10, LEGAL::NONE | QUICKGEO, | ||||||
|  |  | ||||||
|  |         "We can also project a sphere to a sphere of different curvature. For example, what about the azimuthal equidistant projection from Earth to Moon? " | ||||||
|  |         "This projection correctly maps the angles and distances from a chosen point at Earth. " | ||||||
|  |         "Press 'o' to use the place on Earth you are in as the chosen point, try other projections, or change the other settings!" | ||||||
|  |         , | ||||||
|  |         [] (presmode mode) { | ||||||
|  |           slide_url(mode, 't', "Twitter link (with description)", "https://twitter.com/ZenoRogue/status/1339946298460483589"); | ||||||
|  |           setCanvas(mode, '0'); | ||||||
|  |            | ||||||
|  |           if(mode == pmStart) { | ||||||
|  |             enable(); | ||||||
|  |             set_geometry(gSphere); | ||||||
|  |             slide_backup(canvas_default_wall, waInvisibleFloor); | ||||||
|  |             slide_backup(pmodel, mdDisk); | ||||||
|  |             slide_backup(pconf.scale, 1000); | ||||||
|  |             slide_backup(pconf.alpha, 1000); | ||||||
|  |             start_game(); | ||||||
|  |             slide_backup(max_alpha, 192); | ||||||
|  |             } | ||||||
|  |           }}); | ||||||
|  |       }); | ||||||
|  |  | ||||||
| } | } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue