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
+3 -6
View File
@@ -496,7 +496,7 @@ static void collideBVH(const mjModel* m, mjData* d, int g,
const int* faceid = m->bvh_nodeid + bvhadr;
const mjtNum* bvh = m->bvh_aabb + 6*bvhadr;
const int* child = m->bvh_child + 2*bvhadr;
mjtByte* visited = d->bvh_active + bvhadr;
mjtByte* bvh_active = m->vis.global.bvactive ? d->bvh_active + bvhadr : NULL;
mj_markStack(d);
// TODO(quaglino): Store bvh max depths to make this bound tighter.
@@ -521,9 +521,6 @@ static void collideBVH(const mjModel* m, mjData* d, int g,
// node1 is a leaf
if (faceid[node] != -1) {
if (visited[node]) {
continue;
}
if (boxIntersect(bvh+6*node, offset, rotation, m, sdf, d)) {
faces[*npoints] = faceid[node];
if (++(*npoints) == MAXSDFFACE) {
@@ -531,7 +528,7 @@ static void collideBVH(const mjModel* m, mjData* d, int g,
mj_freeStack(d);
return;
}
visited[node] = 1;
if (bvh_active) bvh_active[node] = 1;
}
continue;
}
@@ -541,7 +538,7 @@ static void collideBVH(const mjModel* m, mjData* d, int g,
continue;
}
visited[node] = 1;
if (bvh_active) bvh_active[node] = 1;
// recursive call
for (int i=0; i < 2; i++) {