aboutsummaryrefslogtreecommitdiff
path: root/Client/Source/Phy2DLite/World.h
blob: 63bd9834c8b89f7a71c2a4b77e1f0a3421bd549d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma once

#include <vector>
#include <map>
#include "Math.h"
#include "Arbiter.h"

namespace Phy2D
{

    struct Body;
    struct Joint;

    struct World
    {
        World(Vec2 gravity, int iterations) : gravity(gravity), iterations(iterations) {}

        void Add(Body* body);
        void Add(Joint* joint);
        void Clear();

        void Step(number dt);

        void BroadPhase();

        std::vector<Body*> bodies;
        std::vector<Joint*> joints;
        std::map<ArbiterKey, Arbiter> arbiters;
        Vec2 gravity;
        int iterations;
        static bool accumulateImpulses;
        static bool warmStarting;
        static bool positionCorrection;
    };

}