Decompile 11 functions in Source/Contents/Models/ModelLighting.cpp, Source/Contents/Models/ModelNode.cpp, ...

Batch #1082 by ragnarok-clanker: 0 byte-identical, 11 confirmed by peer review.

- fn_02007 ModelMesh::ModelMesh: logic confirmed by peer review
- fn_02009 ModelMesh::~ModelMesh: logic confirmed by peer review
- fn_02011 ModelMesh::CalculateNormals: logic confirmed by peer review
- fn_07958 C3dAnimModelRes::Load: logic confirmed by peer review
- fn_07997 AnimatedModelRecord::~AnimatedModelRecord: logic confirmed by peer review
- fn_08023 C3dAnimModelRes::Unload: logic confirmed by peer review
- fn_17482 C3dNodeV1::Initialize: logic confirmed by peer review
- fn_17484 C3dNodeV2::Initialize: logic confirmed by peer review
- fn_17514 C3dNode::AccumulateBounds: logic confirmed by peer review
- fn_17515 C3dNode::SampleGroundColors: logic confirmed by peer review
- fn_17521 C3dNode::Prepare: logic confirmed by peer review

Reviewed-by: ragnarok-clanker
This commit is contained in:
ragnarok-clanker 2026-10-27 16:31:29 +00:00
commit eb3e3b8b08
11 changed files with 249 additions and 132 deletions

View file

@ -78,7 +78,7 @@ void C3dNode::OverrideColors() {
// OFFSET: 0x00ABB450
// FUNCTION: fn_17515
void C3dNode::SampleGroundColors(const float* matrix, const float* position, const GroundGeometry& ground) {
for (unsigned index = 0; index < this->mesh->faces.size(); ++index) {
for (int index = 0; index < this->mesh->faceCount; ++index) {
const ModelFace& face = this->mesh->faces[index];
for (unsigned corner = 0; corner < 3; ++corner) {
@ -107,7 +107,7 @@ void C3dNode::Prepare(const float* matrix, ModelLightingContext& context) {
AffineMatrix combined;
combined.Compose(this->transform, parentMatrix);
for (unsigned index = 0; index < this->mesh->faces.size(); ++index) {
for (int index = 0; index < this->mesh->faceCount; ++index) {
const ModelFace& face = this->mesh->faces[index];
float light[3];
@ -131,9 +131,9 @@ void C3dNode::Prepare(const float* matrix, ModelLightingContext& context) {
}
}
unsigned index = 0;
int index = 0;
while (index < this->mesh->faces.size()) {
while (index < this->mesh->faceCount) {
const unsigned texture = this->mesh->faces[index].texture;
CTexture* image = this->textures[texture % this->textures.size()];
@ -149,7 +149,7 @@ void C3dNode::Prepare(const float* matrix, ModelLightingContext& context) {
}
for (unsigned corner = 0; corner < 3; ++corner) {
if (this->mesh->textureVertices.empty()) {
if (this->mesh->textureVertexCount == 0) {
state.uv[corner][0] = u;
state.uv[corner][1] = v;
} else {
@ -160,7 +160,7 @@ void C3dNode::Prepare(const float* matrix, ModelLightingContext& context) {
}
++index;
} while (index < this->mesh->faces.size() && this->mesh->faces[index].texture == texture);
} while (index < this->mesh->faceCount && this->mesh->faces[index].texture == texture);
}
this->SampleGroundColors(combined.values, context.position, context.ground);