mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-07-21 18:32:49 +00:00
rogueviz:: matrix memoization in multidraw
This commit is contained in:
parent
e6bdfcc94f
commit
827ae794d6
14
rogueviz.cpp
14
rogueviz.cpp
@ -1056,6 +1056,15 @@ void queuedisk(const transmatrix& V, const colorpair& cp, bool legend) {
|
|||||||
|
|
||||||
unordered_map<pair<edgeinfo*, int>, int> drawn_edges;
|
unordered_map<pair<edgeinfo*, int>, int> drawn_edges;
|
||||||
|
|
||||||
|
map<pair<cell*, cell*>, transmatrix> relmatrices;
|
||||||
|
|
||||||
|
transmatrix& memo_relative_matrix(cell *c1, cell *c2) {
|
||||||
|
auto& p = relmatrices[make_pair(c1, c2)];
|
||||||
|
if(p[2][2] == 0)
|
||||||
|
p = shmup::calc_relative_matrix(c1, c2, NOHINT);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
void drawVertex(const transmatrix &V, cell *c, shmup::monster *m) {
|
void drawVertex(const transmatrix &V, cell *c, shmup::monster *m) {
|
||||||
if(m->dead) return;
|
if(m->dead) return;
|
||||||
int i = m->pid;
|
int i = m->pid;
|
||||||
@ -1103,10 +1112,10 @@ void drawVertex(const transmatrix &V, cell *c, shmup::monster *m) {
|
|||||||
if(svg::in && alpha < 16) continue;
|
if(svg::in && alpha < 16) continue;
|
||||||
|
|
||||||
transmatrix gm1 =
|
transmatrix gm1 =
|
||||||
multidraw ? V * shmup::calc_relative_matrix(vd1.m->base, c, NOHINT) :
|
multidraw ? V * memo_relative_matrix(vd1.m->base, c) :
|
||||||
shmup::ggmatrix(vd1.m->base);
|
shmup::ggmatrix(vd1.m->base);
|
||||||
transmatrix gm2 =
|
transmatrix gm2 =
|
||||||
multidraw ? V * shmup::calc_relative_matrix(vd2.m->base, c, NOHINT) :
|
multidraw ? V * memo_relative_matrix(vd2.m->base, c) :
|
||||||
shmup::ggmatrix(vd2.m->base);
|
shmup::ggmatrix(vd2.m->base);
|
||||||
|
|
||||||
hyperpoint h1 = gm1 * vd1.m->at * C0;
|
hyperpoint h1 = gm1 * vd1.m->at * C0;
|
||||||
@ -1477,6 +1486,7 @@ void close() {
|
|||||||
sag::sagedges.clear();
|
sag::sagedges.clear();
|
||||||
edgetypes.clear();
|
edgetypes.clear();
|
||||||
on = false;
|
on = false;
|
||||||
|
relmatrices.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void turn(int delta) {
|
void turn(int delta) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user