//---------------------------------------------------------------------------- void InverseKinematics::OnKeyDown (unsigned char ucKey, int, int) { if ( ucKey == 'q' || ucKey == 'Q' || ucKey == KEY_ESCAPE ) { RequestTermination(); return; } if ( Transform(ucKey) ) return; switch ( ucKey ) { case '0': // reset frame rate measurements ResetTime(); return; case 'w': m_spkWireframeState->Enabled() = !m_spkWireframeState->Enabled(); return; case 'i': m_pkIKCtrl->Active() = !m_pkIKCtrl->Active(); m_spkScene->UpdateGS(0.0f); UpdateLine(); return; } }
//---------------------------------------------------------------------------- void NURBSCurveExample::OnKeyDown (unsigned char ucKey, int, int) { if ( ucKey == 'q' || ucKey == 'Q' || ucKey == KEY_ESCAPE ) { RequestTermination(); return; } switch ( ucKey ) { case 'g': if ( m_fSimTime <= 1.0f ) DoSimulation1(); else if ( m_fSimTime <= 2.0f ) DoSimulation2(); else InitialConfiguration(); break; case '0': InitialConfiguration(); OnDisplay(); break; case 'c': m_bDrawControlPoints = !m_bDrawControlPoints; OnDisplay(); break; } }
//---------------------------------------------------------------------------- void DrawImplicitSurface::OnKeyDown (unsigned char ucKey, int, int) { if ( ucKey == 'q' || ucKey == 'Q' || ucKey == KEY_ESCAPE ) { RequestTermination(); return; } switch ( ucKey ) { case '+': // increase ray sample size case '=': m_iMaxSample += 100; m_kRT.DrawSurface(m_iMaxSample,m_kRT.Direction(),m_bBlur); OnDisplay(); break; case '-': // decrease ray sample size case '_': if ( m_iMaxSample > 100 ) { m_iMaxSample -= 100; m_kRT.DrawSurface(m_iMaxSample,m_kRT.Direction(),m_bBlur); OnDisplay(); } break; case 'b': // toggle blur of output image case 'B': m_bBlur = !m_bBlur; m_kRT.DrawSurface(m_iMaxSample,m_kRT.Direction(),m_bBlur); OnDisplay(); break; } }
//---------------------------------------------------------------------------- void EnvironmentMaps::OnKeyDown (unsigned char ucKey, int, int) { if ( ucKey == 'q' || ucKey == 'Q' || ucKey == KEY_ESCAPE ) { RequestTermination(); return; } }
//---------------------------------------------------------------------------- void Polylines::OnKeyDown (unsigned char ucKey, int, int) { if ( ucKey == 'q' || ucKey == 'Q' || ucKey == KEY_ESCAPE ) { RequestTermination(); return; } }
//---------------------------------------------------------------------------- void MapTextureToQuad::OnKeyDown (unsigned char ucKey, int, int) { if ( ucKey == 'q' || ucKey == 'Q' || ucKey == KEY_ESCAPE ) { RequestTermination(); return; } }
bool ConsoleApp::OnKeyPress(int key) { if(key == K_ESCAPE) { RequestTermination(); return true; } return false; }
//---------------------------------------------------------------------------- void Skinning::OnKeyDown (unsigned char ucKey, int, int) { if ( ucKey == 'q' || ucKey == 'Q' || ucKey == KEY_ESCAPE ) { RequestTermination(); return; } else if ( ucKey == ' ' ) { m_bShaderEnabled = !m_bShaderEnabled; if ( m_bShaderEnabled ) { m_spkTriMesh->SetVertexShader(m_spkVertShader); } else { m_spkTriMesh->SetVertexShader(NULL); } } }
//---------------------------------------------------------------------------- void WaterDropFormation::OnKeyDown (unsigned char ucKey, int, int) { if ( ucKey == 'q' || ucKey == 'Q' || ucKey == KEY_ESCAPE ) { RequestTermination(); return; } switch ( ucKey ) { case 'w': // toggle wireframe case 'W': m_spkWireframe->Enabled() = !m_spkWireframe->Enabled(); return; #ifdef SINGLE_STEP case 'g': DoPhysical(); return; #endif } }
//---------------------------------------------------------------------------- void WrigglingSnake::OnKeyDown (unsigned char ucKey, int, int) { if ( ucKey == 'q' || ucKey == 'Q' || ucKey == KEY_ESCAPE ) { RequestTermination(); return; } switch ( ucKey ) { case 'w': // toggle wireframe case 'W': m_spkWireframe->Enabled() = !m_spkWireframe->Enabled(); break; #ifdef SINGLE_STEP case 'g': case 'G': ModifyCurve(); break; #endif } }
//---------------------------------------------------------------------------- void GelatinCube::OnKeyDown (unsigned char ucKey, int iX, int iY) { if ( ucKey == 'q' || ucKey == 'Q' || ucKey == KEY_ESCAPE ) { RequestTermination(); return; } switch ( ucKey ) { case 'w': // toggle wireframe case 'W': m_spkWireframe->Enabled() = !m_spkWireframe->Enabled(); break; #ifdef SINGLE_STEP case 'g': case 'G': DoPhysical(); break; #endif } }
//---------------------------------------------------------------------------- void Rope::OnKeyDown (unsigned char ucKey, int iX, int iY) { if ( ucKey == 'q' || ucKey == 'Q' || ucKey == KEY_ESCAPE ) { RequestTermination(); return; } int i; switch ( ucKey ) { case 'g': DoPhysical(); break; case 'w': // toggle wireframe case 'W': m_spkWireframe->Enabled() = !m_spkWireframe->Enabled(); break; case 'm': // decrease mass if ( m_pkModule->GetMass(1) > 0.05f ) { for (i = 1; i < m_pkModule->GetNumParticles()-1; i++) m_pkModule->SetMass(i,m_pkModule->GetMass(i)-0.01f); } break; case 'M': // increase mass for (i = 1; i < m_pkModule->GetNumParticles()-1; i++) m_pkModule->SetMass(i,m_pkModule->GetMass(i)+0.01f); break; case 'c': // decrease spring constant if ( m_pkModule->Constant(0) > 0.05f ) { for (i = 0; i < m_pkModule->GetNumSprings(); i++) m_pkModule->Constant(i) -= 0.01f; } break; case 'C': // increase spring constant for (i = 0; i < m_pkModule->GetNumSprings(); i++) m_pkModule->Constant(i) += 0.01f; break; case 'l': // decrease spring resting length if ( m_pkModule->Length(0) > 0.05f ) { for (i = 0; i < m_pkModule->GetNumSprings(); i++) m_pkModule->Length(i) -= 0.01f; } break; case 'L': // increase spring resting length for (i = 0; i < m_pkModule->GetNumSprings(); i++) m_pkModule->Length(i) += 0.01f; break; case 'f': // toggle wind force on/off case 'F': m_pkModule->EnableWind() = !m_pkModule->EnableWind(); break; case 'r': // toggle random wind direction change on/off case 'R': m_pkModule->EnableWindChange() = !m_pkModule->EnableWindChange(); break; } }
//---------------------------------------------------------------------------- void RipplingOcean::OnKeyDown (unsigned char ucKey, int, int) { if ( ucKey == 'q' || ucKey == 'Q' || ucKey == KEY_ESCAPE ) { RequestTermination(); return; } else if ( ucKey == 'w' ) { m_fWaveHeightFactor -= 0.1f; if ( m_fWaveHeightFactor < 0 ) m_fWaveHeightFactor = 0; } else if ( ucKey == 'W' ) { m_fWaveHeightFactor += 0.1f; } else if ( ucKey == 's' ) { m_fWaveSpeedFactor -= 0.1f; if ( m_fWaveSpeedFactor < 0 ) m_fWaveSpeedFactor = 0; } else if ( ucKey == 'S' ) { m_fWaveSpeedFactor += 0.1f; } else if ( ucKey == 'a' ) { m_fAmbient -= 0.05f; if ( m_fAmbient < 0 ) m_fAmbient = 0; } else if ( ucKey == 'A' ) { m_fAmbient += 0.05f; if ( m_fAmbient > 1 ) m_fAmbient = 1; } else if ( ucKey == 'r' ) { m_fRippleSpeedFactor -= 0.1f; if ( m_fRippleSpeedFactor < 0 ) m_fRippleSpeedFactor = 0; } else if ( ucKey == 'R' ) { m_fRippleSpeedFactor += 0.1f; } else if ( ucKey == 'T' ) { m_fTexRepeat += 0.1f; } else if ( ucKey == 't' ) { m_fTexRepeat -= 0.1f; if ( m_fTexRepeat < 0 ) m_fTexRepeat = 0; } else if ( ucKey == ' ' ) { m_bStopped = !m_bStopped; m_fStopTime = GetTimeInSeconds(); } }
void Process::Kill() { if (m_impl) m_impl->Kill(); RequestTermination(); }