//---------------------------------------------------------------------------- void WaterDropFormation::DoPhysical2 () { if (!mCircle) { Configuration1(); } mSimTime += mSimDelta; // Surface evolves to a disk. float t = mSimTime - 1.0f, oneMinusT = 1.0f - t; Vector2f newCtrl = oneMinusT*mSpline->GetControlPoint(2) + t*mSpline->GetControlPoint(1); mSpline->SetControlPoint(2, newCtrl); // Sphere floats down a little bit. int numCtrlPoints = mCircle->GetNumCtrlPoints(); for (int i = 0; i < numCtrlPoints; ++i) { newCtrl = mCircle->GetControlPoint(i) + Vector2f::UNIT_Y/32.0f; mCircle->SetControlPoint(i, newCtrl); } mWaterSurface->UpdateSurface(); mWaterDrop->UpdateSurface(); mScene->Update(); }
//---------------------------------------------------------------------------- void WaterDropFormation::DoPhysical2 () { if ( !m_pkCircle ) Configuration1(); m_fSimTime += m_fSimDelta; // surface evolves to a disk float fT = m_fSimTime - 1.0f, fOmT = 1.0f - fT; Vector2f kNewCtrl = fOmT*m_pkSpline->GetControlPoint(2) + fT*m_pkSpline->GetControlPoint(1); m_pkSpline->SetControlPoint(2,kNewCtrl); // sphere floats down a little bit int iMax = m_pkCircle->GetNumCtrlPoints(); for (int i = 0; i < iMax; i++) { kNewCtrl = m_pkCircle->GetControlPoint(i) + Vector2f::UNIT_Y/32.0f; m_pkCircle->SetControlPoint(i,kNewCtrl); } m_spkWaterSurface->UpdateSurface(); m_spkWaterDrop->UpdateSurface(); m_spkScene->UpdateGS(0.0f); }