void CMainFrame::OnAudioGenerate() { CWaveGenDlg dlg; // construct wave generator dialog on stack if (m_WaveGenParms.m_Channels) // if generation parameters are valid dlg.SetParms(m_WaveGenParms); // init dialog from parameters if (dlg.DoModal() == IDOK) { dlg.GetParms(m_WaveGenParms); // get generation parameters from dialog MakeWave(m_WaveGenParms); // generate wave according to parameters } }
void StageWaveManager::ChangeWave() { if (nowWaveNum < maxWaveNum) { nowWaveNum += 1; isChangeWave = true; std::cout << "stage" + std::to_string(nowStageNum) + "_wave" + std::to_string(nowWaveNum) + ".txt" << std::endl; MakeWave("res/stage/stage" + std::to_string(nowStageNum) + "_wave" + std::to_string(nowWaveNum) + ".txt"); } }
void DrawNextTimeLayer () { if (!Pause) MakeWave (); for (int x = 1; x + 1 < SIZE_X; x ++) { for (int y = 1; y + 1 < SIZE_Y; y ++) { assert (x + 1 < SIZE_X && x - 1 >= 0); assert (y + 1 < SIZE_Y && y - 1 >= 0); Vertices [x][y].coords [2] = CurrentHeight [x][y]; Vertices [x][y].normal [0] = CurrentHeight [x - 1][y] - CurrentHeight [x + 1][y]; Vertices [x][y].normal [1] = CurrentHeight [x][y - 1] - CurrentHeight [x][y + 1]; } } if (!Pause) MaxHeight = computeNextHeight (CurrentHeight, PreviousHeight, PrePreviousHeight, Vector <int> (SIZE_X, SIZE_Y), SPACE_STEP, TIME_STEP, ALPHA, VIS); glEnable (GL_TEXTURE_2D); glEnable (GL_NORMALIZE); glEnable (GL_LIGHTING); glDisable (GL_CULL_FACE); glEnable (GL_DEPTH_TEST); glEnable (GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_SRC_COLOR); glEnable (GL_TEXTURE_GEN_S); glEnable (GL_TEXTURE_GEN_T); glBindTexture(GL_TEXTURE_2D, Texture [1]); for (int x = 0; x + 1 < SIZE_X; x++) { glBegin (GL_TRIANGLE_STRIP); for (int y = 0; y < SIZE_Y; y++) { assert (x + 1 < SIZE_X && x + 1 >= 0); assert (y < SIZE_Y && y >= 0); glNormal3fv (Vertices [x][y].normal); glVertex3fv (Vertices [x][y].coords); glNormal3fv (Vertices [x + 1][y].normal); glVertex3fv (Vertices [x + 1][y].coords); } glEnd(); } VelocitySum = 0; for (int x = 0; x < SIZE_X; x ++) { for (int y = 0; y < SIZE_Y; y ++) { assert (x < SIZE_X && x >= 0); assert (y < SIZE_Y && y >= 0); VelocitySum += fabs (CurrentHeight [x][y] - PreviousHeight [x][y]); } } equateArrs (PrePreviousHeight, PreviousHeight, Vector <int> (SIZE_X, SIZE_Y)); equateArrs (PreviousHeight, CurrentHeight, Vector <int> (SIZE_X, SIZE_Y)); }