Class TTimeSensorNode

Unit

Declaration

type TTimeSensorNode = class(TAbstractTimeDependentNode)

Description

Generate events as time passes.

Hierarchy

Overview

Methods

Public constructor Create(const AX3DName: String = ''; const ABaseUrl: String = ''); override;
Public procedure FakeTime(const TimeInAnimation: TFloatTime; const ALoop, AFractionIncreasing: boolean; const PartialSend: TPartialSend = nil); overload;
Public procedure FakeTime(const TimeInAnimation: TFloatTime; const ALoop, AFractionIncreasing: boolean; const TimeOfEvents: TX3DTime; const PartialSend: TPartialSend = nil); overload;
Public procedure Start(const ALoop: Boolean; const AFractionIncreasing: Boolean = true; const InitialTime: TFloatTime = 0);
Public procedure Stop;
Public procedure CreateNode; override;
Public class function ClassX3DType: string; override;

Properties

Public property FdCycleInterval: TSFTime read FFdCycleInterval;
Public property CycleInterval: TFloatTime read GetCycleInterval write SetCycleInterval;
Public property EventCycleTime: TSFTimeEvent read FEventCycleTime;
Public property EventFraction_changed: TSFFloatEvent read FEventFraction_changed;
Public property EventTime: TSFTimeEvent read FEventTime;
Public property FdEnabled: TSFBool read FFdEnabled;
Public property Enabled: Boolean read GetEnabled write SetEnabled;
Public property FdFractionIncreasing: TSFBool read FFdFractionIncreasing;
Public property FractionIncreasing: Boolean read GetFractionIncreasing write SetFractionIncreasing;
Public property FdDetectAffectedFields: TSFBool read FFdDetectAffectedFields;
Public property DetectAffectedFields: Boolean read GetDetectAffectedFields write SetDetectAffectedFields;

Description

Methods

Public constructor Create(const AX3DName: String = ''; const ABaseUrl: String = ''); override;

This item has no description. Showing description inherited from TX3DNode.Create.

Constructor. Initializes various properties:

  • Name, BaseUrl are initialized from given parameters.

  • The Fields, Events lists are filled in every descendant, to have all the fields/events defined by the specification.

  • DefaultContainerField, and other node-specific stuff, is filled in descendants. This is actually implemented in CreateNode, that is called at the end of this constructor.

Public procedure FakeTime(const TimeInAnimation: TFloatTime; const ALoop, AFractionIncreasing: boolean; const PartialSend: TPartialSend = nil); overload;

Send TimeSensor output events, without actually activating the TimeSensor.

This is useful in situations when you want the X3D scene state to reflect given time, but you do not want to activate sensor and generally you do not want to initialize anything that would continue animating on it's own.

Note: We ignore TimeSensor.loop (FdLoop) field, instead we follow our own ALoop parameter. We also ignore TimeSensor.fractionIncreasing field, instead we follow our own AFractionIncreasing parameter. We also ignore TimeSensor.enabled field, assuming that you always want to behave like it's enabled (in particular, this makes TCastleSceneCore.ForceAnimationPose always working, even if TCastleSceneCore.PlayAnimation set enabled = false on previously-stopped animation).

We take into account TimeSensor.cycleInterval (FdCycleInterval), just like during normal TimeSensor behavior. We send out isActive:=true, fraction_changed, elapsedTime and time X3D output events, and they should drive the rest of animation.

About the TimeOfEvents parameter:

In X3D, if you send a message (which is what happens when various X3D nodes communicate, e.g. TimeSensors send messages to interpolators) the message will be ignored if it already passed through the same route (TX3DRoute) with the timestamp >= than current. This is a simple mechanism to avoid route loops in X3D.

It means you need to use increasing time each time you initiate an X3D event.

The implementation of FakeTime without TimeOfEvents parameter solves it by using an internal, always increasing, time value. It will work, but only if you don't process events in your X3D graphs by any other means than this FakeTime time call.

In general case, when using FakeTime together with TCastleScene that has active events (TCastleSceneCore.ProcessEvents = True), you should call overloaded TTimeSensorNode.FakeTime with TimeOfEvents parameter. Use MyScene.NextEventTime as the value of TimeOfEvents. NextEventTime internally returns current time, and also increases it by some special epsilon used only for comparison.

Public procedure FakeTime(const TimeInAnimation: TFloatTime; const ALoop, AFractionIncreasing: boolean; const TimeOfEvents: TX3DTime; const PartialSend: TPartialSend = nil); overload;

This item has no description.

Public procedure Start(const ALoop: Boolean; const AFractionIncreasing: Boolean = true; const InitialTime: TFloatTime = 0);

Start or stop the time sensor right now, by setting the fields of this time sensor.

Usually you should prefer using the TCastleSceneCore.PlayAnimation or TCastleSceneCore.StopAnimation instead of these methods. The scene methods allow to play the animation with lots of features, and are more comfortable to use (e.g. you do not need to find the TTimeSensorNode reference).

Using these methods directly is useful to play multiple animations simultaneously.

Public procedure Stop;

This item has no description.

Public procedure CreateNode; override;

This item has no description. Showing description inherited from TAbstractChildNode.CreateNode.

Automatically generated node properties.

Do not edit this file manually! To add new properties: - add them to the text files in tools/internal/x3d-nodes-to-pascal/nodes-specification/ , - and regenerate include files by running x3d-nodes-to-pascal

Public class function ClassX3DType: string; override;

This item has no description. Showing description inherited from TX3DNode.ClassX3DType.

Node type name in VRML/X3D, for this class. Normal VRML/X3D node classes should override this to return something non-empty, and then X3DType automatically will return the same value.

Empty for classes that don't have a hardcoded VRML/X3D node name, like a special TX3DUnknownNode. Such special classes should override then X3DType to return actual non-empty name there.

You usually should call X3DType. The only use of this method is that it works on classes (it's "class function"), without needing at actual instance.

Properties

Public property FdCycleInterval: TSFTime read FFdCycleInterval;

Internal wrapper for property CycleInterval. This wrapper API may change, we advise to access simpler CycleInterval instead.

Public property CycleInterval: TFloatTime read GetCycleInterval write SetCycleInterval;

This item has no description.

Public property EventCycleTime: TSFTimeEvent read FEventCycleTime;

This item has no description.

Public property EventFraction_changed: TSFFloatEvent read FEventFraction_changed;

This item has no description.

Public property EventTime: TSFTimeEvent read FEventTime;

This item has no description.

Public property FdEnabled: TSFBool read FFdEnabled;

Internal wrapper for property Enabled. This wrapper API may change, we advise to access simpler Enabled instead.

Public property Enabled: Boolean read GetEnabled write SetEnabled;

This item has no description.

Public property FdFractionIncreasing: TSFBool read FFdFractionIncreasing;

Internal wrapper for property FractionIncreasing. This wrapper API may change, we advise to access simpler FractionIncreasing instead.

Public property FractionIncreasing: Boolean read GetFractionIncreasing write SetFractionIncreasing;

This item has no description.

Public property FdDetectAffectedFields: TSFBool read FFdDetectAffectedFields;

Internal wrapper for property DetectAffectedFields. This wrapper API may change, we advise to access simpler DetectAffectedFields instead.

Public property DetectAffectedFields: Boolean read GetDetectAffectedFields write SetDetectAffectedFields;

This item has no description.


Generated by PasDoc 0.16.0.