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 51 of file PhysicsBody.h.

Constructor & Destructor Documentation

◆ PhysicsDataBridge()

DLLEXPORT PhysicsDataBridge::PhysicsDataBridge ( PhysicsPositionProvider provider)

Definition at line 353 of file PhysicsBody.cpp.

354 {
355  if(provider) {
356  AttachedProvider = provider;
357  AttachedProvider->_OnAttachBridge(this);
358  }
359 }
DLLEXPORT void _OnAttachBridge(PhysicsDataBridge *bridge)

◆ ~PhysicsDataBridge()

DLLEXPORT PhysicsDataBridge::~PhysicsDataBridge ( )

Definition at line 361 of file PhysicsBody.cpp.

362 {
363  if(AttachedProvider) {
364 
365  // This calls _OnDetachBridge on us
366  AttachedProvider->_OnAttachBridge(nullptr);
367  }
368 }
DLLEXPORT void _OnAttachBridge(PhysicsDataBridge *bridge)

Member Function Documentation

◆ _OnDetachBridge()

DLLEXPORT void PhysicsDataBridge::_OnDetachBridge ( PhysicsPositionProvider provider)
protected

Definition at line 370 of file PhysicsBody.cpp.

371 {
372  if(AttachedProvider == provider) {
373  AttachedProvider = nullptr;
374  } else {
375  LOG_ERROR("PhysicsDataBridge: wrong provider called _OnDetachBridge, expected: " +
376  Convert::ToHexadecimalString(AttachedProvider) +
377  " got: " + Convert::ToHexadecimalString(provider));
378  }
379 }
#define LOG_ERROR(x)
Definition: Define.h:96
static std::string ToHexadecimalString(const T &val)
Definition: Convert.h:93

◆ GetDataSource()

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

Definition at line 58 of file PhysicsBody.h.

59  {
60  return AttachedProvider;
61  }

◆ getWorldTransform()

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

Definition at line 381 of file PhysicsBody.cpp.

382 {
383  if(AttachedProvider)
384  AttachedProvider->getWorldTransform(worldTrans);
385 }
DLLEXPORT void getWorldTransform(btTransform &worldTrans) const override final

◆ setWorldTransform()

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

Definition at line 387 of file PhysicsBody.cpp.

388 {
389  if(AttachedProvider)
390  AttachedProvider->setWorldTransform(worldTrans);
391 }
DLLEXPORT void setWorldTransform(const btTransform &worldTrans) override final

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