Skip to content

Commit

Permalink
Merge pull request #2390 from talregev:TalR/mesh
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 723916727
Change-Id: I0abb0a12121c9eb291ccbc6afa0b4117bd389956
  • Loading branch information
copybara-github committed Feb 6, 2025
2 parents dec7b66 + fd568d6 commit cb1696e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/user/user_mesh.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
#include "user/user_objects.h"
#include "user/user_resource.h"
#include "user/user_util.h"
#include <tiny_obj_loader.h>

extern "C" {
#include "qhull_ra.h"
Expand Down Expand Up @@ -395,7 +394,7 @@ void mjCMesh::CacheMesh(mjCCache* cache, const mjResource* resource,
+ (sizeof(int) * vertex_index_.size())
+ (sizeof(int) * normal_index_.size())
+ (sizeof(int) * texcoord_index_.size())
+ (sizeof(unsigned char) * num_face_vertices_.size());
+ (sizeof(face_vertices_type) * num_face_vertices_.size());

std::shared_ptr<const void> cached_data(mesh, +[](const void* data) {
const mjCMesh* mesh = static_cast<const mjCMesh*>(data);
Expand Down
6 changes: 5 additions & 1 deletion src/user/user_objects.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
#include <mujoco/mjspec.h>
#include "user/user_cache.h"
#include "user/user_util.h"
#include <tiny_obj_loader.h>

using face_vertices_type =
decltype(tinyobj::mesh_t::num_face_vertices)::value_type;

// forward declarations of all mjC/X classes
class mjCError;
Expand Down Expand Up @@ -1010,7 +1014,7 @@ class mjCMesh: public mjCMesh_, private mjsMesh {
std::vector<int> vertex_index_;
std::vector<int> normal_index_;
std::vector<int> texcoord_index_;
std::vector<unsigned char> num_face_vertices_;
std::vector<face_vertices_type> num_face_vertices_;

// compute the volume and center-of-mass of the mesh given the face center
void ComputeVolume(double CoM[3], mjtGeomInertia gtype, const double facecen[3]);
Expand Down

0 comments on commit cb1696e

Please sign in to comment.