public class SoVRMLTimeSensor extends SoVRMLInterpolator
<font color="#0000FF">NOTE:</font> This class does not exist in Open Inventor 10.0 and later.
This section describes the expected behavior of the node in a conforming VRML97 browser application. In some cases, the application is responsible for implementing portions of the expected behavior. Open Inventor viewer classes and IVF classes implement some of the application behaviors.
This section may reference portions of the VRML97 specification that are not present in this help file. The complete VRML97 spec is available at
SoVRMLTimeSensors generate events as time passes. SoVRMLTimeSensors can be used to drive continuous simulations and animations, periodic activities (e.g., one per minute), and/or single occurrence events such as an alarm clock. SoVRMLTimeSensor
discrete eventOuts include: isActive , which becomes true when the SoVRMLTimeSensor
begins running, and false when it stops running, and cycleTime , a time event at startTime
and at the beginning of each new cycle (useful for synchronization with other time-based objects). The remaining outputs generate continuous events and consist of fraction_changed , which is an SFFloat in the closed interval [0,1] representing the completed fraction of the current cycle, and time , an SFTime event specifying the absolute time for a given simulation tick.
If the enabled
exposedField is true, the SoVRMLTimeSensor
is enabled and may be running. If a set_enabled false event is received while the SoVRMLTimeSensor
is running, then the sensor should evaluate and send all relevant outputs, send a false value for isActive, and disable itself. However, events on the exposedFields of the SoVRMLTimeSensor
(such as set_startTime) are processed and their corresponding eventOuts ( startTime_changed) are sent regardless of the state of enabled
. The remaining discussion assumes enabled
is true.
The loop
, startTime
, and stopTime
exposedFields, and the isActive eventOut and their affects on the SoVRMLTimeSensor
node, are discussed in detail in the "Concepts - Time Dependent Nodes" section. The "cycle" of an SoVRMLTimeSensor
lasts for cycleInterval
seconds. The value of cycleInterval
must be greater than 0 (a value less than or equal to 0 produces undefined results). Because the SoVRMLTimeSensor
is more complex than the abstract SoVRMLTimeDep node and generates continuous eventOuts, some of the information in the "Time Dependent Nodes" section is repeated here.
A cycleTime eventOut can be used for synchronization purposes, e.g., sound with animation. The value of a cycleTime eventOut will be equal to the time at the beginning of the current cycle. A cycleTime eventOut is generated at the beginning of every cycle, including the cycle starting at startTime
. The first cycleTime eventOut for an SoVRMLTimeSensor
node can be used as an alarm (single pulse at a specified time).
When an SoVRMLTimeSensor
becomes active it will generate an isActive = true event and begin generating time , fraction_changed, and cycleTime events, which may be routed to other nodes to drive animation or simulated behaviors - (see below for behavior at read time). The time event outputs the absolute time for a given tick of the SoVRMLTimeSensor
(time fields and events represent the number of seconds since midnight GMT January 1, 1970). fraction_changed events output a floating point value in the closed interval [0, 1], where 0 corresponds to startTime
and 1 corresponds to startTime
+ N*cycleInterval
, where N = 1, 2, ... . That is, the time and fraction_changed eventOuts can be computed as:
Atime = now f = fmod(now - startTime, cycleInterval) if (f == 0.0 && now > startTime) fraction_changed = 1.0 else fraction_changed = f / cycleInterval
SoVRMLTimeSensor
can be set up to be active at read time by specifying loop
true (not the default) and stopTime
<= startTime
(satisfied by the default values). The time events output absolute times for each tick of the SoVRMLTimeSensor
startTime
and end with either startTime
+cycleInterval
, stopTime
, or loop forever depending on the values of the other fields. An active SoVRMLTimeSensor
must stop at the first simulation tick when time
now >= stopTime
> startTime
.
No guarantees are made with respect to how often an SoVRMLTimeSensor
will generate time events, but an SoVRMLTimeSensor
should generate events at least at every simulation tick. SoVRMLTimeSensors are guaranteed to generate final time and fraction_changed events. If loop is false, the final time event will be generated with a value of (startTime
+cycleInterval
) or stopTime
(if stopTime
> startTime), whichever value is less. If loop
is true at the completion of every cycle, then the final event will be generated as evaluated at stopTime
(if stopTime
> startTime
) or never.
An active SoVRMLTimeSensor
ignores set_cycleInterval , and set_startTime events. An active SoVRMLTimeSensor
also ignores set_stopTime events for set_stopTime < startTime
. For example, if a set_startTime event is received while an SoVRMLTimeSensor
is active, then that set_startTime event is ignored (the startTime
field is not changed, and a startTime_changed eventOut is not generated). If an active SoVRMLTimeSensor
receives a set_stopTime event that is less than
now and greater than or equal to startTime
, it behaves as if the stopTime
requested is
now and sends the final events based on
now (note that stopTime
is set as specified in the eventIn).
File format/default:
VRMLTimeSensor {
cycleInterval | 1 |
enabled | true |
loop | false |
pauseTime | 0 |
resumeTime | 0 |
startTime | 0 |
stopTime | 0 |
metadata | NULL |
SoSFTime | set_cycleInterval |
SoSFBool | set_enabled |
SoSFBool | set_loop |
SoSFTime | set_pauseTime (Note: Not implemented) |
SoSFTime | set_resumeTime (Note: Not implemented) |
SoSFTime | set_startTime |
SoSFTime | set_stopTime |
SoSFNode | set_metadata |
SoSFTime | cycleTime |
SoSFFloat | fraction_changed |
SoSFBool | isActive |
SoSFBool | isPaused (Note: Not implemented) |
SoSFTime | time |
SoSFTime | cycleInterval_changed |
SoSFBool | enabled_changed |
SoSFBool | loop_changed |
SoSFTime | pauseTime_changed (Note: Not implemented) |
SoSFTime | resumeTime_changed (Note: Not implemented) |
SoSFTime | startTime_changed |
SoSFTime | stopTime_changed |
SoSFTime | elapsedTime |
SoSFNode | metadata_changed |
Inventor.ConstructorCommand
Modifier and Type | Field and Description |
---|---|
SoSFTime |
cycleInterval
Deprecated.
Time for each cycle in seconds.
|
SoSFBool |
enabled
Deprecated.
Enables (true) or disables (false) the sensor.
|
SoSFBool |
loop
Deprecated.
Specifies whether a cycle should be repeated (true) or terminated (false) at the end of the cycle.
|
SoSFTime |
pauseTime
Deprecated.
(Note: Not implemented) Pause time.
|
SoSFTime |
resumeTime
Deprecated.
(Note: Not implemented) Resume time.
|
SoSFTime |
startTime
Deprecated.
Starting time of the cycle.
|
SoSFTime |
stopTime
Deprecated.
Stop time of the cycle.
|
metadata
VERBOSE_LEVEL, ZeroHandle
Constructor and Description |
---|
SoVRMLTimeSensor()
Deprecated.
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static void |
enableEvents(boolean OnOffFlag)
Deprecated.
Enables/disables events for
all
SoVRMLTimeSensor objects. |
static boolean |
isEventsEnabled()
Deprecated.
Queries if events are enabled for all objects of this class.
|
copy, evaluateWrapper, getByName, getOutput, getOutputName
affectsState, callback, copy, distribute, doAction, getAlternateRep, getBoundingBox, getMatrix, getPrimitiveCount, getRenderUnitID, GLRender, GLRenderBelowPath, GLRenderInPath, GLRenderOffPath, grabEventsCleanup, grabEventsSetup, handleEvent, isBoundingBoxIgnoring, isOverride, pick, rayPick, search, setOverride, touch, write
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
dispose, getEXTERNPROTO, getName, getPROTO, isDisposable, isSynchronizable, setName, setSynchronizable
getAddress, getNativeResourceHandle, startInternalThreads, stopInternalThreads
public final SoSFTime cycleInterval
public final SoSFBool enabled
public final SoSFBool loop
public final SoSFTime pauseTime
public final SoSFTime resumeTime
public final SoSFTime startTime
public final SoSFTime stopTime
public static boolean isEventsEnabled()
public static void enableEvents(boolean OnOffFlag)
SoVRMLTimeSensor
objects.
If you have created several objects of this class, you can disable/enable events for all of them with a single call to this method.Generated on January 23, 2025, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com