ray:: in VR raycasting, raycast_map is called just once per frame

This commit is contained in:
Zeno Rogue 2021-03-09 14:09:58 +01:00
parent 04472e513d
commit 91f7b2696f
1 changed files with 4 additions and 1 deletions

View File

@ -1425,6 +1425,8 @@ transmatrix get_ms(cell *c, int a, bool mirror) {
int nesting; int nesting;
struct raycast_map { struct raycast_map {
int saved_frameid;
vector<cell*> lst; vector<cell*> lst;
map<cell*, int> ids; map<cell*, int> ids;
@ -1636,6 +1638,7 @@ struct raycast_map {
} }
void create_all(cell *cs) { void create_all(cell *cs) {
saved_frameid = frameid;
generate_initial_ms(cs); generate_initial_ms(cs);
generate_cell_listing(cs); generate_cell_listing(cs);
apply_shape(); apply_shape();
@ -1643,7 +1646,7 @@ struct raycast_map {
} }
bool need_to_create(cell *cs) { bool need_to_create(cell *cs) {
if(!fixed_map) return true; if(!fixed_map && frameid != saved_frameid) return true;
return !ids.count(cs); return !ids.count(cs);
} }
}; };