Leviathan  0.8.0.0
Leviathan game engine
Leviathan::PositionComponentState Class Reference

State for Position without a Physics. More...

#include <CommonStateObjects.h>

+ Inheritance diagram for Leviathan::PositionComponentState:

Public Member Functions

DLLEXPORT void Interpolate (Position &target, PositionComponentState &other, float progress)
 Interpolates the target component between this state and the other state. More...
 
- Public Member Functions inherited from Leviathan::ComponentState
 ComponentState (int32_t tick, COMPONENT_TYPE componenttype)
 
virtual ~ComponentState ()
 
virtual DLLEXPORT void CreateUpdatePacket (ComponentState *olderstate, sf::Packet &packet)=0
 Adds update data to a packet. More...
 
virtual DLLEXPORT bool FillMissingData (ComponentState &otherstate)=0
 Copies data to missing values in this state from another state. More...
 
 ComponentState (const ComponentState &other)=delete
 
void operator= (const ComponentState &other)=delete
 

Public Attributes

Member< Float3_Position
 
Member< Float4_Rotation
 
- Public Attributes inherited from Leviathan::ComponentState
const int32_t Tick
 The tick this delta state matches. More...
 
const COMPONENT_TYPE ComponentType
 

Additional Inherited Members

- Public Types inherited from Leviathan::ComponentState
template<typename T >
using Member = PotentiallyUpdatedValue< T >
 

Detailed Description

State for Position without a Physics.

Definition at line 40 of file CommonStateObjects.h.

Member Function Documentation

◆ Interpolate()

DLLEXPORT void PositionComponentState::Interpolate ( Position target,
PositionComponentState other,
float  progress 
)

Interpolates the target component between this state and the other state.

The other state needs to be the more up to date one and progres HAS to be between 0.f and 1.f indicating the progress between the states.

Note
This may not be missing any values, if this is missing values before the call this can be filled directly from the component

Definition at line 82 of file CommonStateObjects.cpp.

84 {
85  Float3 pos = StateHelper::Interpolate(_Position, other._Position, progress);
87 
88  target.Members._Position = pos;
89  target.Members._Orientation = rot;
90 
91  target.Marked = true;
92 }
static DLLEXPORT Float4 InterpolateQuoternion(Member< Float4 > &first, Member< Float4 > &second, float progress)
static DLLEXPORT Float3 Interpolate(Member< Float3 > &first, Member< Float3 > &second, float progress)

Member Data Documentation

◆ _Position

Member<Float3> Leviathan::PositionComponentState::_Position

Definition at line 46 of file CommonStateObjects.h.

◆ _Rotation

Member<Float4> Leviathan::PositionComponentState::_Rotation

Definition at line 47 of file CommonStateObjects.h.


The documentation for this class was generated from the following files: