diff options
| author | Léo Lam <leo@leolam.fr> | 2022-03-21 00:45:06 +0100 |
|---|---|---|
| committer | Léo Lam <leo@leolam.fr> | 2022-03-21 03:00:36 +0100 |
| commit | ec37bc00181e69a88a410e2807d5f560bae81529 (patch) | |
| tree | 1ba1830c665f547c1720ef296d94486fa4b5bb72 /src/KingSystem/Physics/System/physRayCastForRequest.h | |
| parent | 509d557731ce02136f79026ce1e1d5683c93876f (diff) | |
ksys/phys: Add RayCastRequestMgr
Diffstat (limited to 'src/KingSystem/Physics/System/physRayCastForRequest.h')
| -rw-r--r-- | src/KingSystem/Physics/System/physRayCastForRequest.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/KingSystem/Physics/System/physRayCastForRequest.h b/src/KingSystem/Physics/System/physRayCastForRequest.h new file mode 100644 index 00000000..f5e68ad8 --- /dev/null +++ b/src/KingSystem/Physics/System/physRayCastForRequest.h @@ -0,0 +1,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 |
