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) {
+12
View File
@@ -0,0 +1,12 @@
<mujoco>
<asset>
<texture name="texture1" type="2d" file="hfield.png"/>
</asset>
<worldbody>
<light name="light1" type="spot" pos="1 2 3" dir="0 0 1" diffuse="0.1 0.2 0.3" ambient="0.4 0.5 0.6" specular="0.7 0.8 0.95"/>
<light name="light2" type="spot" attenuation="0.1 0.2 0.3" cutoff="0.4" exponent="0.5"/>
<light name="light3" type="point" range="2" intensity="300" bulbradius="0.5"/>
<light name="light4" type="directional" dir="1 0 0" active="false" castshadow="false"/>
<light name="light5" type="image" texture="texture1"/>
</worldbody>
</mujoco>