Fix bug in material texrepeat attribute, fixes #2223.

Was mistakenly cast from float to int, bug introduced in 3.2.0

PiperOrigin-RevId: 697993181
Change-Id: I643a07e2b0866a4af56d7cbd3344e764a7caf56f
This commit is contained in:
Yuval Tassa
2024-11-19 06:29:49 -08:00
committed by Copybara-Service
parent 072039ac60
commit 5c23ae11ef
6 changed files with 26 additions and 24 deletions
+3 -3
View File
@@ -1304,7 +1304,7 @@ static void makeMaterial(const mjModel* m, mjrContext* con) {
}
if (m->nmat >= mjMAXMATERIAL-1) {
mju_error("Maximum number of materials is 100, got %d", m->nmat);
mju_error("Maximum number of materials is %d, got %d", mjMAXMATERIAL, m->nmat);
}
for (int i=0; i < m->nmat; i++) {
if (m->mat_texid[i*mjNTEXROLE + mjTEXROLE_RGB] >= 0) {
@@ -1320,8 +1320,8 @@ static void makeMaterial(const mjModel* m, mjrContext* con) {
for (int i=0; i < m->ntex; i++) {
if (m->tex_type[i] == mjTEXTURE_SKYBOX) {
if (m->nmat >= mjMAXMATERIAL-2) {
mju_error("With skybox, maximum number of materials is 99, got %d",
m->nmat);
mju_error("With skybox, maximum number of materials is %d, got %d",
mjMAXMATERIAL-1, m->nmat);
}
for (int j=0; j < mjNTEXROLE; j++) {
con->mat_texid[mjNTEXROLE * (mjMAXMATERIAL-1) + j] = -1;