Leviathan  0.8.0.0
Leviathan game engine
Leviathan::Position Class Reference

Entity has position and direction it is looking at. More...

#include <Components.h>

+ Inheritance diagram for Leviathan::Position:

Classes

struct  Data
 

Public Types

using StateT = PositionState
 

Public Member Functions

 Position (const Data &data)
 Creates at specific position. More...
 
void GetPositionDataForPhysics (const Float3 *&position, const Float4 *&orientation) const override
 
void SetPositionDataFromPhysics (const Float3 &position, const Float4 &orientation) override
 
DLLEXPORT void ApplyState (const PositionState &state)
 Applies the state and marks this as changed. Doesn't check if the state is actually different. More...
 
 REFERENCE_HANDLE_UNCOUNTED_TYPE (Position)
 
- Public Member Functions inherited from Leviathan::ComponentWithStates< PositionState >
 ComponentWithStates (COMPONENT_TYPE type)
 
- Public Member Functions inherited from Leviathan::Component
 Component (COMPONENT_TYPE type)
 
 Component (const Component &)=delete
 
Componentoperator= (const Component &)=delete
 
- Public Member Functions inherited from Leviathan::PhysicsPositionProvider
DLLEXPORT ~PhysicsPositionProvider ()
 
DLLEXPORT void getWorldTransform (btTransform &worldTrans) const override final
 
DLLEXPORT void setWorldTransform (const btTransform &worldTrans) override final
 

Public Attributes

Data Members
 
- Public Attributes inherited from Leviathan::ComponentWithStates< PositionState >
bool StateMarked
 
float InterpolatingStartTime
 
int InterpolatingRemoteStartTick
 
PositionState * InterpolatingStartState
 
PositionState * InterpolatingEndState
 
- Public Attributes inherited from Leviathan::Component
bool Marked
 
const COMPONENT_TYPE Type
 Type of this component, used for network serialization. More...
 

Static Public Attributes

static constexpr auto TYPE = COMPONENT_TYPE::Position
 

Additional Inherited Members

- Protected Member Functions inherited from Leviathan::PhysicsPositionProvider
DLLEXPORT void _OnAttachBridge (PhysicsDataBridge *bridge)
 

Detailed Description

Entity has position and direction it is looking at.

Note
Any possible locking needs to be handled by the caller
Todo:
Initial position states should not be generated or initially sent data shouldn't have the state instead the first state would be guaranteed to be sent after it

Definition at line 34 of file Components.h.

Member Typedef Documentation

◆ StateT

using Leviathan::Position::StateT = PositionState

Definition at line 73 of file Components.h.

Constructor & Destructor Documentation

◆ Position()

Leviathan::Position::Position ( const Data data)
inline

Creates at specific position.

Definition at line 48 of file Components.h.

48 : ComponentWithStates(TYPE), Members(data) {}
static constexpr auto TYPE
Definition: Components.h:72

Member Function Documentation

◆ ApplyState()

DLLEXPORT void Position::ApplyState ( const PositionState &  state)

Applies the state and marks this as changed. Doesn't check if the state is actually different.

Definition at line 26 of file Components.cpp.

27 {
28  Members._Orientation = state._Orientation;
29  Members._Position = state._Position;
30  Marked = true;
31 }

◆ GetPositionDataForPhysics()

void Leviathan::Position::GetPositionDataForPhysics ( const Float3 *&  position,
const Float4 *&  orientation 
) const
inlineoverridevirtual

Implements Leviathan::PhysicsPositionProvider.

Definition at line 50 of file Components.h.

52  {
53  position = &Members._Position;
54  orientation = &Members._Orientation;
55  }

◆ REFERENCE_HANDLE_UNCOUNTED_TYPE()

Leviathan::Position::REFERENCE_HANDLE_UNCOUNTED_TYPE ( Position  )

◆ SetPositionDataFromPhysics()

void Leviathan::Position::SetPositionDataFromPhysics ( const Float3 position,
const Float4 orientation 
)
inlineoverridevirtual

Implements Leviathan::PhysicsPositionProvider.

Definition at line 57 of file Components.h.

58  {
59  Members._Position = position;
60  Members._Orientation = orientation;
61  Marked = true;
62  }

Member Data Documentation

◆ Members

Data Leviathan::Position::Members

Definition at line 70 of file Components.h.

◆ TYPE

constexpr auto Leviathan::Position::TYPE = COMPONENT_TYPE::Position
static

Definition at line 72 of file Components.h.


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