33 #ifndef DART_DYNAMICS_MESHSHAPE_HPP_ 34 #define DART_DYNAMICS_MESHSHAPE_HPP_ 38 #include <assimp/scene.h> 40 #include "dart/common/ResourceRetriever.hpp" 41 #include "dart/dynamics/Shape.hpp" 81 const Eigen::Vector3d& scale,
84 common::ResourceRetrieverPtr resourceRetriever =
nullptr);
90 const std::string&
getType()
const override;
95 const aiScene* getMesh()
const;
105 const std::string& path =
"",
106 common::ResourceRetrieverPtr resourceRetriever =
nullptr);
111 common::ResourceRetrieverPtr resourceRetriever =
nullptr);
124 common::ResourceRetrieverPtr getResourceRetriever();
126 void setScale(
const Eigen::Vector3d& scale);
128 const Eigen::Vector3d& getScale()
const;
151 int getDisplayList()
const;
153 void setDisplayList(
int index);
155 static const aiScene* loadMesh(
const std::string& filePath);
157 static const aiScene* loadMesh(
158 const std::string& _uri,
const common::ResourceRetrieverPtr& retriever);
160 static const aiScene* loadMesh(
161 const common::Uri& uri,
const common::ResourceRetrieverPtr& retriever);
173 const aiScene* mMesh;
203 #endif // DART_DYNAMICS_MESHSHAPE_HPP_ Use the color specified by the visual aspect.
Definition: MeshShape.hpp:53
Eigen::Vector3d mScale
Scale.
Definition: MeshShape.hpp:188
common::ResourceRetrieverPtr mResourceRetriever
Optional method of loading resources by URI.
Definition: MeshShape.hpp:182
void updateVolume() const override
Updates volume.
Definition: MeshShape.cpp:355
AlphaMode getAlphaMode() const
Returns the alpha mode that this mesh is using.
Definition: MeshShape.cpp:274
int getColorIndex() const
Get the index that will be used when the ColorMode is set to COLOR_INDEX.
Definition: MeshShape.cpp:286
~MeshShape() override
Destructor.
Definition: MeshShape.cpp:146
void setColorMode(ColorMode mode)
Set how the color of this mesh should be determined.
Definition: MeshShape.cpp:256
void setAlphaMode(AlphaMode mode)
Sets how the alpha of this mesh should be determined.
Definition: MeshShape.cpp:268
const common::Uri & getMeshUri2() const
Returns URI to the mesh; an empty string if unavailable.
Definition: MeshShape.cpp:177
Definition: MeshShape.hpp:46
std::string mMeshPath
Path the mesh on disk, if available.
Definition: MeshShape.hpp:179
MeshShape(const Eigen::Vector3d &scale, const aiScene *mesh, const common::Uri &uri="", common::ResourceRetrieverPtr resourceRetriever=nullptr)
Constructor.
Definition: MeshShape.cpp:130
Always use the alpha of visual aspect.
Definition: MeshShape.hpp:76
const std::string & getMeshPath() const
Returns path to the mesh on disk; an empty string if unavailable.
Definition: MeshShape.cpp:189
int mDisplayList
OpenGL DisplayList id for rendering.
Definition: MeshShape.hpp:185
void updateBoundingBox() const override
Updates bounding box.
Definition: MeshShape.cpp:311
int mColorIndex
Specifies which color index should be used when mColorMode is COLOR_INDEX.
Definition: MeshShape.hpp:197
Definition: Aspect.cpp:40
Use the colors specified by the Mesh's material.
Definition: MeshShape.hpp:51
ColorMode getColorMode() const
Get the coloring mode that this mesh is using.
Definition: MeshShape.cpp:262
void setColorIndex(int index)
Set which entry in aiMesh::mColor should be used when the color mode is COLOR_INDEX.
Definition: MeshShape.cpp:280
virtual void update()
Updates positions of the vertices or the elements.
Definition: MeshShape.cpp:183
ColorMode
Definition: MeshShape.hpp:49
Use the colors specified by aiMesh::mColor.
Definition: MeshShape.hpp:52
std::string getMeshUri() const
Returns URI to the mesh as std::string; an empty string if unavailable.
Definition: MeshShape.cpp:171
AlphaMode
Alpha mode to specify how the alpha of this mesh should be determined.
Definition: MeshShape.hpp:59
The Uri struct provides URI parsing and merging functionality based on RFC 3986.
Definition: Uri.hpp:86
Blend alphas of visual aspect and mesh.
Definition: MeshShape.hpp:67
const std::string & getType() const override
Returns a string representing the shape type.
Definition: MeshShape.cpp:152
ColorMode mColorMode
Specifies how the color of this mesh should be determined.
Definition: MeshShape.hpp:191
Eigen::Matrix3d computeInertia(double mass) const override
Computes the inertia.
Definition: MeshShape.cpp:304
AlphaMode mAlphaMode
Specifies how the alpha of this mesh should be determined.
Definition: MeshShape.hpp:194
Use the alpha of mesh or visual aspect.
Definition: MeshShape.hpp:73
static const std::string & getStaticType()
Returns shape type for this class.
Definition: MeshShape.cpp:158
common::Uri mMeshUri
URI the mesh, if available).
Definition: MeshShape.hpp:176