diff --git a/rug.cpp b/rug.cpp index d90fe3ea..045ec09a 100644 --- a/rug.cpp +++ b/rug.cpp @@ -974,7 +974,7 @@ vector ct_array; vector cp_array; -basic_textureinfo tinf; +EX basic_textureinfo tinf; void drawTriangle(triangle& t) { for(int i=0; i<3; i++) { diff --git a/screenshot.cpp b/screenshot.cpp index 34873185..b8d57809 100644 --- a/screenshot.cpp +++ b/screenshot.cpp @@ -247,6 +247,7 @@ EX always_false in; EX ld rug_width = .01; fhstream f; + string filename; string coord(ld val) { char buf[100]; @@ -274,7 +275,7 @@ EX always_false in; return hash(h[0]) + 7 * hash(h[1]) + 13 * hash(h[2]); } - EX void fatten(vector& data) { + EX void fatten(vector& data, vector& tdata) { map normals; for(int i=0; i data2; + vector tdata2; for(int i=0; i data; + vector tdata; for(int i=0; itvertices[p.offset_texture+i]); } for(auto& d: data) { hyperpoint h; @@ -354,7 +373,7 @@ EX always_false in; applymodel(h, d); } if(print && (p.flags & POLY_FAT)) { - fatten(data); + fatten(data, tdata); p.cnt = isize(data); } else if(print) { @@ -372,14 +391,28 @@ EX always_false in; } if(sdet > 0) for(int i=0; i& what IS(shot::default_screenshot_content)) { dynamicval v2(in, true); dynamicval v3(noshadow, true); + filename = fname; f.f = fopen(fname.c_str(), "wt"); @@ -412,6 +446,15 @@ EX always_false in; ptds.clear(); what(); + + if(used_rug) { + resetbuffer rb; + rug::glbuf->enable(); + SDL_Surface *s = rug::glbuf->render(); + dynamicval dx(shot::shotx, rug::texturesize); + dynamicval dy(shot::shoty, rug::texturesize); + shot::postprocess(filename + "-rug.png", s, s); + } } #endif EX } @@ -471,7 +514,7 @@ EX void default_screenshot_content() { } #if CAP_PNG -void postprocess(string fname, SDL_Surface *sdark, SDL_Surface *sbright) { +EX void postprocess(string fname, SDL_Surface *sdark, SDL_Surface *sbright) { if(gamma == 1 && shot_aa == 1 && sdark == sbright) { IMAGESAVE(sdark, fname.c_str()); return;