H3D API  2.4.1
TimeSensor.h
Go to the documentation of this file.
1 // Copyright 2004-2019, SenseGraphics AB
3 //
4 // This file is part of H3D API.
5 //
6 // H3D API is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // H3D API is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with H3D API; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // A commercial license is also available. Please contact us at
21 // www.sensegraphics.com for more information.
22 //
23 //
27 //
29 #ifndef __TIMESENSOR_H__
30 #define __TIMESENSOR_H__
31 
33 #include <H3D/SFFloat.h>
34 
35 namespace H3D {
36 
134  class H3DAPI_API TimeSensor : public X3DTimeDependentNode {
135  public:
136 
140  public:
141  TimeHandler() : elapsed_cycle_time( 0 ) {}
142  protected:
145  virtual void update();
147  virtual void activate( H3DTime time );
150  };
151 #ifdef __BORLANDC__
152  friend class TimeHandler;
153 #endif
154 
158 
160  TimeSensor( Inst< SFNode > _metadata = 0,
161  Inst< SFBool > _loop = 0,
162  Inst< SFTime > _pauseTime = 0,
163  Inst< SFTime > _resumeTime = 0,
164  Inst< StartTime > _startTime = 0,
165  Inst< StopTime > _stopTime = 0,
166  Inst< SFTime > _elapsedTime = 0,
167  Inst< SFBool > _isActive = 0,
168  Inst< SFBool > _isPaused = 0,
169  Inst< TimeHandler > _timeHandler = 0,
170  Inst< CycleInterval > _cycleInterval = 0,
171  Inst< SFTime > _cycleTime = 0,
172  Inst< SFBool > _enabled = 0,
173  Inst< SFFloat > _fraction_changed = 0,
174  Inst< SFTime > _time = 0 );
175 
180  H3DUniquePtr< CycleInterval > cycleInterval;
181 
186  H3DUniquePtr< SFTime > cycleTime;
187 
193  H3DUniquePtr< SFBool > enabled;
194 
199  H3DUniquePtr< SFFloat > fraction_changed;
200 
205  H3DUniquePtr< SFTime > time;
206 
209  protected:
210  bool activate_through_enabled;
211  bool previous_enabled;
212  };
213 }
214 
215 #endif
Contains the SFFloat field class.
Header file for X3DTimeDependentNode, X3D scene-graph node.
The TimeHandler field is specialized to include the handling of the TimeSensor specific fields.
Definition: TimeSensor.h:139
H3DTime elapsed_cycle_time
The time that have elapsed in the current cycle.
Definition: TimeSensor.h:149
TimeSensor nodes generate events as time passes.
Definition: TimeSensor.h:134
H3DUniquePtr< CycleInterval > cycleInterval
The cycleInterval field defines how long a cycle lasts in seconds.
Definition: TimeSensor.h:180
H3DUniquePtr< SFBool > enabled
If the enabled field is TRUE, the TimeSensor node is enabled and may be running, otherwise no field u...
Definition: TimeSensor.h:193
H3DUniquePtr< SFFloat > fraction_changed
The fraction_changed field is the completed fraction of the current cycle, i.e.
Definition: TimeSensor.h:199
StartTime CycleInterval
The CycleInterval has the same conditions for update as the StartTime so use that field class definit...
Definition: TimeSensor.h:157
H3DUniquePtr< SFTime > cycleTime
The cycleTime field sends a time event at startTime and at the beginning of each new cycle with the c...
Definition: TimeSensor.h:186
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: TimeSensor.h:208
H3DUniquePtr< SFTime > time
The time field sends the absolute time for a given simulation tick( i.e.
Definition: TimeSensor.h:205
The StartTime field is a specialization of the SFTime field so that the value cannot be changed when ...
Definition: X3DTimeDependentNode.h:75
The TimeHandler field updates once per scene-graph loop to monitor the current time and updates the f...
Definition: X3DTimeDependentNode.h:50
This abstract node type is the base node type from which all time-dependent nodes are derived.
Definition: X3DTimeDependentNode.h:41
double H3DTime
H3D API namespace.
Definition: Anchor.h:38
The H3DNodeDatabase contains a mapping between a name of a Node and the constructor for the Node with...
Definition: H3DNodeDatabase.h:194