Add built-in sphere mesh.
PiperOrigin-RevId: 791162850 Change-Id: I573a414727e79f1a495e0f2282b2faff48ab3443
This commit is contained in:
committed by
Copybara-Service
parent
5220767457
commit
996f0040fd
@@ -7,6 +7,7 @@
|
||||
</visual>
|
||||
|
||||
<asset>
|
||||
<mesh name="sphere" builtin="sphere" params="3" scale=".08 .08 .08"/>
|
||||
<texture type="skybox" builtin="gradient" rgb1="0.3 0.5 0.7" rgb2="0 0 0" width="64" height="64"/>
|
||||
<texture name="texplane" type="2d" builtin="checker" rgb1=".2 .3 .4" rgb2=".1 0.15 0.2" width="512" height="512" mark="cross" markrgb=".8 .8 .8"/>
|
||||
<material name="matplane" reflectance="0.3" texture="texplane" texrepeat="1 1" texuniform="true"/>
|
||||
@@ -38,8 +39,4 @@
|
||||
</replicate>
|
||||
</replicate>
|
||||
</worldbody>
|
||||
|
||||
<asset>
|
||||
<mesh name="sphere" builtin="wedge" params="25 25 180 90 0" scale=".08 .08 .08"/>
|
||||
</asset>
|
||||
</mujoco>
|
||||
|
||||
Vendored
+3
-1
@@ -1,5 +1,6 @@
|
||||
<mujoco model="makemesh">
|
||||
<asset>
|
||||
<mesh name="sphere" builtin="sphere" params="2" scale=".8 .8 .8"/>
|
||||
<mesh name="hemisphere" builtin="hemisphere" params="4" scale=".8 .8 .8"/>
|
||||
<mesh name="wedge" builtin="wedge" params="10 10 60 60 0"/>
|
||||
<mesh name="prism3" builtin="cone" params="3 1" scale=".3 .3 .3"/>
|
||||
@@ -10,7 +11,8 @@
|
||||
|
||||
<worldbody>
|
||||
<light pos="0 0 10"/>
|
||||
<geom mesh="hemisphere" type="mesh" pos="-2 0 0"/>
|
||||
<geom mesh="sphere" type="mesh" pos="-3 0 0"/>
|
||||
<geom mesh="hemisphere" type="mesh" pos="-1 0 0"/>
|
||||
<geom mesh="wedge" type="mesh" euler="90 -90 0"/>
|
||||
<geom mesh="prism5" type="mesh" pos="2 0 0" euler="90 0 0"/>
|
||||
<geom mesh="prism3" type="mesh" pos="3 0 0"/>
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
// Tests for user/user_objects.cc.
|
||||
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
@@ -732,7 +733,6 @@ TEST_F(MjCMeshTest, VolumeTooSmall) {
|
||||
EXPECT_THAT(model, testing::IsNull());
|
||||
EXPECT_THAT(error.data(), HasSubstr("mesh volume is too small"));
|
||||
mj_deleteModel(model);
|
||||
|
||||
}
|
||||
|
||||
TEST_F(MjCMeshTest, VisualVolumeTooSmall) {
|
||||
@@ -760,7 +760,6 @@ TEST_F(MjCMeshTest, VisualVolumeTooSmall) {
|
||||
EXPECT_THAT(model, testing::IsNull());
|
||||
EXPECT_THAT(error.data(), HasSubstr("mesh volume is too small"));
|
||||
mj_deleteModel(model);
|
||||
|
||||
}
|
||||
|
||||
TEST_F(MjCMeshTest, VisualVolumeSmallAllowedShell) {
|
||||
@@ -1310,5 +1309,27 @@ TEST_F(MjCMeshTest, HemisphereSizes) {
|
||||
mj_deleteModel(model);
|
||||
}
|
||||
|
||||
TEST_F(MjCMeshTest, SphereSizes) {
|
||||
static constexpr char xml[] = R"(
|
||||
<mujoco model="makemesh">
|
||||
<asset>
|
||||
<mesh name="h0" builtin="sphere" params="0"/>
|
||||
<mesh name="h1" builtin="sphere" params="1"/>
|
||||
<mesh name="h2" builtin="sphere" params="2"/>
|
||||
</asset>
|
||||
</mujoco>
|
||||
)";
|
||||
std::array<char, 1024> error;
|
||||
mjModel* model = LoadModelFromString(xml, error.data(), error.size());
|
||||
ASSERT_THAT(model, NotNull()) << error.data();
|
||||
EXPECT_EQ(model->mesh_vertnum[0], 2 + 10 * std::pow(4, 0));
|
||||
EXPECT_EQ(model->mesh_vertnum[1], 2 + 10 * std::pow(4, 1));
|
||||
EXPECT_EQ(model->mesh_vertnum[2], 2 + 10 * std::pow(4, 2));
|
||||
EXPECT_EQ(model->mesh_facenum[0], 20 * std::pow(4, 0));
|
||||
EXPECT_EQ(model->mesh_facenum[1], 20 * std::pow(4, 1));
|
||||
EXPECT_EQ(model->mesh_facenum[2], 20 * std::pow(4, 2));
|
||||
mj_deleteModel(model);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace mujoco
|
||||
|
||||
Reference in New Issue
Block a user