mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-02-02 20:29:17 +00:00
optimized drawing side walls
This commit is contained in:
parent
e6b5a333ba
commit
cf968c8be1
24
drawing.cpp
24
drawing.cpp
@ -57,6 +57,7 @@ struct dqi_poly : drawqueueitem {
|
|||||||
int flags;
|
int flags;
|
||||||
struct basic_textureinfo *tinf;
|
struct basic_textureinfo *tinf;
|
||||||
hyperpoint intester;
|
hyperpoint intester;
|
||||||
|
float cache;
|
||||||
void draw();
|
void draw();
|
||||||
void gldraw();
|
void gldraw();
|
||||||
void draw_back();
|
void draw_back();
|
||||||
@ -1737,6 +1738,7 @@ EX void quickqueue() {
|
|||||||
|
|
||||||
ld xintval(const hyperpoint& h) {
|
ld xintval(const hyperpoint& h) {
|
||||||
if(sphereflipped()) return -h[2];
|
if(sphereflipped()) return -h[2];
|
||||||
|
if(hyperbolic) return -h[2];
|
||||||
return -intval(h, C0);
|
return -intval(h, C0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1938,15 +1940,21 @@ EX void drawqueue() {
|
|||||||
|
|
||||||
sort_drawqueue();
|
sort_drawqueue();
|
||||||
|
|
||||||
|
if(GDIM == 2)
|
||||||
for(PPR p: {PPR::REDWALLs, PPR::REDWALLs2, PPR::REDWALLs3, PPR::WALL3s,
|
for(PPR p: {PPR::REDWALLs, PPR::REDWALLs2, PPR::REDWALLs3, PPR::WALL3s,
|
||||||
PPR::LAKEWALL, PPR::INLAKEWALL, PPR::BELOWBOTTOM})
|
PPR::LAKEWALL, PPR::INLAKEWALL, PPR::BELOWBOTTOM, PPR::ASHALLOW, PPR::BSHALLOW}) {
|
||||||
if(GDIM == 2) sort(&ptds[qp0[int(p)]], &ptds[qp[int(p)]],
|
int pp = int(p);
|
||||||
[] (const unique_ptr<drawqueueitem>& p1, const unique_ptr<drawqueueitem>& p2) {
|
for(int i=qp0[pp]; i<qp[pp]; i++) {
|
||||||
auto ap1 = (dqi_poly&) *p1;
|
auto ap = (dqi_poly&) *ptds[i];
|
||||||
auto ap2 = (dqi_poly&) *p2;
|
ap.cache = xintval(ap.V * xpush0(.1));
|
||||||
return xintval(ap1.V * xpush0(.1))
|
}
|
||||||
< xintval(ap2.V * xpush0(.1));
|
sort(&ptds[qp0[int(p)]], &ptds[qp[int(p)]],
|
||||||
});
|
[] (const unique_ptr<drawqueueitem>& p1, const unique_ptr<drawqueueitem>& p2) {
|
||||||
|
auto ap1 = (dqi_poly&) *p1;
|
||||||
|
auto ap2 = (dqi_poly&) *p2;
|
||||||
|
return ap1.cache < ap2.cache;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
for(PPR p: {PPR::TRANSPARENT_WALL})
|
for(PPR p: {PPR::TRANSPARENT_WALL})
|
||||||
sort(&ptds[qp0[int(p)]], &ptds[qp[int(p)]],
|
sort(&ptds[qp0[int(p)]], &ptds[qp[int(p)]],
|
||||||
|
Loading…
Reference in New Issue
Block a user