source: trunk/test/Physics/Src/EasyConstraint.cpp @ 1748

Last change on this file since 1748 was 1748, checked in by touky, 8 years ago

Small .h & .cpp refactor

File size: 1.4 KB
Line 
1//
2// Lol Engine
3//
4// Copyright: (c) 2010-2012 Sam Hocevar <sam@hocevar.net>
5//            (c) 2009-2012 Cédric Lecacheur <jordx@free.fr>
6//            (c) 2009-2012 Benjamin Huet <huet.benjamin@gmail.com>
7//   This program is free software; you can redistribute it and/or
8//   modify it under the terms of the Do What The Fuck You Want To
9//   Public License, Version 2, as published by Sam Hocevar. See
10//   http://sam.zoy.org/projects/COPYING.WTFPL for more details.
11//
12
13#if defined HAVE_CONFIG_H
14#   include "config.h"
15#endif
16
17#ifdef HAVE_PHYS_USE_BULLET
18#include "../Include/EasyConstraint.h"
19#endif //HAVE_PHYS_USE_BULLET
20
21namespace lol
22{
23
24namespace phys
25{
26
27#ifdef HAVE_PHYS_USE_BULLET
28
29//-------------------------------------------------------------------------
30//EASY_CONSTRAINT
31//--
32
33void EasyConstraint::AddToSimulation(class Simulation* current_simulation)
34{
35        btDiscreteDynamicsWorld* dynamics_world = current_simulation->GetWorld();
36        if (dynamics_world && m_typed_constraint)
37        {
38                dynamics_world->addConstraint(m_typed_constraint, m_disable_a2b_collision);
39                current_simulation->AddToConstraint(this);
40        }
41}
42
43void EasyConstraint::RemoveFromSimulation(class Simulation* current_simulation)
44{
45        btDiscreteDynamicsWorld* dynamics_world = current_simulation->GetWorld();
46        if (dynamics_world, m_typed_constraint)
47                dynamics_world->removeConstraint(m_typed_constraint);
48}
49
50#endif // HAVE_PHYS_USE_BULLET
51
52} /* namespace phys */
53
54} /* namespace lol */
Note: See TracBrowser for help on using the repository browser.