Table of Contents

Struct TimeStep

Namespace
Bonsai.Shaders
Assembly
Bonsai.Shaders.dll

Represents the amount of time elapsed since the last update.

public struct TimeStep : IEquatable<TimeStep>
Implements
Inherited Members

Constructors

TimeStep(double, double)

Initializes a new instance of the TimeStep structure using the specified fixed-step elapsed time and variable-step elapsed clock time.

public TimeStep(double elapsedTime, double elapsedRealTime)

Parameters

elapsedTime double

The amount of elapsed time since the last update, in seconds.

elapsedRealTime double

The amount of elapsed time since the last update, in seconds, following the host computer clock.

Fields

ElapsedRealTime

The amount of elapsed time since the last update, in seconds, following the host computer clock.

public double ElapsedRealTime

Field Value

double

Remarks

This field can be used to measure the real-time jitter of the update and render loops, or in variable-step state updates.

ElapsedTime

The amount of elapsed time since the last update, in seconds.

public double ElapsedTime

Field Value

double

Remarks

This field is useful for fixed-step deterministic state updates, where each step follows the target update or render refresh rates.

Zero

Represents the zero TimeStep value. This field is read-only.

public static readonly TimeStep Zero

Field Value

TimeStep

Methods

Add(TimeStep, TimeStep)

Adds two TimeStep values together.

public static TimeStep Add(TimeStep left, TimeStep right)

Parameters

left TimeStep

The first TimeStep to add.

right TimeStep

The second TimeStep to add.

Returns

TimeStep

A new TimeStep object representing the sum of the left and right values.

Add(ref TimeStep, ref TimeStep, out TimeStep)

Adds two TimeStep values together and stores the result in a return value.

public static void Add(ref TimeStep left, ref TimeStep right, out TimeStep result)

Parameters

left TimeStep

The first TimeStep to add.

right TimeStep

The second TimeStep to add.

result TimeStep

When this method returns, contains the TimeStep object representing the sum of the left and right values.

Equals(TimeStep)

Returns a value indicating whether this instance is equal to the specified TimeStep structure.

public bool Equals(TimeStep other)

Parameters

other TimeStep

The TimeStep object to compare with this instance.

Returns

bool

true if other represents the same timing values as this instance; otherwise, false.

Equals(object)

Returns a value indicating whether the specified object is a TimeStep structure with the same timing values as this TimeStep object.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with this instance.

Returns

bool

true if obj is a TimeStep structure and has the same timing values as this object; otherwise, false.

GetHashCode()

Returns a hash code for this TimeStep value.

public override int GetHashCode()

Returns

int

An integer value that specifies a hash value for this TimeStep object.

Subtract(TimeStep, TimeStep)

Subtracts the second TimeStep value from the first.

public static TimeStep Subtract(TimeStep left, TimeStep right)

Parameters

left TimeStep

The first TimeStep value.

right TimeStep

The second TimeStep value.

Returns

TimeStep

A new TimeStep object representing the difference between the left and right values.

Subtract(ref TimeStep, ref TimeStep, out TimeStep)

Subtracts the second TimeStep value from the first and stores the result in a return value.

public static void Subtract(ref TimeStep left, ref TimeStep right, out TimeStep result)

Parameters

left TimeStep

The first TimeStep value.

right TimeStep

The second TimeStep value.

result TimeStep

When this method returns, contains the TimeStep object representing the difference between the left and right values.

ToString()

Creates a string representation of this TimeStep value.

public override string ToString()

Returns

string

A string representing all the timing values of this TimeStep object.

Operators

operator +(TimeStep, TimeStep)

Adds two TimeStep values together.

public static TimeStep operator +(TimeStep left, TimeStep right)

Parameters

left TimeStep

The TimeStep value on the left-hand side of the addition operator.

right TimeStep

The TimeStep value on the right-hand side of the addition operator.

Returns

TimeStep

A new TimeStep object representing the sum of the left and right values.

operator ==(TimeStep, TimeStep)

Indicates whether two TimeStep values are equal.

public static bool operator ==(TimeStep left, TimeStep right)

Parameters

left TimeStep

The TimeStep value on the left-hand side of the equality operator.

right TimeStep

The TimeStep value on the right-hand side of the equality operator.

Returns

bool

true if left and right have equal timing values; otherwise, false.

operator !=(TimeStep, TimeStep)

Indicates whether two TimeStep values are different.

public static bool operator !=(TimeStep left, TimeStep right)

Parameters

left TimeStep

The TimeStep value on the left-hand side of the inequality operator.

right TimeStep

The TimeStep value on the right-hand side of the inequality operator.

Returns

bool

true if left and right differ in any of their timing values; false if left and right are equal.

operator -(TimeStep, TimeStep)

Subtracts the second TimeStep value from the first.

public static TimeStep operator -(TimeStep left, TimeStep right)

Parameters

left TimeStep

The TimeStep value on the left-hand side of the subtraction operator.

right TimeStep

The TimeStep value on the right-hand side of the subtraction operator.

Returns

TimeStep

A new TimeStep object representing the difference between the left and right values.