1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-06-26 15:13:19 +00:00

ads-game:: better organized spacetime display

This commit is contained in:
Zeno Rogue 2022-10-15 14:25:31 +02:00
parent 5423eebc2d
commit 17e2a56320
3 changed files with 17 additions and 6 deletions

View File

@ -135,11 +135,17 @@ void draw_game_cell(const cell_to_draw& cd) {
rock.pts.push_back(f);
});
}
if(hv) {
ads_point M = current * (V * rock.at) * ads_matrix(Id, rock.pt_main.shift) * C0;
ld t = rock.life_start;
if(t < -100) t = 0;
ld shift = floor((rock.pt_main.shift - t) / spacetime_step) * spacetime_step + t;
ads_point M = current * (V * rock.at) * ads_matrix(Id, shift) * C0;
optimize_shift(M);
for(ld z=-5; z<=5; z+=0.2) {
for(int z0=-spacetime_qty; z0<=spacetime_qty; z0++) {
ld z = z0 * spacetime_step;
if((shift+z) < rock.life_start) continue;
if((shift+z) > rock.life_end) continue;
for(int i=0; i<isize(shape); i += 2) {
auto h = rots::uxpush(shape[i] * ads_scale) * rots::uypush(shape[i+1] * ads_scale) * C0;
curvepoint(h);

View File

@ -501,10 +501,13 @@ void view_ds_game() {
if(hv) {
ld t = rock.at.shift;
if(rock.type == oMainRock) t = floor(10*t + .5) / 10;
if(rock.type == oMainRock) t = floor(t / spacetime_step + .5) * spacetime_step;
transmatrix at = current.T * lorentz(2, 3, t - current.shift) * rock.at.T;
for(ld s=-3; s<=3; s+=0.1) {
transmatrix at1 = at * lorentz(2, 3, s);
for(int z0=-spacetime_qty; z0<=spacetime_qty; z0++) {
ld z = z0 * spacetime_step;
if(t-z < rock.life_start) continue;
if(t-z > rock.life_end) continue;
transmatrix at1 = at * lorentz(2, 3, z);
if((at1 * pov) [2] < 0) continue;
auto& sh = *rock.shape;

View File

@ -136,4 +136,6 @@ bool ads_draw_cell(cell *c, const shiftmatrix& V);
extern transmatrix Duality;
extern int use_duality;
ld spacetime_step = 0.1;
int spacetime_qty = 30;
}}