Add light radius attribute.

Also fix bug: light defaults were not being saved.

PiperOrigin-RevId: 625142278
Change-Id: I8ec3a5a06e9f314e98b7c34346db3c24b34d7e0b
This commit is contained in:
Yuval Tassa
2024-04-15 17:54:05 -07:00
committed by Copybara-Service
parent 683929ab34
commit 0cd28d2423
14 changed files with 135 additions and 48 deletions
+24
View File
@@ -1868,5 +1868,29 @@ TEST_F(XMLReaderTest, ExtentNegativeNotAllowed) {
EXPECT_THAT(error.data(), HasSubstr("line 3"));
}
TEST_F(XMLReaderTest, LightRadius) {
static constexpr char xml[] = R"(
<mujoco>
<default>
<default class="r1">
<light radius="1"/>
</default>
</default>
<worldbody>
<light/>
<light class="r1"/>
<light class="r1" radius="2"/>
</worldbody>
</mujoco>
)";
std::array<char, 1024> error;
mjModel* model = LoadModelFromString(xml, error.data(), error.size());
ASSERT_THAT(model, NotNull()) << error.data();
EXPECT_EQ(model->light_radius[0], 0);
EXPECT_EQ(model->light_radius[1], 1);
EXPECT_EQ(model->light_radius[2], 2);
mj_deleteModel(model);
}
} // namespace
} // namespace mujoco