diff --git a/renderer.cc b/renderer.cc index 31f403b..7994e83 100644 --- a/renderer.cc +++ b/renderer.cc @@ -253,7 +253,7 @@ auto CreateLevelMap() auto uv = AsArray(0u, 0u); // Starting coordinates in texture - static const unsigned char sizes[10] = { 2,4,8,12,16,24,32,40,48,64 }; - static const char combinations[1+870] = "!\"#$%&()*+,-./0123456789:;<=>?@AIJKSTU]^_ghiqrs{|}"; - static const char luvsizedata[1+870] = ",@6J,K6=IF@O&&::,C&&/&,K0&@;>,J&E;ACO)H@@I,&@KWK@/10-(&0&'0:F0:00/&BWABO@B@PTKUW(O@BQB0::6)/1&0''00N0KH@BH5H.AAJ/HQ78BHKWAB0<'0:0N'Q>'0JN:.<6W/*B@870;Q6@PAP@Q@B@G69696EHA11BWV0@7BBHBNB@?6V/E..8-&1'(''1)8:0////97@JB:00AW9'@5@Q/)@6@WIH>EA?@Q-W7O9U,V&EBBA/:W+>W4=WQQB(1KG)TF)B?N,/@9/9&;:;&L01&1/K>J@96EHCV,//W.6K@/0KKA,.I@(&:91&&:/0&&9//6&&ED/6&&C/KN@&&&@/,.6H8(P@U/W88K6&&&&&;6E&'/K;9&9&/NW1&/-T0KW@V'W8BPA,/C:D/W&L//NU2HUR0&:>&;H@KE;:>&.;WB&K@65,EWJN&MI.2@VQWBBQ@9DBKBKBB1K&;3+1KTJ?01QB@;H-P@9G@B?KW/BW)*;=/63N)W.@B@=@>@EBI,@G6/@,/(0&''AK&&&&&B?@&>>K(?AK@&;?HS@@;B6VAU,BQB@>9/2,QA@:&/6&'6'C6'E0;:''&&&&1QTB<)A0,1A&=@&&&&&&&W@W&CW4B/&&&<@8GHN@,N:Q@R3@IQ@BW0UT@@;DE;(&L.U,*>&&0.&@&&96&(8,&2C&&)FH@/&&&&F&&*2("; - unsigned index = combinations[luvsizedata[poly.size()-80]-38]-33; + static const unsigned char sizes[8] = { 2,4,8,16,32,64,96,128 }; + static const char combinations[1+16] = " &',./56>= !(++toggle%1)) for(auto& poly: polys | std::views::filter([&](auto& v) { return v.flags==0 && std::distance(&polys[0],&v)%max==n; })) { + unsigned cheat = usecheat; + while(cheat > std::min(poly.lusize, poly.lvsize)) cheat >>= 1; + // Assemble directional vectors: The normal, and four tangent vectors, all at 90° angles to the previous. @@ -397,3 +398,5 @@ int main() [&](float x,float y,float z, auto,auto, unsigned lu,unsigned lv, auto...) { + if(((lu-poly.lubase)|(lv-poly.lvbase))&cheat) return; + // Camera location for viewing "up" from this point at the surface @@ -425,5 +428,25 @@ int main() color = color + pixels[p] * weights[p]; } - lightmap.get(lu,lv) = color; + if(cheat) + { + for(unsigned q=0; q<=cheat; ++q) + for(unsigned p=0; p<=cheat; ++p) + { + auto boleft = (lu > poly.lubase ) ? lightmap.get(lu-1,lv+q) : color; + auto upleft = (lu > poly.lubase && lv > poly.lvbase) ? lightmap.get(lu-1,lv-1) : boleft; + auto uphere = ( lv > poly.lvbase) ? lightmap.get(lu+p,lv-1) : boleft; + lightmap.get(lu+p,lv+q) = + mix(float(q+1)/float(cheat+1), + mix(float(p+1)/float(cheat+1), upleft,uphere), + mix(float(p+1)/float(cheat+1), boleft,color) + ); + } + } + else + { + for(unsigned p=0; p<=cheat; ++p) + for(unsigned q=0; q<=cheat; ++q) + lightmap.get(lu+p,lv+q) = color; + } }); }