| 133 | } |
| 134 | |
| 135 | S32 xPartitionUpdate(_tagPartition* part, void* data, S32 old_idx, xVec3* current_pos) |
| 136 | { |
| 137 | S32 cur_idx; |
| 138 | |
| 139 | if (current_pos->x < part->min.x || current_pos->x > part->max.x || |
| 140 | current_pos->y < part->min.y || current_pos->y > part->max.y || |
| 141 | current_pos->z < part->min.z || current_pos->z > part->max.z) |
| 142 | { |
| 143 | cur_idx = -1; |
| 144 | } |
| 145 | else |
| 146 | { |
| 147 | cur_idx = xPartitionGetTrueIdx(part, (current_pos->x - part->min.x) / part->space_dim.x, |
| 148 | (current_pos->y - part->min.y) / part->space_dim.y, |
| 149 | (current_pos->z - part->min.z) / part->space_dim.z); |
| 150 | } |
| 151 | |
| 152 | if (old_idx == cur_idx) |
| 153 | return cur_idx; |
| 154 | |
| 155 | _tagPartSpace* src = old_idx == -1 ? &part->global : &part->space[old_idx]; |
| 156 | xPartitionSpaceMove(src, cur_idx == -1 ? &part->global : &part->space[cur_idx], (U32)data); |
| 157 | return cur_idx; |
| 158 | } |
| 159 | |
| 160 | void xPartitionSpaceMove(_tagPartSpace* src, _tagPartSpace* dest, U32 data) |
| 161 | { |
no test coverage detected