Decompile 3 functions in Source/Contents/World/WorldRayQuery.cpp, Source/Contents/World/WorldRayQuery.h
Batch #11327 by cremane: 0 byte-identical, 3 confirmed by peer review. - fn_17661 WorldRayQuery::Intersects: logic confirmed by peer review - fn_17658 WorldRayQuery::Collect: logic confirmed by peer review - fn_17663 WorldRayQuery::CollectNode: logic confirmed by peer review Peer-reviewed-by: Yommy, dori, StrawberrysherbetIX Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
parent
0ff4590d55
commit
a5bebe6404
2 changed files with 10 additions and 10 deletions
|
|
@ -16,7 +16,7 @@ WorldRayQuery::WorldRayQuery() {
|
|||
|
||||
// OFFSET: 0x00AC7C50
|
||||
// FUNCTION: fn_17661
|
||||
bool WorldRayQuery::Intersects(const float* bounds) const {
|
||||
int WorldRayQuery::Intersects(const float* bounds) const {
|
||||
const float centers[3] = {(bounds[3] + bounds[0]) * 0.5f, (bounds[4] + bounds[1]) * 0.5f, (bounds[5] + bounds[2]) * 0.5f};
|
||||
const float extents[3] = {bounds[3] - centers[0], bounds[4] - centers[1], bounds[5] - centers[2]};
|
||||
const float offsets[3] = {centers[0] - this->origin[0], centers[1] - this->origin[1], centers[2] - this->origin[2]};
|
||||
|
|
@ -33,7 +33,7 @@ bool WorldRayQuery::Intersects(const float* bounds) const {
|
|||
const float extent = extents[axis] * parallelScale;
|
||||
|
||||
if (-offsets[axis] - extent > 0.0f || extent - offsets[axis] < 0.0f) {
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
const float inverse = 1.0f / direction;
|
||||
|
|
@ -47,7 +47,7 @@ bool WorldRayQuery::Intersects(const float* bounds) const {
|
|||
exit = far < exit ? far : exit;
|
||||
|
||||
if (entry > exit || exit < 0.0f) {
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -67,9 +67,9 @@ void WorldRayQuery::Collect(const float* ray, WorldSpatialTree* root) {
|
|||
this->limit = 999999.0f;
|
||||
|
||||
if (root) {
|
||||
for (WorldSpatialTree* child : root->children) {
|
||||
if (child && this->Intersects(child->minimum)) {
|
||||
this->CollectNode(child, 1);
|
||||
for (int index = 0; index < 4; ++index) {
|
||||
if (root->children[index] && this->Intersects(root->children[index]->minimum)) {
|
||||
this->CollectNode(root->children[index], 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -85,9 +85,9 @@ void WorldRayQuery::CollectNode(WorldSpatialTree* node, int depth) {
|
|||
if (depth == 5) {
|
||||
this->nodes.push_back(node);
|
||||
} else {
|
||||
for (WorldSpatialTree* child : node->children) {
|
||||
if (child && this->Intersects(child->minimum)) {
|
||||
this->CollectNode(child, depth + 1);
|
||||
for (int index = 0; index < 4; ++index) {
|
||||
if (node->children[index] && this->Intersects(node->children[index]->minimum)) {
|
||||
this->CollectNode(node->children[index], depth + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ struct WorldRayQuery {
|
|||
/* 0020 */ float limit;
|
||||
|
||||
WorldRayQuery();
|
||||
bool Intersects(const float* bounds) const;
|
||||
int Intersects(const float* bounds) const;
|
||||
void Collect(const float* ray, WorldSpatialTree* root);
|
||||
void CollectNode(WorldSpatialTree* node, int depth);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue