mirror of
				https://github.com/zenorogue/hyperrogue.git
				synced 2025-10-31 05:52:59 +00:00 
			
		
		
		
	RogueViz fixes
This commit is contained in:
		
							
								
								
									
										8
									
								
								hyper.h
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								hyper.h
									
									
									
									
									
								
							| @@ -830,6 +830,8 @@ namespace mapeditor { | |||||||
|   void showDrawEditor(); |   void showDrawEditor(); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | struct renderbuffer; | ||||||
|  |  | ||||||
| namespace rug { | namespace rug { | ||||||
|   extern bool rugged; |   extern bool rugged; | ||||||
|   extern bool computed; |   extern bool computed; | ||||||
| @@ -921,6 +923,12 @@ namespace rug { | |||||||
|   void addTriangle(rugpoint *t1, rugpoint *t2, rugpoint *t3, ld len = 1); |   void addTriangle(rugpoint *t1, rugpoint *t2, rugpoint *t3, ld len = 1); | ||||||
|   rugpoint *addRugpoint(hyperpoint h, double dist); |   rugpoint *addRugpoint(hyperpoint h, double dist); | ||||||
|   void buildRug(); |   void buildRug(); | ||||||
|  |  | ||||||
|  | extern renderbuffer *glbuf;  | ||||||
|  | extern eGeometry gwhere; | ||||||
|  | extern bool no_fog; | ||||||
|  | extern ld lowrug, hirug, ruggospeed; | ||||||
|  | extern GLuint alternate_texture; | ||||||
| #endif | #endif | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										303
									
								
								rogueviz-staircase.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										303
									
								
								rogueviz-staircase.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,303 @@ | |||||||
|  | // Hyperbolic Rogue: staircase simulation in RogueViz | ||||||
|  | // Copyright (C) 2011-2018 Zeno and Tehora Rogue, see 'hyper.cpp' for details | ||||||
|  |  | ||||||
|  | // Kohonen's self-organizing networks.  | ||||||
|  | // This is a part of RogueViz, not a part of HyperRogue. | ||||||
|  |  | ||||||
|  | namespace staircase { | ||||||
|  |  | ||||||
|  | using namespace hyperpoint_vec; | ||||||
|  |  | ||||||
|  | ld scurvature = 0; | ||||||
|  | ld acurvature = 0; | ||||||
|  |  | ||||||
|  | ld global_r; | ||||||
|  |  | ||||||
|  | ld szoom = 5; | ||||||
|  |  | ||||||
|  | ld progress = 0; | ||||||
|  |  | ||||||
|  | ld strafex, strafey; | ||||||
|  |  | ||||||
|  | hyperpoint spcoord(hyperpoint h) { | ||||||
|  |   ld phi = h[0], y = h[1], z = h[2], r = global_r; | ||||||
|  |   dynamicval<eGeometry> gw(geometry, rug::gwhere == gElliptic ? gSphere : rug::gwhere); | ||||||
|  |   hyperpoint inh = xpush(-acurvature*(y + r - frac(progress))/szoom) * spin(M_PI/2) * xpush(acurvature*z) * C0; | ||||||
|  |   hyperpoint i = inh * (hdist0(inh) / hypot2(inh)); | ||||||
|  |   ld aphi = (r+phi + floor(progress))*M_PI/6; | ||||||
|  |   return hpxyz(i[1] * sin(aphi), i[1] * cos(aphi), i[0]); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  | rug::rugpoint *pt(hyperpoint h, hyperpoint c) { | ||||||
|  |   auto r = rug::addRugpoint(C0, -1); | ||||||
|  |   r->flat = spcoord(h); | ||||||
|  |   r->x1 = c[0]; | ||||||
|  |   r->y1 = c[1]; | ||||||
|  |   r->valid = true; | ||||||
|  |   return r; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  | void addRect(hyperpoint h, hyperpoint hx, hyperpoint hy, hyperpoint v, hyperpoint vx, hyperpoint vy, int ix, int iy) { | ||||||
|  |   using namespace hyperpoint_vec; | ||||||
|  |   vector<vector<rug::rugpoint*> > rps(iy+1, vector<rug::rugpoint*> (ix+1)); | ||||||
|  |   for(int y=0; y<=iy; y++) | ||||||
|  |   for(int x=0; x<=ix; x++) { | ||||||
|  |     rps[y][x] = pt(h+hx*x/ix+hy*y/iy, v+vx*x/ix+vy*y/iy); | ||||||
|  |     } | ||||||
|  |   for(int y=0; y<iy; y++) | ||||||
|  |   for(int x=0; x<ix; x++)  | ||||||
|  |     rug::addTriangle(rps[y][x], rps[y+1][x], rps[y][x+1]), | ||||||
|  |     rug::addTriangle(rps[y+1][x+1], rps[y][x+1], rps[y+1][x]); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  | void addTri(hyperpoint h, hyperpoint hx, hyperpoint hy, hyperpoint v, hyperpoint vx, hyperpoint vy, int i) { | ||||||
|  |   using namespace hyperpoint_vec; | ||||||
|  |   vector<vector<rug::rugpoint*> > rps(i+1, vector<rug::rugpoint*> (i+1)); | ||||||
|  |   for(int y=0; y<=i; y++) | ||||||
|  |   for(int x=0; x<=i; x++) { | ||||||
|  |     if(x+y <= i) | ||||||
|  |       rps[y][x] = pt(h+hx*x/i+hy*y/i, v+vx*x/i+vy*y/i); | ||||||
|  |     } | ||||||
|  |   for(int y=0; y<i; y++) | ||||||
|  |   for(int x=0; x<i; x++) { | ||||||
|  |     if(x+y < i) | ||||||
|  |       rug::addTriangle(rps[y][x], rps[y+1][x], rps[y][x+1]); | ||||||
|  |     if(x+y+2 <= i) | ||||||
|  |       rug::addTriangle(rps[y+1][x+1], rps[y][x+1], rps[y+1][x]); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  | bool need_texture = true; | ||||||
|  |  | ||||||
|  | texture::texture_data tdata; // = texture::config.data; | ||||||
|  |  | ||||||
|  | void make_texture() { | ||||||
|  |   printf("make texture\n"); | ||||||
|  |   need_texture = false; | ||||||
|  |   tdata.whitetexture(); | ||||||
|  |   int tw = tdata.twidth; | ||||||
|  |   printf("tw = %d\n", tw); | ||||||
|  |   int fw = tw / 4; | ||||||
|  |   auto pix = [&] (int k, int x, int y) -> unsigned& { | ||||||
|  |     return tdata.texture_pixels[y * tw + x + (k&3) * fw + (k>>2) * fw * tw]; | ||||||
|  |     }; | ||||||
|  |   for(int y=0; y<tw; y++) | ||||||
|  |   for(int x=0; x<tw; x++)  | ||||||
|  |     pix(0,x,y) = rand(); | ||||||
|  |   for(int y=0; y<=fw; y++) | ||||||
|  |   for(int x=0; x<=fw; x++) { | ||||||
|  |     typedef long long ll; | ||||||
|  |     pix(0,x,y) = 0xFF000000 + 0x10101 * ((x*ll(fw-x)*y*(fw-y)*255)/ll(fw/2)/(fw/2)/(fw-fw/2)/(fw-fw/2)); | ||||||
|  |     pix(2,x,y) = 0xFF400000 + 0x10000 * (y * 63 / fw); | ||||||
|  |     pix(8,x,y) = 0xFF101010; | ||||||
|  |     pix(10,x,y) = 0xFF000000 + gradient(0, 0xFFD500, 0, x*(fw-x), fw*fw/4); | ||||||
|  |     pix(5,x,y) = 0xFF000000 + gradient(0, 0x804000, -1, sin(2*M_PI*8*y/fw), 1); | ||||||
|  |     pix(7,x,y) = 0xFF000000 + gradient(0, 0x808080, 0, x*ll(fw-x)*y*(fw-y), ll(fw/2)*(fw/2)*(fw-fw/2)*(fw-fw/2)); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   tdata.loadTextureGL(); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  | int savetex; | ||||||
|  |  | ||||||
|  | int prec = 4; | ||||||
|  |  | ||||||
|  | int maxr = 1000; | ||||||
|  |  | ||||||
|  | bool on; | ||||||
|  |  | ||||||
|  | void make_staircase() { | ||||||
|  |  | ||||||
|  |   // stereo::mode = stereo::sODS; | ||||||
|  |   // stereo::set_viewport(0); | ||||||
|  |   rug::no_fog = true; | ||||||
|  |  | ||||||
|  |   printf("scurvature = %lf progress = %lf strafe=%lf,%lf\n", scurvature, progress, strafex, strafey); | ||||||
|  |   rug::renderonce = true; | ||||||
|  |   rug::rug_perspective = true; | ||||||
|  |   if(scurvature > -1e-6 && scurvature < 1e-6) {  | ||||||
|  |     rug::gwhere = gEuclid; | ||||||
|  |     acurvature = 1; | ||||||
|  |     } | ||||||
|  |   else if(scurvature < 0) { | ||||||
|  |     rug::gwhere = gNormal; | ||||||
|  |     acurvature = -scurvature; | ||||||
|  |     } | ||||||
|  |   else { | ||||||
|  |     rug::gwhere = gSphere; | ||||||
|  |     acurvature = scurvature; | ||||||
|  |     } | ||||||
|  |   rug::ruggospeed = acurvature; | ||||||
|  |   stereo::ipd = 0.15 * acurvature; | ||||||
|  |   if(!rug::rugged || !staircase::on) { | ||||||
|  |     staircase::on = true; | ||||||
|  |     rug::reopen(); | ||||||
|  |     } | ||||||
|  |   if(need_texture) { | ||||||
|  |     make_texture(); | ||||||
|  |     rug::alternate_texture = tdata.textureid; | ||||||
|  |     } | ||||||
|  |   rug::clear_model();  | ||||||
|  |   printf("compute\n"); | ||||||
|  |   for(int r=-maxr; r<maxr; r++) { | ||||||
|  |     if(scurvature < -1e-6 && abs(r * acurvature) > 7*12) continue; | ||||||
|  |     if(scurvature > 1e-6 && abs(acurvature*r/szoom) > M_PI) continue; | ||||||
|  |     global_r = r; | ||||||
|  |     // step | ||||||
|  |     addRect(hpxyz(0,0,1), hpxyz(0,0,1), hpxyz(1,0,0), hpxy(0,0), hpxy(.25,0), hpxy(0,.25), prec, prec); | ||||||
|  |     // step connection | ||||||
|  |     addRect(hpxyz(1,0,1), hpxyz(0,0,1), hpxyz(0,1,0), hpxy(0.75,0.25), hpxy(.25,0), hpxy(0,.25), prec, prec); | ||||||
|  |     // triangle inner side | ||||||
|  |     addTri(hpxyz(1,0,1), hpxyz(0,1,0), hpxyz(-1,0,0), hpxy(.5,0), hpxy(.125,.125), hpxy(0,.125), prec); | ||||||
|  |     // rectangle under triangle | ||||||
|  |     addRect(hpxyz(0,0,1), hpxyz(1,1,0), hpxyz(0,1,0), hpxy(.5,.125), hpxy(.125,0), hpxy(0,.125), prec, prec); | ||||||
|  |     // barrier post | ||||||
|  |     addRect(hpxyz(.45,0,1.1), hpxyz(.1,.1,0), hpxyz(0,-3,0), hpxy(0,.5), hpxy(.25,0), hpxy(0,.25), 2, prec); | ||||||
|  |     // barrier | ||||||
|  |     addRect(hpxyz(.45,-3,1), hpxyz(0,0,.2), hpxyz(1,1,0), hpxy(.5,.5), hpxy(.25,0), hpxy(0,.25), 1, prec); | ||||||
|  |     // outer wall | ||||||
|  |     addRect(hpxyz(0,0,2), hpxyz(1,1,0), hpxyz(0,12,0), hpxy(.25,.25), hpxy(.25,0), hpxy(0,.25), prec, prec); | ||||||
|  |     // lower wall | ||||||
|  |     addRect(hpxyz(0,1,1), hpxyz(1,1,0), hpxyz(0,0,1), hpxy(.5,0), hpxy(.25,0), hpxy(0,.25), prec, prec); | ||||||
|  |     }     | ||||||
|  |   printf("push\n"); | ||||||
|  |   rug::push_all_points(0, strafex * acurvature); | ||||||
|  |   rug::push_all_points(1, strafey * acurvature); | ||||||
|  |   for(auto p: rug::points) p->valid = true; | ||||||
|  |   rug::good_shape = true;   | ||||||
|  |   printf("done (%d points)\n", size(rug::points)); | ||||||
|  |   rug::lowrug = 1e-2 * acurvature; | ||||||
|  |   rug::hirug = 1e3 * acurvature; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  | // -0.50 .. 0.16 | ||||||
|  |  | ||||||
|  | int ctick; | ||||||
|  |  | ||||||
|  | void check() { | ||||||
|  |   if(ctick && ctick < ticks) { | ||||||
|  |     calcparam(); | ||||||
|  |     make_staircase(); | ||||||
|  |     ctick = 0; | ||||||
|  |     } | ||||||
|  |   if(on && !rug::rugged) { | ||||||
|  |     on = false; | ||||||
|  |     rug::alternate_texture = 0; | ||||||
|  |     rug::no_fog = false; | ||||||
|  |     rug::ruggospeed = 1; | ||||||
|  |     staircase::on = false; | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|  | void showMenu() { | ||||||
|  |   cmode = sm::SIDE; | ||||||
|  |   gamescreen(0); | ||||||
|  |   dialog::init(XLAT("Spiral Staircase"), iinf[itPalace].color, 150, 0); | ||||||
|  |  | ||||||
|  |   dialog::addSelItem("     " + XLAT("X"), fts(strafex), 'x'); | ||||||
|  |   dialog::addSelItem("     " + XLAT("Y"), fts(strafey), 'y'); | ||||||
|  |   dialog::addSelItem("     " + XLAT("curvature"), fts(scurvature), 'c'); | ||||||
|  |  | ||||||
|  |   dialog::addBreak(100); | ||||||
|  |   dialog::addItem(XLAT("disable menu"), SDLK_ESCAPE); | ||||||
|  |   dialog::addBoolItem(XLAT("low quality"), prec == 1, '1'); | ||||||
|  |   dialog::addBoolItem(XLAT("medium quality"), prec == 2, '2'); | ||||||
|  |   dialog::addBoolItem(XLAT("high quality"), prec == 4, '3'); | ||||||
|  |   dialog::addItem(XLAT("take me back"), 'q'); | ||||||
|  |  | ||||||
|  |   dialog::display(); | ||||||
|  |   keyhandler = [] (int sym, int uni) { | ||||||
|  |     dialog::handleNavigation(sym, uni); | ||||||
|  |      | ||||||
|  |     if(uni == 'x') { | ||||||
|  |       dialog::editNumber(strafex, -1, 1, .05, 1, XLAT("X"), | ||||||
|  |         XLAT("Also changed with keys A/D") | ||||||
|  |         ); | ||||||
|  |       dialog::reaction = [] () { ctick = ticks + 500; }; | ||||||
|  |       } | ||||||
|  |     else if(uni == 'y') { | ||||||
|  |       dialog::editNumber(strafey, -1, 1, .05, 1, XLAT("Y"), | ||||||
|  |         XLAT("Also changed with keys W/S") | ||||||
|  |         ); | ||||||
|  |       dialog::reaction = [] () { ctick = ticks + 500; }; | ||||||
|  |       } | ||||||
|  |     else if(uni == 'c') { | ||||||
|  |       dialog::editNumber(scurvature, -1, 1, .05, 1, XLAT("curvature"), | ||||||
|  |         XLAT("Also changed with keys K/L. Press G for the golden spiral") | ||||||
|  |         ); | ||||||
|  |       dialog::reaction = [] () { ctick = ticks + 500; }; | ||||||
|  |       } | ||||||
|  |     else if(uni == 'w') { | ||||||
|  |       strafey += .1; | ||||||
|  |       ctick = ticks + 200; | ||||||
|  |       } | ||||||
|  |     else if(uni == 's') { | ||||||
|  |       strafey -= .1; | ||||||
|  |       ctick = ticks + 200; | ||||||
|  |       } | ||||||
|  |     else if(uni == 'd') { | ||||||
|  |       strafex += .1; | ||||||
|  |       ctick = ticks + 200; | ||||||
|  |       } | ||||||
|  |     else if(uni == 'a') { | ||||||
|  |       strafex -= .1; | ||||||
|  |       ctick = ticks + 200; | ||||||
|  |       } | ||||||
|  |     else if(uni == 'k') { | ||||||
|  |       scurvature += .02; | ||||||
|  |       ctick = ticks + 200; | ||||||
|  |       } | ||||||
|  |     else if(uni == 'l') { | ||||||
|  |       scurvature -= .02; | ||||||
|  |       ctick = ticks + 200; | ||||||
|  |       } | ||||||
|  |     else if(uni == 'p') { | ||||||
|  |       progress += .1; | ||||||
|  |       ctick = ticks + 200; | ||||||
|  |       } | ||||||
|  |     else if(uni == 'g') { | ||||||
|  |       scurvature = -4 * log((sqrt(5)+1)/2) / 2.4; | ||||||
|  |       ctick = ticks + 200; | ||||||
|  |       } | ||||||
|  |     else if(uni == '1') { | ||||||
|  |       prec = 1, maxr = 100; | ||||||
|  |       make_staircase(); | ||||||
|  |       } | ||||||
|  |     else if(uni == '2') { | ||||||
|  |       prec = 2, maxr = 300; | ||||||
|  |       make_staircase(); | ||||||
|  |       } | ||||||
|  |     else if(uni == '3') { | ||||||
|  |       prec = 4, maxr = 1000; | ||||||
|  |       make_staircase(); | ||||||
|  |       } | ||||||
|  |     else if(uni == 'q') { | ||||||
|  |       ctick = 0; | ||||||
|  |       rug::close(); | ||||||
|  |       popScreen(); | ||||||
|  |       } | ||||||
|  |     else if(doexiton(sym, uni)) popScreen(); | ||||||
|  |     }; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  | #if CAP_COMMANDLINE | ||||||
|  | int readArgs() { | ||||||
|  |   using namespace arg; | ||||||
|  |  | ||||||
|  |   // #1: load the samples | ||||||
|  |    | ||||||
|  |   if(argis("-stair")) { | ||||||
|  |     showstartmenu = false; | ||||||
|  |     ctick = ticks + 2000; | ||||||
|  |     pushScreen(showMenu); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   else return 1; | ||||||
|  |   return 0; | ||||||
|  |   } | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | int phooks = addHook(hooks_args, 100, readArgs) | ||||||
|  |   + addHook(hooks_fixticks, 100, check); | ||||||
|  |  | ||||||
|  | } | ||||||
							
								
								
									
										16
									
								
								rogueviz.cpp
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								rogueviz.cpp
									
									
									
									
									
								
							| @@ -914,7 +914,8 @@ bool edgecmp(edgeinfo *e1, edgeinfo *e2) { | |||||||
|   return e1->weight > e2->weight; |   return e1->weight > e2->weight; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| #include "kohonen.cpp" | #include "rogueviz-kohonen.cpp" | ||||||
|  | #include "rogueviz-staircase.cpp" | ||||||
|  |  | ||||||
| void describe(cell *c) { | void describe(cell *c) { | ||||||
|   if(kind == kKohonen) return kohonen::describe(c); |   if(kind == kKohonen) return kohonen::describe(c); | ||||||
| @@ -1704,6 +1705,7 @@ int readArgs() { | |||||||
| #endif | #endif | ||||||
|  |  | ||||||
| void showMenu() { | void showMenu() { | ||||||
|  |   if(staircase::on) { staircase::showMenu(); return; } | ||||||
|   cmode = sm::SIDE | sm::MAYDARK | sm::DIALOG_STRICT_X; |   cmode = sm::SIDE | sm::MAYDARK | sm::DIALOG_STRICT_X; | ||||||
|   gamescreen(0);   |   gamescreen(0);   | ||||||
|  |  | ||||||
| @@ -1799,6 +1801,7 @@ template<class T> function<void(presmode)> roguevizslide(char c, T t) { | |||||||
|     slidecommand = "toggle the player"; |     slidecommand = "toggle the player"; | ||||||
|     if(mode == 4)  |     if(mode == 4)  | ||||||
|       mapeditor::drawplayer = !mapeditor::drawplayer; |       mapeditor::drawplayer = !mapeditor::drawplayer; | ||||||
|  |     centerover.c = NULL; pd_from = NULL; | ||||||
|     }; |     }; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -1880,7 +1883,7 @@ slide rvslides[] = { | |||||||
|     }, |     }, | ||||||
|  |  | ||||||
|   {"Roguelikes", 63, LEGAL_UNLIMITED, |   {"Roguelikes", 63, LEGAL_UNLIMITED, | ||||||
|     "A visualization of roguelikes, based on disccusion on /r/reddit. " |     "A visualization of roguelikes, based on discussion on /r/reddit. " | ||||||
|     "See: http://www.roguetemple.com/z/hyper/reddit.php", |     "See: http://www.roguetemple.com/z/hyper/reddit.php", | ||||||
|     roguevizslide('0', [] () { |     roguevizslide('0', [] () { | ||||||
|       rogueviz::dftcolor = 0x282828FF; |       rogueviz::dftcolor = 0x282828FF; | ||||||
| @@ -1957,6 +1960,15 @@ slide rvslides[] = { | |||||||
|  |  | ||||||
|       rogueviz::tree::read(RVPATH "treeoflife/tol.txt"); |       rogueviz::tree::read(RVPATH "treeoflife/tol.txt"); | ||||||
|       })}, |       })}, | ||||||
|  |     {"Spiral Staircase", 62, LEGAL_NONE, | ||||||
|  |      "Spiral Staircase Demo. Press '5' to change the curvature or other parameters.", | ||||||
|  |       | ||||||
|  |     [] (presmode mode) { | ||||||
|  |       if(mode == 1) staircase::make_staircase(); | ||||||
|  |       if(mode == 3) rug::close(); | ||||||
|  |       slidecommand = "staircase menu"; | ||||||
|  |       if(mode == 4) pushScreen(staircase::showMenu); | ||||||
|  |       }}, | ||||||
|   {"THE END", 99, LEGAL_ANY | FINALSLIDE, |   {"THE END", 99, LEGAL_ANY | FINALSLIDE, | ||||||
|     "Press '5' to leave the presentation.", |     "Press '5' to leave the presentation.", | ||||||
|     [] (presmode mode) { |     [] (presmode mode) { | ||||||
|   | |||||||
							
								
								
									
										16
									
								
								rug.cpp
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								rug.cpp
									
									
									
									
									
								
							| @@ -1244,8 +1244,12 @@ bool no_fog; | |||||||
|  |  | ||||||
| ld lowrug = 1e-2, hirug = 1e3; | ld lowrug = 1e-2, hirug = 1e3; | ||||||
|  |  | ||||||
|  | GLuint alternate_texture; | ||||||
|  |  | ||||||
| void drawRugScene() { | void drawRugScene() { | ||||||
|   glbuf->use_as_texture(); |   glbuf->use_as_texture(); | ||||||
|  |   if(alternate_texture) | ||||||
|  |     glBindTexture( GL_TEXTURE_2D, alternate_texture); | ||||||
|  |  | ||||||
|   if(backcolor == 0)  |   if(backcolor == 0)  | ||||||
|     glClearColor(0.05,0.05,0.05,1); |     glClearColor(0.05,0.05,0.05,1); | ||||||
| @@ -1478,6 +1482,8 @@ void finger_on(int coord, ld val) { | |||||||
|  |  | ||||||
| transmatrix last_orientation; | transmatrix last_orientation; | ||||||
|  |  | ||||||
|  | ld ruggospeed = 1; | ||||||
|  |  | ||||||
| void actDraw() {  | void actDraw() {  | ||||||
|   try { |   try { | ||||||
|  |  | ||||||
| @@ -1560,9 +1566,9 @@ void actDraw() { | |||||||
|       } |       } | ||||||
|      |      | ||||||
|     model_distance -= push; |     model_distance -= push; | ||||||
|     push_all_points(2, push); |     push_all_points(2, push * ruggospeed); | ||||||
|     push_all_points(0, strafex); |     push_all_points(0, strafex * ruggospeed); | ||||||
|     push_all_points(1, strafey); |     push_all_points(1, strafey * ruggospeed); | ||||||
|     } |     } | ||||||
|   else { |   else { | ||||||
|     if(finger_center) |     if(finger_center) | ||||||
| @@ -1574,8 +1580,8 @@ void actDraw() { | |||||||
|       if(keystate[SDLK_UP]) qm++, t =  t * rotmatrix(alpha, 2, 1); |       if(keystate[SDLK_UP]) qm++, t =  t * rotmatrix(alpha, 2, 1); | ||||||
|       if(keystate[SDLK_LEFT]) qm++, t = t * rotmatrix(alpha, 0, 2); |       if(keystate[SDLK_LEFT]) qm++, t = t * rotmatrix(alpha, 0, 2); | ||||||
|       if(keystate[SDLK_RIGHT]) qm++, t =  t * rotmatrix(alpha, 2, 0); |       if(keystate[SDLK_RIGHT]) qm++, t =  t * rotmatrix(alpha, 2, 0); | ||||||
|       if(keystate[SDLK_PAGEUP]) model_distance /= exp(alpha); |       if(keystate[SDLK_PAGEUP]) model_distance /= exp(alpha * ruggospeed); | ||||||
|       if(keystate[SDLK_PAGEDOWN]) model_distance *= exp(alpha); |       if(keystate[SDLK_PAGEDOWN]) model_distance *= exp(alpha * ruggospeed); | ||||||
|       } |       } | ||||||
|    |    | ||||||
|     if(qm) { |     if(qm) { | ||||||
|   | |||||||
| @@ -3422,7 +3422,8 @@ transmatrix &ggmatrix(cell *c) { | |||||||
|           t = ggmatrix(c2) * eumovedir(3+i); |           t = ggmatrix(c2) * eumovedir(3+i); | ||||||
|       } |       } | ||||||
|     else if(euclid) { |     else if(euclid) { | ||||||
|       t = gmatrix[centerover.c] * eumove(cell_to_vec(c) - cellwalker_to_vec(centerover)); |       if(!centerover.c) centerover = cwt; | ||||||
|  |       t = View * eumove(cell_to_vec(c) - cellwalker_to_vec(centerover)); | ||||||
|       } |       } | ||||||
|     else  |     else  | ||||||
|       t = actualV(viewctr, cview()) * calc_relative_matrix(c, viewctr.h->c7); |       t = actualV(viewctr, cview()) * calc_relative_matrix(c, viewctr.h->c7); | ||||||
|   | |||||||
| @@ -1009,6 +1009,7 @@ namespace gamestack { | |||||||
|   struct gamedata { |   struct gamedata { | ||||||
|     hrmap *hmap; |     hrmap *hmap; | ||||||
|     cellwalker cwt; |     cellwalker cwt; | ||||||
|  |     cellwalker ctover; | ||||||
|     heptspin viewctr; |     heptspin viewctr; | ||||||
|     transmatrix View; |     transmatrix View; | ||||||
|     eGeometry geometry; |     eGeometry geometry; | ||||||
| @@ -1033,6 +1034,7 @@ namespace gamestack { | |||||||
|     gdn.geometry = geometry; |     gdn.geometry = geometry; | ||||||
|     gdn.shmup = shmup::on; |     gdn.shmup = shmup::on; | ||||||
|     gdn.hepta = nonbitrunc; |     gdn.hepta = nonbitrunc; | ||||||
|  |     gdn.ctover = centerover; | ||||||
|     gd.push_back(gdn); |     gd.push_back(gdn); | ||||||
|     } |     } | ||||||
|      |      | ||||||
| @@ -1048,6 +1050,7 @@ namespace gamestack { | |||||||
|     shmup::on = gdn.shmup; |     shmup::on = gdn.shmup; | ||||||
|     resetGeometry(); |     resetGeometry(); | ||||||
|     gd.pop_back(); |     gd.pop_back(); | ||||||
|  |     centerover = gdn.ctover; | ||||||
|     bfs(); |     bfs(); | ||||||
|     } |     } | ||||||
|    |    | ||||||
|   | |||||||
| @@ -78,7 +78,7 @@ bool texture_data::loadTextureGL() { | |||||||
|  |  | ||||||
|   if(textureid == 0) glGenTextures(1, &textureid); |   if(textureid == 0) glGenTextures(1, &textureid); | ||||||
|  |  | ||||||
|   glBindTexture( GL_TEXTURE_2D, config.data.textureid); |   glBindTexture( GL_TEXTURE_2D, textureid); | ||||||
|   glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); |   glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); | ||||||
|   glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); |   glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); | ||||||
|    |    | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Zeno Rogue
					Zeno Rogue