VoltAir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
Public Types | Signals | Public Member Functions | Properties | List of all members
InterpolationLogic Class Reference

Interpolates target's targetProperty value between beginValue and endValue. More...

Inheritance diagram for InterpolationLogic:
Logic QObject

Public Types

enum  State { Paused = 0, Forward, Backward }
 State of the interpolation. More...
 

Signals

void targetChanged ()
 Emitted when target changes. More...
 
void targetPropertyChanged ()
 Emitted when targetProperty changes. More...
 
void beginValueChanged ()
 Emitted when beginValue changes. More...
 
void endValueChanged ()
 Emitted when endValue changes. More...
 
void forwardDurationChanged ()
 Emitted when forwardDuration changes. More...
 
void backwardDurationChanged ()
 Emitted when backwardDuration changes. More...
 
void smoothingChanged ()
 Emitted when smoothing changes. More...
 
void stateChanged ()
 Emitted when state changes. More...
 
void interpolatingSoundChanged ()
 Emitted when interpolatingSound changes. More...
 
- Signals inherited from Logic
void activeChanged ()
 Emitted when active changes. More...
 

Public Member Functions

 InterpolationLogic (QObject *parent=nullptr)
 Constructs an InterpolationLogic. More...
 
QObjectgetTarget () const
 Returns target. More...
 
void setTarget (QObject *value)
 Sets target. More...
 
const QStringgetTargetProperty () const
 Returns targetProperty. More...
 
void setTargetProperty (const QString &value)
 Sets targetProperty. More...
 
QVariant getBeginValue () const
 Returns beginValue. More...
 
void setBeginValue (QVariant value)
 Sets beginValue. More...
 
QVariant getEndValue () const
 Returns endValue. More...
 
void setEndValue (QVariant value)
 Sets endValue. More...
 
float getForwardDuration () const
 Returns forwardDuration. More...
 
void setForwardDuration (float value)
 Sets forwardDuration. More...
 
float getBackwardDuration () const
 Returns backwardDuration. More...
 
void setBackwardDuration (float value)
 Sets backwardDuration. More...
 
float getSmoothing () const
 Returns smoothing. More...
 
void setSmoothing (float value)
 Sets smoothing. More...
 
State getState () const
 Returns state. More...
 
void setState (State value)
 Sets state. More...
 
const QStringgetInterpolatingSound () const
 Returns interpolatingSound. More...
 
void setInterpolatingSound (const QString &value)
 Sets interpolatingSound. More...
 
virtual void init () override
 Resolves target and targetProperty. More...
 
virtual void update () override
 Performs an Engine::TIME_STEP_S based step in the interpolation if state is not InterpolationLogic::Paused. More...
 
- Public Member Functions inherited from Logic
 Logic (QObject *parent=nullptr)
 Constructs a Logic. More...
 
ActorgetActor () const
 Returns actor. More...
 
bool isActive () const
 Returns active. More...
 
void setActive (bool value)
 Sets active. More...
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
virtual const QMetaObjectmetaObject () const
 
QString objectName () const
 
void setObjectName (const QString &name)
 
bool isWidgetType () const
 
bool isWindowType () const
 
bool signalsBlocked () const
 
bool blockSignals (bool block)
 
QThreadthread () const
 
void moveToThread (QThread *targetThread)
 
int startTimer (int interval, Qt::TimerType timerType)
 
void killTimer (int id)
 
findChild (const QString &name, QFlags< Qt::FindChildOption > options) const
 
QList< T > findChildren (const QString &name, QFlags< Qt::FindChildOption > options) const
 
QList< T > findChildren (const QRegExp &regExp, QFlags< Qt::FindChildOption > options) const
 
QList< T > findChildren (const QRegularExpression &re, QFlags< Qt::FindChildOption > options) const
 
const QObjectList & children () const
 
void setParent (QObject *parent)
 
void installEventFilter (QObject *filterObj)
 
void removeEventFilter (QObject *obj)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const
 
bool disconnect (const QObject *receiver, const char *method) const
 
void dumpObjectTree ()
 
void dumpObjectInfo ()
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const
 
QList< QByteArraydynamicPropertyNames () const
 
void destroyed (QObject *obj)
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const
 
bool inherits (const char *className) const
 
void deleteLater ()
 

Properties

QObject target
 Target object whose targetProperty value will be interpolated. More...
 
QString targetProperty
 Q_PROPERTY of target whose value will be interpolated. More...
 
QVariant beginValue
 Value at which to start the interpolation of target's targetProperty. More...
 
QVariant endValue
 Value at which to end the interpolation of target's targetProperty. More...
 
float forwardDuration
 Time, in seconds, over which to perform the InterpolationLogic::Forward interpolation. More...
 
float backwardDuration
 Time, in seconds, over which to perform the InterpolationLogic::Backward interpolation. More...
 
float smoothing
 Factor between linear and smooth interpolation. More...
 
State state
 Current state of the interpolation. More...
 
QString interpolatingSound
 Name of sound asset to play and loop while interpolating. More...
 
- Properties inherited from Logic
Actor actor
 Parent actor that is affected by this Logic's behavior. More...
 
bool active
 Whether or not Engine calls update() on this Logic during the Engine::LOGICS_PHASE. More...
 
- Properties inherited from QObject
 objectName
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 
bool isSignalConnected (const QMetaMethod &signal) const
 
virtual void timerEvent (QTimerEvent *event)
 
virtual void childEvent (QChildEvent *event)
 
