mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 16:22:45 +03:00
feat(model): add CM2Model::AnimateAttachmentsMT
This commit is contained in:
parent
22710e417c
commit
fb79622cec
@ -84,6 +84,55 @@ void CM2Model::Animate() {
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CM2Model::AnimateAttachmentsMT() {
|
||||||
|
// Animate attachment visibility
|
||||||
|
|
||||||
|
for (int32_t i = 0; i < this->m_shared->m_data->attachments.Count(); i++) {
|
||||||
|
auto& attachment = this->m_shared->m_data->attachments[i];
|
||||||
|
auto& modelAttachment = this->m_attachments[i];
|
||||||
|
auto& modelBone = this->m_bones[attachment.boneIndex];
|
||||||
|
|
||||||
|
if (
|
||||||
|
attachment.visibilityTrack.sequenceTimes.Count() > 1
|
||||||
|
|| (attachment.visibilityTrack.sequenceTimes.Count() == 1 && attachment.visibilityTrack.sequenceTimes[0].times.Count() > this->uint90)
|
||||||
|
) {
|
||||||
|
uint8_t defaultValue = 1;
|
||||||
|
M2AnimateTrack<uint8_t, uint8_t>(this, &modelBone, attachment.visibilityTrack, modelAttachment.visibilityTrack, defaultValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Animate attached models
|
||||||
|
|
||||||
|
for (auto model = this->m_attachList; model; model = model->m_attachNext) {
|
||||||
|
C44Matrix view;
|
||||||
|
|
||||||
|
if (model->m_attachIndex == 0xFFFF) {
|
||||||
|
if (!model->m_flag40000) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
view = this->m_boneMatrices[0];
|
||||||
|
} else {
|
||||||
|
auto& attachment = this->m_shared->m_data->attachments[model->m_attachIndex];
|
||||||
|
auto& modelAttachment = this->m_attachments[model->m_attachIndex];
|
||||||
|
|
||||||
|
// Attachment not currently visible
|
||||||
|
if (!modelAttachment.visibilityTrack.currentValue) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
view = this->m_boneMatrices[attachment.boneIndex];
|
||||||
|
view.Translate(attachment.position);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model->m_flag1000) {
|
||||||
|
model->AnimateMTSimple(&view, this->m_currentDiffuse, this->m_currentEmissive, this->float198, this->alpha19C);
|
||||||
|
} else {
|
||||||
|
model->AnimateMT(&view, this->m_currentDiffuse, this->m_currentEmissive, this->float198, this->alpha19C);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CM2Model::AnimateCamerasST() {
|
void CM2Model::AnimateCamerasST() {
|
||||||
for (int32_t i = 0; i < this->m_shared->m_data->cameras.Count(); i++) {
|
for (int32_t i = 0; i < this->m_shared->m_data->cameras.Count(); i++) {
|
||||||
auto& camera = this->m_shared->m_data->cameras[i];
|
auto& camera = this->m_shared->m_data->cameras[i];
|
||||||
@ -481,6 +530,12 @@ void CM2Model::AnimateMT(const C44Matrix* view, const C3Vector& a3, const C3Vect
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
|
if (this->m_attachments || this->m_attachList) {
|
||||||
|
this->AnimateAttachmentsMT();
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void CM2Model::AnimateMTSimple(const C44Matrix* view, const C3Vector& a3, const C3Vector& a4, float a5, float a6) {
|
void CM2Model::AnimateMTSimple(const C44Matrix* view, const C3Vector& a3, const C3Vector& a4, float a5, float a6) {
|
||||||
|
|||||||
@ -144,6 +144,7 @@ class CM2Model {
|
|||||||
{};
|
{};
|
||||||
void AddRef();
|
void AddRef();
|
||||||
void Animate();
|
void Animate();
|
||||||
|
void AnimateAttachmentsMT();
|
||||||
void AnimateCamerasST();
|
void AnimateCamerasST();
|
||||||
void AnimateMT(const C44Matrix* view, const C3Vector& a3, const C3Vector& a4, float a5, float a6);
|
void AnimateMT(const C44Matrix* view, const C3Vector& a3, const C3Vector& a4, float a5, float a6);
|
||||||
void AnimateMTSimple(const C44Matrix* view, const C3Vector& a3, const C3Vector& a4, float a5, float a6);
|
void AnimateMTSimple(const C44Matrix* view, const C3Vector& a3, const C3Vector& a4, float a5, float a6);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user