Add bvhactive flag to visual/global. Fixes #1279.

PiperOrigin-RevId: 599778272
Change-Id: If5530629035cc68b198447503388f59a04041b13
This commit is contained in:
Yuval Tassa
2024-01-19 02:59:06 -08:00
committed by Copybara-Service
parent 2feefbc5d2
commit fea7c10b95
18 changed files with 147 additions and 44 deletions
+7 -1
View File
@@ -627,6 +627,7 @@ int mju_raySlab(const mjtNum aabb[6], const mjtNum xpos[3],
// ray vs tree intersection
mjtNum mju_rayTree(const mjModel* m, const mjData* d, int id, const mjtNum* pnt,
const mjtNum* vec) {
int mark_active = m->vis.global.bvactive;
const int meshid = m->geom_dataid[id];
const int bvhadr = m->mesh_bvhadr[meshid];
const int* faceid = m->bvh_nodeid + bvhadr;
@@ -701,12 +702,17 @@ mjtNum mju_rayTree(const mjModel* m, const mjData* d, int id, const mjtNum* pnt,
// update
if (sol >= 0 && (x < 0 || sol < x)) {
x = sol;
if (mark_active) {
d->bvh_active[node + bvhadr] = 1;
}
}
continue;
}
// used for rendering
d->bvh_active[node + bvhadr] = 1;
if (mark_active) {
d->bvh_active[node + bvhadr] = 1;
}
// add children to the stack
for (int i=0; i < 2; i++) {