summaryrefslogtreecommitdiffstats
path: root/game/code/worldsim/groundplanepool.h
blob: ca93e33ce03437fb7981aadc11061a10d4a74c91 (plain) (blame)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//=============================================================================
// Copyright (C) 2002 Radical Entertainment Ltd.  All rights reserved.
//
// File:        groundplanepool.h
//
// Description: manage pool of ground planes for dynamic physics objects
//
// History:     July 31, 2002 - created, gmayer
//
//=============================================================================

#ifndef GROUNDPLANEPOOL_H
#define GROUNDPLANEPOOL_H

//========================================
// Nested Includes
//========================================

#include <simcommon/simstate.hpp>

//========================================
// Forward References
//========================================


// note to self: maybe vehicles should use this?

class GroundPlanePool
{
public:

    GroundPlanePool(int num);   // how big the pool should be
    ~GroundPlanePool();
    
    //sim::ManualSimState* GetNewGroundPlane();
    
    //int GetNewGroundPlane();    // user refers to it with the returned index
    
    int GetNewGroundPlane(sim::SimState* simStateOwner);
    
    
    void UpdateGroundPlane(int index, rmt::Vector& position, rmt::Vector& normal);
    void FreeGroundPlane(int index);
    bool FreeAllGroundPlanes(); // returns false if there was a problem...

    sim::ManualSimState* GetSimState(int index);
    //sim::SimState* GetSimState(int index);
    
    void EnableCollision(int index);
    void DisableCollision(int index);


private:

    int mTotalNum;
    sim::ManualSimState** mPool;
    //sim::SimState** mPool;

    bool* mInUse;
    
    
    sim::SimState** mSimStateOwners;

    // to save memory, and potentially have more control over the values
    sim::PhysicsProperties* mGroundPlanePhysicsProperties;
            

};

         
#endif //GROUNDPLANEPOOL_H