Make default class members private.

PiperOrigin-RevId: 634288934
Change-Id: I1b7a5ec8dd51c65377b09bcb85c56a849573cac7
This commit is contained in:
Kyle Bayes
2024-05-16 03:21:17 -07:00
committed by Copybara-Service
parent 6e58cedb47
commit e885a3dc3d
9 changed files with 362 additions and 346 deletions
+2 -2
View File
@@ -429,7 +429,7 @@ mjsPlugin* mjs_addPlugin(mjSpec* s) {
// add default to model
mjsDefault* mjs_addDefault(mjSpec* s, const char* classname, int parentid, int* id) {
mjCModel* modelC = static_cast<mjCModel*>(s->element);
*id = (int)modelC->Defaults().size();
*id = (int)modelC->NumDefaults();
mjCDef* def = modelC->AddDefault(classname, parentid);
if (def) {
return &def->spec;
@@ -469,7 +469,7 @@ mjsDefault* mjs_findDefault(mjSpec* s, const char* classname) {
// get default[0] from model
mjsDefault* mjs_getSpecDefault(mjSpec* s) {
mjCModel* modelC = static_cast<mjCModel*>(s->element);
mjCDef* def = modelC->Defaults()[0];
mjCDef* def = modelC->Defaults(0);
if (!def) {
return nullptr;
}
+13 -13
View File
@@ -561,7 +561,7 @@ bool mjCComposite::MakeParticle(mjCModel* model, mjsBody* body, char* error, int
// create tendon
mjsTendon* ten = mjs_addTendon(&model->spec, &def[mjCOMPKIND_TENDON].spec);
mjs_setDefault(ten->element, &model->Defaults()[0]->spec);
mjs_setDefault(ten->element, &model->Defaults(0)->spec);
mjs_setString(ten->name, txt0);
ten->group = 4;
mjs_wrapSite(ten, txt1);
@@ -569,7 +569,7 @@ bool mjCComposite::MakeParticle(mjCModel* model, mjsBody* body, char* error, int
// add equality constraint
mjsEquality* eq = mjs_addEquality(&model->spec, &def[mjCOMPKIND_TENDON].spec);
mjs_setDefault(eq->element, &model->Defaults()[0]->spec);
mjs_setDefault(eq->element, &model->Defaults(0)->spec);
eq->type = mjEQ_TENDON;
mjs_setString(eq->name1, mjs_getString(ten->name));
}
@@ -675,7 +675,7 @@ bool mjCComposite::MakeGrid(mjCModel* model, mjsBody* body, char* error, int err
// create tendon
mjCTendon* ten = model->AddTendon(def + mjCOMPKIND_TENDON);
ten->def = model->Defaults()[0];
ten->def = model->Defaults(0);
mju::sprintf_arr(txt, "%sT%d_%d_%d", prefix.c_str(), i, ix, iy);
ten->name = txt;
ten->WrapSite(txt1);
@@ -683,7 +683,7 @@ bool mjCComposite::MakeGrid(mjCModel* model, mjsBody* body, char* error, int err
// add equality constraint
mjsEquality* eq = mjs_addEquality(&model->spec, &def[mjCOMPKIND_TENDON].spec);
mjs_setDefault(eq->element, &model->Defaults()[0]->spec);
mjs_setDefault(eq->element, &model->Defaults(0)->spec);
eq->type = mjEQ_TENDON;
mjs_setString(eq->name1, ten->name.c_str());
}
@@ -1045,7 +1045,7 @@ mjsBody* mjCComposite::AddRopeBody(mjCModel* model, mjsBody* body, int ix, int i
// add constraint
mjsEquality* eq = mjs_addEquality(&model->spec, &def[mjCOMPKIND_TWIST].spec);
mjs_setDefault(eq->element, &model->Defaults()[0]->spec);
mjs_setDefault(eq->element, &model->Defaults(0)->spec);
eq->type = mjEQ_JOINT;
mjs_setString(eq->name1, mjs_getString(jnt->name));
}
@@ -1063,7 +1063,7 @@ mjsBody* mjCComposite::AddRopeBody(mjCModel* model, mjsBody* body, int ix, int i
// add constraint
mjsEquality* eq = mjs_addEquality(&model->spec, &def[mjCOMPKIND_STRETCH].spec);
mjs_setDefault(eq->element, &model->Defaults()[0]->spec);
mjs_setDefault(eq->element, &model->Defaults(0)->spec);
eq->type = mjEQ_JOINT;
mjs_setString(eq->name1, mjs_getString(jnt->name));
}
@@ -1131,7 +1131,7 @@ bool mjCComposite::MakeBox(mjCModel* model, mjsBody* body, char* error, int erro
// fixed tendon for all joints
mjCTendon* ten = model->AddTendon(def + mjCOMPKIND_TENDON);
ten->def = model->Defaults()[0];
ten->def = model->Defaults(0);
mju::sprintf_arr(txt, "%sT", prefix.c_str());
ten->name = txt;
@@ -1184,7 +1184,7 @@ bool mjCComposite::MakeBox(mjCModel* model, mjsBody* body, char* error, int erro
// add fix constraint
mjsEquality* eq = mjs_addEquality(&model->spec, &def[mjCOMPKIND_JOINT].spec);
mjs_setDefault(eq->element, &model->Defaults()[0]->spec);
mjs_setDefault(eq->element, &model->Defaults(0)->spec);
eq->type = mjEQ_JOINT;
mjs_setString(eq->name1, mjs_getString(jnt->name));
@@ -1218,7 +1218,7 @@ bool mjCComposite::MakeBox(mjCModel* model, mjsBody* body, char* error, int erro
// finalize fixed tendon
mjsEquality* eqt = mjs_addEquality(&model->spec, &def[mjCOMPKIND_TENDON].spec);
mjs_setDefault(eqt->element, &model->Defaults()[0]->spec);
mjs_setDefault(eqt->element, &model->Defaults(0)->spec);
eqt->type = mjEQ_TENDON;
mjs_setString(eqt->name1, ten->name.c_str());
@@ -1244,7 +1244,7 @@ void mjCComposite::MakeShear(mjCModel* model) {
// create tendon
mjCTendon* ten = model->AddTendon(def + mjCOMPKIND_SHEAR);
ten->def = model->Defaults()[0];
ten->def = model->Defaults(0);
ten->WrapSite(txt1);
ten->WrapSite(txt2);
@@ -1254,7 +1254,7 @@ void mjCComposite::MakeShear(mjCModel* model) {
// equality constraint
mjsEquality* eq = mjs_addEquality(&model->spec, &def[mjCOMPKIND_SHEAR].spec);
mjs_setDefault(eq->element, &model->Defaults()[0]->spec);
mjs_setDefault(eq->element, &model->Defaults(0)->spec);
eq->type = mjEQ_TENDON;
mjs_setString(eq->name1, txt);
}
@@ -1552,11 +1552,11 @@ void mjCComposite::MakeCableBonesSubgrid(mjCModel* model, mjsSkin* skin) {
// bind pose
if (iy==0) {
bindpos.push_back((ix==count[0]-1) ? -2*def[0].spec.geom->size[0] : 0);
bindpos.push_back(-def[0].geom.spec.size[1]);
bindpos.push_back(-def[0].Geom().spec.size[1]);
bindpos.push_back(0);
} else if (iy==2) {
bindpos.push_back((ix==count[0]-1) ? -2*def[0].spec.geom->size[0] : 0);
bindpos.push_back(def[0].geom.spec.size[1]);
bindpos.push_back(def[0].Geom().spec.size[1]);
bindpos.push_back(0);
} else {
bindpos.push_back((ix==count[0]-1) ? -2*def[0].spec.geom->size[0] : 0);
+3 -3
View File
@@ -400,7 +400,7 @@ bool mjCFlexcomp::Make(mjSpec* spec, mjsBody* body, char* error, int error_sz) {
mjsFlex* pf = &flex->spec;
int id = flex->id;
*flex = def.flex;
*flex = def.Flex();
flex->PointToLocal();
flex->model = model;
@@ -521,7 +521,7 @@ bool mjCFlexcomp::Make(mjSpec* spec, mjsBody* body, char* error, int error_sz) {
// create edge equality constraint
if (equality) {
mjsEquality* pe = mjs_addEquality(&model->spec, &def.spec);
mjs_setDefault(pe->element, &model->Defaults()[0]->spec);
mjs_setDefault(pe->element, &model->Defaults(0)->spec);
pe->type = mjEQ_FLEX;
pe->active = true;
mjs_setString(pe->name1, name.c_str());
@@ -544,7 +544,7 @@ int mjCFlexcomp::GridID(int ix, int iy, int iz) {
// make grid
bool mjCFlexcomp::MakeGrid(char* error, int error_sz) {
int dim = def.flex.spec.dim;
int dim = def.Flex().spec.dim;
bool hastex = texcoord.empty();
// 1D
+4 -4
View File
@@ -146,12 +146,12 @@ mjCMesh::mjCMesh(mjCModel* _model, mjCDef* _def) {
// reset to default if given
if (_def) {
*this = _def->mesh;
*this = _def->Mesh();
}
// set model, def
model = _model;
def = (_def ? _def : (_model ? _model->Defaults()[0] : 0));
def = (_def ? _def : (_model ? _model->Defaults(0) : 0));
// in case this body is not compiled
CopyFromSpec();
@@ -1426,7 +1426,7 @@ void mjCMesh::Process() {
// apply formula, accumulate
GetVolumeRef(type) += vol;
for (int j=0; j<6; j++) {
P[j] += def->geom.density*vol /
P[j] += def->Geom().density*vol /
(type==mjINERTIA_SHELL ? 12 : 20) * (
2*(D[k[j][0]] * D[k[j][1]] +
E[k[j][0]] * E[k[j][1]] +
@@ -1467,7 +1467,7 @@ void mjCMesh::Process() {
}
// compute sizes of equivalent inertia box
double mass = GetVolumeRef(type) * def->geom.density;
double mass = GetVolumeRef(type) * def->Geom().density;
double* boxsz = GetInertiaBoxPtr(type);
boxsz[0] = sqrt(6*(eigval[1]+eigval[2]-eigval[0])/mass)/2;
boxsz[1] = sqrt(6*(eigval[0]+eigval[2]-eigval[1])/mass)/2;
+2 -1
View File
@@ -222,7 +222,8 @@ class mjCModel : public mjCModel_, private mjSpec {
std::string get_meshdir() const { return meshdir_; }
std::string get_texturedir() const { return texturedir_; }
const std::vector<mjCDef*>& Defaults() const { return defaults_; }
mjCDef* Defaults(int i) const { return defaults_[i]; }
int NumDefaults() const { return defaults_.size(); }
const std::vector<std::pair<const mjpPlugin*, int>>& ActivePlugins() const {
return active_plugins_;
+93 -94
View File
@@ -557,22 +557,22 @@ int mjCBoundingVolumeHierarchy::MakeBVH(
//------------------------- class mjCDef implementation --------------------------------------------
// constructor
mjCDef::mjCDef(void) {
mjCDef::mjCDef() {
name.clear();
parentid = -1;
childid.clear();
mjs_defaultJoint(&joint.spec);
mjs_defaultGeom(&geom.spec);
mjs_defaultSite(&site.spec);
mjs_defaultCamera(&camera.spec);
mjs_defaultLight(&light.spec);
mjs_defaultFlex(&flex.spec);
mjs_defaultMesh(&mesh.spec);
mjs_defaultMaterial(&material.spec);
mjs_defaultPair(&pair.spec);
mjs_defaultEquality(&equality.spec);
mjs_defaultTendon(&tendon.spec);
mjs_defaultActuator(&actuator.spec);
mjs_defaultJoint(&joint_.spec);
mjs_defaultGeom(&geom_.spec);
mjs_defaultSite(&site_.spec);
mjs_defaultCamera(&camera_.spec);
mjs_defaultLight(&light_.spec);
mjs_defaultFlex(&flex_.spec);
mjs_defaultMesh(&mesh_.spec);
mjs_defaultMaterial(&material_.spec);
mjs_defaultPair(&pair_.spec);
mjs_defaultEquality(&equality_.spec);
mjs_defaultTendon(&tendon_.spec);
mjs_defaultActuator(&actuator_.spec);
// make sure all the pointers are local
PointToLocal();
@@ -592,12 +592,12 @@ void mjCDef::Compile(const mjCModel* model) {
CopyFromSpec();
// enforce length of all default userdata arrays
joint.userdata_.resize(model->nuser_jnt);
geom.userdata_.resize(model->nuser_geom);
site.userdata_.resize(model->nuser_site);
camera.userdata_.resize(model->nuser_cam);
tendon.userdata_.resize(model->nuser_tendon);
actuator.userdata_.resize(model->nuser_actuator);
joint_.userdata_.resize(model->nuser_jnt);
geom_.userdata_.resize(model->nuser_geom);
site_.userdata_.resize(model->nuser_site);
camera_.userdata_.resize(model->nuser_cam);
tendon_.userdata_.resize(model->nuser_tendon);
actuator_.userdata_.resize(model->nuser_actuator);
}
@@ -608,18 +608,18 @@ mjCDef& mjCDef::operator=(const mjCDef& other) {
name = other.name;
parentid = other.parentid;
childid = other.childid;
joint = other.joint;
geom = other.geom;
site = other.site;
camera = other.camera;
light = other.light;
flex = other.flex;
mesh = other.mesh;
material = other.material;
pair = other.pair;
equality = other.equality;
tendon = other.tendon;
actuator = other.actuator;
joint_ = other.joint_;
geom_ = other.geom_;
site_ = other.site_;
camera_ = other.camera_;
light_ = other.light_;
flex_ = other.flex_;
mesh_ = other.mesh_;
material_ = other.material_;
pair_ = other.pair_;
equality_ = other.equality_;
tendon_ = other.tendon_;
actuator_ = other.actuator_;
}
PointToLocal();
return *this;
@@ -628,49 +628,49 @@ mjCDef& mjCDef::operator=(const mjCDef& other) {
void mjCDef::PointToLocal() {
joint.PointToLocal();
geom.PointToLocal();
site.PointToLocal();
camera.PointToLocal();
light.PointToLocal();
flex.PointToLocal();
mesh.PointToLocal();
material.PointToLocal();
pair.PointToLocal();
equality.PointToLocal();
tendon.PointToLocal();
actuator.PointToLocal();
joint_.PointToLocal();
geom_.PointToLocal();
site_.PointToLocal();
camera_.PointToLocal();
light_.PointToLocal();
flex_.PointToLocal();
mesh_.PointToLocal();
material_.PointToLocal();
pair_.PointToLocal();
equality_.PointToLocal();
tendon_.PointToLocal();
actuator_.PointToLocal();
spec.element = static_cast<mjElement*>(this);
spec.name = (mjString)&name;
spec.joint = &joint.spec;
spec.geom = &geom.spec;
spec.site = &site.spec;
spec.camera = &camera.spec;
spec.light = &light.spec;
spec.flex = &flex.spec;
spec.mesh = &mesh.spec;
spec.material = &material.spec;
spec.pair = &pair.spec;
spec.equality = &equality.spec;
spec.tendon = &tendon.spec;
spec.actuator = &actuator.spec;
spec.joint = &joint_.spec;
spec.geom = &geom_.spec;
spec.site = &site_.spec;
spec.camera = &camera_.spec;
spec.light = &light_.spec;
spec.flex = &flex_.spec;
spec.mesh = &mesh_.spec;
spec.material = &material_.spec;
spec.pair = &pair_.spec;
spec.equality = &equality_.spec;
spec.tendon = &tendon_.spec;
spec.actuator = &actuator_.spec;
}
void mjCDef::CopyFromSpec() {
joint.CopyFromSpec();
geom.CopyFromSpec();
site.CopyFromSpec();
camera.CopyFromSpec();
light.CopyFromSpec();
flex.CopyFromSpec();
mesh.CopyFromSpec();
material.CopyFromSpec();
pair.CopyFromSpec();
equality.CopyFromSpec();
tendon.CopyFromSpec();
actuator.CopyFromSpec();
joint_.CopyFromSpec();
geom_.CopyFromSpec();
site_.CopyFromSpec();
camera_.CopyFromSpec();
light_.CopyFromSpec();
flex_.CopyFromSpec();
mesh_.CopyFromSpec();
material_.CopyFromSpec();
pair_.CopyFromSpec();
equality_.CopyFromSpec();
tendon_.CopyFromSpec();
actuator_.CopyFromSpec();
}
@@ -1674,12 +1674,12 @@ mjCJoint::mjCJoint(mjCModel* _model, mjCDef* _def) {
// reset to default if given
if (_def) {
*this = _def->joint;
*this = _def->Joint();
}
// set model, def
model = _model;
def = (_def ? _def : (_model ? _model->Defaults()[0] : 0));
def = (_def ? _def : (_model ? _model->Defaults(0) : 0));
// point to local
PointToLocal();
@@ -1878,12 +1878,12 @@ mjCGeom::mjCGeom(mjCModel* _model, mjCDef* _def) {
// reset to default if given
if (_def) {
*this = _def->geom;
*this = _def->Geom();
}
// set model, def
model = _model;
def = (_def ? _def : (_model ? _model->Defaults()[0] : 0));
def = (_def ? _def : (_model ? _model->Defaults(0) : 0));
// point to local
PointToLocal();
@@ -1964,7 +1964,7 @@ void mjCGeom::NameSpace(const mjCModel* m) {
// compute geom volume
double mjCGeom::GetVolume(void) {
double mjCGeom::GetVolume() const {
double height;
// get from mesh
@@ -2512,7 +2512,7 @@ mjCSite::mjCSite(mjCModel* _model, mjCDef* _def) {
// reset to default if given
if (_def) {
*this = _def->site;
*this = _def->Site();
}
// point to local
@@ -2523,7 +2523,7 @@ mjCSite::mjCSite(mjCModel* _model, mjCDef* _def) {
// set model, def
model = _model;
def = (_def ? _def : (_model ? _model->Defaults()[0] : 0));
def = (_def ? _def : (_model ? _model->Defaults(0) : 0));
}
@@ -2664,12 +2664,12 @@ mjCCamera::mjCCamera(mjCModel* _model, mjCDef* _def) {
// reset to default if given
if (_def) {
*this = _def->camera;
*this = _def->Camera();
}
// set model, def
model = _model;
def = (_def ? _def : (_model ? _model->Defaults()[0] : 0));
def = (_def ? _def : (_model ? _model->Defaults(0) : 0));
// point to local
PointToLocal();
@@ -2818,12 +2818,12 @@ mjCLight::mjCLight(mjCModel* _model, mjCDef* _def) {
// reset to default if given
if (_def) {
*this = _def->light;
*this = _def->Light();
}
// set model, def
model = _model;
def = (_def ? _def : (_model ? _model->Defaults()[0] : 0));
def = (_def ? _def : (_model ? _model->Defaults(0) : 0));
PointToLocal();
CopyFromSpec();
@@ -3855,12 +3855,12 @@ mjCMaterial::mjCMaterial(mjCModel* _model, mjCDef* _def) {
// reset to default if given
if (_def) {
*this = _def->material;
*this = _def->Material();
}
// set model, def
model = _model;
def = (_def ? _def : (_model ? _model->Defaults()[0] : 0));
def = (_def ? _def : (_model ? _model->Defaults(0) : 0));
// point to local
PointToLocal();
@@ -3943,12 +3943,12 @@ mjCPair::mjCPair(mjCModel* _model, mjCDef* _def) {
// reset to default if given
if (_def) {
*this = _def->pair;
*this = _def->Pair();
}
// set model, def
model = _model;
def = (_def ? _def : (_model ? _model->Defaults()[0] : 0));
def = (_def ? _def : (_model ? _model->Defaults(0) : 0));
// point to local
PointToLocal();
@@ -4304,12 +4304,12 @@ mjCEquality::mjCEquality(mjCModel* _model, mjCDef* _def) {
// reset to default if given
if (_def) {
*this = _def->equality;
*this = _def->Equality();
}
// set model, def
model = _model;
def = (_def ? _def : (_model ? _model->Defaults()[0] : 0));
def = (_def ? _def : (_model ? _model->Defaults(0) : 0));
// point to local
PointToLocal();
@@ -4466,12 +4466,12 @@ mjCTendon::mjCTendon(mjCModel* _model, mjCDef* _def) {
// reset to default if given
if (_def) {
*this = _def->tendon;
*this = _def->Tendon();
}
// set model, def
model = _model;
def = (_def ? _def : (_model ? _model->Defaults()[0] : 0));
def = (_def ? _def : (_model ? _model->Defaults(0) : 0));
// point to local
PointToLocal();
@@ -4629,19 +4629,18 @@ void mjCTendon::WrapPulley(double divisor, std::string_view info) {
// get number of wraps
int mjCTendon::NumWraps(void) {
int mjCTendon::NumWraps() const {
return (int)path.size();
}
// get pointer to specified wrap
mjCWrap* mjCTendon::GetWrap(int id) {
if (id>=0 && id<(int)path.size()) {
return path[id];
} else {
return 0;
const mjCWrap* mjCTendon::GetWrap(int i) const {
if (i >= 0 && i < (int)path.size()) {
return path[i];
}
return nullptr;
}
@@ -4945,12 +4944,12 @@ mjCActuator::mjCActuator(mjCModel* _model, mjCDef* _def) {
// reset to default if given
if (_def) {
*this = _def->actuator;
*this = _def->Actuator();
}
// set model, def
model = _model;
def = (_def ? _def : (_model ? _model->Defaults()[0] : 0));
def = (_def ? _def : (_model ? _model->Defaults(0) : 0));
// in case this actuator is not compiled
CopyFromSpec();
+72 -56
View File
@@ -413,8 +413,8 @@ class mjCJoint : public mjCJoint_, private mjsJoint {
void CopyFromSpec(void);
// used by mjXWriter and mjCModel
const std::vector<double>& get_userdata() { return userdata_; }
const double* get_range() { return range; }
const std::vector<double>& get_userdata() const { return userdata_; }
const double* get_range() const { return range; }
bool is_limited() const;
bool is_actfrclimited() const;
@@ -475,7 +475,7 @@ class mjCGeom : public mjCGeom_, private mjsGeom {
using mjCBase::name;
mjsGeom spec; // variables set by user
double GetVolume(void); // compute geom volume
double GetVolume() const; // compute geom volume
void SetInertia(void); // compute and set geom inertia
bool IsVisual(void) const { return visual_; }
void SetNotVisual(void) { visual_ = false; }
@@ -489,10 +489,10 @@ class mjCGeom : public mjCGeom_, private mjsGeom {
void SetBoundingVolume(mjCBoundingVolume* bv) const;
// used by mjXWriter and mjCModel
const std::vector<double>& get_userdata() { return userdata_; }
const std::string& get_hfieldname() { return spec_hfieldname_; }
const std::string& get_meshname() { return spec_meshname_; }
const std::string& get_material() { return spec_material_; }
const std::vector<double>& get_userdata() const { return userdata_; }
const std::string& get_hfieldname() const { return spec_hfieldname_; }
const std::string& get_meshname() const { return spec_meshname_; }
const std::string& get_material() const { return spec_material_; }
void del_material() { spec_material_.clear(); }
private:
@@ -546,8 +546,8 @@ class mjCSite : public mjCSite_, private mjsSite {
using mjCBase::info;
// used by mjXWriter and mjCModel
const std::vector<double>& get_userdata() { return userdata_; }
const std::string& get_material() { return material_; }
const std::vector<double>& get_userdata() const { return userdata_; }
const std::string& get_material() const { return material_; }
void del_material() { material_.clear(); }
private:
@@ -589,8 +589,8 @@ class mjCCamera : public mjCCamera_, private mjsCamera {
using mjCBase::info;
// used by mjXWriter and mjCModel
const std::string& get_targetbody() { return targetbody_; }
const std::vector<double>& get_userdata() { return userdata_; }
const std::string& get_targetbody() const { return targetbody_; }
const std::vector<double>& get_userdata() const { return userdata_; }
private:
void Compile(void); // compiler
@@ -629,7 +629,7 @@ class mjCLight : public mjCLight_, private mjsLight {
using mjCBase::info;
// used by mjXWriter and mjCModel
const std::string& get_targetbody() { return targetbody_; }
const std::string& get_targetbody() const { return targetbody_; }
private:
void Compile(void); // compiler
@@ -697,12 +697,12 @@ class mjCFlex: public mjCFlex_, private mjsFlex {
void NameSpace(const mjCModel* m);
// used by mjXWriter and mjCModel
const std::string& get_material() { return material_; }
const std::vector<std::string>& get_vertbody() { return vertbody_; }
const std::vector<double>& get_vert() { return vert_; }
const std::vector<double>& get_elemaabb() { return elemaabb_; }
const std::vector<int>& get_elem() { return elem_; }
const std::vector<float>& get_texcoord() { return texcoord_; }
const std::string& get_material() const { return material_; }
const std::vector<std::string>& get_vertbody() const { return vertbody_; }
const std::vector<double>& get_vert() const { return vert_; }
const std::vector<double>& get_elemaabb() const { return elemaabb_; }
const std::vector<int>& get_elem() const { return elem_; }
const std::vector<float>& get_texcoord() const { return texcoord_; }
bool HasTexcoord() const; // texcoord not null
void DelTexcoord(); // delete texcoord
@@ -921,16 +921,16 @@ class mjCSkin: public mjCSkin_, private mjsSkin {
using mjCBase::classname;
using mjCBase::info;
std::string get_file() const { return file_; }
std::string& get_material() { return material_; }
std::vector<float>& get_vert() { return vert_; }
std::vector<float>& get_texcoord() { return texcoord_; }
std::vector<int>& get_face() { return face_; }
std::vector<std::string>& get_bodyname() { return bodyname_; }
std::vector<float>& get_bindpos() { return bindpos_; }
std::vector<float>& get_bindquat() { return bindquat_; }
std::vector<std::vector<int>>& get_vertid() { return vertid_; }
std::vector<std::vector<float>>& get_vertweight() { return vertweight_; }
const std::string& get_file() const { return file_; }
const std::string& get_material() const { return material_; }
const std::vector<float>& get_vert() const { return vert_; }
const std::vector<float>& get_texcoord() const { return texcoord_; }
const std::vector<int>& get_face() const { return face_; }
const std::vector<std::string>& get_bodyname() const { return bodyname_; }
const std::vector<float>& get_bindpos() const { return bindpos_; }
const std::vector<float>& get_bindquat() const { return bindquat_; }
const std::vector<std::vector<int>>& get_vertid() const { return vertid_; }
const std::vector<std::vector<float>>& get_vertweight() const { return vertweight_; }
void del_material() { material_.clear(); }
void CopyFromSpec();
@@ -1082,7 +1082,7 @@ class mjCMaterial : public mjCMaterial_, private mjsMaterial {
void PointToLocal();
void NameSpace(const mjCModel* m);
std::string get_texture() { return texture_; }
const std::string& get_texture() const { return texture_; }
void del_texture() { texture_.clear(); }
private:
@@ -1124,8 +1124,8 @@ class mjCPair : public mjCPair_, private mjsPair {
void ResolveReferences(const mjCModel* m);
void NameSpace(const mjCModel* m);
std::string get_geomname1() { return geomname1_; }
std::string get_geomname2() { return geomname2_; }
const std::string& get_geomname1() const { return geomname1_; }
const std::string& get_geomname2() const { return geomname2_; }
int GetSignature(void) {
return signature;
@@ -1258,7 +1258,7 @@ class mjCTendon : public mjCTendon_, private mjsTendon {
using mjCBase::info;
void set_material(std::string _material) { material_ = _material; }
std::string& get_material() { return material_; }
const std::string& get_material() const { return material_; }
void del_material() { material_.clear(); }
// API for adding wrapping objects
@@ -1268,12 +1268,12 @@ class mjCTendon : public mjCTendon_, private mjsTendon {
void WrapPulley(double divisor, std::string_view info = ""); // pulley
// API for access to wrapping objects
int NumWraps(void); // number of wraps
mjCWrap* GetWrap(int); // pointer to wrap
int NumWraps() const; // number of wraps
const mjCWrap* GetWrap(int i) const; // pointer to wrap
std::vector<mjCWrap*> path; // wrapping objects
// used by mjXWriter and mjCModel
const std::vector<double>& get_userdata() { return userdata_; }
const std::vector<double>& get_userdata() const { return userdata_; }
const double* get_range() { return range; }
void CopyFromSpec();
@@ -1391,10 +1391,10 @@ class mjCActuator : public mjCActuator_, private mjsActuator {
using mjCBase::info;
// used by mjXWriter and mjCModel
const std::vector<double>& get_userdata() { return userdata_; }
const std::string& get_target() { return spec_target_; }
const std::string& get_slidersite() { return spec_slidersite_; }
const std::string& get_refsite() { return spec_refsite_; }
const std::vector<double>& get_userdata() const { return userdata_; }
const std::string& get_target() const { return spec_target_; }
const std::string& get_slidersite() const { return spec_slidersite_; }
const std::string& get_refsite() const { return spec_refsite_; }
bool is_ctrllimited() const;
bool is_forcelimited() const;
@@ -1615,13 +1615,29 @@ class mjCDef : public mjElement {
friend class mjXWriter;
public:
mjCDef(void); // constructor
mjCDef(const mjCDef& other); // copy constructor
void Compile(const mjCModel* model); // compiler
mjCDef& operator=(const mjCDef& other); // copy assignment
mjCDef();
mjCDef(const mjCDef& other);
mjCDef& operator=(const mjCDef& other);
void PointToLocal(void);
void CopyFromSpec(void);
void Compile(const mjCModel* model);
// accessors
mjCJoint& Joint() { return joint_; }
mjCGeom& Geom() { return geom_; }
mjCSite& Site() { return site_; }
mjCCamera& Camera() { return camera_; }
mjCLight& Light() { return light_; }
mjCFlex& Flex() { return flex_; }
mjCMesh& Mesh() { return mesh_; }
mjCMaterial& Material() { return material_; }
mjCPair& Pair() { return pair_; }
mjCEquality& Equality() { return equality_; }
mjCTendon& Tendon() { return tendon_; }
mjCActuator& Actuator() { return actuator_; }
// identifiers
std::string name; // class name
int parentid; // id of parent class
@@ -1629,19 +1645,19 @@ class mjCDef : public mjElement {
mjsDefault spec;
// default objects (TODO: they should become private)
mjCJoint joint;
mjCGeom geom;
mjCSite site;
mjCCamera camera;
mjCLight light;
mjCFlex flex;
mjCMesh mesh;
mjCMaterial material;
mjCPair pair;
mjCEquality equality;
mjCTendon tendon;
mjCActuator actuator;
private:
mjCJoint joint_;
mjCGeom geom_;
mjCSite site_;
mjCCamera camera_;
mjCLight light_;
mjCFlex flex_;
mjCMesh mesh_;
mjCMaterial material_;
mjCPair pair_;
mjCEquality equality_;
mjCTendon tendon_;
mjCActuator actuator_;
};
#endif // MUJOCO_SRC_USER_USER_OBJECTS_H_