Add support in mjModel for tagging textures with different roles, and use the slot index of a texture to designate its role.

PiperOrigin-RevId: 654030065
Change-Id: I34a5b132a7f91a6bb8f260500c1b9c128a03b596
This commit is contained in:
Tom Erez
2024-07-19 09:28:34 -07:00
committed by Copybara-Service
parent 8a8a44a4db
commit 796173170c
14 changed files with 99 additions and 27 deletions
+16 -2
View File
@@ -42,7 +42,6 @@
#define mjNIMP 5 // number of solver impedance parameters
#define mjNSOLVER 200 // size of one mjData.solver array
#define mjNISLAND 20 // number of mjData.solver arrays
#define mjNTEXMAT 6 // number of textures per material
//---------------------------------- enum types (mjt) ----------------------------------------------
@@ -133,6 +132,21 @@ typedef enum mjtTexture_ { // type of texture
} mjtTexture;
typedef enum mjtTextureRole_ { // role of texture map in rendering
mjTEXROLE_USER = 0, // unspecified
mjTEXROLE_RGB, // base color (albedo)
mjTEXROLE_OCCLUSION, // ambient occlusion
mjTEXROLE_ROUGHNESS, // roughness
mjTEXROLE_METALLIC, // metallic
mjTEXROLE_NORMAL, // normal (bump) map
mjTEXROLE_OPACITY, // transperancy
mjTEXROLE_EMISSIVE, // light emission
mjTEXROLE_RGBA, // base color, opacity
mjTEXROLE_ORM, // occlusion, roughness, metallic
mjNTEXROLE
} mjtTextureRole;
typedef enum mjtIntegrator_ { // integrator mode
mjINT_EULER = 0, // semi-implicit Euler
mjINT_RK4, // 4th-order Runge Kutta
@@ -930,7 +944,7 @@ struct mjModel_ {
int* tex_pathadr; // address of texture asset path; -1: none (ntex x 1)
// materials
int* mat_texid; // indices of textures; -1: none (nmat x mjNTEXMAT)
int* mat_texid; // indices of textures; -1: none (nmat x mjNTEXROLE)
mjtByte* mat_texuniform; // make texture cube uniform (nmat x 1)
float* mat_texrepeat; // texture repetition for 2d mapping (nmat x 2)
float* mat_emission; // emission (x rgb) (nmat x 1)