Gazebo Rendering

API Reference

7.4.2
gz/rendering/ogre2/Ogre2Mesh.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 #ifndef GZ_RENDERING_OGRE2_OGRE2MESH_HH_
18 #define GZ_RENDERING_OGRE2_OGRE2MESH_HH_
19 
20 #include <map>
21 #include <memory>
22 #include <string>
23 #include <unordered_map>
24 #include <vector>
29 
30 namespace Ogre
31 {
32  class Item;
33  class SubItem;
34 }
35 
36 namespace gz
37 {
38  namespace rendering
39  {
40  inline namespace GZ_RENDERING_VERSION_NAMESPACE {
41  //
42  // forward declaration
43  class Ogre2MeshPrivate;
44  class Ogre2SubMeshPrivate;
45 
47  class GZ_RENDERING_OGRE2_VISIBLE Ogre2Mesh :
48  public BaseMesh<Ogre2Geometry>
49  {
51  protected: Ogre2Mesh();
52 
54  public: virtual ~Ogre2Mesh();
55 
56  // Documentation inherited
57  public: virtual void Destroy() override;
58 
59  // Documentation inherited.
60  public: virtual bool HasSkeleton() const override;
61 
62  // Documentation inherited.
64  SkeletonLocalTransforms() const override;
65 
66  // Documentation inherited.
67  public: virtual void SetSkeletonLocalTransforms(
68  const std::map<std::string, math::Matrix4d> &_tfs) override;
69 
70  // Documentation inherited.
72  SkeletonWeights() const override;
73 
74  // Documentation inherited.
75  public: virtual void SetSkeletonWeights(
76  const std::unordered_map<std::string, float> &_weights) override;
77 
78  // Documentation inherited.
79  public: virtual void SetSkeletonAnimationEnabled(const std::string &_name,
80  bool _enabled, bool _loop = true, float _weight = 1.0) override;
81 
82  // Documentation inherited.
83  public: virtual bool SkeletonAnimationEnabled(const std::string &_name)
84  const override;
85 
86  // Documentation inherited.
87  public: virtual void UpdateSkeletonAnimation(
88  std::chrono::steady_clock::duration _time) override;
89 
90  // Documentation inherited
91  public: virtual Ogre::MovableObject *OgreObject() const override;
92 
94  protected: virtual SubMeshStorePtr SubMeshes() const override;
95 
98 
100  protected: Ogre::Item *ogreItem = nullptr;
101 
103  private: friend class Ogre2Scene;
104 
106  private: friend class Ogre2MeshFactory;
107 
109  private: std::unique_ptr<Ogre2MeshPrivate> dataPtr;
110  };
111 
113  class GZ_RENDERING_OGRE2_VISIBLE Ogre2SubMesh :
114  public BaseSubMesh<Ogre2Object>
115  {
117  protected: Ogre2SubMesh();
118 
120  public: virtual ~Ogre2SubMesh();
121 
122  // Documentation inherited
123  public: virtual void Destroy() override;
124 
127  public: void SetMeshName(const std::string &_name);
128 
130  public: virtual Ogre::SubItem *Ogre2SubItem() const;
131 
134  protected: virtual void SetMaterialImpl(MaterialPtr _material) override;
135 
137  protected: virtual void Init() override;
138 
140  protected: Ogre::SubItem *ogreSubItem = nullptr;
141 
143  private: friend class Ogre2Scene;
144 
147  private: friend class Ogre2SubMeshStoreFactory;
148 
150  private: std::unique_ptr<Ogre2SubMeshPrivate> dataPtr;
151  };
152  }
153  }
154 }
155 #endif