MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / UpdateParticles

Method UpdateParticles

ogsr_engine/xrGame/ParticlesPlayer.cpp:239–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

237}
238
239void CParticlesPlayer::UpdateParticles()
240{
241 if (!m_bActiveBones)
242 return;
243 m_bActiveBones = false;
244
245 CObject* object = m_self_object;
246 VERIFY(object);
247
248 for (BoneInfoVecIt b_it = m_Bones.begin(); b_it != m_Bones.end(); b_it++)
249 {
250 SBoneInfo& b_info = *b_it;
251
252 for (ParticlesInfoListIt p_it = b_info.particles.begin(); p_it != b_info.particles.end(); p_it++)
253 {
254 SParticlesInfo& p_info = *p_it;
255 if (!p_info.ps)
256 continue;
257 //обновить позицию партиклов
258 Fmatrix xform;
259 xform.setHPB(p_info.angles.x, p_info.angles.y, p_info.angles.z);
260 GetBonePos(object, b_info.index, b_info.offset, xform.c);
261 p_info.ps->UpdateParent(xform, parent_vel);
262
263 //обновить время существования
264 if (p_info.life_time != u32(-1))
265 {
266 if (p_info.life_time > Device.dwTimeDelta)
267 p_info.life_time -= Device.dwTimeDelta;
268 else
269 {
270 p_info.ps->Stop();
271 p_info.life_time = u32(-1);
272 }
273 }
274 if (!p_info.ps->IsPlaying())
275 {
276 CParticlesObject::Destroy(p_info.ps);
277 }
278 else
279 m_bActiveBones = true;
280 }
281
282 const auto RI = std::remove_if(b_info.particles.begin(), b_info.particles.end(), [](const SParticlesInfo& pi) { return pi.ps == nullptr; });
283 b_info.particles.erase(RI, b_info.particles.end());
284 }
285}
286
287void CParticlesPlayer::GetBonePos(CObject* pObject, u16 bone_id, const Fvector& offset, Fvector& result)
288{

Callers

nothing calls this directly

Calls 9

DestroyFunction · 0.85
setHPBMethod · 0.80
u32Enum · 0.70
beginMethod · 0.45
endMethod · 0.45
UpdateParentMethod · 0.45
StopMethod · 0.45
IsPlayingMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected