本文整理汇总了C++中FluidSystem::GetParam方法的典型用法代码示例。如果您正苦于以下问题:C++ FluidSystem::GetParam方法的具体用法?C++ FluidSystem::GetParam怎么用?C++ FluidSystem::GetParam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FluidSystem
的用法示例。
在下文中一共展示了FluidSystem::GetParam方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: keyboard_func
void keyboard_func ( unsigned char key, int x, int y )
{
switch( key ) {
case 'M': case 'm': {
psys_nmax *= 2;
if ( psys_nmax > 65535 ) psys_nmax = 65535;
psys.SPH_CreateExample ( psys_demo, psys_nmax );
} break;
case 'N': case 'n': {
psys_nmax /= 2;
if ( psys_nmax < 64 ) psys_nmax = 64;
psys.SPH_CreateExample ( psys_demo, psys_nmax );
} break;
case '0':
UpdateEmit ();
psys_freq++;
psys.SetVec ( EMIT_RATE, Vector3DF(psys_freq, psys_rate, 0) );
break;
case '9':
UpdateEmit ();
psys_freq--; if ( psys_freq < 0 ) psys_freq = 0;
psys.SetVec ( EMIT_RATE, Vector3DF(psys_freq, psys_rate, 0) );
break;
case '.': case '>':
UpdateEmit ();
if ( ++psys_rate > 100 ) psys_rate = 100;
psys.SetVec ( EMIT_RATE, Vector3DF(psys_freq, psys_rate, 0) );
break;
case ',': case '<':
UpdateEmit ();
if ( --psys_rate < 0 ) psys_rate = 0;
psys.SetVec ( EMIT_RATE, Vector3DF(psys_freq, psys_rate, 0) );
break;
case 'g': case 'G': psys.Toggle ( USE_CUDA ); break;
case 'f': case 'F': mode = MODE_DOF; break;
case 'z': case 'Z': mode = MODE_CAM_TO; break;
case 'c': case 'C': mode = MODE_CAM; break;
case 'h': case 'H': bHelp = !bHelp; break;
case 'i': case 'I':
UpdateEmit ();
mode = MODE_OBJPOS;
break;
case 'o': case 'O':
UpdateEmit ();
mode = MODE_OBJ;
break;
case 'x': case 'X':
if ( ++iClrMode > 2) iClrMode = 0;
psys.SetParam ( CLR_MODE, iClrMode );
break;
case 'l': case 'L': mode = MODE_LIGHTPOS; break;
case 'd': case 'D': {
int d = psys.GetParam ( PNT_DRAWMODE ) + 1;
if ( d > 2 ) d = 0;
psys.SetParam ( PNT_DRAWMODE, d );
} break;
case 's': case 'S': if ( ++iShade > 2 ) iShade = 0; break;
case 27: exit( 0 ); break;
case '`':
bRec = !bRec; break;
case ' ':
//psys.Run (); ptris.Rebuild (); break;
bPause = !bPause; break;
case '\'': case ';': psys.SPH_CreateExample ( psys_demo, psys_nmax ); break;
case 'r': case 'R': psys.SPH_CreateExample ( psys_demo, psys_nmax ); break;
case '[':
psys_demo--;
if (psys_demo < 0 ) psys_demo = 10;
psys.SPH_CreateExample ( psys_demo, psys_nmax );
UpdateEmit ();
break;
case ']':
psys_demo++;
if (psys_demo > 10 ) psys_demo = 0;
psys.SPH_CreateExample ( psys_demo, psys_nmax );
UpdateEmit ();
break;
default:
break;
}
}
示例2: draw2D
void draw2D ()
{
mint::Time start, stop;
#ifdef USE_SHADOWS
disableShadows ();
#endif
glDisable ( GL_LIGHTING );
glDisable ( GL_DEPTH_TEST );
glMatrixMode ( GL_PROJECTION );
glLoadIdentity ();
glScalef ( 2.0/window_width, -2.0/window_height, 1 ); // Setup view (0,0) to (800,600)
glTranslatef ( -window_width/2.0, -window_height/2, 0.0);
glMatrixMode ( GL_MODELVIEW );
glLoadIdentity ();
glPushMatrix ();
glGetFloatv ( GL_MODELVIEW_MATRIX, view_matrix );
glPopMatrix ();
char disp[200];
glColor4f ( 1.0, 1.0, 1.0, 1.0 );
strcpy ( disp, "Press H for help." ); drawText ( 10, 20, disp );
if ( bHelp ) {
if ( psys.GetToggle ( USE_CUDA ) ) {
sprintf ( disp, "Kernel: USING CUDA (GPU)" ); drawText ( 20, 40, disp );
} else {
sprintf ( disp, "Kernel: USING CPU" ); drawText ( 20, 40, disp );
}
sprintf ( disp, "KEYBOARD" ); drawText ( 20, 60, disp );
sprintf ( disp, "[ ] Next/Prev Demo" ); drawText ( 20, 70, disp );
sprintf ( disp, "N M Adjust Max Particles" ); drawText ( 20, 80, disp );
sprintf ( disp, "space Pause" ); drawText ( 20, 90, disp );
sprintf ( disp, "S Shading mode" ); drawText ( 20, 100, disp );
sprintf ( disp, "G Toggle CUDA vs CPU" ); drawText ( 20, 110, disp );
sprintf ( disp, "< > Change emitter rate" ); drawText ( 20, 120, disp );
sprintf ( disp, "C Move camera /w mouse" ); drawText ( 20, 130, disp );
sprintf ( disp, "I Move emitter /w mouse" ); drawText ( 20, 140, disp );
sprintf ( disp, "O Change emitter angle" ); drawText ( 20, 150, disp );
sprintf ( disp, "L Move light /w mouse" ); drawText ( 20, 160, disp );
sprintf ( disp, "X Draw velocity/pressure/color" ); drawText ( 20, 170, disp );
Vector3DF vol = psys.GetVec(SPH_VOLMAX);
vol -= psys.GetVec(SPH_VOLMIN);
sprintf ( disp, "Volume Size: %3.5f %3.2f %3.2f", vol.x, vol.y, vol.z ); drawText ( 20, 190, disp );
sprintf ( disp, "Time Step (dt): %3.5f", psys.GetDT () ); drawText ( 20, 200, disp );
sprintf ( disp, "Num Particles: %d", psys.NumPoints() ); drawText ( 20, 210, disp );
sprintf ( disp, "Simulation Scale: %3.5f", psys.GetParam(SPH_SIMSIZE) ); drawText ( 20, 220, disp );
sprintf ( disp, "Simulation Size (m): %3.5f", psys.GetParam(SPH_SIMSCALE) ); drawText ( 20, 230, disp );
sprintf ( disp, "Smooth Radius (m): %3.3f", psys.GetParam(SPH_SMOOTHRADIUS) ); drawText ( 20, 240, disp );
sprintf ( disp, "Particle Radius (m): %3.3f", psys.GetParam(SPH_PRADIUS) ); drawText ( 20, 250, disp );
sprintf ( disp, "Particle Mass (kg): %0.8f", psys.GetParam(SPH_PMASS) ); drawText ( 20, 260, disp );
sprintf ( disp, "Rest Density (kg/m^3): %3.3f", psys.GetParam(SPH_RESTDENSITY) ); drawText ( 20, 270, disp );
sprintf ( disp, "Viscosity: %3.3f", psys.GetParam(SPH_VISC) ); drawText ( 20, 280, disp );
sprintf ( disp, "Internal Stiffness: %3.3f", psys.GetParam(SPH_INTSTIFF) ); drawText ( 20, 290, disp );
sprintf ( disp, "Boundary Stiffness: %6.0f", psys.GetParam(SPH_EXTSTIFF) ); drawText ( 20, 300, disp );
sprintf ( disp, "Boundary Dampening: %4.3f", psys.GetParam(SPH_EXTDAMP) ); drawText ( 20, 310, disp );
sprintf ( disp, "Speed Limiting: %4.3f", psys.GetParam(SPH_LIMIT) ); drawText ( 20, 320, disp );
vol = psys.GetVec ( PLANE_GRAV_DIR );
sprintf ( disp, "Gravity: %3.2f %3.2f %3.2f", vol.x, vol.y, vol.z ); drawText ( 20, 330, disp );
}
}