Compare commits

...

3 Commits

Author SHA1 Message Date
VDm
9b704b3366 fix(model): remove workaround for AffineInverse 2025-06-15 22:30:53 +04:00
VDm
442aa10690 chore(build): upgrade .gitignore 2025-06-15 20:48:25 +04:00
VDm
38116e7f0b chore(build): upgrade dependencies 2025-06-15 20:47:26 +04:00
5 changed files with 15 additions and 97 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@
/cmake-build-*
/out
/CMakeSettings.json

@ -1 +1 @@
Subproject commit 7fa49919037fe35eae3ff7908dbe00b56cfac212
Subproject commit 50b094a8cf37b81837a27a7871b3e671294b1d01

@ -1 +1 @@
Subproject commit 2e824bfdc3e4a97057751d4ff7403d08de39745f
Subproject commit dd963fe88344e81d38924d49ef2c3f59e0510eb3

View File

@ -80,8 +80,8 @@ void CCharacterSelection::ShowCharacter() {
if (CCharacterSelection::m_modelFrame) {
auto model = CCharacterSelection::m_modelFrame->m_model;
if (model) {
//model->DetachAllChildrenById(0);
//model->DetachAllChildrenById(1);
model->DetachAllChildrenById(0);
model->DetachAllChildrenById(1);
}
}
@ -91,9 +91,7 @@ void CCharacterSelection::ShowCharacter() {
if (character.m_characterModel) {
if (!character.m_characterModel->m_attachParent && CCharacterSelection::m_modelFrame && CCharacterSelection::m_modelFrame->m_model) {
character.m_characterModel->SetVisible(1);
character.m_characterModel->AttachToParent(CCharacterSelection::m_modelFrame->m_model, 0, nullptr, 0);
character.m_characterModel->SetVisible(1);
}
// TODO
@ -109,10 +107,17 @@ void CCharacterSelection::ShowCharacter() {
auto scene = CCharacterSelection::m_modelFrame->GetScene();
character.m_characterModel = scene->CreateModel(rec->m_modelName, 0);
++CCharacterSelection::m_characterCount;
}
void CCharacterSelection::SetCharFacing(float facing) {
if (!CCharacterSelection::m_characterCount || !CCharacterSelection::GetNumCharacters()) {
if (!CCharacterSelection::m_characterCount) {
return;
}
CCharacterSelection::m_charFacing = facing;
if (!CCharacterSelection::GetNumCharacters()) {
return;
}

View File

@ -674,98 +674,10 @@ uint16_t CM2Model::AttachToParent(CM2Model* parent, uint32_t attachmentId, const
auto transform = parent->GetAttachmentWorldTransform(attachmentId);
float v12 = sqrt(transform.a0 * transform.a0 + transform.a1 * transform.a1 + transform.a2 * transform.a2);
// WRAP: C44Matrix__AffineInvertInPlace below
if (fabs(v12 - 1.0f) >= 0.00000095367432) {
float v5[3][3];
v5[0][0] = transform.a0;
v5[0][1] = transform.a1;
v5[0][2] = transform.a2;
v5[1][0] = transform.b0;
v5[1][1] = transform.b1;
v5[1][2] = transform.b2;
v5[2][0] = transform.c0;
v5[2][1] = transform.c1;
v5[2][2] = transform.c2;
float v8[3][3];
v8[0][0] = v5[0][0];
v8[0][1] = v5[1][0];
v8[0][2] = v5[2][0];
v8[1][0] = v5[0][1];
v8[1][1] = v5[1][1];
v8[1][2] = v5[2][1];
v8[2][0] = v5[0][2];
v8[2][1] = v5[1][2];
v8[2][2] = v5[2][2];
C44Matrix matrix;
matrix.a0 = v8[0][0];
matrix.a1 = v8[0][1];
matrix.a2 = v8[0][2];
matrix.a3 = 0.0f;
matrix.b0 = v8[1][0];
matrix.b1 = v8[1][1];
matrix.b2 = v8[1][2];
matrix.b3 = 0.0f;
matrix.c0 = v8[2][0];
matrix.c1 = v8[2][1];
matrix.c2 = v8[2][2];
matrix.c3 = 0.0f;
matrix.d0 = 0.0f;
matrix.d1 = 0.0f;
matrix.d2 = 0.0f;
matrix.d3 = 1.0f;
matrix.Scale(1.0f / (v12 * v12));
matrix.Translate(C3Vector(-transform.d0, -transform.d1, -transform.d2));
transform = matrix;
} else {
float v5[3][3];
v5[0][0] = transform.a0;
v5[0][1] = transform.a1;
v5[0][2] = transform.a2;
v5[1][0] = transform.b0;
v5[1][1] = transform.b1;
v5[1][2] = transform.b2;
v5[2][0] = transform.c0;
v5[2][1] = transform.c1;
v5[2][2] = transform.c2;
float v8[3][3];
v8[0][0] = v5[0][0];
v8[0][1] = v5[1][0];
v8[0][2] = v5[2][0];
v8[1][0] = v5[0][1];
v8[1][1] = v5[1][1];
v8[1][2] = v5[2][1];
v8[2][0] = v5[0][2];
v8[2][1] = v5[1][2];
v8[2][2] = v5[2][2];
C44Matrix matrix;
matrix.a0 = v8[0][0];
matrix.a1 = v8[0][1];
matrix.a2 = v8[0][2];
matrix.a3 = 0.0f;
matrix.b0 = v8[1][0];
matrix.b1 = v8[1][1];
matrix.b2 = v8[1][2];
matrix.b3 = 0.0f;
matrix.c0 = v8[2][0];
matrix.c1 = v8[2][1];
matrix.c2 = v8[2][2];
matrix.c3 = 0.0f;
matrix.d0 = 0.0f;
matrix.d1 = 0.0f;
matrix.d2 = 0.0f;
matrix.d3 = 1.0f;
matrix.Translate(C3Vector(-transform.d0, -transform.d1, -transform.d2));
transform = matrix;
}
transform = transform.AffineInverse(v12);
if (!this->m_flag8000) {
this->matrixB4 = C44Matrix();
this->matrixB4.Identity();
}
transform.Translate(*a4);