Leviathan  0.8.0.0
Leviathan game engine
Leviathan::PhysicsDataBridge Class Reference

This is an indirection helper for allowing world entities to detach from physics objects if they get destroyed. More...

#include <PhysicsBody.h>

+ Inheritance diagram for Leviathan::PhysicsDataBridge:

Public Member Functions

DLLEXPORT PhysicsDataBridge (PhysicsPositionProvider *provider)
 
DLLEXPORT ~PhysicsDataBridge ()
 
auto GetDataSource () const
 
DLLEXPORT void getWorldTransform (btTransform &worldTrans) const override final
 
DLLEXPORT void setWorldTransform (const btTransform &worldTrans) override final
 

Protected Member Functions

DLLEXPORT void _OnDetachBridge (PhysicsPositionProvider *provider)
 

Detailed Description

This is an indirection helper for allowing world entities to detach from physics objects if they get destroyed.

Definition at line 49 of file PhysicsBody.h.

Constructor & Destructor Documentation

◆ PhysicsDataBridge()

DLLEXPORT PhysicsDataBridge::PhysicsDataBridge ( PhysicsPositionProvider provider)

Definition at line 334 of file PhysicsBody.cpp.

335 {
336  if(provider) {
337  AttachedProvider = provider;
338  AttachedProvider->_OnAttachBridge(this);
339  }
340 }
DLLEXPORT void _OnAttachBridge(PhysicsDataBridge *bridge)

◆ ~PhysicsDataBridge()

DLLEXPORT PhysicsDataBridge::~PhysicsDataBridge ( )

Definition at line 342 of file PhysicsBody.cpp.

343 {
344  if(AttachedProvider) {
345 
346  // This calls _OnDetachBridge on us
347  AttachedProvider->_OnAttachBridge(nullptr);
348  }
349 }
DLLEXPORT void _OnAttachBridge(PhysicsDataBridge *bridge)

Member Function Documentation

◆ _OnDetachBridge()

DLLEXPORT void PhysicsDataBridge::_OnDetachBridge ( PhysicsPositionProvider provider)
protected

Definition at line 351 of file PhysicsBody.cpp.

352 {
353  if(AttachedProvider == provider) {
354  AttachedProvider = nullptr;
355  } else {
356  LOG_ERROR("PhysicsDataBridge: wrong provider called _OnDetachBridge, expected: " +
357  Convert::ToHexadecimalString(AttachedProvider) +
358  " got: " + Convert::ToHexadecimalString(provider));
359  }
360 }
#define LOG_ERROR(x)
Definition: Define.h:83
static std::string ToHexadecimalString(const T &val)
Definition: Convert.h:93

◆ GetDataSource()

auto Leviathan::PhysicsDataBridge::GetDataSource ( ) const
inline

Definition at line 56 of file PhysicsBody.h.

57  {
58  return AttachedProvider;
59  }

◆ getWorldTransform()

DLLEXPORT void PhysicsDataBridge::getWorldTransform ( btTransform &  worldTrans) const
finaloverride

Definition at line 362 of file PhysicsBody.cpp.

363 {
364  if(AttachedProvider)
365  AttachedProvider->getWorldTransform(worldTrans);
366 }
DLLEXPORT void getWorldTransform(btTransform &worldTrans) const override final

◆ setWorldTransform()

DLLEXPORT void PhysicsDataBridge::setWorldTransform ( const btTransform &  worldTrans)
finaloverride

Definition at line 368 of file PhysicsBody.cpp.

369 {
370  if(AttachedProvider)
371  AttachedProvider->setWorldTransform(worldTrans);
372 }
DLLEXPORT void setWorldTransform(const btTransform &worldTrans) override final

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