mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-24 07:56:59 +00:00
3D drawing
This commit is contained in:
parent
49f0c248bd
commit
d5fc277531
@ -100,8 +100,8 @@ EX shiftmatrix minimize_point_value(shiftmatrix T, function<ld(const shiftmatrix
|
||||
ld best = value(T);
|
||||
|
||||
for(int it=0; it<50; it++)
|
||||
for(int s=0; s<4; s++) {
|
||||
shiftmatrix T1 = T * spin(s * quarter_circle) * xpush(pow(1.2, -it));
|
||||
for(int s=0; s<2*WDIM; s++) {
|
||||
shiftmatrix T1 = T * cpush(s/2, (s&1?1:-1) * pow(1.2, -it));
|
||||
ld dist = value(T1);
|
||||
if(dist < best) best = dist, T = T1;
|
||||
if(mdBandAny()) {
|
||||
@ -1111,8 +1111,11 @@ EX void apply_other_model(shiftpoint H_orig, hyperpoint& ret, eModel md) {
|
||||
d = sqrt(2*(1 - cos(d))) * M_PI / 2;
|
||||
else if(pmodel == mdEquiarea && hyperbolic)
|
||||
d = sqrt(2*(cosh(d) - 1)) / 1.5;
|
||||
|
||||
ld factor = d * df / rad;
|
||||
if(!vrhr::rendering()) factor /= M_PI;
|
||||
|
||||
ret = H * (d * df / rad / M_PI);
|
||||
ret = H * factor;
|
||||
if(GDIM == 2) ret[2] = 0;
|
||||
if(MAXMDIM == 4) ret[3] = 1;
|
||||
if(zlev != 1 && use_z_coordinate())
|
||||
|
@ -1584,7 +1584,7 @@ EX namespace mapeditor {
|
||||
}
|
||||
|
||||
EX shiftpoint find_mouseh3() {
|
||||
if(vrhr::active() && WDIM == 2)
|
||||
if(vrhr::active())
|
||||
return mouseh;
|
||||
if(front_config == eFront::sphere_camera)
|
||||
return in_front_dist(front_edit);
|
||||
|
17
vr.cpp
17
vr.cpp
@ -41,6 +41,8 @@ EX cell *forward_cell;
|
||||
|
||||
EX ld vraim_x, vraim_y, vrgo_x, vrgo_y;
|
||||
|
||||
EX ld pointer_length = 1;
|
||||
|
||||
vector<pair<string, string> > headset_desc = {
|
||||
{"none", "Ignore the headset movement and rotation."},
|
||||
{"rotation only", "Ignore the headset movement but do not ignore its rotation."},
|
||||
@ -472,9 +474,15 @@ ld vr_distance(shiftpoint h, int id, ld& dist) {
|
||||
|
||||
E4; hscr[3] = 1;
|
||||
hyperpoint hc = inverse(sm * hmd_at * vrdata.pose_matrix[id] * sm) * hmd_mv * hscr;
|
||||
if(hc[2] > 0.1) return 1e6; /* behind */
|
||||
dist = -hc[2];
|
||||
return sqhypot_d(2, hc);
|
||||
if(WDIM == 2) {
|
||||
if(hc[2] > 0.1) return 1e6; /* behind */
|
||||
dist = -hc[2];
|
||||
return sqhypot_d(2, hc);
|
||||
}
|
||||
else {
|
||||
hc[2] += dist;
|
||||
return sqhypot_d(3, hc);
|
||||
}
|
||||
}
|
||||
|
||||
EX hyperpoint vr_direction;
|
||||
@ -489,8 +497,9 @@ EX void compute_point(int id, shiftpoint& res, cell*& c, ld& dist) {
|
||||
movedir md = vectodir(vr_direction);
|
||||
cellwalker xc = cwt + md.d + wstep;
|
||||
forward_cell = xc.at;
|
||||
return;
|
||||
}
|
||||
|
||||
dist = pointer_length;
|
||||
|
||||
gen_mv();
|
||||
set_vr_sphere();
|
||||
|
Loading…
Reference in New Issue
Block a user