Update XML parsing to store asset path so that assets can be recovered and sent to external renderers
PiperOrigin-RevId: 567347908 Change-Id: I4d8e1abe35be3a67643ff925af709921280856f8
This commit is contained in:
committed by
Copybara-Service
parent
4f34cacf35
commit
7f8018a3f3
@@ -593,6 +593,7 @@ struct mjModel_ {
|
||||
int nuser_sensor; // number of mjtNums in sensor_user
|
||||
int nnames; // number of chars in all names
|
||||
int nnames_map; // number of slots in the names hash map
|
||||
int npaths; // number of chars in all paths
|
||||
|
||||
// sizes set after mjModel construction (only affect mjData)
|
||||
int nM; // number of non-zeros in sparse inertia matrix
|
||||
@@ -777,6 +778,7 @@ struct mjModel_ {
|
||||
int* mesh_graphadr; // graph data address; -1: no graph (nmesh x 1)
|
||||
mjtNum* mesh_pos; // translation applied to asset vertices (nmesh x 3)
|
||||
mjtNum* mesh_quat; // rotation applied to asset vertices (nmesh x 4)
|
||||
int* mesh_assetpathadr; // address of asset path for mesh; -1: none (nmesh x 1)
|
||||
float* mesh_vert; // vertex positions for all meshes (nmeshvert x 3)
|
||||
float* mesh_normal; // normals for all meshes (nmeshnormal x 3)
|
||||
float* mesh_texcoord; // vertex texcoords for all meshes (nmeshtexcoord x 2)
|
||||
@@ -983,6 +985,9 @@ struct mjModel_ {
|
||||
int* name_pluginadr; // plugin instance name pointers (nplugin x 1)
|
||||
char* names; // names of all objects, 0-terminated (nnames x 1)
|
||||
int* names_map; // internal hash map of names (nnames_map x 1)
|
||||
|
||||
// paths
|
||||
char* paths; // paths to assets, 0-terminated (npaths x 1)
|
||||
};
|
||||
typedef struct mjModel_ mjModel;
|
||||
|
||||
|
||||
@@ -401,6 +401,7 @@ struct mjvSceneState_ {
|
||||
int nwrap;
|
||||
int nsensor;
|
||||
int nnames;
|
||||
int npaths;
|
||||
int nsensordata;
|
||||
|
||||
mjOption opt;
|
||||
@@ -468,6 +469,7 @@ struct mjvSceneState_ {
|
||||
int* mesh_bvhnum;
|
||||
int* mesh_texcoordadr;
|
||||
int* mesh_graphadr;
|
||||
int* mesh_assetpathadr;
|
||||
|
||||
int* skin_matid;
|
||||
int* skin_group;
|
||||
@@ -543,6 +545,7 @@ struct mjvSceneState_ {
|
||||
int* name_tendonadr;
|
||||
int* name_actuatoradr;
|
||||
char* names;
|
||||
char* paths;
|
||||
} model;
|
||||
|
||||
// fields in mjData that are necessary to re-render a scene
|
||||
|
||||
@@ -118,6 +118,7 @@
|
||||
X ( nuser_actuator ) \
|
||||
X ( nuser_sensor ) \
|
||||
XMJV( nnames ) \
|
||||
XMJV( npaths ) \
|
||||
X ( nnames_map ) \
|
||||
X ( nM ) \
|
||||
X ( nD ) \
|
||||
@@ -132,6 +133,8 @@
|
||||
X ( narena ) \
|
||||
X ( nbuffer )
|
||||
|
||||
/* nbuffer needs to be the final field */
|
||||
|
||||
|
||||
// define symbols needed in MJMODEL_POINTERS (corresponding to number of columns)
|
||||
#define MJMODEL_POINTERS_PREAMBLE( m ) \
|
||||
@@ -296,6 +299,7 @@
|
||||
XMJV( int, mesh_graphadr, nmesh, 1 ) \
|
||||
X ( mjtNum, mesh_pos, nmesh, 3 ) \
|
||||
X ( mjtNum, mesh_quat, nmesh, 4 ) \
|
||||
XMJV( int, mesh_assetpathadr, nmesh, 1 ) \
|
||||
X ( float, mesh_vert, nmeshvert, 3 ) \
|
||||
X ( float, mesh_normal, nmeshnormal, 3 ) \
|
||||
X ( float, mesh_texcoord, nmeshtexcoord, 2 ) \
|
||||
@@ -468,6 +472,7 @@
|
||||
X ( int, name_pluginadr, nplugin, 1 ) \
|
||||
XMJV( char, names, nnames, 1 ) \
|
||||
X ( int, names_map, nnames_map, 1 ) \
|
||||
XMJV( char, paths, npaths, 1 ) \
|
||||
|
||||
//-------------------------------- mjData ----------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user