TrueReality  v0.1.1912
RingArrayCallback.cpp
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 
24 
25 #include <trBase/SmrtPtr.h>
26 #include <trUtil/Logging/Log.h>
27 
28 namespace trCore::SceneObjects
29 {
32  {
33  }
34 
37  {
38  }
39 
41  void RingArrayCallback::operator()(osg::Node* nodePtr, osg::NodeVisitor* /*nvPtr*/)
42  {
43  if (mFirstFrame)
44  {
45  //Set the timer at 0 on the first run.
47  mTimer.Tick();
48  mFirstFrame = false;
49  }
50 
51  if (nodePtr != nullptr)
52  {
53  //Update our timed loop
54  mTimer.Tick();
55 
56  //Pass the frame time to the ring update
57  static_cast<RingArray*>(nodePtr)->Update(mTimer.GetSecondsPerTick());
58  }
59  else
60  {
61  LOG_E("Callback not connected to a RingArray")
62  }
63  }
64 }
A rotating ring array model.
Definition: RingArray.h:47
Namespace that contains controls for sample scene objects.
TimeTicks Tick()
Get the timers tick value.
Definition: Timer.h:100
#define LOG_E(msg)
Log an ERROR message.
Definition: Log.h:165
double GetSecondsPerTick() const
Get the number of seconds per tick.
Definition: Timer.h:232
void SetStartTick()
Set the start tick.
Definition: Timer.h:112
virtual void operator()(osg::Node *nodePtr, osg::NodeVisitor *nvPtr) override
Callback method called by the NodeVisitor when visiting a node.