Add mjv_copyModel to copy mjModel, skipping large arrays not required for abstract visualization.
This functionality is meant for fast copying of `mjModel` when synchronizing the visualization state, as in the Python passive viewer. PiperOrigin-RevId: 699199743 Change-Id: I13a5160063eb09139ec1aee9c4969bc1c6f547f1
This commit is contained in:
committed by
Copybara-Service
parent
74dcd51d83
commit
1d64362adc
@@ -378,13 +378,13 @@
|
||||
X ( mjtNum, mesh_scale, nmesh, 3 ) \
|
||||
X ( mjtNum, mesh_pos, nmesh, 3 ) \
|
||||
X ( mjtNum, mesh_quat, nmesh, 4 ) \
|
||||
X ( float, mesh_vert, nmeshvert, 3 ) \
|
||||
X ( float, mesh_normal, nmeshnormal, 3 ) \
|
||||
X ( float, mesh_texcoord, nmeshtexcoord, 2 ) \
|
||||
X ( int, mesh_face, nmeshface, 3 ) \
|
||||
X ( int, mesh_facenormal, nmeshface, 3 ) \
|
||||
X ( int, mesh_facetexcoord, nmeshface, 3 ) \
|
||||
X ( int, mesh_graph, nmeshgraph, 1 ) \
|
||||
XNV ( float, mesh_vert, nmeshvert, 3 ) \
|
||||
XNV ( float, mesh_normal, nmeshnormal, 3 ) \
|
||||
XNV ( float, mesh_texcoord, nmeshtexcoord, 2 ) \
|
||||
XNV ( int, mesh_face, nmeshface, 3 ) \
|
||||
XNV ( int, mesh_facenormal, nmeshface, 3 ) \
|
||||
XNV ( int, mesh_facetexcoord, nmeshface, 3 ) \
|
||||
XNV ( int, mesh_graph, nmeshgraph, 1 ) \
|
||||
XMJV( int, mesh_pathadr, nmesh, 1 ) \
|
||||
XMJV( int, skin_matid, nskin, 1 ) \
|
||||
XMJV( int, skin_group, nskin, 1 ) \
|
||||
@@ -412,14 +412,14 @@
|
||||
X ( int, hfield_nrow, nhfield, 1 ) \
|
||||
X ( int, hfield_ncol, nhfield, 1 ) \
|
||||
X ( int, hfield_adr, nhfield, 1 ) \
|
||||
X ( float, hfield_data, nhfielddata, 1 ) \
|
||||
XNV ( float, hfield_data, nhfielddata, 1 ) \
|
||||
XMJV( int, hfield_pathadr, nhfield, 1 ) \
|
||||
X ( int, tex_type, ntex, 1 ) \
|
||||
X ( int, tex_height, ntex, 1 ) \
|
||||
X ( int, tex_width, ntex, 1 ) \
|
||||
X ( int, tex_nchannel, ntex, 1 ) \
|
||||
X ( int, tex_adr, ntex, 1 ) \
|
||||
X ( mjtByte, tex_data, ntexdata, 1 ) \
|
||||
XNV ( mjtByte, tex_data, ntexdata, 1 ) \
|
||||
XMJV( int, tex_pathadr, ntex, 1 ) \
|
||||
XMJV( int, mat_texid, nmat, mjNTEXROLE ) \
|
||||
XMJV( mjtByte, mat_texuniform, nmat, 1 ) \
|
||||
@@ -779,4 +779,9 @@
|
||||
// redefine X to expand to nothing, and XMJV to do what's required
|
||||
#define XMJV X
|
||||
|
||||
// alias XNV to be the same as X
|
||||
// to obtain only X macros for fields that are relevant for mjvScene creation,
|
||||
// redefine XNV to expand to nothing
|
||||
#define XNV X
|
||||
|
||||
#endif // MUJOCO_MJXMACRO_H_
|
||||
|
||||
@@ -692,6 +692,9 @@ MJAPI int mjv_updateSceneFromState(const mjvSceneState* scnstate, const mjvOptio
|
||||
const mjvPerturb* pert, mjvCamera* cam, int catmask,
|
||||
mjvScene* scn);
|
||||
|
||||
// Copy mjModel, skip large arrays not required for abstract visualization.
|
||||
MJAPI void mjv_copyModel(mjModel* dest, const mjModel* src);
|
||||
|
||||
// Set default scene state.
|
||||
MJAPI void mjv_defaultSceneState(mjvSceneState* scnstate);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user