Add texture attribute to lights.

PiperOrigin-RevId: 763739805
Change-Id: I333ed2ac68f30f79f688ca01d7b5fd6bf2d836c9
This commit is contained in:
Google DeepMind
2025-05-27 05:03:04 -07:00
committed by Copybara-Service
parent 441ca838a1
commit 568620dd2f
18 changed files with 106 additions and 4 deletions
+23
View File
@@ -2294,6 +2294,29 @@ TEST_F(UserObjectsTest, FrameTransformsLight) {
mj_deleteModel(m);
}
TEST_F(ContentTypeTest, ImageLightsReferenceTexture) {
static constexpr char xml[] = R"(
<mujoco>
<asset>
<texture name="texture" type="cube" builtin="flat" mark="cross" width="8"
rgb1="0.8 0.6 0.4" rgb2="0.8 0.6 0.4" markrgb="1 1 1"/>
</asset>
<worldbody>
<light type="image" texture="texture"/>
</worldbody>
</mujoco>
)";
std::array<char, 1024> error;
mjModel* m = LoadModelFromString(xml, error.data(), error.size());
EXPECT_THAT(m, NotNull());
EXPECT_EQ(m->ntex, 1);
EXPECT_EQ(m->nlight, 1);
EXPECT_THAT(m->light_texid[0], 0);
mj_deleteModel(m);
}
// ------------- test bvh ------------------------------------------------------
TEST_F(UserObjectsTest, RobustBVH) {