Reconstruct readable C++ and organize cohesive source subsystems
Administrative source import: native x86 compilation passed for 423 authored units. Source placement and submission states are migrated separately; this commit does not imply peer acceptance.
Previous head: 35d2a8cb36
Payload SHA256: 592f016d2730c5593bb653aa054c1e5f76a6df72c8f5a09e66f74876e2e33dee
This commit is contained in:
parent
35d2a8cb36
commit
a47d20f8be
890 changed files with 11796 additions and 16664 deletions
46
Source/Contents/Models/ModelNodeBounds.cpp
Normal file
46
Source/Contents/Models/ModelNodeBounds.cpp
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#include "Contents/Models/ModelNode.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
// OFFSET: 0x00ABB300
|
||||
// FUNCTION: fn_17514
|
||||
void C3dNode::AccumulateBounds(float* bounds, const float* matrix) {
|
||||
AffineMatrix parentMatrix;
|
||||
std::memcpy(parentMatrix.values, matrix, sizeof(parentMatrix.values));
|
||||
AffineMatrix combined;
|
||||
combined.Compose(this->transform, parentMatrix);
|
||||
|
||||
for (const auto& vertex : this->mesh->vertices) {
|
||||
const float x = ((vertex[0] * combined.values[0] + vertex[1] * combined.values[3]) + vertex[2] * combined.values[6]) + combined.values[9];
|
||||
const float y = ((vertex[1] * combined.values[4] + vertex[0] * combined.values[1]) + vertex[2] * combined.values[7]) + combined.values[10];
|
||||
const float z = ((vertex[0] * combined.values[2] + vertex[1] * combined.values[5]) + vertex[2] * combined.values[8]) + combined.values[11];
|
||||
|
||||
if (bounds[0] > x) {
|
||||
bounds[0] = x;
|
||||
}
|
||||
|
||||
if (x > bounds[3]) {
|
||||
bounds[3] = x;
|
||||
}
|
||||
|
||||
if (bounds[1] > y) {
|
||||
bounds[1] = y;
|
||||
}
|
||||
|
||||
if (y > bounds[4]) {
|
||||
bounds[4] = y;
|
||||
}
|
||||
|
||||
if (bounds[2] > z) {
|
||||
bounds[2] = z;
|
||||
}
|
||||
|
||||
if (z > bounds[5]) {
|
||||
bounds[5] = z;
|
||||
}
|
||||
}
|
||||
|
||||
for (C3dNode* child : this->children) {
|
||||
child->AccumulateBounds(bounds, combined.values);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue