Class TInternalTimeDependentHandler

Unit

Declaration

type TInternalTimeDependentHandler = class(TObject)

Description

Common helper for all X3DTimeDependentNode descendants. This includes things descending from interface IAbstractTimeDependentNode, in particular (but not only) descending from class TAbstractTimeDependentNode.

It would be cleaner to have Node declared as IAbstractTimeDependentNode, and have IAbstractTimeDependentNode contain common fields. Then a lot of fields of this class would not be needed, as they would be accessible as IAbstractTimeDependentNode fields. TODO: maybe in the future.

Hierarchy

  • TObject
  • TInternalTimeDependentHandler

Overview

Fields

Public Node: TX3DNode;
Public OnCycleInterval: TTimeFunction;
Public FdLoop: TSFBool;
Public FdPauseTime: TSFTime;
Public FdResumeTime: TSFTime;
Public FdStartTime: TSFTime;
Public FdStopTime: TSFTime;
Public FdEnabled: TSFBool;
Public EventElapsedTime: TSFTimeEvent;
Public EventIsActive: TSFBoolEvent;
Public EventIsPaused: TSFBoolEvent;
Public EventCycleTime: TSFTimeEvent;
Public PartialSend: TPartialSend;

Methods

Public function CycleInterval: TFloatTime;
Public function SetTime(const NewTime: TFloatTime; const TimeIncrease: TFloatTime; const ResetTime: boolean): boolean;

Properties

Public property IsActive: boolean read FIsActive write SetIsActive;
Public property IsPaused: boolean read FIsPaused write SetIsPaused;
Public property ElapsedTime: TFloatTime read FElapsedTime write SetElapsedTime;
Public property ElapsedTimeInCycle: TFloatTime read FElapsedTimeInCycle;

Description

Fields

Public Node: TX3DNode;
 
Public OnCycleInterval: TTimeFunction;
 
Public FdLoop: TSFBool;
 
Public FdPauseTime: TSFTime;
 
Public FdResumeTime: TSFTime;
 
Public FdStartTime: TSFTime;
 
Public FdStopTime: TSFTime;
 
Public FdEnabled: TSFBool;

May be Nil if node doesn't have an "enabled" field.

Public EventElapsedTime: TSFTimeEvent;
 
Public EventIsActive: TSFBoolEvent;
 
Public EventIsPaused: TSFBoolEvent;
 
Public EventCycleTime: TSFTimeEvent;

May be Nil if node doesn't have a "cycleTime" event.

Public PartialSend: TPartialSend;

Propagate this to all send events, to make animation fade-in/out.

Methods

Public function CycleInterval: TFloatTime;

Cycle interval for this time-dependent node.

Public function SetTime(const NewTime: TFloatTime; const TimeIncrease: TFloatTime; const ResetTime: boolean): boolean;

Call this when world time increases. This is the most important method of this class, that basically implements time-dependent nodes operations.

NewTime and TimeIncrease are produced by TCastleSceneCore.SetTime and friends.

When ResetTime = true, this means that "TimeIncrease value is unknown" (you must pass TimeIncrease = 0 in this case). This can happen only when were called by ResetTime.

In other circumstances, TimeIncrease must be >= 0. (It's allowed to pass TimeIncrease = 0 and ResetTime = false, this doesn't advance the clock, but is a useful trick to force some update, see HandleChangeTimeStopStart in TCastleSceneCore.InternalChangedField implementation.)

References: see X3D specification "Time" component, 8.2 ("concepts") for logic behind all those start/stop/pause/resumeTime, cycleInterval, loop properties.

Returns

If some state of time-dependent node changed.

Properties

Public property IsActive: boolean read FIsActive write SetIsActive;

Is the sensor enabled and running (ignoring whether it is paused). Changing this automatically causes appropriate events to be generated.

Public property IsPaused: boolean read FIsPaused write SetIsPaused;

Is the sensor paused. Changing this automatically causes appropriate events to be generated.

Public property ElapsedTime: TFloatTime read FElapsedTime write SetElapsedTime;

Time in seconds since the sensor was activated and running, not counting any time while in pause state. Changing this automatically causes appropriate events to be generated.

Public property ElapsedTimeInCycle: TFloatTime read FElapsedTimeInCycle;

Like ElapsedTime, but spent in the current cycle. When cycleInterval = 0, this is always 0. When cycleInterval <> 0, this is always >= 0 and < cycleInterval .


Generated by PasDoc 0.16.0.