DART  6.10.1
Mesh.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2021, The DART development contributors
3  * All rights reserved.
4  *
5  * The list of contributors can be found at:
6  * https://github.com/dartsim/dart/blob/master/LICENSE
7  *
8  * This file is provided under the following "BSD-style" License:
9  * Redistribution and use in source and binary forms, with or
10  * without modification, are permitted provided that the following
11  * conditions are met:
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
19  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef DART_UTILS_MJCF_DETAIL_MESH_HPP_
34 #define DART_UTILS_MJCF_DETAIL_MESH_HPP_
35 
36 #include <tinyxml2.h>
37 
42 
43 namespace dart {
44 namespace utils {
45 namespace MjcfParser {
46 namespace detail {
47 
48 class Mesh final
49 {
50 public:
52  Mesh() = default;
53 
55 
56  const std::string& getName() const;
57  const std::string& getFile() const;
58  const Eigen::Vector3d& getScale() const;
59 
61 
63 
64 private:
65  // Private members used by Asset class
66  friend class Asset;
67  friend class Default;
68  Errors read(tinyxml2::XMLElement* element);
69 
71  Errors preprocess(const Compiler& compiler);
72 
75  Errors compile(const Compiler& compiler);
76 
78  Errors postprocess(const Compiler& compiler);
79 
81 
82 private:
84 
86  std::string mName{""};
87 
88  std::string mFile{""};
89 
90  Eigen::Vector3d mScale{Eigen::Vector3d::Ones()};
91 
94  mutable bool mTriedToParse{false};
96 };
97 
98 } // namespace detail
99 } // namespace MjcfParser
100 } // namespace utils
101 } // namespace dart
102 
103 #endif // #ifndef DART_UTILS_MJCF_DETAIL_MESH_HPP_
std::string mFile
Definition: Mesh.hpp:88
bool mTriedToParse
Definition: Mesh.hpp:94
dynamics::MeshShapePtr mMeshShape
Definition: Mesh.hpp:95
Mesh()=default
Default constructor.
Eigen::Vector3d mScale
Definition: Mesh.hpp:90
dynamics::MeshShapePtr createMeshShape() const
Definition: Mesh.cpp:119
common::ResourceRetrieverPtr mRetriever
Definition: Mesh.hpp:93
Errors postprocess(const Compiler &compiler)
Updates attributes and elements that require the compiled parent element.
Definition: Mesh.cpp:111
const Eigen::Vector3d & getScale() const
Definition: Mesh.cpp:146
const std::string & getName() const
Definition: Mesh.cpp:134
const std::string & getFile() const
Definition: Mesh.cpp:140
dynamics::MeshShapePtr getMeshShape() const
Definition: Mesh.cpp:152
std::string mName
Name of this Mesh.
Definition: Mesh.hpp:86
MeshAttributes mAttributes
Definition: Mesh.hpp:83
common::Uri mMeshUri
Definition: Mesh.hpp:92
Errors preprocess(const Compiler &compiler)
Updates attributes and elements that doesn't require any other elements.
Definition: Mesh.cpp:79
Errors read(tinyxml2::XMLElement *element)
Definition: Mesh.cpp:47
Errors compile(const Compiler &compiler)
Updates attributes and elements that require the preprocessed child elements of this <Mesh>.
Definition: Mesh.cpp:99
std::shared_ptr< ResourceRetriever > ResourceRetrieverPtr
Definition: ResourceRetriever.hpp:76
std::shared_ptr< MeshShape > MeshShapePtr
Definition: SmartPointer.hpp:87
std::vector< Error > Errors
Definition: Error.hpp:85
Definition: BulletCollisionDetector.cpp:65
The Uri struct provides URI parsing and merging functionality based on RFC 3986.
Definition: Uri.hpp:87
Intermediate raw data read from the XML file.
Definition: MeshAttributes.hpp:50