Record TX3DTime

Hierarchy
Properties

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:

  1. 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.

  2. 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.

  3. 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.

  4. 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

Public Seconds: TFloatTime;
Public PlusTicks: Cardinal;

Methods

Public class function Oldest: TX3DTime; static;
Public class operator > (const Time1, Time2: TX3DTime): boolean;
Public class operator >= (const Time1, Time2: TX3DTime): boolean;
Public class operator < (const Time1, Time2: TX3DTime): boolean;
Public class operator <= (const Time1, Time2: TX3DTime): boolean;

Description

Fields

Public Seconds: TFloatTime;
 
Public PlusTicks: Cardinal;
 

Methods

Public class function Oldest: TX3DTime; static;
 
Public class operator > (const Time1, Time2: TX3DTime): boolean;
 
Public class operator >= (const Time1, Time2: TX3DTime): boolean;
 
Public class operator < (const Time1, Time2: TX3DTime): boolean;
 
Public class operator <= (const Time1, Time2: TX3DTime): boolean;
 

Generated by PasDoc 0.15.0.