summaryrefslogtreecommitdiff
path: root/src/KingSystem/Physics/System/physRayCastForRequest.h
blob: f5e68ad807196032872ae17b615e000a31265c48 (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 <container/seadTList.h>
#include "KingSystem/Physics/System/physRayCast.h"
#include "KingSystem/Utils/Types.h"

namespace ksys::phys {

class RayCastRequestMgr;

/// A RayCast that is used by RayCastRequestMgr to process raycast requests.
class RayCastForRequest : public RayCast {
    SEAD_RTTI_OVERRIDE(RayCastForRequest, RayCast)
public:
    static RayCastForRequest* allocRequest(SystemGroupHandler* group_handler = nullptr,
                                           GroundHit ground_hit = GroundHit::HitAll);

    explicit RayCastForRequest(RayCastRequestMgr* mgr);
    ~RayCastForRequest() override;

    bool submitRequest(ContactLayerType layer_type);
    bool isRequestQueued() const;
    bool isRequestFinished() const;

    /// This must be called after you're finished using this RayCast.
    void release();

private:
    friend class RayCastRequestMgr;

    RayCastRequestMgr* mMgr{};
    sead::TListNode<RayCastForRequest*> mListNode{this};
    ContactLayerType mRequestContactLayerType = ContactLayerType::Entity;
};

}  // namespace ksys::phys