// compile with: // ./mymake -O3 inner-maps // run with: // ./hyper -innner-map -noscr -canvas r -canvas i -wsh 0 -smart 4 -shott 0 -alpha 1 #include "rogueviz.h" namespace hr { namespace inner { bool out = true; EX struct renderbuffer *buf1, *buf2; map lti; ld mdist; bool for_klein = false; ld alpha = -.7; cell *rendercenter; shiftmatrix rendercenterV; bool auto_move = false; ld texture_alpha = 1; ld inner_alpha = 1; bool dense = false; // should do 30x -- temporarily disabled ld iterations = 1; ld iterations_bank; void gentexture() { if(out) iterations_bank += iterations; while(iterations_bank >= 1) { iterations_bank -= 1; println(hlog, "# = ", isize(lti)); dynamicval b(out, false); dynamicval va(pconf.alpha, texture_alpha); if(!buf1) { buf1 = new renderbuffer(rug::texturesize, rug::texturesize, true); buf2 = new renderbuffer(rug::texturesize, rug::texturesize, true); } resetbuffer rb; rug::calcparam_rug(); models::configure(); buf1->enable(); buf1->clear(0); buf2->use_as_texture(); draw_boundary(0); draw_boundary(1); draw_model_elements(); drawthemap(); drawqueue(); calcparam(); rb.reset(); swap(buf1, buf2); rendercenter = centerover; rendercenterV = gmatrix[centerover]; } } void frame() { gentexture(); if(auto_move) { color_t col = minf[moReptile].color; drawMonsterType(moReptile, NULL, shiftless(spin(alpha)), col, mdist, col); mapeditor::drawplayer = false; } } bool done; hpcshape edgeshape; hpcshape circ; ld crad = dense ? .5 : 1.82; ld ceps = .02; ld crad_p; void need_redo() { done = false; } void make_shape() { if(done) return; done = true; cgi.bshape(circ, PPR::WALL); circ.flags |= POLY_TRIANGLES; int k = for_klein ? 1 : 2; int maxz = for_klein ? 120 : 30; for(int z=0; zeditable(0, 5, .1, "texture projection distance", "", 't'); param_f(inner_alpha, "inner_ialpha") ->editable(0, 5, .1, "inner projection distance", "", 'i') ->set_reaction(need_redo); param_b(dense, "inner_dense") ->editable("densely packed maps", 'd'); param_f(crad, "inner_crad") ->editable(0, 10, .1, "radii of the inner maps", "", 'r') ->set_reaction(need_redo); param_f(ceps, "inner_ceps") ->editable(0, 0.1, .001, "map frame size", "", 'f') ->set_reaction(need_redo); param_b(auto_move, "auto_move") ->editable("animate", 'a'); param_f(iterations, "inner_iterations") ->editable(0, 30, 0.2, "iterations per frame", "How many times per frame should we re-render the map", 'i') ->set_reaction(need_redo); }); } }