Copy texture coordinates from OBJ into flex. Fixes #2464.

PiperOrigin-RevId: 732109960
Change-Id: I506b3540ab5d489ce8f10d0c473919611ccb654a
This commit is contained in:
Alessio Quaglino
2025-02-28 06:03:11 -08:00
committed by Copybara-Service
parent 06e217df7e
commit 7651cb1b33
19 changed files with 117 additions and 15 deletions
+6
View File
@@ -413,6 +413,7 @@ bool mjCFlexcomp::Make(mjsBody* body, char* error, int error_sz) {
mjs_setString(pf->name, name.c_str());
mjs_setInt(pf->elem, element.data(), element.size());
mjs_setFloat(pf->texcoord, texcoord.data(), texcoord.size());
mjs_setInt(pf->facetexcoord, facetexcoord.data(), facetexcoord.size());
if (!centered) {
mjs_setDouble(pf->vert, point.data(), point.size());
}
@@ -1055,6 +1056,11 @@ bool mjCFlexcomp::MakeMesh(mjCModel* model, char* error, int error_sz) {
point[i] = (double) mesh.Vert(i);
}
if (mesh.HasTexcoord()) {
texcoord = mesh.Texcoord();
facetexcoord = mesh.FaceTexcoord();
}
// copy faces or create 3D mesh
if (def.spec.flex->dim == 2) {
element = mesh.Face();