diff options
author | aap <aap@papnet.eu> | 2019-08-17 21:24:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-17 21:24:26 +0200 |
commit | ed9ab6c55f5316baa7ce420a682097fcfe8afb05 (patch) | |
tree | c05b0093155e8d7a76646cee93a50429430b3b54 /src/modelinfo | |
parent | Merge pull request #194 from Nick007J/master (diff) | |
parent | AnimViewer messages, Particle fix, Peds (diff) | |
download | re3-ed9ab6c55f5316baa7ce420a682097fcfe8afb05.tar re3-ed9ab6c55f5316baa7ce420a682097fcfe8afb05.tar.gz re3-ed9ab6c55f5316baa7ce420a682097fcfe8afb05.tar.bz2 re3-ed9ab6c55f5316baa7ce420a682097fcfe8afb05.tar.lz re3-ed9ab6c55f5316baa7ce420a682097fcfe8afb05.tar.xz re3-ed9ab6c55f5316baa7ce420a682097fcfe8afb05.tar.zst re3-ed9ab6c55f5316baa7ce420a682097fcfe8afb05.zip |
Diffstat (limited to '')
-rw-r--r-- | src/modelinfo/PedModelInfo.cpp | 39 | ||||
-rw-r--r-- | src/modelinfo/PedModelInfo.h | 1 |
2 files changed, 40 insertions, 0 deletions
diff --git a/src/modelinfo/PedModelInfo.cpp b/src/modelinfo/PedModelInfo.cpp index c5242ef6..afe177c2 100644 --- a/src/modelinfo/PedModelInfo.cpp +++ b/src/modelinfo/PedModelInfo.cpp @@ -189,6 +189,45 @@ CPedModelInfo::CreateHitColModel(void) m_hitColModel = colmodel; } +CColModel* +CPedModelInfo::AnimatePedColModel(CColModel* colmodel, RwFrame* frame) +{ + RwObjectNameAssociation nameAssoc; + RwObjectIdAssociation idAssoc; + RwMatrix* mat = RwMatrixCreate(); + CColSphere* spheres = colmodel->spheres; + + for (int i = 0; i < NUMPEDINFONODES; i++) { + RwFrame* f = nil; + if (m_pColNodeInfos[i].name) { + nameAssoc.name = m_pColNodeInfos[i].name; + nameAssoc.frame = nil; + RwFrameForAllChildren(frame, FindFrameFromNameCB, &nameAssoc); + f = nameAssoc.frame; + } + else { + idAssoc.id = m_pColNodeInfos[i].pedNode; + idAssoc.frame = nil; + RwFrameForAllChildren(frame, FindFrameFromIdCB, &idAssoc); + f = idAssoc.frame; + } + if (f) { + RwMatrixCopy(mat, RwFrameGetMatrix(f)); + + for (f = RwFrameGetParent(f); f; f = RwFrameGetParent(f)) { + RwMatrixTransform(mat, &f->modelling, rwCOMBINEPOSTCONCAT); + if (RwFrameGetParent(f) == frame) + break; + } + + spheres[i].center.x = mat->pos.x + m_pColNodeInfos[i].x; + spheres[i].center.y = mat->pos.y + 0.0f; + spheres[i].center.z = mat->pos.z + m_pColNodeInfos[i].z; + } + } + + return colmodel; +} class CPedModelInfo_ : public CPedModelInfo { diff --git a/src/modelinfo/PedModelInfo.h b/src/modelinfo/PedModelInfo.h index 483d13f8..a2d58d6e 100644 --- a/src/modelinfo/PedModelInfo.h +++ b/src/modelinfo/PedModelInfo.h @@ -39,5 +39,6 @@ public: void SetLowDetailClump(RpClump*); void CreateHitColModel(void); CColModel *GetHitColModel(void) { return m_hitColModel; } + static CColModel *AnimatePedColModel(CColModel* colmodel, RwFrame* frame); }; static_assert(sizeof(CPedModelInfo) == 0x54, "CPedModelInfo: error"); |