Open Inventor Reference
|
Timer that runs for a pre-set amount of time. More...
#include <Inventor/engines/SoOneShot.h>
Public Types | |
enum | Flags { RETRIGGERABLE = (1<<0), HOLD_FINAL = (1<<1) } |
Public Member Functions | |
SoOneShot () | |
Constructor. | |
Static Public Member Functions | |
static void | initClass () |
Initializes base engine class. | |
Public Attributes | |
Inputs | |
SoSFTime | duration |
Duration of the active cycle. | |
SoSFTrigger | trigger |
Start the cycle. | |
SoSFBitMask | flags |
Control flags. | |
SoSFBool | disable |
If TRUE, the timer is disabled. | |
SoSFTime | timeIn |
Running time. | |
Outputs | |
SoEngineOutput | timeOut |
Elapsed time from the start. | |
SoEngineOutput | isActive |
Is TRUE during the active cycle. | |
SoEngineOutput | ramp |
Ramps linearly from 0.0 to 1.0. | |
Protected Member Functions | |
virtual void | inputChanged (SoField *whichInput) |
This is called whenever the value of an input is changed. | |
virtual void | writeInstance (SoOutput *out) |
Writes instance to SoOutput. | |
virtual SbBool | readInstance (SoInput *in, unsigned short flags) |
Reads stuff into instance. |
This engine is a timer that runs for a pre-set amount of time and then stops. By default, the timeIn input is connected to the realTime global field. It can, however, by connected to any other time source.
The timer is started when the trigger input is touched. It then runs for the specified duration , and updates the timeOut output with the time that has elapsed. During that time, the ramp output is also updated. The ramp output starts at 0.0 at the beginning of the cycle, and linearly increases until it reaches 1.0 at the end of the cycle.
You can disable the timer by setting the disable input to TRUE. The output value remains 0.0 while the timer is disabled. If the timer is disabled in the middle of a cycle the output values will be set to 0.0.
The flags input contains control flags. Using the flags you can set the timer to be retriggerable in the middle of a cycle, and set the output values to stay high after the cycle has been completed. By default, these flags are not set.
Definition at line 114 of file SoOneShot.h.
enum SoOneShot::Flags |
RETRIGGERABLE |
can start over during cycle? |
HOLD_FINAL |
ramp & timeOut stay high after cycle? |
Definition at line 119 of file SoOneShot.h.
SoOneShot::SoOneShot | ( | ) |
static void SoOneShot::initClass | ( | ) | [static] |
Reimplemented from SoEngine.
virtual void SoOneShot::inputChanged | ( | SoField * | whichField | ) | [protected, virtual] |
The default method does nothing. Subclasses can override this to detect when a specific field is changed.
Reimplemented from SoEngine.
Works around a problem with old files that contain explicit references to the default connection to realTime.
Reimplemented from SoEngine.
virtual void SoOneShot::writeInstance | ( | SoOutput * | out | ) | [protected, virtual] |
Takes care of not writing out connection to realTime that is created in constructor.
Reimplemented from SoEngine.
Definition at line 139 of file SoOneShot.h.
Definition at line 128 of file SoOneShot.h.
Definition at line 136 of file SoOneShot.h.
Definition at line 153 of file SoOneShot.h.
Definition at line 156 of file SoOneShot.h.
Definition at line 142 of file SoOneShot.h.
Definition at line 150 of file SoOneShot.h.
The trigger will be ignored if it is touched in the middle of a cycle and the RETRIGGERABLE flag is not set.
Definition at line 133 of file SoOneShot.h.