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:
committed by
Copybara-Service
parent
8a8a44a4db
commit
796173170c
@@ -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)
|
||||
|
||||
@@ -115,9 +115,9 @@ struct mjrContext_ { // custom OpenGL context
|
||||
unsigned int auxColor_r[mjNAUX]; // auxiliary color buffer for resolving
|
||||
|
||||
// materials with textures
|
||||
int mat_texid[mjMAXMATERIAL*mjNTEXMAT]; // 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]; // texture repetition for 2d mapping
|
||||
int mat_texrepeat[mjMAXMATERIAL*2]; // texture repetition for 2d mapping
|
||||
|
||||
// texture objects and info
|
||||
int ntexture; // number of allocated textures
|
||||
|
||||
@@ -414,7 +414,7 @@
|
||||
X ( int, tex_adr, ntex, 1 ) \
|
||||
X ( mjtByte, tex_data, ntexdata, 1 ) \
|
||||
XMJV( int, tex_pathadr, ntex, 1 ) \
|
||||
XMJV( int, mat_texid, nmat, mjNTEXMAT ) \
|
||||
XMJV( int, mat_texid, nmat, mjNTEXROLE ) \
|
||||
XMJV( mjtByte, mat_texuniform, nmat, 1 ) \
|
||||
XMJV( float, mat_texrepeat, nmat, 2 ) \
|
||||
XMJV( float, mat_emission, nmat, 1 ) \
|
||||
|
||||
Reference in New Issue
Block a user