bool CAmebaZone::BlowoutState() { bool result = inherited::BlowoutState(); if(!result) UpdateBlowout(); for(OBJECT_INFO_VEC_IT it = m_ObjectInfoMap.begin(); m_ObjectInfoMap.end() != it; ++it) Affect(&(*it)); return result; }
void CCustomZone::AffectObjects() { if(m_dwAffectFrameNum == Device.dwFrame) return; m_dwAffectFrameNum = Device.dwFrame; if(Device.dwPrecacheFrame) return; OBJECT_INFO_VEC_IT it; for(it = m_ObjectInfoMap.begin(); m_ObjectInfoMap.end() != it; ++it) { if( !(*it).object->getDestroy() ) Affect( &(*it) ); } }
void __fastcall Tunnel::MakeKeyFrames( char *nom, short nseg, short condition ) { short i, k; GLfloat tmp[3]; GLfloat dir[10][3]; MakeDir(nom, nseg, dir); /////////////////////// // Position KeyFrames /////////////////////// // 1st PosKey[0][0] = PosKey[0][1] = PosKey[0][2] = 0; Affect(PosKeyDir[0], dir[1]); PosKeyTime[0] = 0; // 2st Scal(PosKey[1], LSEG, dir[1]); Affect(PosKeyDir[1], dir[1]); PosKeyTime[1] = (double) LSEG / SPEED; for(k=2, i=2 ; i<=nseg ; i++) { // k-ieme Add(tmp, dir[i-1], dir[i]); Scal(tmp, RSEG, tmp); Add(PosKey[k], PosKey[k-1], tmp); Affect(PosKeyDir[k], dir[i]); PosKeyTime[k] = PosKeyTime[k-1] + (double) M_PI_2 * RSEG / SPEED; k++; // k-ieme (+1) Scal(tmp, LSEG, dir[i]); Add(PosKey[k], PosKey[k-1], tmp); Affect(PosKeyDir[k], dir[i]); PosKeyTime[k] = PosKeyTime[k-1] + (double) LSEG / SPEED; k++; } nPosKey = k-1; LastPosKey = 0; NextPosKey = 1; //////////////////////////////////////////////// // Rotation KeyFrames, fonction des conditions //////////////////////////////////////////////// if(condition == 1) { // 1st Affect(RotKeyDir[0], dir[1]); RotKeyUp[0][0] = RotKeyUp[0][2] = 0; RotKeyUp[0][1] = 1; RotKeyTime[0] = PosKeyTime[0]; for(k=1, i=1 ; i<nseg ; ) { // k-ieme Affect(RotKeyDir[k], dir[i]); Affect(RotKeyUp[k], RotKeyUp[k-1]); // Meme que précédement RotKeyTime[k] = PosKeyTime[k] - (double) ANTICIPATION/SPEED; k++; i++; // k-ieme +1 Affect(RotKeyDir[k], dir[i]); Cross(tmp, RotKeyDir[k-1], RotKeyDir[k]); if(CompareAbs(tmp, RotKeyUp[k-1])) // Si rotation autour de RotKeyUp Affect(RotKeyUp[k], RotKeyUp[k-1]); else // Sinon applique la rotation à RotKeyUp Cross(RotKeyUp[k], tmp, RotKeyUp[k-1]); RotKeyTime[k] = PosKeyTime[k]; k++; } // dernier Affect(RotKeyDir[k], dir[i]); Affect(RotKeyUp[k], RotKeyUp[k-1]); // Meme que précédement RotKeyTime[k] = PosKeyTime[k]; nRotKey = k; LastRotKey = 0; NextRotKey = 1; } else if(condition == 2) { // 1st Affect(RotKeyDir[0], dir[1]); RotKeyUp[0][0] = RotKeyUp[0][2] = 0; RotKeyUp[0][1] = 1; RotKeyTime[0] = PosKeyTime[0]; for(k=1, i=1 ; i<nseg ; ) { // k-ieme Affect(RotKeyDir[k], dir[i]); Affect(RotKeyUp[k], RotKeyUp[k-1]); // Meme que précédement RotKeyTime[k] = PosKeyTime[k] - (double) ANTICIPATION/SPEED; k++; i++; // k-ieme +1 Affect(RotKeyDir[k], dir[i]); Cross(tmp, RotKeyDir[k-1], RotKeyDir[k]); if(CompareAbs(tmp, RotKeyUp[k-1])) // Si rotation autour de RotKeyUp Affect(RotKeyUp[k], RotKeyUp[0]); else // Sinon applique la rotation à RotKeyUp Cross(RotKeyUp[k], tmp, RotKeyUp[k-1]); RotKeyTime[k] = PosKeyTime[k]; k++; } // dernier Affect(RotKeyDir[k], dir[i]); Affect(RotKeyUp[k], RotKeyUp[k-1]); // Meme que précédement RotKeyTime[k] = PosKeyTime[k]; nRotKey = k; LastRotKey = 0; NextRotKey = 1; } else if(condition == 3) { // 1st Affect(RotKeyDir[0], dir[1]); RotKeyUp[0][0] = RotKeyUp[0][2] = 0; RotKeyUp[0][1] = 1; RotKeyTime[0] = PosKeyTime[0]; for(k=1, i=1 ; i<nseg ; ) { // k-ieme Affect(RotKeyDir[k], RotKeyDir[k-1]); Affect(RotKeyUp[k], RotKeyUp[0]); // Meme que précédement RotKeyTime[k] = PosKeyTime[k] - (double) ANTICIPATION/SPEED; k++; i++; // k-ieme +1 if(dir[i][1] == 1 || dir[i][1] == -1) // si segment vertical { if(i+1 <= nseg) Affect(RotKeyDir[k], dir[i+1]); else Affect(RotKeyDir[k], RotKeyDir[k-1]); } else Affect(RotKeyDir[k], dir[i]); Affect(RotKeyUp[k], RotKeyUp[0]); RotKeyTime[k] = PosKeyTime[k]; k++; } // dernier if(dir[i][1] == 1 || dir[i][1] == -1) // si segment vertical Affect(RotKeyDir[k], RotKeyDir[k-1]); else Affect(RotKeyDir[k], dir[i]); Affect(RotKeyUp[k], RotKeyUp[0]); // Meme que précédement RotKeyTime[k] = PosKeyTime[k]; nRotKey = k; LastRotKey = 0; NextRotKey = 1; } }
////////////////////////////////// // Camera's position calculation ////////////////////////////////// void __fastcall Tunnel::CameraPosition( GLfloat t ) { GLfloat N[3]; GLfloat tmp[3], tmp2[3]; double r, teta; ////////////////// // Position keys ////////////////// if(t >= PosKeyTime[NextPosKey]) { if(NextPosKey == nPosKey) // fin d'animation : quite return(false); else { LastPosKey++; NextPosKey++; } } if(Compare(PosKeyDir[LastPosKey], PosKeyDir[NextPosKey])) { // Segment de droite r = (t - PosKeyTime[LastPosKey])/(PosKeyTime[NextPosKey] - PosKeyTime[LastPosKey]); Scal(tmp, (GLfloat) LSEG*r, PosKeyDir[LastPosKey]); Add(View, tmp, PosKey[LastPosKey]); } else { // Arc de cercle teta = M_PI_2 * (t - PosKeyTime[LastPosKey])/(PosKeyTime[NextPosKey] - PosKeyTime[LastPosKey]); Scal(tmp, (GLfloat) RSEG*sin(teta), PosKeyDir[LastPosKey]); Scal(tmp2, (GLfloat) -RSEG*cos(teta), PosKeyDir[NextPosKey]); Add(View, tmp, tmp2); Scal(tmp, (GLfloat) RSEG, PosKeyDir[NextPosKey]); Add(View, View, tmp); Add(View, View, PosKey[LastPosKey]); } ////////////////// // Rotation keys ////////////////// if(t >= RotKeyTime[NextRotKey]) { if(NextRotKey == nRotKey) // fin d'animation : quite return(false); else { LastRotKey++; NextRotKey++; } // Initialisations de keyframe au cas ou pas de rotation envisagée Affect(ViewDir, RotKeyDir[LastRotKey]); Affect(ViewUp, RotKeyUp[LastRotKey]); } r = (t - RotKeyTime[LastRotKey])/(RotKeyTime[NextRotKey] - RotKeyTime[LastRotKey]); if(! Compare(RotKeyUp[LastRotKey], RotKeyUp[NextRotKey])) Interpolate(ViewUp, r, RotKeyUp[LastRotKey], RotKeyUp[NextRotKey]); if(! Compare(RotKeyDir[LastRotKey], RotKeyDir[NextRotKey])) Interpolate(ViewDir, r, RotKeyDir[LastRotKey], RotKeyDir[NextRotKey]); #ifdef FPS_DEBUG frames++; if(frames >= 10) { char str[40]; sprintf(str, "Navigation 3D (%.2ffps)", 10000/(t-oldt)); fprintf(fdebug, "\n%.2ffps", 10000/(t-oldt)); // SetWindowText(GLwin.hWnd, str); oldt = t; frames = 0; } #endif // Calcule Ref à partir de viewdir Add(Ref, View, ViewDir); return(true); }
static int Delete(mysql_config_t &mysql_config, std::string sql, std::string *error = NULL) { return Affect(mysql_config, sql, error); }
static int Insert(mysql_config_t &mysql_config, std::vector<std::string> &sqls, std::string *error = NULL) { return Affect(mysql_config, sqls, error); }