DART 6.10.1
Loading...
Searching...
No Matches
Asset.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_ASSET_HPP_
34#define DART_UTILS_MJCF_DETAIL_ASSET_HPP_
35
36#include <unordered_map>
37#include <vector>
38
39#include <tinyxml2.h>
40
44
45namespace dart {
46namespace utils {
47namespace MjcfParser {
48namespace detail {
49
50class Body;
51
52class Asset final
53{
54public:
56 Asset() = default;
57
59
61 std::size_t getNumMeshes() const;
62
64 const Mesh& getMesh(std::size_t index) const;
65
67 const Mesh* getMesh(const std::string& name) const;
68
70
71private:
72 // Private members used by MujocoModel class
73 friend class MujocoModel;
74 Errors read(tinyxml2::XMLElement* element);
75
77 Errors preprocess(const Compiler& compiler);
78
81 Errors compile(const Compiler& compiler);
82
84 Errors postprocess(const Compiler& compiler);
85
86private:
87 std::vector<Mesh> mMeshes;
88 std::unordered_map<std::string, Mesh*> mMeshMap;
89};
90
91} // namespace detail
92} // namespace MjcfParser
93} // namespace utils
94} // namespace dart
95
96#endif // #ifndef DART_UTILS_MJCF_DETAIL_ASSET_HPP_
std::string * name
Definition SkelParser.cpp:1697
std::size_t index
Definition SkelParser.cpp:1672
Asset()=default
Default constructor.
Errors postprocess(const Compiler &compiler)
Updates attributes and elements that require the compiled parent element.
Definition Asset.cpp:129
std::vector< Mesh > mMeshes
Definition Asset.hpp:87
Errors read(tinyxml2::XMLElement *element)
Definition Asset.cpp:69
std::unordered_map< std::string, Mesh * > mMeshMap
Definition Asset.hpp:88
const Mesh & getMesh(std::size_t index) const
Returns <mesh> element at index in <asset>.
Definition Asset.cpp:49
Errors preprocess(const Compiler &compiler)
Updates attributes and elements that doesn't require any other elements.
Definition Asset.cpp:99
std::size_t getNumMeshes() const
Returns the number of <mesh> elements in <asset>.
Definition Asset.cpp:43
Errors compile(const Compiler &compiler)
Updates attributes and elements that require the preprocessed child elements of this <Asset>.
Definition Asset.cpp:113
Main class to parse MJCF model file.
Definition MujocoModel.hpp:56
std::vector< Error > Errors
Definition Error.hpp:85
Definition BulletCollisionDetector.cpp:65