Refactor user cache to just support void pointers so user objects can be cached whole.

PiperOrigin-RevId: 651307384
Change-Id: I92c058a900727070235d00b6d2165c29fd12e7b0
This commit is contained in:
Kyle Bayes
2024-07-11 01:00:26 -07:00
committed by Copybara-Service
parent c145b79f6e
commit f9ab89b205
6 changed files with 372 additions and 664 deletions
+10 -1
View File
@@ -846,7 +846,10 @@ class mjCMesh: public mjCMesh_, private mjsMesh {
private:
void LoadOBJ(mjResource* resource); // load mesh in wavefront OBJ format
bool LoadCachedOBJ(const mjCAsset& asset); // load OBJ from cache asset, return true on success
// load OBJ from cache asset, return true on success
bool LoadCachedOBJ(mjCCache *cache, const mjResource* resource);
// put OBJ into asset cache
void CacheOBJ(mjCCache *cache, const mjResource* resource);
void LoadSTL(mjResource* resource); // load mesh in STL BIN format
void LoadMSH(mjResource* resource); // load mesh in MSH BIN format
void LoadSDF(); // generate mesh using marching cubes
@@ -864,6 +867,12 @@ class mjCMesh: public mjCMesh_, private mjsMesh {
double* center_; // face circumcenter data (3*nface)
int* graph_; // convex graph data
// for caching purposes
std::vector<int> vertex_index_;
std::vector<int> normal_index_;
std::vector<int> texcoord_index_;
std::vector<unsigned char> num_face_vertices_;
// compute the volume and center-of-mass of the mesh given the face center
void ComputeVolume(double CoM[3], mjtGeomInertia type, const double facecen[3],
bool exactmeshinertia);