virtual void customEvent (QEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 

Detailed Description

Interpolates target's targetProperty value between beginValue and endValue.

Note
Currently, InterpolationLogic supports the following types for interpolation:
  • QMetaType::Bool
  • QMetaType::Double
  • QMetaType::Float
  • QMetaType::Int
  • QMetaType::QPointF

Member Enumeration Documentation

State of the interpolation.

Enumerator
Paused 

Interpolation is currently paused, not changing targetProperty on update().

Forward 

Currently interpolating targetProperty from beginValue to endValue.

Backward 

Currently interpolating targetProperty from endValue to beginValue.

Constructor & Destructor Documentation

InterpolationLogic::InterpolationLogic ( QObject parent = nullptr)
explicit

Constructs an InterpolationLogic.

Parameters
parentParent object

Member Function Documentation

void InterpolationLogic::backwardDurationChanged ( )
signal

Emitted when backwardDuration changes.

void InterpolationLogic::beginValueChanged ( )
signal

Emitted when beginValue changes.

void InterpolationLogic::endValueChanged ( )
signal

Emitted when endValue changes.

void InterpolationLogic::forwardDurationChanged ( )
signal

Emitted when forwardDuration changes.

float InterpolationLogic::getBackwardDuration ( ) const
inline

Returns backwardDuration.

QVariant InterpolationLogic::getBeginValue ( ) const
inline

Returns beginValue.

QVariant InterpolationLogic::getEndValue ( ) const
inline

Returns endValue.

float InterpolationLogic::getForwardDuration ( ) const
inline

Returns forwardDuration.

const QString& InterpolationLogic::getInterpolatingSound ( ) const
inline
float InterpolationLogic::getSmoothing ( ) const
inline

Returns smoothing.

State InterpolationLogic::getState ( ) const
inline

Returns state.

QObject* InterpolationLogic::getTarget ( ) const
inline

Returns target.

const QString& InterpolationLogic::getTargetProperty ( ) const
inline

Returns targetProperty.

virtual void InterpolationLogic::init ( )
overridevirtual

Resolves target and targetProperty.

Specifically, if targetProperty is of the form where it's prefixed by a period-separated list of sub-QObjects (e.g. target: actor15, property: body.width), this module makes the appropriate transformation to where it is no longer implicitly referencing these sub-QObjects (e.g. target: actor15.body, property: width. Furthermore, this function also compensates for the fact that targetProperty may have a non-QObject, non-primitive element of the list that needs to be part of the targetProperty. For instance, target: actor15, property: body.linearVelocity.x would be parsed to actor15.body, property: linearVelocity, with special handling for x sub-component.

Reimplemented from Logic.

void InterpolationLogic::interpolatingSoundChanged ( )
signal

Emitted when interpolatingSound changes.

void InterpolationLogic::setBackwardDuration ( float  value)

Sets backwardDuration.

Parameters
valueSeconds to set backwardDuration to
void InterpolationLogic::setBeginValue ( QVariant  value)

Sets beginValue.

Parameters
valueValue to set beginValue to
void InterpolationLogic::setEndValue ( QVariant  value)

Sets endValue.

Parameters
valueValue to set endValue to
void InterpolationLogic::setForwardDuration ( float  value)

Sets forwardDuration.

Parameters
valueSeconds to set forwardDuration to
void InterpolationLogic::setInterpolatingSound ( const QString value)

Sets interpolatingSound.

Parameters
valueString to set interpolatingSound to
void InterpolationLogic::setSmoothing ( float  value)

Sets smoothing.

Parameters
valueFactor to set smoothing to
void InterpolationLogic::setState ( State  value)

Sets state.

Parameters
valueState to set state to
void InterpolationLogic::setTarget ( QObject value)

Sets target.

Parameters
valueObject to set target to
void InterpolationLogic::setTargetProperty ( const QString value)

Sets targetProperty.

Parameters
valueString to set targetProperty to
void InterpolationLogic::smoothingChanged ( )
signal

Emitted when smoothing changes.

void InterpolationLogic::stateChanged ( )
signal

Emitted when state changes.

void InterpolationLogic::targetChanged ( )
signal

Emitted when target changes.

void InterpolationLogic::targetPropertyChanged ( )
signal

Emitted when targetProperty changes.

virtual void InterpolationLogic::update ( )
overridevirtual

Performs an Engine::TIME_STEP_S based step in the interpolation if state is not InterpolationLogic::Paused.

Reimplemented from Logic.

Property Documentation

float InterpolationLogic::backwardDuration
readwrite

Time, in seconds, over which to perform the InterpolationLogic::Backward interpolation.

QVariant InterpolationLogic::beginValue
readwrite

Value at which to start the interpolation of target's targetProperty.

QVariant InterpolationLogic::endValue
readwrite

Value at which to end the interpolation of target's targetProperty.

float InterpolationLogic::forwardDuration
readwrite

Time, in seconds, over which to perform the InterpolationLogic::Forward interpolation.

QString InterpolationLogic::interpolatingSound
readwrite

Name of sound asset to play and loop while interpolating.

float InterpolationLogic::smoothing
readwrite

Factor between linear and smooth interpolation.

0.0f is entirely linear interpolation, and 1.0f is entirely smooth (achieved via Util::smoothstep()), which gives the interpolation the strongest easing-in and out.

State InterpolationLogic::state
readwrite

Current state of the interpolation.

QObject InterpolationLogic::target
readwrite

Target object whose targetProperty value will be interpolated.

QString InterpolationLogic::targetProperty
readwrite

Q_PROPERTY of target whose value will be interpolated.