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:
committed by
Copybara-Service
parent
072039ac60
commit
5c23ae11ef
@@ -13,6 +13,8 @@ MJX
|
||||
Bug fixes
|
||||
^^^^^^^^^
|
||||
- Fixed :github:issue:`2212`, type error in ``mjx.get_data``.
|
||||
- Fixed bug introduced in 3.2.0 in handling of :ref:`texrepeat<asset-material-texrepeat>` attribute, was mistakenly cast
|
||||
from ``float`` to ``int``, (fixed :github:issue:`2223`).
|
||||
|
||||
Version 3.2.5 (Nov 4, 2024)
|
||||
---------------------------
|
||||
|
||||
@@ -1582,14 +1582,14 @@ struct mjrContext_ { // custom OpenGL context
|
||||
unsigned int auxColor_r[mjNAUX]; // auxiliary color buffer for resolving
|
||||
|
||||
// materials with textures
|
||||
int mat_texid[mjMAXMATERIAL*mjNTEXROLE]; // material texture ids (-1: no texture)
|
||||
int mat_texuniform[mjMAXMATERIAL]; // texture repetition for 2d mapping
|
||||
int mat_texrepeat[mjMAXMATERIAL*2]; // texture repetition for 2d mapping
|
||||
int mat_texid[mjMAXMATERIAL*mjNTEXROLE]; // material texture ids (-1: no texture)
|
||||
int mat_texuniform[mjMAXMATERIAL]; // uniform cube mapping
|
||||
float mat_texrepeat[mjMAXMATERIAL*2]; // texture repetition for 2d mapping
|
||||
|
||||
// texture objects and info
|
||||
int ntexture; // number of allocated textures
|
||||
int textureType[mjMAXTEXTURE]; // type of texture (mjtTexture) (ntexture)
|
||||
unsigned int texture[mjMAXTEXTURE]; // texture names
|
||||
int ntexture; // number of allocated textures
|
||||
int textureType[mjMAXTEXTURE]; // type of texture (mjtTexture) (ntexture)
|
||||
unsigned int texture[mjMAXTEXTURE]; // texture names
|
||||
|
||||
// displaylist starting positions
|
||||
unsigned int basePlane; // all planes from model
|
||||
@@ -1628,13 +1628,13 @@ struct mjrContext_ { // custom OpenGL context
|
||||
int windowDoublebuffer; // is default/window framebuffer double buffered
|
||||
|
||||
// framebuffer
|
||||
int currentBuffer; // currently active framebuffer: mjFB_WINDOW or mjFB_OFFSCREEN
|
||||
int currentBuffer; // currently active framebuffer: mjFB_WINDOW or mjFB_OFFSCREEN
|
||||
|
||||
// pixel output format
|
||||
int readPixelFormat; // default color pixel format for mjr_readPixels
|
||||
int readPixelFormat; // default color pixel format for mjr_readPixels
|
||||
|
||||
// depth output format
|
||||
int readDepthMap; // depth mapping: mjDEPTH_ZERONEAR or mjDEPTH_ZEROFAR
|
||||
int readDepthMap; // depth mapping: mjDEPTH_ZERONEAR or mjDEPTH_ZEROFAR
|
||||
};
|
||||
typedef struct mjrContext_ mjrContext;
|
||||
typedef enum mjtGeomInertia_ { // type of inertia inference
|
||||
|
||||
@@ -115,14 +115,14 @@ struct mjrContext_ { // custom OpenGL context
|
||||
unsigned int auxColor_r[mjNAUX]; // auxiliary color buffer for resolving
|
||||
|
||||
// materials with textures
|
||||
int mat_texid[mjMAXMATERIAL*mjNTEXROLE]; // material texture ids (-1: no texture)
|
||||
int mat_texuniform[mjMAXMATERIAL]; // texture repetition for 2d mapping
|
||||
int mat_texrepeat[mjMAXMATERIAL*2]; // texture repetition for 2d mapping
|
||||
int mat_texid[mjMAXMATERIAL*mjNTEXROLE]; // material texture ids (-1: no texture)
|
||||
int mat_texuniform[mjMAXMATERIAL]; // uniform cube mapping
|
||||
float mat_texrepeat[mjMAXMATERIAL*2]; // texture repetition for 2d mapping
|
||||
|
||||
// texture objects and info
|
||||
int ntexture; // number of allocated textures
|
||||
int textureType[mjMAXTEXTURE]; // type of texture (mjtTexture) (ntexture)
|
||||
unsigned int texture[mjMAXTEXTURE]; // texture names
|
||||
int ntexture; // number of allocated textures
|
||||
int textureType[mjMAXTEXTURE]; // type of texture (mjtTexture) (ntexture)
|
||||
unsigned int texture[mjMAXTEXTURE]; // texture names
|
||||
|
||||
// displaylist starting positions
|
||||
unsigned int basePlane; // all planes from model
|
||||
@@ -161,13 +161,13 @@ struct mjrContext_ { // custom OpenGL context
|
||||
int windowDoublebuffer; // is default/window framebuffer double buffered
|
||||
|
||||
// framebuffer
|
||||
int currentBuffer; // currently active framebuffer: mjFB_WINDOW or mjFB_OFFSCREEN
|
||||
int currentBuffer; // currently active framebuffer: mjFB_WINDOW or mjFB_OFFSCREEN
|
||||
|
||||
// pixel output format
|
||||
int readPixelFormat; // default color pixel format for mjr_readPixels
|
||||
int readPixelFormat; // default color pixel format for mjr_readPixels
|
||||
|
||||
// depth output format
|
||||
int readDepthMap; // depth mapping: mjDEPTH_ZERONEAR or mjDEPTH_ZEROFAR
|
||||
int readDepthMap; // depth mapping: mjDEPTH_ZERONEAR or mjDEPTH_ZEROFAR
|
||||
};
|
||||
typedef struct mjrContext_ mjrContext;
|
||||
|
||||
|
||||
@@ -8596,12 +8596,12 @@ STRUCTS: Mapping[str, StructDecl] = dict([
|
||||
inner_type=ValueType(name='int'),
|
||||
extents=(1000,),
|
||||
),
|
||||
doc='texture repetition for 2d mapping',
|
||||
doc='uniform cube mapping',
|
||||
),
|
||||
StructFieldDecl(
|
||||
name='mat_texrepeat',
|
||||
type=ArrayType(
|
||||
inner_type=ValueType(name='int'),
|
||||
inner_type=ValueType(name='float'),
|
||||
extents=(2000,),
|
||||
),
|
||||
doc='texture repetition for 2d mapping',
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -5681,7 +5681,7 @@ public unsafe struct mjrContext_ {
|
||||
public fixed uint auxColor_r[10];
|
||||
public fixed int mat_texid[10000];
|
||||
public fixed int mat_texuniform[1000];
|
||||
public fixed int mat_texrepeat[2000];
|
||||
public fixed float mat_texrepeat[2000];
|
||||
public int ntexture;
|
||||
public fixed int textureType[1000];
|
||||
public fixed uint texture[1000];
|
||||
|
||||
Reference in New Issue
Block a user