| 144 | } |
| 145 | |
| 146 | BOOL CDemoPlay::ProcessCam(SCamEffectorInfo& info) |
| 147 | { |
| 148 | // skeep a few frames before counting |
| 149 | if (Device.dwPrecacheFrame) |
| 150 | return TRUE; |
| 151 | stat_Start(); |
| 152 | |
| 153 | // Per-frame statistics |
| 154 | { |
| 155 | stat_table.push_back(stat_Timer_frame.GetElapsed_sec()); |
| 156 | stat_Timer_frame.Start(); |
| 157 | } |
| 158 | |
| 159 | // Process motion |
| 160 | if (m_pMotion) |
| 161 | { |
| 162 | Fvector R; |
| 163 | Fmatrix mRotate; |
| 164 | m_pMotion->_Evaluate(m_MParam->Frame(), info.p, R); |
| 165 | m_MParam->Update(Device.fTimeDelta, 1.f, true); |
| 166 | fLifeTime -= Device.fTimeDelta; |
| 167 | if (m_MParam->bWrapped) |
| 168 | { |
| 169 | stat_Stop(); |
| 170 | stat_Start(); |
| 171 | } |
| 172 | mRotate.setXYZi(R.x, R.y, R.z); |
| 173 | info.d.set(mRotate.k); |
| 174 | info.n.set(mRotate.j); |
| 175 | } |
| 176 | else |
| 177 | { |
| 178 | if (seq.empty()) |
| 179 | { |
| 180 | g_pGameLevel->Cameras().RemoveCamEffector(cefDemo); |
| 181 | return TRUE; |
| 182 | } |
| 183 | |
| 184 | fStartTime += Device.fTimeDelta; |
| 185 | |
| 186 | float ip; |
| 187 | float p = fStartTime / fSpeed; |
| 188 | float t = modff(p, &ip); |
| 189 | int frame = iFloor(ip); |
| 190 | VERIFY(t >= 0); |
| 191 | |
| 192 | if (frame >= m_count) |
| 193 | { |
| 194 | dwCyclesLeft--; |
| 195 | if (0 == dwCyclesLeft) |
| 196 | return FALSE; |
| 197 | fStartTime = 0; |
| 198 | // just continue |
| 199 | // stat_Stop (); |
| 200 | // stat_Start (); |
| 201 | } |
| 202 | |
| 203 | int f1 = frame; |