Add realtime parameter to visual global.

PiperOrigin-RevId: 478775714
Change-Id: Ic2d178a5c57d298d005215219ce8470392c4651b
This commit is contained in:
Alessio Quaglino
2022-10-04 07:08:21 -07:00
committed by Copybara-Service
parent f85cfb8ed2
commit bc1490b7a8
10 changed files with 29 additions and 3 deletions
+1
View File
@@ -160,6 +160,7 @@ void mj_defaultVisual(mjVisual* vis) {
vis->global.glow = 0.3;
vis->global.offwidth = 640;
vis->global.offheight = 480;
vis->global.realtime = 1.0;
// rendering quality
vis->quality.shadowsize = 4096;
+6 -2
View File
@@ -109,8 +109,8 @@ static const char* MJCF[nMJCF][mjXATTRNUM] = {
{"visual", "*", "0"},
{"<"},
{"global", "?", "8", "fovy", "ipd", "azimuth", "elevation", "linewidth", "glow", "offwidth",
"offheight"},
{"global", "?", "9", "fovy", "ipd", "azimuth", "elevation", "linewidth", "glow", "offwidth",
"offheight", "realtime"},
{"quality", "?", "5", "shadowsize", "offsamples", "numslices", "numstacks",
"numquads"},
{"headlight", "?", "4", "ambient", "diffuse", "specular", "active"},
@@ -2172,6 +2172,10 @@ void mjXReader::Visual(XMLElement* section) {
ReadAttr(elem, "glow", 1, &vis->global.glow, text);
ReadAttrInt(elem, "offwidth", &vis->global.offwidth);
ReadAttrInt(elem, "offheight", &vis->global.offheight);
if (ReadAttr(elem, "realtime", 1, &vis->global.realtime, text))
if (vis->global.realtime<=0) {
throw mjXError(elem, "realtime must be greater than 0");
}
}
// quality sub-element
+1
View File
@@ -868,6 +868,7 @@ void mjXWriter::Visual(XMLElement* root) {
WriteAttr(elem, "elevation", 1, &vis->global.elevation, &visdef.global.elevation);
WriteAttr(elem, "linewidth", 1, &vis->global.linewidth, &visdef.global.linewidth);
WriteAttr(elem, "glow", 1, &vis->global.glow, &visdef.global.glow);
WriteAttr(elem, "realtime", 1, &vis->global.realtime, &visdef.global.realtime);
WriteAttrInt(elem, "offwidth", vis->global.offwidth, visdef.global.offwidth);
WriteAttrInt(elem, "offheight", vis->global.offheight, visdef.global.offheight);
if (!elem->FirstAttribute()) {