Record TX3DTime
Unit
Declaration
type TX3DTime = record
Description
Complete timestamp for X3D events. For most purposes, you're interested only in it's Seconds field, this is the amount of continuous time that passed (in double-precision seconds).
More precisely, timestamp is actually a sum of Seconds + PlusTicks ticks. PlusTicks is the number of discrete "ticks" that occurred with the same Seconds value. A tick is, conceptually, an infinitely small amount of time.
Ticks are used when comparing time values: when two timestamps have the same Seconds value, then we can compare the PlusTicks field. Timestamps are equal only when both Seconds and PlusTicks values are exactly equal.
The practical justification of PlusTicks usage:
First, note that X3D standard defines that within one timestamp, only one event may pass through one route. This mechanism allows to avoid loops in routes.
Now note that when using TCastleSceneCore, Seconds is increased by TCastleSceneCore.IncreaseTime. TCastleSceneCore doesn't require how often should IncreaseTime be called, in particular you can call multiple times TCastleSceneCore.Press, TCastleSceneCore.Release, TCastleSceneCore.PointingDeviceMove without continuously updating time. You can even not update time at all, and still call TCastleSceneCore.Press and such.
This is a good thing — it allows TCastleSceneCore to be very flexible. The idea is that sensors are activated when user interface reports some event. You don't have to update time before every TCastleSceneCore.Press and such.
The potential problem here is that when you call TCastleSceneCore.Press twice, without the TCastleSceneCore.IncreaseTime in between, then the second TCastleSceneCore.Press events will have "clogged" routes. Events send from the second TCastleSceneCore.Press may be blocked on routes, since they will be detected as occuring within the same timestamp, so (following VRML/X3D standard) they'll have to be ignored.
Using "Seconds seconds + PlusTicks ticks" allows to avoid this. Each TCastleSceneCore.Press and such increases world time by 1 tick – this way, the second TCastleSceneCore.Press will have one more tick, so will always be considered later, and things will work Ok.
Overview
Fields
Seconds: TFloatTime; |
|
PlusTicks: Cardinal; |
Methods
class function Oldest: TX3DTime; static; |
|
class operator > (const Time1, Time2: TX3DTime): boolean; |
|
class operator >= (const Time1, Time2: TX3DTime): boolean; |
|
class operator < (const Time1, Time2: TX3DTime): boolean; |
|
class operator <= (const Time1, Time2: TX3DTime): boolean; |
Description
Fields
Seconds: TFloatTime; |
|
PlusTicks: Cardinal; |
|
Methods
class function Oldest: TX3DTime; static; |
|
class operator > (const Time1, Time2: TX3DTime): boolean; |
|
class operator >= (const Time1, Time2: TX3DTime): boolean; |
|
class operator < (const Time1, Time2: TX3DTime): boolean; |
|
class operator <= (const Time1, Time2: TX3DTime): boolean; |
|
Generated by PasDoc 0.16.0.