float *get_points() { char *dat; Point *p; float *cp; dat = psys.mBuf[0].data; for (int i = 0; i < psys.NumPoints(); i++) { p = (Point*) dat; cpoints[i*3+0] = p->pos.x; cpoints[i*3+1] = p->pos.y; cpoints[i*3+2] = p->pos.z; dat += psys.mBuf[0].stride; } return cpoints; }
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 ); } }
int get_num_points() { return psys.NumPoints(); }