3#include "game/field/CourseColMgr.hh"
8ObjColMgr::ObjColMgr(
const void *file)
9 : m_mtx(
EGG::Matrix34f::ident), m_mtxInv(
EGG::Matrix34f::ident), m_kclScale(1.0f),
10 m_movingObjVel(
EGG::Vector3f::zero) {
11 m_data =
new KColData(file);
15ObjColMgr::~ObjColMgr() {
21void ObjColMgr::narrScLocal(f32 radius,
const EGG::Vector3f &pos, KCLTypeMask flags) {
23 CourseColMgr::Instance()->scaledNarrowScopeLocal(m_kclScale, radius, m_data, posWrtModel,
30 return m_mtx.ps_multVector(posLocal);
36 return m_mtx.ps_multVector(posLocal);
41 KCLTypeMask flags, CollisionInfoPartial *info, KCLTypeMask *typeMaskOut) {
43 bool hasPrevY = prevPos.y != std::numeric_limits<f32>::infinity();
44 EGG::Vector3f prevPosWrtModel = hasPrevY ? m_mtxInv.ps_multVector(prevPos) : EGG::Vector3f::inf;
45 auto *courseColMgr = CourseColMgr::Instance();
48 CollisionInfoPartial tempInfo;
49 tempInfo.bbox.setZero();
51 if (courseColMgr->noBounceWallInfo()) {
52 courseColMgr->setLocalMtx(&m_mtx);
55 if (courseColMgr->checkPointPartial(m_kclScale, m_data, posWrtModel, prevPosWrtModel, flags,
56 &tempInfo, typeMaskOut)) {
57 tempInfo.bbox.min = m_mtx.ps_multVector33(tempInfo.bbox.min);
58 tempInfo.bbox.max = m_mtx.ps_multVector33(tempInfo.bbox.max);
61 tempInfo.bbox.min = min.
minimize(tempInfo.bbox.max);
62 tempInfo.bbox.max = min.
maximize(tempInfo.bbox.max);
64 info->bbox.min = info->bbox.min.
minimize(tempInfo.bbox.min);
65 info->bbox.max = info->bbox.max.
maximize(tempInfo.bbox.max);
73 return courseColMgr->checkPointPartial(m_kclScale, m_data, posWrtModel, prevPosWrtModel, flags,
79 KCLTypeMask flags, CollisionInfoPartial *info, KCLTypeMask *typeMaskOut) {
81 bool hasPrevY = prevPos.y != std::numeric_limits<f32>::infinity();
82 EGG::Vector3f prevPosWrtModel = hasPrevY ? m_mtxInv.ps_multVector(prevPos) : EGG::Vector3f::inf;
83 auto *courseColMgr = CourseColMgr::Instance();
86 CollisionInfoPartial tempInfo;
87 tempInfo.bbox.setZero();
89 if (courseColMgr->noBounceWallInfo()) {
90 courseColMgr->setLocalMtx(&m_mtx);
93 if (courseColMgr->checkPointPartialPush(m_kclScale, m_data, posWrtModel, prevPosWrtModel,
94 flags, &tempInfo, typeMaskOut)) {
95 tempInfo.bbox.min = m_mtx.ps_multVector33(tempInfo.bbox.min);
96 tempInfo.bbox.max = m_mtx.ps_multVector33(tempInfo.bbox.max);
99 tempInfo.bbox.min = min.
minimize(tempInfo.bbox.max);
100 tempInfo.bbox.max = min.
maximize(tempInfo.bbox.max);
102 info->bbox.min = info->bbox.min.
minimize(tempInfo.bbox.min);
103 info->bbox.max = info->bbox.max.
maximize(tempInfo.bbox.max);
111 return courseColMgr->checkPointPartialPush(m_kclScale, m_data, posWrtModel, prevPosWrtModel,
112 flags, info, typeMaskOut);
117 KCLTypeMask flags, CollisionInfo *info, KCLTypeMask *typeMaskOut) {
119 bool hasPrevY = prevPos.y != std::numeric_limits<f32>::infinity();
120 EGG::Vector3f prevPosWrtModel = hasPrevY ? m_mtxInv.ps_multVector(prevPos) : EGG::Vector3f::inf;
121 auto *courseColMgr = CourseColMgr::Instance();
124 CollisionInfo tempInfo;
127 if (courseColMgr->noBounceWallInfo()) {
128 courseColMgr->setLocalMtx(&m_mtx);
131 if (courseColMgr->checkPointFull(m_kclScale, m_data, posWrtModel, prevPosWrtModel, flags,
132 &tempInfo, typeMaskOut)) {
133 info->transformInfo(tempInfo, m_mtx, m_movingObjVel);
141 return courseColMgr->checkPointFull(m_kclScale, m_data, posWrtModel, prevPosWrtModel, flags,
147 KCLTypeMask flags, CollisionInfo *info, KCLTypeMask *typeMaskOut) {
149 bool hasPrevY = prevPos.y != std::numeric_limits<f32>::infinity();
150 EGG::Vector3f prevPosWrtModel = hasPrevY ? m_mtxInv.ps_multVector(prevPos) : EGG::Vector3f::inf;
151 auto *courseColMgr = CourseColMgr::Instance();
154 CollisionInfo tempInfo;
157 if (courseColMgr->noBounceWallInfo()) {
158 courseColMgr->setLocalMtx(&m_mtx);
161 if (courseColMgr->checkPointFullPush(m_kclScale, m_data, posWrtModel, prevPosWrtModel,
162 flags, &tempInfo, typeMaskOut)) {
163 info->transformInfo(tempInfo, m_mtx, m_movingObjVel);
171 return courseColMgr->checkPointFullPush(m_kclScale, m_data, posWrtModel, prevPosWrtModel, flags,
176bool ObjColMgr::checkSpherePartial(f32 radius,
const EGG::Vector3f &pos,
177 const EGG::Vector3f &prevPos, KCLTypeMask flags, CollisionInfoPartial *info,
178 KCLTypeMask *typeMaskOut) {
180 bool hasPrevY = prevPos.y != std::numeric_limits<f32>::infinity();
181 EGG::Vector3f prevPosWrtModel = hasPrevY ? m_mtxInv.ps_multVector(prevPos) : EGG::Vector3f::inf;
182 auto *courseColMgr = CourseColMgr::Instance();
185 CollisionInfoPartial tempInfo;
186 tempInfo.bbox.setZero();
188 if (courseColMgr->noBounceWallInfo()) {
189 courseColMgr->setLocalMtx(&m_mtx);
192 if (courseColMgr->checkSpherePartial(m_kclScale, radius, m_data, posWrtModel,
193 prevPosWrtModel, flags, &tempInfo, typeMaskOut)) {
194 tempInfo.bbox.min = m_mtx.ps_multVector33(tempInfo.bbox.min);
195 tempInfo.bbox.max = m_mtx.ps_multVector33(tempInfo.bbox.max);
198 tempInfo.bbox.min = min.
minimize(tempInfo.bbox.max);
199 tempInfo.bbox.max = min.
maximize(tempInfo.bbox.max);
201 info->bbox.min = info->bbox.min.
minimize(tempInfo.bbox.min);
202 info->bbox.max = info->bbox.max.
maximize(tempInfo.bbox.max);
210 return courseColMgr->checkSpherePartial(m_kclScale, radius, m_data, posWrtModel,
211 prevPosWrtModel, flags, info, typeMaskOut);
215bool ObjColMgr::checkSpherePartialPush(f32 radius,
const EGG::Vector3f &pos,
216 const EGG::Vector3f &prevPos, KCLTypeMask flags, CollisionInfoPartial *info,
217 KCLTypeMask *typeMaskOut) {
219 bool hasPrevY = prevPos.y != std::numeric_limits<f32>::infinity();
220 EGG::Vector3f prevPosWrtModel = hasPrevY ? m_mtxInv.ps_multVector(prevPos) : EGG::Vector3f::inf;
221 auto *courseColMgr = CourseColMgr::Instance();
224 CollisionInfoPartial tempInfo;
225 tempInfo.bbox.setZero();
227 if (courseColMgr->noBounceWallInfo()) {
228 courseColMgr->setLocalMtx(&m_mtx);
231 if (courseColMgr->checkSpherePartialPush(m_kclScale, radius, m_data, posWrtModel,
232 prevPosWrtModel, flags, &tempInfo, typeMaskOut)) {
233 tempInfo.bbox.min = m_mtx.ps_multVector33(tempInfo.bbox.min);
234 tempInfo.bbox.max = m_mtx.ps_multVector33(tempInfo.bbox.max);
237 tempInfo.bbox.min = min.
minimize(tempInfo.bbox.max);
238 tempInfo.bbox.max = min.
maximize(tempInfo.bbox.max);
240 info->bbox.min = info->bbox.min.
minimize(tempInfo.bbox.min);
241 info->bbox.max = info->bbox.max.
maximize(tempInfo.bbox.max);
249 return courseColMgr->checkSpherePartialPush(m_kclScale, radius, m_data, posWrtModel,
250 prevPosWrtModel, flags, info, typeMaskOut);
255 KCLTypeMask flags, CollisionInfo *info, KCLTypeMask *typeMaskOut) {
257 bool hasPrevY = prevPos.y != std::numeric_limits<f32>::infinity();
258 EGG::Vector3f prevPosWrtModel = hasPrevY ? m_mtxInv.ps_multVector(prevPos) : EGG::Vector3f::inf;
259 auto *courseColMgr = CourseColMgr::Instance();
262 CollisionInfo tempInfo;
265 if (courseColMgr->noBounceWallInfo()) {
266 courseColMgr->setLocalMtx(&m_mtx);
269 if (courseColMgr->checkSphereFull(m_kclScale, radius, m_data, posWrtModel, prevPosWrtModel,
270 flags, &tempInfo, typeMaskOut)) {
271 info->transformInfo(tempInfo, m_mtx, m_movingObjVel);
279 return courseColMgr->checkSphereFull(m_kclScale, radius, m_data, posWrtModel, prevPosWrtModel,
280 flags, info, typeMaskOut);
284bool ObjColMgr::checkSphereFullPush(f32 radius,
const EGG::Vector3f &pos,
285 const EGG::Vector3f &prevPos, KCLTypeMask flags, CollisionInfo *info,
286 KCLTypeMask *typeMaskOut) {
288 bool hasPrevY = prevPos.y != std::numeric_limits<f32>::infinity();
289 EGG::Vector3f prevPosWrtModel = hasPrevY ? m_mtxInv.ps_multVector(prevPos) : EGG::Vector3f::inf;
290 auto *courseColMgr = CourseColMgr::Instance();
293 CollisionInfo tempInfo;
296 if (courseColMgr->noBounceWallInfo()) {
297 courseColMgr->setLocalMtx(&m_mtx);
300 if (courseColMgr->checkSphereFullPush(m_kclScale, radius, m_data, posWrtModel,
301 prevPosWrtModel, flags, &tempInfo, typeMaskOut)) {
302 info->transformInfo(tempInfo, m_mtx, m_movingObjVel);
310 return courseColMgr->checkSphereFullPush(m_kclScale, radius, m_data, posWrtModel,
311 prevPosWrtModel, flags, info, typeMaskOut);
316 KCLTypeMask flags, CollisionInfoPartial *info, KCLTypeMask *typeMaskOut) {
317 if (m_data->prismCache(0) == 0) {
322 bool hasPrevY = prevPos.y != std::numeric_limits<f32>::infinity();
323 EGG::Vector3f prevPosWrtModel = hasPrevY ? m_mtxInv.ps_multVector(prevPos) : EGG::Vector3f::inf;
324 auto *courseColMgr = CourseColMgr::Instance();
327 CollisionInfoPartial tempInfo;
328 tempInfo.bbox.setZero();
330 if (courseColMgr->noBounceWallInfo()) {
331 courseColMgr->setLocalMtx(&m_mtx);
334 if (courseColMgr->checkPointCachedPartial(m_kclScale, m_data, posWrtModel, prevPosWrtModel,
335 flags, &tempInfo, typeMaskOut)) {
336 tempInfo.bbox.min = m_mtx.ps_multVector33(tempInfo.bbox.min);
337 tempInfo.bbox.max = m_mtx.ps_multVector33(tempInfo.bbox.max);
340 tempInfo.bbox.min = min.
minimize(tempInfo.bbox.max);
341 tempInfo.bbox.max = min.
maximize(tempInfo.bbox.max);
343 info->bbox.min = info->bbox.min.
minimize(tempInfo.bbox.min);
344 info->bbox.max = info->bbox.max.
maximize(tempInfo.bbox.max);
352 return courseColMgr->checkPointCachedPartial(m_kclScale, m_data, posWrtModel, prevPosWrtModel,
353 flags, info, typeMaskOut);
358 KCLTypeMask flags, CollisionInfoPartial *info, KCLTypeMask *typeMaskOut) {
359 if (m_data->prismCache(0) == 0) {
364 bool hasPrevY = prevPos.y != std::numeric_limits<f32>::infinity();
365 EGG::Vector3f prevPosWrtModel = hasPrevY ? m_mtxInv.ps_multVector(prevPos) : EGG::Vector3f::inf;
366 auto *courseColMgr = CourseColMgr::Instance();
369 CollisionInfoPartial tempInfo;
370 tempInfo.bbox.setZero();
372 if (courseColMgr->noBounceWallInfo()) {
373 courseColMgr->setLocalMtx(&m_mtx);
376 if (courseColMgr->checkPointCachedPartialPush(m_kclScale, m_data, posWrtModel,
377 prevPosWrtModel, flags, &tempInfo, typeMaskOut)) {
378 tempInfo.bbox.min = m_mtx.ps_multVector33(tempInfo.bbox.min);
379 tempInfo.bbox.max = m_mtx.ps_multVector33(tempInfo.bbox.max);
382 tempInfo.bbox.min = min.
minimize(tempInfo.bbox.max);
383 tempInfo.bbox.max = min.
maximize(tempInfo.bbox.max);
385 info->bbox.min = info->bbox.min.
minimize(tempInfo.bbox.min);
386 info->bbox.max = info->bbox.max.
maximize(tempInfo.bbox.max);
394 return courseColMgr->checkPointCachedPartialPush(m_kclScale, m_data, posWrtModel,
395 prevPosWrtModel, flags, info, typeMaskOut);
400 KCLTypeMask flags, CollisionInfo *info, KCLTypeMask *typeMaskOut) {
401 if (m_data->prismCache(0) == 0) {
406 bool hasPrevY = prevPos.y != std::numeric_limits<f32>::infinity();
407 EGG::Vector3f prevPosWrtModel = hasPrevY ? m_mtxInv.ps_multVector(prevPos) : EGG::Vector3f::inf;
408 auto *courseColMgr = CourseColMgr::Instance();
411 CollisionInfo tempInfo;
414 if (courseColMgr->noBounceWallInfo()) {
415 courseColMgr->setLocalMtx(&m_mtx);
418 if (courseColMgr->checkPointCachedFull(m_kclScale, m_data, posWrtModel, prevPosWrtModel,
419 flags, &tempInfo, typeMaskOut)) {
420 info->transformInfo(tempInfo, m_mtx, m_movingObjVel);
428 return courseColMgr->checkPointCachedFull(m_kclScale, m_data, posWrtModel, prevPosWrtModel,
429 flags, info, typeMaskOut);
434 KCLTypeMask flags, CollisionInfo *info, KCLTypeMask *typeMaskOut) {
435 if (m_data->prismCache(0) == 0) {
440 bool hasPrevY = prevPos.y != std::numeric_limits<f32>::infinity();
441 EGG::Vector3f prevPosWrtModel = hasPrevY ? m_mtxInv.ps_multVector(prevPos) : EGG::Vector3f::inf;
442 auto *courseColMgr = CourseColMgr::Instance();
445 CollisionInfo tempInfo;
448 if (courseColMgr->noBounceWallInfo()) {
449 courseColMgr->setLocalMtx(&m_mtx);
452 if (courseColMgr->checkPointCachedFullPush(m_kclScale, m_data, posWrtModel, prevPosWrtModel,
453 flags, &tempInfo, typeMaskOut)) {
454 info->transformInfo(tempInfo, m_mtx, m_movingObjVel);
462 return courseColMgr->checkPointCachedFullPush(m_kclScale, m_data, posWrtModel, prevPosWrtModel,
463 flags, info, typeMaskOut);
467bool ObjColMgr::checkSphereCachedPartial(f32 radius,
const EGG::Vector3f &pos,
468 const EGG::Vector3f &prevPos, KCLTypeMask typeflags, CollisionInfoPartial *info,
469 KCLTypeMask *typeMaskOut) {
470 if (m_data->prismCache(0) == 0) {
475 bool hasPrevY = prevPos.y != std::numeric_limits<f32>::infinity();
476 EGG::Vector3f prevPosWrtModel = hasPrevY ? m_mtxInv.ps_multVector(prevPos) : EGG::Vector3f::inf;
477 auto *courseColMgr = CourseColMgr::Instance();
480 CollisionInfoPartial tempInfo;
481 tempInfo.bbox.setZero();
483 if (courseColMgr->noBounceWallInfo()) {
484 courseColMgr->setLocalMtx(&m_mtx);
487 if (courseColMgr->checkSphereCachedPartial(m_kclScale, radius, m_data, posWrtModel,
488 prevPosWrtModel, typeflags, &tempInfo, typeMaskOut)) {
489 tempInfo.bbox.min = m_mtx.ps_multVector33(tempInfo.bbox.min);
490 tempInfo.bbox.max = m_mtx.ps_multVector33(tempInfo.bbox.max);
493 tempInfo.bbox.min = min.
minimize(tempInfo.bbox.max);
494 tempInfo.bbox.max = min.
maximize(tempInfo.bbox.max);
496 info->bbox.min = info->bbox.min.
minimize(tempInfo.bbox.min);
497 info->bbox.max = info->bbox.max.
maximize(tempInfo.bbox.max);
505 return courseColMgr->checkSphereCachedPartial(m_kclScale, radius, m_data, posWrtModel,
506 prevPosWrtModel, typeflags, info, typeMaskOut);
510bool ObjColMgr::checkSphereCachedPartialPush(f32 radius,
const EGG::Vector3f &pos,
511 const EGG::Vector3f &prevPos, KCLTypeMask typeflags, CollisionInfoPartial *info,
512 KCLTypeMask *typeMaskOut) {
513 if (m_data->prismCache(0) == 0) {
518 bool hasPrevY = prevPos.y != std::numeric_limits<f32>::infinity();
519 EGG::Vector3f prevPosWrtModel = hasPrevY ? m_mtxInv.ps_multVector(prevPos) : EGG::Vector3f::inf;
520 auto *courseColMgr = CourseColMgr::Instance();
523 CollisionInfoPartial tempInfo;
524 tempInfo.bbox.setZero();
526 if (courseColMgr->noBounceWallInfo()) {
527 courseColMgr->setLocalMtx(&m_mtx);
530 if (courseColMgr->checkSphereCachedPartialPush(m_kclScale, radius, m_data, posWrtModel,
531 prevPosWrtModel, typeflags, &tempInfo, typeMaskOut)) {
532 tempInfo.bbox.min = m_mtx.ps_multVector33(tempInfo.bbox.min);
533 tempInfo.bbox.max = m_mtx.ps_multVector33(tempInfo.bbox.max);
536 tempInfo.bbox.min = min.
minimize(tempInfo.bbox.max);
537 tempInfo.bbox.max = min.
maximize(tempInfo.bbox.max);
539 info->bbox.min = info->bbox.min.
minimize(tempInfo.bbox.min);
540 info->bbox.max = info->bbox.max.
maximize(tempInfo.bbox.max);
548 return courseColMgr->checkSphereCachedPartialPush(m_kclScale, radius, m_data, posWrtModel,
549 prevPosWrtModel, typeflags, info, typeMaskOut);
553bool ObjColMgr::checkSphereCachedFull(f32 radius,
const EGG::Vector3f &pos,
554 const EGG::Vector3f &prevPos, KCLTypeMask typeflags, CollisionInfo *info,
555 KCLTypeMask *typeMaskOut) {
556 if (m_data->prismCache(0) == 0) {
561 bool hasPrevY = prevPos.y != std::numeric_limits<f32>::infinity();
562 EGG::Vector3f prevPosWrtModel = hasPrevY ? m_mtxInv.ps_multVector(prevPos) : EGG::Vector3f::inf;
563 auto *courseColMgr = CourseColMgr::Instance();
566 CollisionInfo tempInfo;
569 if (courseColMgr->noBounceWallInfo()) {
570 courseColMgr->setLocalMtx(&m_mtx);
573 if (courseColMgr->checkSphereCachedFull(m_kclScale, radius, m_data, posWrtModel,
574 prevPosWrtModel, typeflags, &tempInfo, typeMaskOut)) {
575 info->transformInfo(tempInfo, m_mtx, m_movingObjVel);
583 return courseColMgr->checkSphereCachedFull(m_kclScale, radius, m_data, posWrtModel,
584 prevPosWrtModel, typeflags, info, typeMaskOut);
588bool ObjColMgr::checkSphereCachedFullPush(f32 radius,
const EGG::Vector3f &pos,
589 const EGG::Vector3f &prevPos, KCLTypeMask typeflags, CollisionInfo *info,
590 KCLTypeMask *typeMaskOut) {
591 if (m_data->prismCache(0) == 0) {
596 bool hasPrevY = prevPos.y != std::numeric_limits<f32>::infinity();
597 EGG::Vector3f prevPosWrtModel = hasPrevY ? m_mtxInv.ps_multVector(prevPos) : EGG::Vector3f::inf;
598 auto *courseColMgr = CourseColMgr::Instance();
601 CollisionInfo tempInfo;
604 if (courseColMgr->noBounceWallInfo()) {
605 courseColMgr->setLocalMtx(&m_mtx);
608 if (courseColMgr->checkSphereCachedFullPush(m_kclScale, radius, m_data, posWrtModel,
609 prevPosWrtModel, typeflags, &tempInfo, typeMaskOut)) {
610 info->transformInfo(tempInfo, m_mtx, m_movingObjVel);
618 return courseColMgr->checkSphereCachedFullPush(m_kclScale, radius, m_data, posWrtModel,
619 prevPosWrtModel, typeflags, info, typeMaskOut);
Vector3f maximize(const Vector3f &rhs) const
Returns a vector whose elements are the max of the elements of both vectors.
Vector3f minimize(const Vector3f &rhs) const
Returns a vector whose elements are the min of the elements of both vectors.