| 1 | #pragma once |
| 2 | |
| 3 | #include <basis/seadTypes.h> |
| 4 | #include <math/seadBoundBox.h> |
| 5 | #include <math/seadQuat.h> |
| 6 | #include <math/seadVector.h> |
| 7 | |
| 8 | namespace al { |
| 9 | enum class Axis : s32; |
| 10 | class PlacementInfo; |
| 11 | |
| 12 | class RollingCubePose { |
| 13 | public: |
| 14 | RollingCubePose(); |
| 15 | |
| 16 | bool isMovementRotate() const; |
| 17 | bool isMovementSlide() const; |
| 18 | void setCubeSize(const sead::BoundBox3f& cubeSize); |
| 19 | void calcNearPose(sead::Quatf* nearPose, const sead::Quatf& quat) const; |
| 20 | void fittingToBoundingBox(sead::Quatf* quat, sead::Vector3f* trans) const; |
| 21 | void calcBoundingBoxCenter(sead::Vector3f* center) const; |
| 22 | void calcBoundingBoxCenter(sead::Vector3f* center, const sead::Quatf& quat, |
| 23 | const sead::Vector3f& trans) const; |
| 24 | void setNextCubePose(const RollingCubePose* nextPose); |
| 25 | void calcBottomFacePoint(sead::Vector3f facePoints[4]) const; |
| 26 | void init(const PlacementInfo& placementInfo); |
| 27 | void calcRotateQT(sead::Quatf* outQuat, sead::Vector3f* outTrans, const sead::Quatf& quat, |
| 28 | const sead::Vector3f& trans, f32 rate) const; |
| 29 | Axis calcBottomFaceIndex() const; |
| 30 | |
| 31 | const PlacementInfo& getPlacementInfo() const { return *mPlacementInfo; } |
| 32 | |
| 33 | const sead::Quatf& getQuat() const { return mQuat; } |
| 34 | |
| 35 | const sead::Vector3f& getTrans() const { return mTrans; } |
| 36 | |
| 37 | const sead::BoundBox3f& getCubeSize() const { return mCubeSize; } |
| 38 | |
| 39 | const sead::Vector3f& getRotateAxis() const { return mRotateAxis; } |
| 40 | |
| 41 | const sead::Vector3f& getRotateCenter() const { return mRotateCenter; } |
| 42 | |
| 43 | f32 getRotateDegree() const { return mRotateDegree; } |
| 44 | |
| 45 | const sead::Vector3f& getSlideVec() const { return mSlideVec; } |
| 46 | |
| 47 | private: |
| 48 | enum class MovementType { None, Rotate, Slide }; |
| 49 | |
| 50 | PlacementInfo* mPlacementInfo = nullptr; |
| 51 | sead::Quatf mQuat = sead::Quatf::unit; |
| 52 | sead::Vector3f mTrans = sead::Vector3f::zero; |
| 53 | sead::BoundBox3f mCubeSize; |
| 54 | sead::Vector3f mRotateAxis = sead::Vector3f::zero; |
| 55 | sead::Vector3f mRotateCenter = sead::Vector3f::zero; |
| 56 | f32 mRotateDegree = 0.0f; |
| 57 | sead::Vector3f mSlideVec = sead::Vector3f::zero; |
| 58 | MovementType mMovementType = MovementType::Rotate; |
| 59 | }; |
| 60 | |
| 61 | } // namespace al |
| 62 | |