TrueReality  v0.1.1912
RingArray.h
Go to the documentation of this file.
1 /*
2 * True Reality Open Source Game and Simulation Engine
3 * Copyright © 2021 Acid Rain Studios LLC
4 *
5 * This library is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU Lesser General Public License as published by the Free
7 * Software Foundation; either version 3.0 of the License, or (at your option)
8 * any later version.
9 *
10 * This library is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this library; if not, write to the Free Software Foundation, Inc.,
17 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * @author Maxim Serebrennik
20 */
21 
22 #pragma once
23 
24 #include <trCore/Export.h>
25 
26 #include <trBase/SmrtPtr.h>
27 
28 #include <osg/Group>
29 #include <osg/Node>
30 #include <osg/NodeVisitor>
31 #include <osg/PositionAttitudeTransform>
32 
38 namespace trCore::SceneObjects
39 {
47  class TR_CORE_EXPORT RingArray : public osg::Group
48  {
49  public:
50 
51  const static std::string RING_1_FILE_NAME;
52  const static std::string RING_2_FILE_NAME;
53  const static std::string RING_3_FILE_NAME;
54  const static std::string RING_4_FILE_NAME;
55 
61  RingArray();
62 
70  RingArray(double angleCorrection);
71 
79  virtual void Update(double deltaTime);
80 
81  protected:
82 
88  ~RingArray();
89 
95  void LoadModels();
96 
102  void SetupModelTree();
103 
111  void UpdateRing1Slide(double deltaTime);
112 
120  void UpdateRing2Angle(double deltaTime);
121 
129  void UpdateRing2Slide(double deltaTime);
130 
138  void UpdateRing3Angle(double deltaTime);
139 
147  void UpdateRing3Slide(double deltaTime);
148 
156  void UpdateRing4Angle(double deltaTime);
157 
158  private:
159 
160  const double MAX_RING_SPEED = 5.0;
161  const double RING_ACCEL = 0.1;
162  const double START_DELAY = 5.0;
163 
166  double mRing1SlideSpeed = 0.0;
167  double mRing1SlideAngle = 0.0;
168  double mRing1SlideDelay = 0.0;
171  double mRing2RotationSpeed = 0.0;
172  double mRing2RotationAngle = 0.0;
173  double mRing2RotationDelay = 0.0;
175  double mRing2SlideSpeed = 0.0;
176  double mRing2SlideAngle = 0.0;
177  double mRing2SlideDelay = 0.0;
180  double mRing3RotationSpeed = 0.0;
181  double mRing3RotationAngle = 0.0;
182  double mRing3RotationDelay = 0.0;
184  double mRing3SlideSpeed = 0.0;
185  double mRing3SlideAngle = 0.0;
186  double mRing3SlideDelay = 0.0;
189  double mRing4RotationSpeed = 0.0;
190  double mRing4RotationAngle = 0.0;
191  double mRing4RotationDelay = 0.0;
192 
194  };
195 }
A rotating ring array model.
Definition: RingArray.h:47
#define TR_CORE_EXPORT
Definition: trCore/Export.h:33
static const std::string RING_1_FILE_NAME
Definition: RingArray.h:51
Namespace that contains controls for sample scene objects.
trBase::SmrtPtr< osg::PositionAttitudeTransform > mRing2Slide
Definition: RingArray.h:174
trBase::SmrtPtr< osg::PositionAttitudeTransform > mRing3Slide
Definition: RingArray.h:183
trBase::SmrtPtr< osg::PositionAttitudeTransform > mRing3Rotation
Definition: RingArray.h:179
trBase::SmrtPtr< osg::PositionAttitudeTransform > mRing2Rotation
Definition: RingArray.h:170
trBase::SmrtPtr< osg::Group > mRing2
Definition: RingArray.h:169
trBase::SmrtPtr< osg::Group > mRing1
Definition: RingArray.h:164
trBase::SmrtPtr< osg::PositionAttitudeTransform > mAngleCorrection
Definition: RingArray.h:193
trBase::SmrtPtr< osg::Node > mRing4
Definition: RingArray.h:187
static const std::string RING_2_FILE_NAME
Definition: RingArray.h:52
static const std::string RING_3_FILE_NAME
Definition: RingArray.h:53
trBase::SmrtPtr< osg::PositionAttitudeTransform > mRing4Rotation
Definition: RingArray.h:188
trBase::SmrtPtr< osg::PositionAttitudeTransform > mRing1Slide
Definition: RingArray.h:165
trBase::SmrtPtr< osg::Group > mRing3
Definition: RingArray.h:178
static const std::string RING_4_FILE_NAME
Definition: RingArray.h:54