i6engine  1.0
MoverCircleComponent.h
Go to the documentation of this file.
1 /*
2  * i6engine
3  * Copyright (2016) Daniel Bonrath, Michael Baer, All rights reserved.
4  *
5  * This file is part of i6engine; i6engine is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
25 #ifndef __I6ENGINE_API_MOVERCIRCLECOMPONENT_H__
26 #define __I6ENGINE_API_MOVERCIRCLECOMPONENT_H__
27 
30 
32 
33 #include "boost/date_time/posix_time/posix_time.hpp"
34 #include "boost/thread/mutex.hpp"
35 
36 namespace i6e {
37 namespace api {
38 
50  public:
51  MoverCircleComponent(const int64_t id, const attributeMap & params);
53 
54  void setPositioning(const Positioning posing) { _positioning = posing; }
55 
56  void setCircleParameters(const Vec3 & cC, const Vec3 & cA, const double & cR) {
57  _circleCenter = cC;
58  _circleAxis = cA;
59  _circleRadius = cR;
60  }
61 
67  void start(Vec3 & startPos) override;
68 
69  Vec3 getCircleAxis() const { return _circleAxis; }
70  double getCircleRadius() const { return _circleRadius; }
71 
75  attributeMap synchronize() const override;
76 
77  std::string getTemplateName() const override {
78  return "MoverCircle";
79  }
80 
81  void reset() override;
82 
83  std::vector<componentOptions> getComponentOptions() override;
84 
85  private:
89  Vec3 _circleCenter;
90 
95  Vec3 _circleAxis;
96 
101  double _circleRadius;
102 
106  void loadParams(const attributeMap & params) override;
107 
108  void News(const GameMessage::Ptr & msg) override;
109 
110  void getNewPosition(const uint64_t t, Vec3 & newPos, Quaternion & newRot) override;
111 
112  MoverCircleComponent(const MoverCircleComponent &) = delete;
113 
114  const MoverCircleComponent & operator=(const MoverCircleComponent &) = delete;
115  };
116 
117 } /* namespace api */
118 } /* namespace i6e */
119 
120 #endif /* __I6ENGINE_API_MOVERCIRCLECOMPONENT_H__ */
121 
This component let's the Object move through the world automatically on fixed paths Use addKeyFrame()...
Class describing a 3d rotation.
Definition: i6eQuaternion.h:58
void setCircleParameters(const Vec3 &cC, const Vec3 &cA, const double &cR)
#define ISIXE_MODULES_API
moves an object around a point in a circular way For creating a MoverCircleComponent, these keys are possible: Name Required Type Description Public pos yes Vec3 center of the circle yes axis yes Vec3 axis around which the mover should circle yes radius yes double radius of the circle yes realCenterPos no Vec3 the real start pos of the circle no
boost::shared_ptr< Message > Ptr
Definition: Message.h:66
std::map< std::string, std::string > attributeMap
Definition: attributeMap.h:42
Implements 3-dimensional vectors.
Definition: i6eVector.h:48
void setPositioning(const Positioning posing)
std::string getTemplateName() const override
returns the name this template was registered with