Rename mesh_assetpathadr to mesh_pathadr and move it to the end of the mesh section.

PiperOrigin-RevId: 568911603
Change-Id: I8f21c3d1cc9c73b6a95292a50f262b1a199d0898
This commit is contained in:
Saran Tunyasuvunakool
2023-09-27 11:31:26 -07:00
committed by Copybara-Service
parent 0dfeedb320
commit 8ed321d469
9 changed files with 19 additions and 19 deletions
+2 -2
View File
@@ -1046,7 +1046,6 @@ 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)
@@ -1054,6 +1053,7 @@ struct mjModel_ {
int* mesh_facenormal; // normal face data (nmeshface x 3)
int* mesh_facetexcoord; // texture face data (nmeshface x 3)
int* mesh_graph; // convex graph data (nmeshgraph x 1)
int* mesh_pathadr; // address of asset path for mesh; -1: none (nmesh x 1)
// skins
int* skin_matid; // skin material id; -1: none (nskin x 1)
@@ -2068,7 +2068,7 @@ struct mjvSceneState_ {
int* mesh_bvhnum;
int* mesh_texcoordadr;
int* mesh_graphadr;
int* mesh_assetpathadr;
int* mesh_pathadr;
int* skin_matid;
int* skin_group;
+1 -1
View File
@@ -778,7 +778,6 @@ 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)
@@ -786,6 +785,7 @@ struct mjModel_ {
int* mesh_facenormal; // normal face data (nmeshface x 3)
int* mesh_facetexcoord; // texture face data (nmeshface x 3)
int* mesh_graph; // convex graph data (nmeshgraph x 1)
int* mesh_pathadr; // address of asset path for mesh; -1: none (nmesh x 1)
// skins
int* skin_matid; // skin material id; -1: none (nskin x 1)
+1 -1
View File
@@ -469,7 +469,7 @@ struct mjvSceneState_ {
int* mesh_bvhnum;
int* mesh_texcoordadr;
int* mesh_graphadr;
int* mesh_assetpathadr;
int* mesh_pathadr;
int* skin_matid;
int* skin_group;
+1 -1
View File
@@ -299,7 +299,6 @@
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 ) \
@@ -307,6 +306,7 @@
X ( int, mesh_facenormal, nmeshface, 3 ) \
X ( int, mesh_facetexcoord, nmeshface, 3 ) \
X ( int, mesh_graph, nmeshgraph, 1 ) \
XMJV( int, mesh_pathadr, nmesh, 1 ) \
XMJV( int, skin_matid, nskin, 1 ) \
XMJV( int, skin_group, nskin, 1 ) \
XMJV( float, skin_rgba, nskin, 4 ) \
+8 -8
View File
@@ -2123,13 +2123,6 @@ STRUCTS: Mapping[str, StructDecl] = dict([
),
doc='rotation applied to asset vertices (nmesh x 4)',
),
StructFieldDecl(
name='mesh_assetpathadr',
type=PointerType(
inner_type=ValueType(name='int'),
),
doc='address of asset path for mesh; -1: none (nmesh x 1)',
),
StructFieldDecl(
name='mesh_vert',
type=PointerType(
@@ -2179,6 +2172,13 @@ STRUCTS: Mapping[str, StructDecl] = dict([
),
doc='convex graph data (nmeshgraph x 1)', # pylint: disable=line-too-long
),
StructFieldDecl(
name='mesh_pathadr',
type=PointerType(
inner_type=ValueType(name='int'),
),
doc='address of asset path for mesh; -1: none (nmesh x 1)',
),
StructFieldDecl(
name='skin_matid',
type=PointerType(
@@ -5977,7 +5977,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
doc='',
),
StructFieldDecl(
name='mesh_assetpathadr',
name='mesh_pathadr',
type=PointerType(
inner_type=ValueType(name='int'),
),
+1 -1
View File
@@ -1867,7 +1867,7 @@ const char* mj_validateReferences(const mjModel* m) {
X(name_textadr, ntext, nnames , 0 ) \
X(name_tupleadr, ntuple, nnames , 0 ) \
X(name_keyadr, nkey, nnames , 0 ) \
X(mesh_assetpathadr, nmesh, npaths , 0 )
X(mesh_pathadr, nmesh, npaths , 0 )
#define X(adrarray, nadrs, ntarget, numarray) { \
int *nums = (numarray); \
+2 -2
View File
@@ -1332,10 +1332,10 @@ void mjCModel::CopyPaths(mjModel* m) {
for (unsigned int i=0; i<meshes.size(); i++) {
if (meshes[i]->file().empty()) {
m->mesh_assetpathadr[i] = -1;
m->mesh_pathadr[i] = -1;
continue;
}
m->mesh_assetpathadr[i] = adr;
m->mesh_pathadr[i] = adr;
// copy path
size_t path_size = meshes[i]->file().size();
+1 -1
View File
@@ -377,7 +377,7 @@ TEST_F(MjCMeshTest, SaveMeshOnce) {
mjModel* model = mj_loadXML(xml_path.c_str(), 0, error.data(), error.size());
// Confirm the mesh file is loaded and stored in paths
EXPECT_EQ(
std::string(&model->paths[model->mesh_assetpathadr[0]]), "cube.obj");
std::string(&model->paths[model->mesh_pathadr[0]]), "cube.obj");
std::string saved_xml = SaveAndReadXml(model);
EXPECT_THAT(saved_xml, Not(testing::HasSubstr("vertex")));
mj_deleteModel(model);
+2 -2
View File
@@ -5250,7 +5250,6 @@ public unsafe struct mjModel_ {
public int* mesh_graphadr;
public double* mesh_pos;
public double* mesh_quat;
public int* mesh_assetpathadr;
public float* mesh_vert;
public float* mesh_normal;
public float* mesh_texcoord;
@@ -5258,6 +5257,7 @@ public unsafe struct mjModel_ {
public int* mesh_facenormal;
public int* mesh_facetexcoord;
public int* mesh_graph;
public int* mesh_pathadr;
public int* skin_matid;
public int* skin_group;
public float* skin_rgba;
@@ -6006,7 +6006,7 @@ public unsafe struct model {
public int* mesh_bvhnum;
public int* mesh_texcoordadr;
public int* mesh_graphadr;
public int* mesh_assetpathadr;
public int* mesh_pathadr;
public int* skin_matid;
public int* skin_group;
public float* skin_rgba;