Raise error if mesh has flipped faces.

PiperOrigin-RevId: 461860424
Change-Id: Ib23c50cf7f64de1173404d2f65ad87177fab45b3
This commit is contained in:
Alessio Quaglino
2022-07-19 05:47:08 -07:00
committed by Copybara-Service
parent e6480c76a9
commit 8dd9971409
6 changed files with 95 additions and 14 deletions
+7 -1
View File
@@ -34,6 +34,7 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <absl/container/flat_hash_set.h>
#include <absl/strings/match.h>
#include <mujoco/mjmodel.h>
#include <mujoco/mjtnum.h>
#include <mujoco/mjxmacro.h>
@@ -416,10 +417,15 @@ TEST_F(XMLWriterTest, WriteReadCompare) {
if (p.path().extension() == ext) {
std::string xml = p.path().string();
// if file is meant to fail, skip it
if (absl::StrContains(p.path().string(), "malformed_")) {
continue;
}
// load model
std::array<char, 1000> error;
mjModel* m = mj_loadXML(xml.c_str(), nullptr, error.data(), error.size());
ASSERT_THAT(m, NotNull()) << "Failed to load model: " << error.data();
ASSERT_THAT(m, NotNull()) << "Failed to load " << xml.c_str() << ": " << error.data();
// make data
mjData* d = mj_makeData(m);