Move BVH active visualization flag reset after early return check in MuJoCo collision driver.
This avoids unnecessarily resetting the bvh_active flags when the collision driver returns early due to disabled constraints, disabled contacts, or having fewer than two bodies/flexes. PiperOrigin-RevId: 959531283 Change-Id: I85caf054b06e3be1018d710f9ab762627fc3356a
This commit is contained in:
committed by
Copybara-Service
parent
f9a00bd5b5
commit
1362a8bded
@@ -599,17 +599,17 @@ void mj_collision(const mjModel* m, mjData* d) {
|
||||
resetArena(d);
|
||||
mj_clearEfc(d);
|
||||
|
||||
// reset the visualization flags
|
||||
if (m->vis.global.bvactive) {
|
||||
memset(d->bvh_active, 0, m->nbvh);
|
||||
}
|
||||
|
||||
// return if disabled
|
||||
if (mjDISABLED(mjDSBL_CONSTRAINT) || mjDISABLED(mjDSBL_CONTACT) || nbodyflex < 2) {
|
||||
TM_END1(mjTIMER_POS_COLLISION);
|
||||
return;
|
||||
}
|
||||
|
||||
// reset the visualization flags
|
||||
if (m->vis.global.bvactive) {
|
||||
memset(d->bvh_active, 0, m->nbvh);
|
||||
}
|
||||
|
||||
mj_markStack(d);
|
||||
|
||||
// broadphase collision detector
|
||||
|
||||
@@ -144,7 +144,7 @@ void mj_defaultVisual(mjVisual* vis) {
|
||||
vis->global.offheight = 480;
|
||||
vis->global.realtime = 1.0;
|
||||
vis->global.ellipsoidinertia = 0;
|
||||
vis->global.bvactive = 1;
|
||||
vis->global.bvactive = 0;
|
||||
|
||||
// rendering quality
|
||||
vis->quality.shadowsize = 4096;
|
||||
|
||||
@@ -1193,7 +1193,7 @@
|
||||
</xs:simpleType>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="ellipsoidinertia" type="kw_bool" default="false"/>
|
||||
<xs:attribute name="bvactive" type="kw_bool" default="true"/>
|
||||
<xs:attribute name="bvactive" type="kw_bool" default="false"/>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="quality">
|
||||
|
||||
@@ -122,7 +122,7 @@ static const mjXDefaultEntry kDefaults_mjVisual_global[] = {
|
||||
{"offheight", (int)offsetof(mjVisual, global.offheight), 2, 1, 1, 0, {480.0}},
|
||||
{"realtime", (int)offsetof(mjVisual, global.realtime), 1, 1, 1, 0, {1.0}},
|
||||
{"ellipsoidinertia", (int)offsetof(mjVisual, global.ellipsoidinertia), 2, 1, 1, 0, {0}},
|
||||
{"bvactive", (int)offsetof(mjVisual, global.bvactive), 2, 1, 1, 0, {1}},
|
||||
{"bvactive", (int)offsetof(mjVisual, global.bvactive), 2, 1, 1, 0, {0}},
|
||||
};
|
||||
|
||||
static const mjXDefaultEntry kDefaults_mjVisual_headlight[] = {
|
||||
|
||||
+1
-1
@@ -687,7 +687,7 @@ element global : mjVisual (field=global) {
|
||||
offheight : int = 480
|
||||
realtime : float = 1 (positive)
|
||||
ellipsoidinertia : bool = false
|
||||
bvactive : bool = true
|
||||
bvactive : bool = false
|
||||
}
|
||||
|
||||
element quality : mjVisual (field=quality) {
|
||||
|
||||
Reference in New Issue
Block a user