CParticlesPlayer::SParticlesInfo* CParticlesPlayer::SBoneInfo::AppendParticles(CObject* object, const shared_str& ps_name) { SParticlesInfo* pi = FindParticles(ps_name); if (pi) return pi; particles.push_back (SParticlesInfo()); pi = &particles.back(); pi->ps = CParticlesObject::Create(*ps_name,FALSE); return pi; }
void CParticlesPlayer::SBoneInfo::StopParticles(const shared_str& ps_name, bool bDestroy) { SParticlesInfo* pi = FindParticles(ps_name); if (pi) { if(!bDestroy) pi->ps->Stop(); else CParticlesObject::Destroy(pi->ps); } }
void Target::Run() { printf("Target::Run running...\n"); while (1) { if (m_newImage && GetImage()) { printf("Target::Run got image\n"); m_pTop = m_pBottom = m_pLeft = m_pRight = NULL; m_leftX = m_rightX = -1; bool result = FindParticles() && AnalyzeParticles(); { Synchronized mutex(m_sem); m_newImage = false; m_processingComplete = true; m_targetsFound = result; if (result) { m_targetCenter.angle = m_centerAngle; m_targetCenter.distance = m_centerDistance; m_targetCenter.valid = true; m_targetTop.angle = m_topAngle; //m_targetTop.distance = m_topDistance; m_targetTop.distance = m_centerDistance; m_targetTop.valid = (m_pTop != NULL); m_targetBottom.angle = m_bottomAngle; //m_targetBottom.distance = m_bottomDistance; m_targetBottom.distance = m_centerDistance; m_targetBottom.valid = (m_pBottom != NULL); m_targetLeft.angle = m_leftAngle; m_targetLeft.distance = m_leftDistance; m_targetLeft.valid = !m_leftClipped; m_targetRight.angle = m_rightAngle; m_targetRight.distance = m_rightDistance; m_targetRight.valid = !m_rightClipped; } else { m_targetCenter.valid = false; m_targetTop.valid = false; m_targetBottom.valid = false; m_targetLeft.valid = false; m_targetRight.valid = false; } } if (DriverStation::GetInstance()->GetEnhancedIO().GetDigital(3)) { SaveImages(); } } // no thrashing! Wait(0.10); } }