summaryrefslogtreecommitdiff
path: root/lib/hkStubs/Havok/Physics2012/Collide/Shape/Query/hkpShapeRayCastOutput.h
blob: 8ab574eee2c1262da78bf378f11b430e9cbe5947 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#pragma once

#include <Havok/Physics2012/Collide/Shape/Query/hkpShapeRayCastCollectorOutput.h>
#include <Havok/Physics2012/Collide/Shape/hkpShape.h>
#include <Havok/Physics2012/Collide/Shape/hkpShapeBase.h>

struct hkpShapeRayCastOutput : public hkpShapeRayCastCollectorOutput {
    HK_DECLARE_CLASS_ALLOCATOR(hkpShapeRayCastOutput)

    static constexpr int MAX_HIERARCHY_DEPTH = 8;

    HK_FORCE_INLINE hkpShapeRayCastOutput();

    HK_FORCE_INLINE void changeLevel(int delta);
    HK_FORCE_INLINE void setKey(hkpShapeKey key);
    HK_FORCE_INLINE int getLevel() const;

    HK_FORCE_INLINE void reset();

    hkpShapeKey m_shapeKeys[MAX_HIERARCHY_DEPTH];

private:
    HK_FORCE_INLINE void _reset();

    int m_shapeKeyIndex;
};

inline hkpShapeRayCastOutput::hkpShapeRayCastOutput() {
    _reset();
}

inline void hkpShapeRayCastOutput::changeLevel(int delta) {
    m_shapeKeyIndex += delta;
}

inline void hkpShapeRayCastOutput::setKey(hkpShapeKey key) {
    m_shapeKeys[m_shapeKeyIndex] = key;
}

inline int hkpShapeRayCastOutput::getLevel() const {
    return m_shapeKeyIndex;
}

inline void hkpShapeRayCastOutput::reset() {
    hkpShapeRayCastCollectorOutput::reset();
    _reset();
}

inline void hkpShapeRayCastOutput::_reset() {
    m_shapeKeyIndex = 0;
    m_shapeKeys[0] = HK_INVALID_SHAPE_KEY;
}