#include <KColData.hh>
Performs lookups for KCL triangles.
Definition at line 68 of file KColData.hh.
Classes | |
| struct | KCollisionPrism |
| struct | KCollisionPrismGeometry |
| Stores the vertex, height and normals of a collision prism. More... | |
Public Types | |
| enum class | CollisionCheckType { Edge , Plane , Movement } |
Public Member Functions | |
| STATIC_ASSERT (sizeof(KCollisionPrism)==0x10) | |
| STATIC_ASSERT (sizeof(KCollisionPrismGeometry)==0x40) | |
| KColData (const void *file) | |
| void | narrowScopeLocal (const EGG::Vector3f &pos, f32 radius, KCLTypeMask mask) |
| void | narrowPolygon_EachBlock (const u16 *prismArray) |
| void | computeBBox () |
| Calculates a EGG::BoundBox3f that describes the boundary of the track's KCL. | |
| bool | checkPointCollision (f32 *distOut, EGG::Vector3f *fnrmOut, u16 *flagsOut) |
| bool | checkSphereCollision (f32 *distOut, EGG::Vector3f *fnrmOut, u16 *flagsOut) |
| bool | checkSphere (f32 *distOut, EGG::Vector3f *fnrmOut, u16 *flagsOut) |
| Iterates the list of looked-up triangles to see if we are colliding. | |
| bool | checkSphereSingle (f32 *distOut, EGG::Vector3f *fnrmOut, u16 *flagsOut) |
| void | lookupPoint (const EGG::Vector3f &pos, const EGG::Vector3f &prevPos, KCLTypeMask typeMask) |
| Sets members in preparation of a subsequent point collision check call. | |
| void | lookupSphere (f32 radius, const EGG::Vector3f &pos, const EGG::Vector3f &prevPos, KCLTypeMask typeMask) |
| Sets members in preparation of a subsequent sphere collision check call. | |
| void | lookupSphereCached (const EGG::Vector3f &p1, const EGG::Vector3f &p2, u32 typeMask, f32 radius) |
| const u16 * | searchBlock (const EGG::Vector3f &pos) |
| Finds the data block corresponding to the provided position. | |
Static Public Member Functions | |
| static EGG::Vector3f | GetVertex (f32 height, const EGG::Vector3f &vertex1, const EGG::Vector3f &fnrm, const EGG::Vector3f &enrm3, const EGG::Vector3f &enrm) |
| Computes a prism vertex based off of the triangle's normal vectors. | |
Getters | |
| const EGG::BoundBox3f & | bbox () const |
| u16 | prismCache (u32 idx) const |
Private Member Functions | |
| void | preloadPrismGeometry () |
| Resolves each prism's vertex, height, and normal indices into a contiguous struct. | |
| template<CollisionCheckType Type> | |
| bool | checkCollision (u16 prismIdx, f32 *distOut, EGG::Vector3f *fnrmOut, u16 *flagsOut) |
| This is a combination of the three collision checks in the base game. | |
| bool | checkPointCollision (u16 prismIdx, f32 *distOut, EGG::Vector3f *fnrmOut, u16 *flagsOut, bool movement) |
| This is a combination of two point collision check functions. They only vary based on whether we are checking movement. | |
| bool | checkSphereMovement (f32 *distOut, EGG::Vector3f *fnrmOut, u16 *attributeOut) |
| Iterates the local data block to check for directional collision. | |
| bool | checkPointMovement (f32 *distOut, EGG::Vector3f *fnrmOut, u16 *attributeOut) |
| bool | checkPoint (f32 *distOut, EGG::Vector3f *fnrmOut, u16 *attributeOut) |
Private Attributes | |
| const void * | m_posData |
| const void * | m_nrmData |
| const void * | m_prismData |
| const void * | m_blockData |
| f32 | m_prismThickness |
| EGG::Vector3f | m_areaMinPos |
| u32 | m_areaXWidthMask |
| The x dimension of the octree's bounding box. | |
| u32 | m_areaYWidthMask |
| The y dimension of the octree's bounding box. | |
| u32 | m_areaZWidthMask |
| The z dimension of the octree's bounding box. | |
| u32 | m_blockWidthShift |
| Used to initialize octree navigation. | |
| u32 | m_areaXBlocksShift |
| Used to initialize octree navigation. | |
| u32 | m_areaXYBlocksShift |
| Used to initialize octree navigation. | |
| f32 | m_sphereRadius |
| Clamps the sphere we check collision against. | |
| EGG::Vector3f | m_pos |
| EGG::Vector3f | m_prevPos |
| EGG::Vector3f | m_movement |
| f32 | m_radius |
| KCLTypeMask | m_typeMask |
| const u16 * | m_prismIter |
| EGG::BoundBox3f | m_bbox |
| std::array< u16, 256 > | m_prismCache |
| u16 * | m_prismCacheTop |
| u16 * | m_cachedPrismArray |
| EGG::Vector3f | m_cachedPos |
| f32 | m_cachedRadius |
| owning_span< KCollisionPrismGeometry > | m_prismGeometry |
| One-indexed array of each prism's geometry. | |
| owning_span< u16 > | m_prismAttributes |
| One-indexed array of each prism's KCL attribute. | |
|
strong |
Definition at line 70 of file KColData.hh.
|
0x807BDC5C |
Definition at line 14 of file KColData.cc.
|
inlinenodiscard |
Definition at line 126 of file KColData.hh.
|
nodiscardprivate |
This is a combination of the three collision checks in the base game.
| prismIdx | The index of the prism to check for collision against |
The checks vary only by a few if-statements, related to whether we are checking for:
Definition at line 349 of file KColData.cc.
|
nodiscardprivate0x807C21F4 |
Definition at line 628 of file KColData.cc.
|
nodiscard0x807C1F80 |
Definition at line 111 of file KColData.cc.
|
nodiscardprivate |
This is a combination of two point collision check functions. They only vary based on whether we are checking movement.
| prismIdx | The index of the collision prism to check against |
Definition at line 541 of file KColData.cc.
|
nodiscardprivate0x807C1F80 |
Definition at line 647 of file KColData.cc.
|
nodiscard0x807C1514 |
Iterates the list of looked-up triangles to see if we are colliding.
| distOut | If colliding, returns the distance between the player and the triangle |
| fnrmOut | If colliding, returns the floor normal of the triangle |
| flagsOut | If colliding, returns the KCL attributes for that triangle |
Definition at line 128 of file KColData.cc.
|
nodiscard0x807C2410 |
Definition at line 117 of file KColData.cc.
|
nodiscardprivate0x807C0884 |
Iterates the local data block to check for directional collision.
| distOut | If colliding, returns the distance between the player and the tri |
| fnrmOut | If colliding, returns the floor normal of the triangle |
| attributeOut | If colliding, returns the KCL attributes for that triangle |
Definition at line 608 of file KColData.cc.
|
nodiscard0x807C0F00 |
Definition at line 148 of file KColData.cc.
|
0x807BDDFC |
Calculates a EGG::BoundBox3f that describes the boundary of the track's KCL.
Definition at line 90 of file KColData.cc.
|
staticnodiscard0x807BDF54 |
Computes a prism vertex based off of the triangle's normal vectors.
Definition at line 282 of file KColData.cc.
|
0x807C1B0C |
Sets members in preparation of a subsequent point collision check call.
Definition at line 179 of file KColData.cc.
|
0x807C1BB4 |
Sets members in preparation of a subsequent sphere collision check call.
Definition at line 190 of file KColData.cc.
|
0x807C1DE8 |
Definition at line 201 of file KColData.cc.
|
0x807C243C |
We assume the cache has same endianness as the archive file, so do not parse out the prism index and directly store it in the cache.
Definition at line 73 of file KColData.cc.
|
0x807C24C0 |
Definition at line 57 of file KColData.cc.
|
private |
Resolves each prism's vertex, height, and normal indices into a contiguous struct.
This is a performance optimization for Kinoko to avoid having to byteswap and index several different arrays to fetch a prism's geometry. Memory cost is 64 bytes per prism for the geometry plus 2 bytes per prism for the attribute, which is at worst ~690KB (for Maple Treeway).
Definition at line 295 of file KColData.cc.
|
inlinenodiscard |
Definition at line 130 of file KColData.hh.
|
nodiscard0x807BE030 |
Finds the data block corresponding to the provided position.
| point | The player's position |
Definition at line 224 of file KColData.cc.
|
private |
Definition at line 156 of file KColData.hh.
|
private |
Used to initialize octree navigation.
Definition at line 161 of file KColData.hh.
|
private |
The x dimension of the octree's bounding box.
Definition at line 157 of file KColData.hh.
|
private |
Used to initialize octree navigation.
Definition at line 162 of file KColData.hh.
|
private |
The y dimension of the octree's bounding box.
Definition at line 158 of file KColData.hh.
|
private |
The z dimension of the octree's bounding box.
Definition at line 159 of file KColData.hh.
|
private |
Definition at line 170 of file KColData.hh.
|
private |
Definition at line 154 of file KColData.hh.
|
private |
Used to initialize octree navigation.
Definition at line 160 of file KColData.hh.
|
private |
Definition at line 174 of file KColData.hh.
|
private |
Definition at line 173 of file KColData.hh.
|
private |
Definition at line 175 of file KColData.hh.
|
private |
Definition at line 166 of file KColData.hh.
|
private |
Definition at line 152 of file KColData.hh.
|
private |
Definition at line 164 of file KColData.hh.
|
private |
Definition at line 151 of file KColData.hh.
|
private |
Definition at line 165 of file KColData.hh.
|
private |
One-indexed array of each prism's KCL attribute.
Kept separate from m_prismGeometry so that KCollisionPrismGeometry can have better cache alignment.
Definition at line 184 of file KColData.hh.
|
private |
Definition at line 171 of file KColData.hh.
|
private |
Definition at line 172 of file KColData.hh.
|
private |
Definition at line 153 of file KColData.hh.
|
private |
One-indexed array of each prism's geometry.
Kinoko-specific optimization for cache locality. See KCollisionPrismGeometry.
Definition at line 179 of file KColData.hh.
|
private |
Definition at line 169 of file KColData.hh.
|
private |
Definition at line 155 of file KColData.hh.
|
private |
Definition at line 167 of file KColData.hh.
|
private |
Clamps the sphere we check collision against.
Definition at line 163 of file KColData.hh.
|
private |
Definition at line 168 of file KColData.hh.